Switch Impl types to Holderable (#11662)

* Switch Impl types to Holderable

* Fix compile issues

* more improvements

* compile fixes

* remove unneeded unwrapAndConvertHolder call

---------

Co-authored-by: Bjarne Koll <git@lynxplay.dev>
This commit is contained in:
Jake Potrebic
2024-12-08 12:50:55 -08:00
parent e7ac163b76
commit a53051b155
10 changed files with 917 additions and 288 deletions

View File

@@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final Map<NamespacedKey, B> cache = new HashMap<>();
+ private final Map<B, NamespacedKey> byValue = new java.util.IdentityHashMap<>(); // Paper - improve Registry
private final net.minecraft.core.Registry<M> minecraftRegistry;
private final BiFunction<NamespacedKey, M, B> minecraftToBukkit;
private final io.papermc.paper.registry.entry.RegistryTypeMapper<M, B> minecraftToBukkit; // Paper - switch to Holder
private final BiFunction<NamespacedKey, ApiVersion, NamespacedKey> serializationUpdater; // Paper - rename to make it *clear* what it is *only* for
@@ -0,0 +0,0 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
}
@@ -49,9 +49,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return bukkit;
}
@@ -0,0 +0,0 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
return this.minecraftToBukkit.apply(namespacedKey, minecraft);
return this.minecraftToBukkit.convertDirectHolder(holder);
}
// Paper end - support Direct Holders
+
+ // Paper start - improve Registry
+ @Override