diff --git a/patches/server/0502-Cache-block-data-strings.patch b/patches/server/0502-Cache-block-data-strings.patch index cb7563b976..45c6cb13a1 100644 --- a/patches/server/0502-Cache-block-data-strings.patch +++ b/patches/server/0502-Cache-block-data-strings.patch @@ -17,23 +17,15 @@ index 95842327aa08d4717f86e9dcc0519ab24c41ca14..135b3e44fb6054d360327a0ce46decc4 if (this.isSameThread()) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index 3594f432a25b580173e8577bf324be954f5eddd1..6dc8f9f269db6971b8b46819e017357899ccd118 100644 +index 3594f432a25b580173e8577bf324be954f5eddd1..d62ba8d02228b2a00202190ff16a0efc342c7b83 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -@@ -13,6 +13,7 @@ import net.minecraft.commands.arguments.blocks.BlockStateParser; - import net.minecraft.core.Direction; - import net.minecraft.core.Registry; - import net.minecraft.nbt.CompoundTag; -+import net.minecraft.resources.ResourceLocation; - import net.minecraft.util.StringRepresentable; - import net.minecraft.world.level.block.Block; - import net.minecraft.world.level.block.state.BlockState; -@@ -494,9 +495,39 @@ public class CraftBlockData implements BlockData { +@@ -494,9 +494,39 @@ public class CraftBlockData implements BlockData { Preconditions.checkState(CraftBlockData.MAP.put(nms, bukkit) == null, "Duplicate mapping %s->%s", nms, bukkit); } + // Paper start - cache block data strings -+ private static Map stringDataCache = new HashMap<>(); ++ private static Map stringDataCache = new java.util.concurrent.ConcurrentHashMap<>(); + + static { + // cache all of the default states at startup, will not cache ones with the custom states inside of the @@ -54,7 +46,7 @@ index 3594f432a25b580173e8577bf324be954f5eddd1..6dc8f9f269db6971b8b46819e0173578 + if (material != null) { + Block block = CraftMagicNumbers.getBlock(material); + if (block != null) { -+ ResourceLocation key = Registry.BLOCK.getKey(block); ++ net.minecraft.resources.ResourceLocation key = Registry.BLOCK.getKey(block); + data = data == null ? key.toString() : key + data; + } + } diff --git a/patches/server/0515-Optimise-getType-calls.patch b/patches/server/0515-Optimise-getType-calls.patch index 2d3e0a72de..0e53779cac 100644 --- a/patches/server/0515-Optimise-getType-calls.patch +++ b/patches/server/0515-Optimise-getType-calls.patch @@ -67,10 +67,10 @@ index 0a755f38fae9dc84440f43113920c5b4c6d8218b..7b9e943b391c061782fccd2b8d705cee public void setFlag(int flag) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index 6dc8f9f269db6971b8b46819e017357899ccd118..7f49c7c7048b5778f20ddce1d844d4b389e6597f 100644 +index 0949ce5ea6aa8e28494e4435e3a7f3ee07052d34..4e06795e3a74c2c3467376bd6c95aecdef125ea4 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -@@ -45,7 +45,7 @@ public class CraftBlockData implements BlockData { +@@ -44,7 +44,7 @@ public class CraftBlockData implements BlockData { @Override public Material getMaterial() {