diff options
author | Bjarne Koll <[email protected]> | 2024-06-13 16:45:27 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-06-13 16:45:27 +0200 |
commit | 79e2cb620ef03539390d97940824b38b707918f5 (patch) | |
tree | f3e6b4fac523a002dac888b07189600d6842b570 /patches/server/0481-Add-RegistryAccess-for-managing-Registries.patch | |
parent | 906df69f05d0779906377abb809bfec9fc3c3546 (diff) | |
download | Paper-1.20.6.tar.gz Paper-1.20.6.zip |
Update upstream (Bukkit/CraftBukkit/Spigot) (#10875)1.20.6
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
376e37db SPIGOT-7677: Update which entities are marked as spawnable
06c4add3 SPIGOT-7737: Add separate TreeType.MEGA_PINE
19b7caaa SPIGOT-7731: Spawn eggs cannot have damage
e585297e PR-1022: Add force option to Player#spawnParticle
d26e0094 PR-1018: Add methods to get players seeing specific chunks
8df1ed18 PR-978: Add Material#isCompostable and Material#getCompostChance
4b9b59c7 SPIGOT-7676: Enforce locale parameter in toLowerCase and toUpperCase method calls and always use root locale
8d1e700a PR-1020: Cast instead of using #typed when getting BlockType and ItemType to better work with testing / mocks
fa28607a PR-1016: Fix incorrect assumption of Fireball having constant speed
4c6c8586 PR-1015: Add a tool component to ItemMeta
6f6b2123 PR-1014: Add PotionEffectTypeCategory to distinguish between beneficial and harmful effects
f511cfe1 PR-1013, SPIGOT-4288, SPIGOT-6202: Add material rerouting in preparation for the switch to ItemType and BlockType
def44cbf SPIGOT-7669: Fix typo in ProjectileHitEvent#getHitBlockFace documentation
53fa4f72 PR-1011: Throw an exception if a RecipeChoice is ever supplied air
CraftBukkit Changes:
ee95e171a SPIGOT-7737: Add separate TreeType.MEGA_PINE
0dae4c62c Fix spawn egg equality check and copy constructor
ab59e847c Fix spawn eggs with no entity creating invalid stacks and disconnect creative clients
3b6093b28 SPIGOT-7736: Creative spawn egg use loses components
c6b4d5a87 SPIGOT-7731: Spawn eggs cannot have damage
340ccd57f SPIGOT-7735: Fix serialization of player heads with note block sound
fd2f41834 SPIGOT-7734: Can't register a custom advancement using unsafe()
02456e2a5 PR-1413: Add force option to Player#spawnParticle
6a61f38b2 SPIGOT-7680: Per-world weather command
58c41cebb PR-1409: Add methods to get players seeing specific chunks
16c976797 PR-1412: Fix shipwreck loot tables not being set for BlockTransformers
7189ba636 PR-1360: Add Material#isCompostable and Material#getCompostChance
900384556 SPIGOT-7676: Enforce locale parameter in toLowerCase and toUpperCase method calls and always use root locale
bdb40c5f1 Increase outdated build delay
d6607c7dd SPIGOT-7675: Fix FoodComponent config deserialization
b148ed332 PR-1406: Fix incorrect assumption of Fireball having constant speed
3ec31ca75 PR-1405: Add a tool component to ItemMeta
5d7d675b9 PR-1404: Add PotionEffectTypeCategory to distinguish between beneficial and harmful effects
960827981 PR-1403, SPIGOT-4288, SPIGOT-6202: Add material rerouting in preparation for the switch to ItemType and BlockType
94e44ec93 PR-1401: Add a config option to accept old keys in registry get calls
a43701920 PR-1402: Fix ChunkSnapshot#isSectionEmpty() is always false
87d0a3368 SPIGOT-7668: Move NONE Registry updater to FieldRename to avoid some class loader issues
2ea1e7ac2 PR-1399: Fix regression preventing positive .setDamage value from causing knockback for 0 damage events
ba2d49d21 Increase outdated build delay
Spigot Changes:
fcd94e21 Rebuild patches
342f4939 SPIGOT-7661: Add experimental unload-frozen-chunks option
Diffstat (limited to 'patches/server/0481-Add-RegistryAccess-for-managing-Registries.patch')
-rw-r--r-- | patches/server/0481-Add-RegistryAccess-for-managing-Registries.patch | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/patches/server/0481-Add-RegistryAccess-for-managing-Registries.patch b/patches/server/0481-Add-RegistryAccess-for-managing-Registries.patch index c06dec8fbe..140aee8bd1 100644 --- a/patches/server/0481-Add-RegistryAccess-for-managing-Registries.patch +++ b/patches/server/0481-Add-RegistryAccess-for-managing-Registries.patch @@ -706,10 +706,10 @@ index cf08819dd7ef6db807053a52aaf66a7fdea18ab6..69682d7be64a2163d574de939f5146f5 SimpleJsonResourceReloadListener.scanDirectory(resourceManager, type.directory(), GSON, map); map.forEach( diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java -index 7c1304b42c6692cf66613fb2cf851b9df17f21e5..0b19ddf411933240f3cdc6b4e9ce3817c8d45af1 100644 +index 107734d32d8bb6384b96e11d99d36cb9a203750f..a644309edb612d97da290f86a1ef6fe597c7d85d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java -@@ -111,57 +111,12 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> { +@@ -110,57 +110,12 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> { + ", this can happen if a plugin creates its own registry entry with out properly registering it."); } @@ -725,37 +725,37 @@ index 7c1304b42c6692cf66613fb2cf851b9df17f21e5..0b19ddf411933240f3cdc6b4e9ce3817 - return new CraftRegistry<>(Enchantment.class, registryHolder.registryOrThrow(Registries.ENCHANTMENT), CraftEnchantment::new, FieldRename.ENCHANTMENT_RENAME); - } - if (bukkitClass == GameEvent.class) { -- return new CraftRegistry<>(GameEvent.class, registryHolder.registryOrThrow(Registries.GAME_EVENT), CraftGameEvent::new, CraftRegistry.NONE); +- return new CraftRegistry<>(GameEvent.class, registryHolder.registryOrThrow(Registries.GAME_EVENT), CraftGameEvent::new, FieldRename.NONE); - } - if (bukkitClass == MusicInstrument.class) { -- return new CraftRegistry<>(MusicInstrument.class, registryHolder.registryOrThrow(Registries.INSTRUMENT), CraftMusicInstrument::new, CraftRegistry.NONE); +- return new CraftRegistry<>(MusicInstrument.class, registryHolder.registryOrThrow(Registries.INSTRUMENT), CraftMusicInstrument::new, FieldRename.NONE); - } - if (bukkitClass == PotionEffectType.class) { -- return new CraftRegistry<>(PotionEffectType.class, registryHolder.registryOrThrow(Registries.MOB_EFFECT), CraftPotionEffectType::new, CraftRegistry.NONE); +- return new CraftRegistry<>(PotionEffectType.class, registryHolder.registryOrThrow(Registries.MOB_EFFECT), CraftPotionEffectType::new, FieldRename.NONE); - } - if (bukkitClass == Structure.class) { -- return new CraftRegistry<>(Structure.class, registryHolder.registryOrThrow(Registries.STRUCTURE), CraftStructure::new, CraftRegistry.NONE); +- return new CraftRegistry<>(Structure.class, registryHolder.registryOrThrow(Registries.STRUCTURE), CraftStructure::new, FieldRename.NONE); - } - if (bukkitClass == StructureType.class) { -- return new CraftRegistry<>(StructureType.class, BuiltInRegistries.STRUCTURE_TYPE, CraftStructureType::new, CraftRegistry.NONE); +- return new CraftRegistry<>(StructureType.class, BuiltInRegistries.STRUCTURE_TYPE, CraftStructureType::new, FieldRename.NONE); - } - if (bukkitClass == TrimMaterial.class) { -- return new CraftRegistry<>(TrimMaterial.class, registryHolder.registryOrThrow(Registries.TRIM_MATERIAL), CraftTrimMaterial::new, CraftRegistry.NONE); +- return new CraftRegistry<>(TrimMaterial.class, registryHolder.registryOrThrow(Registries.TRIM_MATERIAL), CraftTrimMaterial::new, FieldRename.NONE); - } - if (bukkitClass == TrimPattern.class) { -- return new CraftRegistry<>(TrimPattern.class, registryHolder.registryOrThrow(Registries.TRIM_PATTERN), CraftTrimPattern::new, CraftRegistry.NONE); +- return new CraftRegistry<>(TrimPattern.class, registryHolder.registryOrThrow(Registries.TRIM_PATTERN), CraftTrimPattern::new, FieldRename.NONE); - } - if (bukkitClass == DamageType.class) { -- return new CraftRegistry<>(DamageType.class, registryHolder.registryOrThrow(Registries.DAMAGE_TYPE), CraftDamageType::new, CraftRegistry.NONE); +- return new CraftRegistry<>(DamageType.class, registryHolder.registryOrThrow(Registries.DAMAGE_TYPE), CraftDamageType::new, FieldRename.NONE); - } - if (bukkitClass == Wolf.Variant.class) { -- return new CraftRegistry<>(Wolf.Variant.class, registryHolder.registryOrThrow(Registries.WOLF_VARIANT), CraftWolf.CraftVariant::new, CraftRegistry.NONE); +- return new CraftRegistry<>(Wolf.Variant.class, registryHolder.registryOrThrow(Registries.WOLF_VARIANT), CraftWolf.CraftVariant::new, FieldRename.NONE); - } - if (bukkitClass == BlockType.class) { -- return new CraftRegistry<>(BlockType.class, registryHolder.registryOrThrow(Registries.BLOCK), CraftBlockType::new, CraftRegistry.NONE); +- return new CraftRegistry<>(BlockType.class, registryHolder.registryOrThrow(Registries.BLOCK), CraftBlockType::new, FieldRename.NONE); - } - if (bukkitClass == ItemType.class) { -- return new CraftRegistry<>(ItemType.class, registryHolder.registryOrThrow(Registries.ITEM), CraftItemType::new, CraftRegistry.NONE); +- return new CraftRegistry<>(ItemType.class, registryHolder.registryOrThrow(Registries.ITEM), CraftItemType::new, FieldRename.NONE); - } - - return null; @@ -770,7 +770,7 @@ index 7c1304b42c6692cf66613fb2cf851b9df17f21e5..0b19ddf411933240f3cdc6b4e9ce3817 } if (bukkit instanceof Registry.SimpleRegistry<?> simple) { -@@ -187,23 +142,21 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> { +@@ -186,23 +141,21 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> { return bukkit.get(namespacedKey); } @@ -800,10 +800,10 @@ index 7c1304b42c6692cf66613fb2cf851b9df17f21e5..0b19ddf411933240f3cdc6b4e9ce3817 @Override public B get(NamespacedKey namespacedKey) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 756fb2613c2cca9ff937a770b1e35c499fcb97a1..c18515e56a8ac010897e3e2f65b2b28566f4ef71 100644 +index aee62eef2a67be2ca0d1c19143cc7f42e5e32390..740b34322aeb566248abfe0e34b8919078982217 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -279,7 +279,7 @@ public final class CraftServer implements Server { +@@ -280,7 +280,7 @@ public final class CraftServer implements Server { protected final DedicatedServer console; protected final DedicatedPlayerList playerList; private final Map<String, World> worlds = new LinkedHashMap<String, World>(); @@ -812,7 +812,7 @@ index 756fb2613c2cca9ff937a770b1e35c499fcb97a1..c18515e56a8ac010897e3e2f65b2b285 private YamlConfiguration configuration; private YamlConfiguration commandsConfiguration; private final Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions())); -@@ -2690,7 +2690,7 @@ public final class CraftServer implements Server { +@@ -2713,7 +2713,7 @@ public final class CraftServer implements Server { @Override public <T extends Keyed> Registry<T> getRegistry(Class<T> aClass) { @@ -822,19 +822,21 @@ index 756fb2613c2cca9ff937a770b1e35c499fcb97a1..c18515e56a8ac010897e3e2f65b2b285 @Deprecated diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java b/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java -index d3c9b5b6651be7474f91c99fd31140f9641e579b..43d9f70769be4be6c07b0a3d689e43e9f6805a19 100644 +index d2eef51fb508a2cfc45ce8e11bb0fe0e89a24b0e..4ce818047911922857a5d5b377aa34ae0dfecba4 100644 --- a/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java +++ b/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java -@@ -53,10 +53,13 @@ public class FieldRename { +@@ -56,11 +56,14 @@ public class FieldRename { return Enum.valueOf(enumClass, FieldRename.rename(apiVersion, enumClass.getName().replace('.', '/'), name)); } +- @RequireCompatibility("allow-old-keys-in-registry") - public static <T extends Keyed> T get(Registry<T> registry, NamespacedKey namespacedKey) { - // We don't have version-specific changes, so just use current, and don't inject a version - return CraftRegistry.get(registry, namespacedKey, ApiVersion.CURRENT); - } + // Paper start - absolutely not, having this as an expectation for plugin developers opens a huge + // can of worms in the future, especially if mojang comes back and reuses some old key ++ // @RequireCompatibility("allow-old-keys-in-registry") + // public static <T extends Keyed> T get(Registry<T> registry, NamespacedKey namespacedKey) { + // // We don't have version-specific changes, so just use current, and don't inject a version + // return CraftRegistry.get(registry, namespacedKey, ApiVersion.CURRENT); @@ -850,6 +852,19 @@ index 0000000000000000000000000000000000000000..8a083d45004f82fc9c51c219fb20f346 +++ b/src/main/resources/META-INF/services/io.papermc.paper.registry.RegistryAccess @@ -0,0 +1 @@ +io.papermc.paper.registry.PaperRegistryAccess +diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml +index 6615fffc4cbeee971f2b0f918cb8a9fd1fac2430..eef7c125b2689f29cae5464659eacdf33f5695b2 100644 +--- a/src/main/resources/configurations/bukkit.yml ++++ b/src/main/resources/configurations/bukkit.yml +@@ -23,8 +23,6 @@ settings: + shutdown-message: Server closed + minimum-api: none + use-map-color-cache: true +- compatibility: +- allow-old-keys-in-registry: false + spawn-limits: + monsters: 70 + animals: 10 diff --git a/src/test/java/io/papermc/paper/registry/LegacyRegistryIdentifierTest.java b/src/test/java/io/papermc/paper/registry/LegacyRegistryIdentifierTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b9d00e65639521eecd44bd2be3e012264c3785f5 |