diff --git a/patches/server/0037-Implement-FerriteCore.patch b/patches/server/0037-Implement-FerriteCore.patch index 7317bd9..a450356 100644 --- a/patches/server/0037-Implement-FerriteCore.patch +++ b/patches/server/0037-Implement-FerriteCore.patch @@ -7,30 +7,34 @@ Original: malte0811/FerriteCore Copyright (C) 2023 malte0811 diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index bee42ce7c1cb0f5ebd4890c02bc9c5dd727f7fd6..478802cedeef5166bf5662187038d1439be6c242 100644 +index bee42ce7c1cb0f5ebd4890c02bc9c5dd727f7fd6..22f194956640b88c1d060b732e517f85d9091cf6 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -737,9 +737,16 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -737,6 +737,12 @@ public abstract class BlockBehaviour implements FeatureElement { protected BlockBehaviour.BlockStateBase.Cache cache; private FluidState fluidState; private boolean isRandomlyTicking; + // Plazma start - FerriteCore -+ public final java.util.Map CACHE_COLLIDE = new java.util.HashMap<>(); -+ public final java.util.Map> CACHE_PROJECT = new java.util.HashMap<>(); -+ public final java.util.Map CACHE_FACE_STURDY = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap<>(it.unimi.dsi.fastutil.booleans.BooleanArrays.HASH_STRATEGY); -+ private final ThreadLocal LAST_CACHE = new ThreadLocal<>(); ++ public static final java.util.Map CACHE_COLLIDE = new java.util.HashMap<>(); ++ public static final java.util.Map> CACHE_PROJECT = new java.util.HashMap<>(); ++ public static final java.util.Map CACHE_FACE_STURDY = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap<>(it.unimi.dsi.fastutil.booleans.BooleanArrays.HASH_STRATEGY); ++ private static final ThreadLocal LAST_CACHE = new ThreadLocal<>(); + // Plazma end protected BlockStateBase(Block block, ImmutableMap, Comparable> propertyMap, MapCodec codec) { super(block, propertyMap, codec); -+ LAST_CACHE.set(asState().cache); // Plazma - FerriteCore - this.fluidState = Fluids.EMPTY.defaultFluidState(); - BlockBehaviour.Properties blockbase_info = block.properties; +@@ -795,6 +801,7 @@ public abstract class BlockBehaviour implements FeatureElement { + // Paper end -@@ -759,7 +766,60 @@ public abstract class BlockBehaviour implements FeatureElement { - this.offsetFunction = blockbase_info.offsetFunction; - this.spawnParticlesOnBreak = blockbase_info.spawnParticlesOnBreak; - this.conditionallyFullOpaque = this.isOpaque() & this.isTransparentOnSomeFaces(); // Paper + public void initCache() { ++ LAST_CACHE.set(asState().cache); // Plazma - FerriteCore + this.fluidState = ((Block) this.owner).getFluidState(this.asState()); + this.isRandomlyTicking = ((Block) this.owner).isRandomlyTicking(this.asState()); + if (!this.getBlock().hasDynamicShape()) { +@@ -832,7 +839,61 @@ public abstract class BlockBehaviour implements FeatureElement { + } + } + // Paper end + // Plazma start - FerriteCore + if (asState().cache != null) { + Cache newCache = asState().cache; @@ -67,6 +71,7 @@ index bee42ce7c1cb0f5ebd4890c02bc9c5dd727f7fd6..478802cedeef5166bf5662187038d143 + } + // Plazma end + } ++ + // Plazma start - FerriteCore + private void replaceInternals(net.minecraft.world.phys.shapes.ArrayVoxelShape toKeep, net.minecraft.world.phys.shapes.ArrayVoxelShape toReplace) { + if (toKeep == toReplace) return; @@ -85,10 +90,10 @@ index bee42ce7c1cb0f5ebd4890c02bc9c5dd727f7fd6..478802cedeef5166bf5662187038d143 + return null; } + // Plazma end - // Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time - private org.bukkit.craftbukkit.block.data.CraftBlockData cachedCraftBlockData; -@@ -1205,10 +1265,10 @@ public abstract class BlockBehaviour implements FeatureElement { + public Block getBlock() { + return (Block) this.owner; +@@ -1205,10 +1266,10 @@ public abstract class BlockBehaviour implements FeatureElement { final boolean propagatesSkylightDown; final int lightBlock; @Nullable diff --git a/patches/server/0040-Reduce-allocations.patch b/patches/server/0040-Reduce-allocations.patch index 296360b..808b643 100644 --- a/patches/server/0040-Reduce-allocations.patch +++ b/patches/server/0040-Reduce-allocations.patch @@ -1100,7 +1100,7 @@ index 9a2ec50be757dfa3780a49ec96942fed89ed530c..d5b904a36d7c0a9d0f8787eccc770fd4 System.out.println("Starting server"); Thread runThread = new Thread(() -> { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 69fe6480a52dca86b09a331345347e88f77a298d..7fedc6f701167c5b1ef39a89abe96e81704878ff 100644 +index e363891e8ab872ed24c557e3f94110f36c6fb277..409d2e1d936932177caebdb1e12278bdd58db3b2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -472,7 +472,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {