mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-22 16:29:23 +00:00
add back ender dragon fight optimization
This commit is contained in:
@@ -72,6 +72,12 @@ public class DivineGlobalConfiguration extends ConfigurationPart {
|
||||
}
|
||||
}
|
||||
|
||||
public Optimizations optimizations;
|
||||
|
||||
public class Optimizations extends ConfigurationPart {
|
||||
public boolean optimizedDragonRespawn = true;
|
||||
}
|
||||
|
||||
public Chat chat;
|
||||
|
||||
public class Chat extends ConfigurationPart {
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package space.bxteam.divinemc.util.carpetams;
|
||||
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.pattern.BlockInWorld;
|
||||
import net.minecraft.world.level.block.state.pattern.BlockPattern;
|
||||
|
||||
/**
|
||||
* Original <a href="https://github.com/Minecraft-AMS/Carpet-AMS-Addition">here</a>
|
||||
*
|
||||
* @author 1024-byteeeee
|
||||
*/
|
||||
public class BlockPatternHelper {
|
||||
public static BlockPattern.BlockPatternMatch partialSearchAround(BlockPattern pattern, Level world, BlockPos pos) {
|
||||
LoadingCache<BlockPos, BlockInWorld> loadingCache = BlockPattern.createLevelCache(world, false);
|
||||
int i = Math.max(Math.max(pattern.getWidth(), pattern.getHeight()), pattern.getDepth());
|
||||
|
||||
for (BlockPos blockPos : BlockPos.betweenClosed(pos, pos.offset(i - 1, 0, i - 1))) {
|
||||
for (Direction direction : Direction.values()) {
|
||||
for (Direction direction2 : Direction.values()) {
|
||||
BlockPattern.BlockPatternMatch result;
|
||||
if (direction2 == direction || direction2 == direction.getOpposite() || (result = pattern.matches(blockPos, direction, direction2, loadingCache)) == null)
|
||||
continue;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user