From ead1af956646bde338116d53b0dc1eb20b8453d7 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sun, 10 Nov 2024 20:29:55 -0800 Subject: [PATCH] Support tags for more SimpleRegistry --- ...gistryAccess-for-managing-registries.patch | 72 +++++++++++++++++-- .../api/0471-Registry-Modification-API.patch | 37 +--------- ...73-Proxy-ItemStack-to-CraftItemStack.patch | 8 +-- ...gistryAccess-for-managing-Registries.patch | 59 +++++++++++++-- .../0993-Registry-Modification-API.patch | 68 ++++++++++-------- ...0994-Add-registry-entry-and-builders.patch | 10 +-- ...95-Proxy-ItemStack-to-CraftItemStack.patch | 6 +- 7 files changed, 170 insertions(+), 90 deletions(-) diff --git a/patches/api/0236-Add-RegistryAccess-for-managing-registries.patch b/patches/api/0236-Add-RegistryAccess-for-managing-registries.patch index 9150b77592..06d8e6d23f 100644 --- a/patches/api/0236-Add-RegistryAccess-for-managing-registries.patch +++ b/patches/api/0236-Add-RegistryAccess-for-managing-registries.patch @@ -206,8 +206,45 @@ index 3470755c65a2db38e679adc35d3d43f7fef5468d..1fe3a5e2f5c15fddfbcd503a061ebf75 public static Registry getRegistry(@NotNull Class tClass) { return server.getRegistry(tClass); } +diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java +index 37e7862be843da4f48ac061fb1625854fd671b2a..cdc09d18088af3100cb731702edb7e6bffdeb502 100644 +--- a/src/main/java/org/bukkit/Particle.java ++++ b/src/main/java/org/bukkit/Particle.java +@@ -162,28 +162,23 @@ public enum Particle implements Keyed { + + private final NamespacedKey key; + private final Class dataType; +- final boolean register; ++ // Paper - all particles are registered + + Particle(String key) { + this(key, Void.class); + } + +- Particle(String key, boolean register) { +- this(key, Void.class, register); +- } ++ // Paper - all particles are registered + + Particle(String key, /*@NotNull*/ Class data) { +- this(key, data, true); +- } +- +- Particle(String key, /*@NotNull*/ Class data, boolean register) { ++ // Paper - all particles are registered + if (key != null) { + this.key = NamespacedKey.minecraft(key); + } else { + this.key = null; + } + dataType = data; +- this.register = register; ++ // Paper - all particles are registered + } + + /** diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java -index b4f297f90e3c1deaa1fc3f4418418588ab19b6c5..46dce7c2a543f6b165975565ea9d40654a132b9b 100644 +index b4f297f90e3c1deaa1fc3f4418418588ab19b6c5..d03bdf6617ce66950e335f0afb52c19b2e2a14e2 100644 --- a/src/main/java/org/bukkit/Registry.java +++ b/src/main/java/org/bukkit/Registry.java @@ -86,26 +86,32 @@ public interface Registry extends Iterable { @@ -256,7 +293,7 @@ index b4f297f90e3c1deaa1fc3f4418418588ab19b6c5..46dce7c2a543f6b165975565ea9d4065 /** * Custom boss bars. * -@@ -155,13 +161,15 @@ public interface Registry extends Iterable { +@@ -155,25 +161,29 @@ public interface Registry extends Iterable { * * @see Cat.Type */ @@ -274,7 +311,11 @@ index b4f297f90e3c1deaa1fc3f4418418588ab19b6c5..46dce7c2a543f6b165975565ea9d4065 /** * Server entity types. * -@@ -172,8 +180,10 @@ public interface Registry extends Iterable { + * @see EntityType + */ +- Registry ENTITY_TYPE = new SimpleRegistry<>(EntityType.class, (entity) -> entity != EntityType.UNKNOWN); ++ Registry ENTITY_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.ENTITY_TYPE); // Paper + /** * Server instruments. * * @see MusicInstrument @@ -295,7 +336,7 @@ index b4f297f90e3c1deaa1fc3f4418418588ab19b6c5..46dce7c2a543f6b165975565ea9d4065 /** * Default server loot tables. * -@@ -200,13 +210,13 @@ public interface Registry extends Iterable { +@@ -200,25 +210,25 @@ public interface Registry extends Iterable { * @see MenuType */ @ApiStatus.Experimental @@ -311,6 +352,20 @@ index b4f297f90e3c1deaa1fc3f4418418588ab19b6c5..46dce7c2a543f6b165975565ea9d4065 /** * Server particles. * + * @see Particle + */ +- Registry PARTICLE_TYPE = new SimpleRegistry<>(Particle.class, (par) -> par.register); ++ Registry PARTICLE_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.PARTICLE_TYPE); // Paper + /** + * Server potions. + * + * @see PotionType + */ +- Registry POTION = new SimpleRegistry<>(PotionType.class); ++ Registry POTION = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.POTION); // Paper + /** + * Server statistics. + * @@ -229,58 +239,67 @@ public interface Registry extends Iterable { * Server structures. * @@ -428,6 +483,15 @@ index b4f297f90e3c1deaa1fc3f4418418588ab19b6c5..46dce7c2a543f6b165975565ea9d4065 /** * Get the object by its key. * +@@ -396,7 +417,7 @@ public interface Registry extends Iterable { + return (namespacedKey != null) ? get(namespacedKey) : null; + } + +- static final class SimpleRegistry & Keyed> implements Registry { ++ class SimpleRegistry & Keyed> implements Registry { // Paper - remove final + + private final Class type; + private final Map map; diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java index 6bc43f3a5748a1b83aa4c4d462df3cbc9220c267..cad9c18dbe56ffcef377f0b1162bc880fc56aa6c 100644 --- a/src/main/java/org/bukkit/Server.java diff --git a/patches/api/0471-Registry-Modification-API.patch b/patches/api/0471-Registry-Modification-API.patch index 68aa633997..74474eb752 100644 --- a/patches/api/0471-Registry-Modification-API.patch +++ b/patches/api/0471-Registry-Modification-API.patch @@ -809,7 +809,7 @@ index 0000000000000000000000000000000000000000..bf49125acc8a0508bf59674bba3ed350 + } +} diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java -index 67b9ab322baecf5b2453df4795106514cb073108..7cf7c6d05aa6cbf3f0c8612831404552c6a7b84a 100644 +index c3d49f9c640eb390f507f9521a389cb7c172983a..87907918c42b11780b285b6d82e7297628a07376 100644 --- a/src/main/java/org/bukkit/Registry.java +++ b/src/main/java/org/bukkit/Registry.java @@ -384,6 +384,27 @@ public interface Registry extends Iterable { @@ -875,38 +875,3 @@ index 67b9ab322baecf5b2453df4795106514cb073108..7cf7c6d05aa6cbf3f0c8612831404552 /** * Get the object by its key. * -@@ -561,5 +610,23 @@ public interface Registry extends Iterable { - return value.getKey(); - } - // Paper end - improve Registry -+ -+ // Paper start - RegistrySet API -+ @SuppressWarnings("deprecation") -+ @Override -+ public boolean hasTag(final io.papermc.paper.registry.tag.@NotNull TagKey key) { -+ return Bukkit.getUnsafe().getTag(key) != null; -+ } -+ -+ @SuppressWarnings("deprecation") -+ @Override -+ public io.papermc.paper.registry.tag.@NotNull Tag getTag(final io.papermc.paper.registry.tag.@NotNull TagKey key) { -+ final io.papermc.paper.registry.tag.Tag tag = Bukkit.getUnsafe().getTag(key); -+ if (tag == null) { -+ throw new java.util.NoSuchElementException("No tag " + key + " found"); -+ } -+ return tag; -+ } -+ // Paper end - RegistrySet API - } - } -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index b503b5e13c51580367d53939ad4c19a7718c22ce..5b13617e497e847ef66214f9140aea0cd41f4c4f 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -281,4 +281,6 @@ public interface UnsafeValues { - // Paper end - lifecycle event API - - @NotNull java.util.List computeTooltipLines(@NotNull ItemStack itemStack, @NotNull io.papermc.paper.inventory.tooltip.TooltipContext tooltipContext, @Nullable org.bukkit.entity.Player player); // Paper - expose itemstack tooltip lines -+ -+ io.papermc.paper.registry.tag.@Nullable Tag getTag(io.papermc.paper.registry.tag.@NotNull TagKey tagKey); // Paper - hack to get tags for non-server backed registries - } diff --git a/patches/api/0473-Proxy-ItemStack-to-CraftItemStack.patch b/patches/api/0473-Proxy-ItemStack-to-CraftItemStack.patch index 927052f343..1608d48862 100644 --- a/patches/api/0473-Proxy-ItemStack-to-CraftItemStack.patch +++ b/patches/api/0473-Proxy-ItemStack-to-CraftItemStack.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Proxy ItemStack to CraftItemStack diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 5b13617e497e847ef66214f9140aea0cd41f4c4f..56d16c887b7663aab7db2f7be532d9912aeb3570 100644 +index b503b5e13c51580367d53939ad4c19a7718c22ce..307439827b401acb96f0df1cf4ef31835bd1d513 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -283,4 +283,6 @@ public interface UnsafeValues { - @NotNull java.util.List computeTooltipLines(@NotNull ItemStack itemStack, @NotNull io.papermc.paper.inventory.tooltip.TooltipContext tooltipContext, @Nullable org.bukkit.entity.Player player); // Paper - expose itemstack tooltip lines +@@ -281,4 +281,6 @@ public interface UnsafeValues { + // Paper end - lifecycle event API - io.papermc.paper.registry.tag.@Nullable Tag getTag(io.papermc.paper.registry.tag.@NotNull TagKey tagKey); // Paper - hack to get tags for non-server backed registries + @NotNull java.util.List computeTooltipLines(@NotNull ItemStack itemStack, @NotNull io.papermc.paper.inventory.tooltip.TooltipContext tooltipContext, @Nullable org.bukkit.entity.Player player); // Paper - expose itemstack tooltip lines + + ItemStack createEmptyStack(); // Paper - proxy ItemStack } diff --git a/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch b/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch index 40062b9b22..16b5c28731 100644 --- a/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch +++ b/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch @@ -12,12 +12,13 @@ public net.minecraft.server.RegistryLayer STATIC_ACCESS diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java new file mode 100644 -index 0000000000000000000000000000000000000000..c6969f968b45eff2aeb44e647712abda10c7c113 +index 0000000000000000000000000000000000000000..2f22f46f80b80be43a2cc1cd8afb51f4d1fd0e91 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java -@@ -0,0 +1,156 @@ +@@ -0,0 +1,157 @@ +package io.papermc.paper.registry; + ++import com.google.common.base.Preconditions; +import io.papermc.paper.adventure.PaperAdventure; +import io.papermc.paper.registry.entry.RegistryEntry; +import java.util.Collections; @@ -125,16 +126,16 @@ index 0000000000000000000000000000000000000000..c6969f968b45eff2aeb44e647712abda + entry(Registries.INSTRUMENT, RegistryKey.INSTRUMENT, MusicInstrument.class, CraftMusicInstrument::new).delayed(), + + // api-only -+ apiOnly(Registries.ENTITY_TYPE, RegistryKey.ENTITY_TYPE, () -> org.bukkit.Registry.ENTITY_TYPE), -+ apiOnly(Registries.PARTICLE_TYPE, RegistryKey.PARTICLE_TYPE, () -> org.bukkit.Registry.PARTICLE_TYPE), -+ apiOnly(Registries.POTION, RegistryKey.POTION, () -> org.bukkit.Registry.POTION), ++ apiOnly(Registries.ENTITY_TYPE, RegistryKey.ENTITY_TYPE, PaperSimpleRegistry::entityType), ++ apiOnly(Registries.PARTICLE_TYPE, RegistryKey.PARTICLE_TYPE, PaperSimpleRegistry::particleType), ++ apiOnly(Registries.POTION, RegistryKey.POTION, PaperSimpleRegistry::potion), + apiOnly(Registries.MEMORY_MODULE_TYPE, RegistryKey.MEMORY_MODULE_TYPE, () -> (org.bukkit.Registry>) (org.bukkit.Registry) org.bukkit.Registry.MEMORY_MODULE_TYPE) + ); + final Map, RegistryEntry> byRegistryKey = new IdentityHashMap<>(REGISTRY_ENTRIES.size()); + final Map, RegistryEntry> byResourceKey = new IdentityHashMap<>(REGISTRY_ENTRIES.size()); + for (final RegistryEntry entry : REGISTRY_ENTRIES) { -+ byRegistryKey.put(entry.apiKey(), entry); -+ byResourceKey.put(entry.mcKey(), entry); ++ Preconditions.checkState(byRegistryKey.put(entry.apiKey(), entry) == null, "Duplicate api registry key: %s", entry.apiKey()); ++ Preconditions.checkState(byResourceKey.put(entry.mcKey(), entry) == null, "Duplicate mc registry key: %s", entry.mcKey()); + } + BY_REGISTRY_KEY = Collections.unmodifiableMap(byRegistryKey); + BY_RESOURCE_KEY = Collections.unmodifiableMap(byResourceKey); @@ -305,6 +306,50 @@ index 0000000000000000000000000000000000000000..35b6a7c5bac9640332a833bd3627f2bc + return (RegistryKey) LegacyRegistryIdentifiers.CLASS_TO_KEY_MAP.get(type); + } +} +diff --git a/src/main/java/io/papermc/paper/registry/PaperSimpleRegistry.java b/src/main/java/io/papermc/paper/registry/PaperSimpleRegistry.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6d134ace042758da722960cbcb48e52508dafd61 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/PaperSimpleRegistry.java +@@ -0,0 +1,38 @@ ++package io.papermc.paper.registry; ++ ++import java.util.function.Predicate; ++import net.minecraft.core.registries.BuiltInRegistries; ++import org.bukkit.Keyed; ++import org.bukkit.Particle; ++import org.bukkit.Registry; ++import org.bukkit.entity.EntityType; ++import org.bukkit.potion.PotionType; ++import org.jspecify.annotations.NullMarked; ++ ++@NullMarked ++public class PaperSimpleRegistry & Keyed, M> extends Registry.SimpleRegistry { ++ ++ static Registry entityType() { ++ return new PaperSimpleRegistry<>(EntityType.class, entity -> entity != EntityType.UNKNOWN, BuiltInRegistries.ENTITY_TYPE); ++ } ++ ++ static Registry particleType() { ++ return new PaperSimpleRegistry<>(Particle.class, BuiltInRegistries.PARTICLE_TYPE); ++ } ++ ++ static Registry potion() { ++ return new PaperSimpleRegistry<>(PotionType.class, BuiltInRegistries.POTION); ++ } ++ ++ private final net.minecraft.core.Registry nmsRegistry; ++ ++ protected PaperSimpleRegistry(final Class type, final net.minecraft.core.Registry nmsRegistry) { ++ super(type); ++ this.nmsRegistry = nmsRegistry; ++ } ++ ++ public PaperSimpleRegistry(final Class type, final Predicate predicate, final net.minecraft.core.Registry nmsRegistry) { ++ super(type, predicate); ++ this.nmsRegistry = nmsRegistry; ++ } ++} diff --git a/src/main/java/io/papermc/paper/registry/RegistryHolder.java b/src/main/java/io/papermc/paper/registry/RegistryHolder.java new file mode 100644 index 0000000000000000000000000000000000000000..a31bdd9f02fe75a87fceb2ebe8c36b3232a561cc diff --git a/patches/server/0993-Registry-Modification-API.patch b/patches/server/0993-Registry-Modification-API.patch index 17e32ead7f..9c06253961 100644 --- a/patches/server/0993-Registry-Modification-API.patch +++ b/patches/server/0993-Registry-Modification-API.patch @@ -11,18 +11,18 @@ public net.minecraft.resources.RegistryOps lookupProvider public net.minecraft.resources.RegistryOps$HolderLookupAdapter diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java -index 39120c63ed25d45a4083523fbfe79d871f4d892e..f563e6e7a558d22f571154640e99cc86718c89f5 100644 +index 2f22f46f80b80be43a2cc1cd8afb51f4d1fd0e91..3ec2aa5da045b62809afd2c13fc9ae74189dbdad 100644 --- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java +++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java -@@ -2,6 +2,7 @@ package io.papermc.paper.registry; - +@@ -3,6 +3,7 @@ package io.papermc.paper.registry; + import com.google.common.base.Preconditions; import io.papermc.paper.adventure.PaperAdventure; import io.papermc.paper.registry.entry.RegistryEntry; +import io.papermc.paper.registry.tag.TagKey; import java.util.Collections; import java.util.IdentityHashMap; import java.util.List; -@@ -68,6 +69,7 @@ import org.checkerframework.framework.qual.DefaultQualifier; +@@ -69,6 +70,7 @@ import org.checkerframework.framework.qual.DefaultQualifier; import static io.papermc.paper.registry.entry.RegistryEntry.apiOnly; import static io.papermc.paper.registry.entry.RegistryEntry.entry; @@ -30,7 +30,7 @@ index 39120c63ed25d45a4083523fbfe79d871f4d892e..f563e6e7a558d22f571154640e99cc86 @DefaultQualifier(NonNull.class) public final class PaperRegistries { -@@ -151,6 +153,15 @@ public final class PaperRegistries { +@@ -152,6 +154,15 @@ public final class PaperRegistries { return ResourceKey.create((ResourceKey>) PaperRegistries.registryToNms(typedKey.registryKey()), PaperAdventure.asVanilla(typedKey.key())); } @@ -286,6 +286,38 @@ index 0000000000000000000000000000000000000000..69e946173407eb05b18a2b19b0d45cbb + return this.freezeEventTypes.getOrCreate(type.registryKey(), RegistryLifecycleEventType::new); + } +} +diff --git a/src/main/java/io/papermc/paper/registry/PaperSimpleRegistry.java b/src/main/java/io/papermc/paper/registry/PaperSimpleRegistry.java +index 6d134ace042758da722960cbcb48e52508dafd61..cc39bc68d29055ef6429f08f975412bd9fe68dbc 100644 +--- a/src/main/java/io/papermc/paper/registry/PaperSimpleRegistry.java ++++ b/src/main/java/io/papermc/paper/registry/PaperSimpleRegistry.java +@@ -1,6 +1,10 @@ + package io.papermc.paper.registry; + ++import io.papermc.paper.registry.set.NamedRegistryKeySetImpl; ++import io.papermc.paper.registry.tag.Tag; ++import io.papermc.paper.registry.tag.TagKey; + import java.util.function.Predicate; ++import net.minecraft.core.HolderSet; + import net.minecraft.core.registries.BuiltInRegistries; + import org.bukkit.Keyed; + import org.bukkit.Particle; +@@ -35,4 +39,16 @@ public class PaperSimpleRegistry & Keyed, M> extends Registry. + super(type, predicate); + this.nmsRegistry = nmsRegistry; + } ++ ++ @Override ++ public boolean hasTag(final TagKey key) { ++ final net.minecraft.tags.TagKey nmsKey = PaperRegistries.toNms(key); ++ return this.nmsRegistry.get(nmsKey).isPresent(); ++ } ++ ++ @Override ++ public Tag getTag(final TagKey key) { ++ final HolderSet.Named namedHolderSet = this.nmsRegistry.get(PaperRegistries.toNms(key)).orElseThrow(); ++ return new NamedRegistryKeySetImpl<>(key, namedHolderSet); ++ } + } diff --git a/src/main/java/io/papermc/paper/registry/WritableCraftRegistry.java b/src/main/java/io/papermc/paper/registry/WritableCraftRegistry.java new file mode 100644 index 0000000000000000000000000000000000000000..78317c7ab42a666f19634593a8f3b696700764c8 @@ -1360,32 +1392,6 @@ index 45c78c113e881b277e1216293ad918ee40b44325..8314059455d91f01b986c5c0a239f418 + } + // Paper end - RegistrySet API } -diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index f0556a207f6d9d1766ef0d9753355f7fa5052dc1..f55733b7a56ac21cb297971b9e854ef54001ca26 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -666,6 +666,21 @@ public final class CraftMagicNumbers implements UnsafeValues { - } - // Paper end - lifecycle event API - -+ // Paper start - hack to get tags for non server-backed registries -+ @Override -+ public io.papermc.paper.registry.tag.Tag getTag(final io.papermc.paper.registry.tag.TagKey tagKey) { // TODO remove Keyed -+ if (tagKey.registryKey() != io.papermc.paper.registry.RegistryKey.ENTITY_TYPE && tagKey.registryKey() != io.papermc.paper.registry.RegistryKey.FLUID) { -+ throw new UnsupportedOperationException(tagKey.registryKey() + " doesn't have tags"); -+ } -+ final net.minecraft.resources.ResourceKey> nmsKey = io.papermc.paper.registry.PaperRegistries.registryToNms(tagKey.registryKey()); -+ final net.minecraft.core.Registry nmsRegistry = org.bukkit.craftbukkit.CraftRegistry.getMinecraftRegistry().lookupOrThrow(nmsKey); -+ return nmsRegistry -+ .get(io.papermc.paper.registry.PaperRegistries.toNms(tagKey)) -+ .map(named -> new io.papermc.paper.registry.set.NamedRegistryKeySetImpl<>(tagKey, named)) -+ .orElse(null); -+ } -+ // Paper end - hack to get tags for non server-backed registries -+ - /** - * This helper class represents the different NBT Tags. - *

diff --git a/src/main/resources/META-INF/services/io.papermc.paper.registry.event.RegistryEventTypeProvider b/src/main/resources/META-INF/services/io.papermc.paper.registry.event.RegistryEventTypeProvider new file mode 100644 index 0000000000000000000000000000000000000000..8bee1a5ed877a04e4d027593df1f42cefdd824e7 diff --git a/patches/server/0994-Add-registry-entry-and-builders.patch b/patches/server/0994-Add-registry-entry-and-builders.patch index be3eccb69a..11aa5726d6 100644 --- a/patches/server/0994-Add-registry-entry-and-builders.patch +++ b/patches/server/0994-Add-registry-entry-and-builders.patch @@ -6,19 +6,19 @@ Subject: [PATCH] Add registry entry and builders Feature patch diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java -index d34ffad8a36abbb215491d74ae8d9b490a0bc64f..f8c6da955e4bd0e480c7b581d2a4325738f9dd6f 100644 +index 3ec2aa5da045b62809afd2c13fc9ae74189dbdad..82fc79fb78be6e5d77060717e28d75cb9e8c388b 100644 --- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java +++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java -@@ -1,6 +1,8 @@ - package io.papermc.paper.registry; +@@ -2,6 +2,8 @@ package io.papermc.paper.registry; + import com.google.common.base.Preconditions; import io.papermc.paper.adventure.PaperAdventure; +import io.papermc.paper.registry.data.PaperEnchantmentRegistryEntry; +import io.papermc.paper.registry.data.PaperGameEventRegistryEntry; import io.papermc.paper.registry.entry.RegistryEntry; import io.papermc.paper.registry.tag.TagKey; import java.util.Collections; -@@ -80,7 +82,7 @@ public final class PaperRegistries { +@@ -81,7 +83,7 @@ public final class PaperRegistries { static { REGISTRY_ENTRIES = List.of( // built-ins @@ -27,7 +27,7 @@ index d34ffad8a36abbb215491d74ae8d9b490a0bc64f..f8c6da955e4bd0e480c7b581d2a43257 entry(Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, StructureType.class, CraftStructureType::new), entry(Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, PotionEffectType.class, CraftPotionEffectType::new), entry(Registries.BLOCK, RegistryKey.BLOCK, BlockType.class, CraftBlockType::new), -@@ -102,7 +104,7 @@ public final class PaperRegistries { +@@ -103,7 +105,7 @@ public final class PaperRegistries { entry(Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, TrimPattern.class, CraftTrimPattern::new).delayed(), entry(Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE, DamageType.class, CraftDamageType::new).delayed(), entry(Registries.WOLF_VARIANT, RegistryKey.WOLF_VARIANT, Wolf.Variant.class, CraftWolf.CraftVariant::new).delayed(), diff --git a/patches/server/0995-Proxy-ItemStack-to-CraftItemStack.patch b/patches/server/0995-Proxy-ItemStack-to-CraftItemStack.patch index c7dfc54b2e..a321d37f33 100644 --- a/patches/server/0995-Proxy-ItemStack-to-CraftItemStack.patch +++ b/patches/server/0995-Proxy-ItemStack-to-CraftItemStack.patch @@ -205,12 +205,12 @@ index 6cc9d7a9e6d4bfdc27e52fc581b2bb832616f121..6930d0afb230a88aa813b02e4d55c95d + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index f55733b7a56ac21cb297971b9e854ef54001ca26..8af9ac9e22a15457da12f0746d0e411942c278fb 100644 +index f0556a207f6d9d1766ef0d9753355f7fa5052dc1..2539802c0a02b6a564bdbd58e93ffe5685e775b9 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -681,6 +681,13 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -666,6 +666,13 @@ public final class CraftMagicNumbers implements UnsafeValues { } - // Paper end - hack to get tags for non server-backed registries + // Paper end - lifecycle event API + // Paper start - proxy ItemStack + @Override