mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 18:27:17 +01:00
SPIGOT-6973: Setting biome calls String#intern for every biome placed
By: md_5 <git@md-5.net>
This commit is contained in:
parent
9cff7d3ca0
commit
8ea55f306a
1 changed files with 29 additions and 0 deletions
|
@ -0,0 +1,29 @@
|
|||
--- a/net/minecraft/resources/ResourceKey.java
|
||||
+++ b/net/minecraft/resources/ResourceKey.java
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
public class ResourceKey<T> {
|
||||
|
||||
- private static final Map<String, ResourceKey<?>> VALUES = Collections.synchronizedMap(Maps.newIdentityHashMap());
|
||||
+ private static final Map<String, ResourceKey<?>> 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 <T> ResourceKey<T> 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 <E> Optional<ResourceKey<E>> cast(ResourceKey<? extends IRegistry<E>> 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() {
|
Loading…
Reference in a new issue