mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
Don't use snapshots for acquiring blockstate
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
@@ -386,7 +_,7 @@
|
||||
|
||||
// CraftBukkit start - add method
|
||||
public org.bukkit.inventory.InventoryHolder getOwner() {
|
||||
- return getOwner(true);
|
||||
+ return getOwner(org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.createSnapshotOnRetrievingBlockState); // DivineMC - EMC: Don't use snapshots for acquiring blockstate
|
||||
}
|
||||
|
||||
public org.bukkit.inventory.InventoryHolder getOwner(boolean useSnapshot) {
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -332,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public BlockState getState() {
|
||||
- return CraftBlockStates.getBlockState(this);
|
||||
+ return CraftBlockStates.getBlockState(this, org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.createSnapshotOnRetrievingBlockState); // DivineMC - EMC: Don't use snapshots for acquiring blockstate
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
|
||||
@@ -185,7 +_,7 @@
|
||||
}
|
||||
|
||||
public static BlockState getBlockState(Block block) {
|
||||
- return CraftBlockStates.getBlockState(block, true);
|
||||
+ return CraftBlockStates.getBlockState(block, org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.createSnapshotOnRetrievingBlockState); // DivineMC - EMC: Don't use snapshots for acquiring blockstate
|
||||
}
|
||||
|
||||
public static BlockState getBlockState(Block block, boolean useSnapshot) {
|
||||
@@ -389,6 +389,7 @@ public class DivineConfig {
|
||||
public static boolean sheepOptimization = true;
|
||||
public static boolean optimizedDragonRespawn = false;
|
||||
public static boolean reduceChuckLoadAndLookup = true;
|
||||
public static boolean createSnapshotOnRetrievingBlockState = true;
|
||||
public static boolean hopperThrottleWhenFull = false;
|
||||
public static int hopperThrottleSkipTicks = 0;
|
||||
|
||||
@@ -484,6 +485,9 @@ public class DivineConfig {
|
||||
"When enabled, improving performance and reducing lag during the dragon’s 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.");
|
||||
createSnapshotOnRetrievingBlockState = getBoolean(ConfigCategory.PERFORMANCE.key("optimizations.create-snapshot-on-retrieving-block-state"), createSnapshotOnRetrievingBlockState,
|
||||
"Whether to create a snapshot (copy) of BlockState data when plugins retrieve them.",
|
||||
"If false, plugins get direct BlockState access for better performance but risk data corruption from poor plugin design.");
|
||||
|
||||
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