From 8ea55f306a50e2d46549e53c765bb6d8b62fb34f Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sun, 3 Apr 2022 09:20:16 +1000 Subject: [PATCH] SPIGOT-6973: Setting biome calls String#intern for every biome placed By: md_5 --- .../net/minecraft/resources/ResourceKey.patch | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 paper-server/nms-patches/net/minecraft/resources/ResourceKey.patch diff --git a/paper-server/nms-patches/net/minecraft/resources/ResourceKey.patch b/paper-server/nms-patches/net/minecraft/resources/ResourceKey.patch new file mode 100644 index 0000000000..e71146066e --- /dev/null +++ b/paper-server/nms-patches/net/minecraft/resources/ResourceKey.patch @@ -0,0 +1,29 @@ +--- a/net/minecraft/resources/ResourceKey.java ++++ b/net/minecraft/resources/ResourceKey.java +@@ -10,7 +10,7 @@ + + public class ResourceKey { + +- private static final Map> VALUES = Collections.synchronizedMap(Maps.newIdentityHashMap()); ++ private static final Map> VALUES = Collections.synchronizedMap(Maps.newHashMap()); // CraftBukkit - SPIGOT-6973: remove costly intern + private final MinecraftKey registryName; + private final MinecraftKey location; + +@@ -29,7 +29,7 @@ + } + + private static ResourceKey create(MinecraftKey minecraftkey, MinecraftKey minecraftkey1) { +- String s = (minecraftkey + ":" + minecraftkey1).intern(); ++ String s = (minecraftkey + ":" + minecraftkey1); // CraftBukkit - SPIGOT-6973: remove costly intern + + return (ResourceKey) ResourceKey.VALUES.computeIfAbsent(s, (s1) -> { + return new ResourceKey<>(minecraftkey, minecraftkey1); +@@ -50,7 +50,7 @@ + } + + public Optional> cast(ResourceKey> resourcekey) { +- return this.isFor(resourcekey) ? Optional.of(this) : Optional.empty(); ++ return this.isFor(resourcekey) ? (Optional) Optional.of(this) : Optional.empty(); // CraftBukkit - decompile error + } + + public MinecraftKey location() {