9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-21 07:49:18 +00:00

add back old "Optimized dragon respawn" patch

This commit is contained in:
NONPLAYT
2025-06-11 19:34:54 +03:00
parent 8f2222c945
commit b398787288
3 changed files with 134 additions and 0 deletions

View File

@@ -331,6 +331,7 @@ public class DivineConfig {
public static boolean useCompactBitStorage = false;
public static boolean commandBlockParseResultsCaching = true;
public static boolean sheepOptimization = true;
public static boolean optimizedDragonRespawn = false;
public static boolean reduceChuckLoadAndLookup = true;
public static boolean hopperThrottleWhenFull = false;
public static int hopperThrottleSkipTicks = 0;
@@ -438,6 +439,8 @@ public class DivineConfig {
"Caches the parse results of command blocks, can significantly reduce performance impact.");
sheepOptimization = getBoolean(ConfigCategory.PERFORMANCE.key("optimizations.sheep-optimization"), sheepOptimization,
"Enables optimization from Carpet Fixes mod, using a prebaked list of all the possible colors and combinations for sheep.");
optimizedDragonRespawn = getBoolean(ConfigCategory.PERFORMANCE.key("optimizations.optimized-dragon-respawn"), optimizedDragonRespawn,
"When enabled, improving performance and reducing lag during the dragons resurrection event.");
reduceChuckLoadAndLookup = getBoolean(ConfigCategory.PERFORMANCE.key("optimizations.reduce-chunk-load-and-lookup"), reduceChuckLoadAndLookup,
"If enabled, optimizes chunk loading and block state lookups by reducing the number of chunk accesses required during operations such as Enderman teleportation.");

View File

@@ -0,0 +1,27 @@
package org.bxteam.divinemc.util;
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;
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;
}
}