mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-23 00:39:16 +00:00
Reduce chunk loading & lookups
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Wed, 11 Jun 2025 19:12:00 +0300
|
||||
Subject: [PATCH] Reduce chunk loading & lookups
|
||||
|
||||
Original license: GPL v3
|
||||
Original project: https://github.com/pufferfish-gg/Pufferfish
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/EnderMan.java b/net/minecraft/world/entity/monster/EnderMan.java
|
||||
index c7cc8e1277bbfa8bcac596a5043e418cb1567971..146826c99a410bef2afd5ed055b40a6ae6b38701 100644
|
||||
--- a/net/minecraft/world/entity/monster/EnderMan.java
|
||||
+++ b/net/minecraft/world/entity/monster/EnderMan.java
|
||||
@@ -334,11 +334,28 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
private boolean teleport(double x, double y, double z) {
|
||||
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(x, y, z);
|
||||
|
||||
- while (mutableBlockPos.getY() > this.level().getMinY() && !this.level().getBlockState(mutableBlockPos).blocksMotion()) {
|
||||
- mutableBlockPos.move(Direction.DOWN);
|
||||
+ // DivineMC start - Reduce chunk loading & lookups
|
||||
+ BlockState blockState;
|
||||
+ if (org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.reduceChuckLoadAndLookup) {
|
||||
+ net.minecraft.world.level.chunk.LevelChunk chunk = this.level().getChunkIfLoaded(mutableBlockPos);
|
||||
+ if (chunk == null) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ while (mutableBlockPos.getY() > this.level().getMinY() && !chunk.getBlockState(mutableBlockPos).blocksMotion()) {
|
||||
+ mutableBlockPos.move(Direction.DOWN);
|
||||
+ }
|
||||
+
|
||||
+ blockState = chunk.getBlockState(mutableBlockPos);
|
||||
+ } else {
|
||||
+ while (mutableBlockPos.getY() > this.level().getMinY() && !this.level().getBlockState(mutableBlockPos).blocksMotion()) {
|
||||
+ mutableBlockPos.move(Direction.DOWN);
|
||||
+ }
|
||||
+
|
||||
+ blockState = this.level().getBlockState(mutableBlockPos);
|
||||
}
|
||||
+ // DivineMC end - Reduce chunk loading & lookups
|
||||
|
||||
- BlockState blockState = this.level().getBlockState(mutableBlockPos);
|
||||
boolean flag = blockState.blocksMotion();
|
||||
boolean isWater = blockState.getFluidState().is(FluidTags.WATER);
|
||||
if (flag && !isWater) {
|
||||
@@ -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 reduceChuckLoadAndLookup = true;
|
||||
public static boolean hopperThrottleWhenFull = false;
|
||||
public static int hopperThrottleSkipTicks = 0;
|
||||
|
||||
@@ -437,6 +438,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.");
|
||||
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.");
|
||||
|
||||
hopperThrottleWhenFull = getBoolean(ConfigCategory.PERFORMANCE.key("optimizations.hopper-throttle-when-full.enabled"), hopperThrottleWhenFull,
|
||||
"When enabled, hoppers will throttle if target container is full.");
|
||||
|
||||
Reference in New Issue
Block a user