From 49bd7f424106d170ec40382ba41adcfd4dc7ee96 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 31 Oct 2024 22:56:20 +0100 Subject: Missing things --- .../0467-Add-RegistryAccess-for-managing-Registries.patch | 15 ++++++++------- patches/server/0580-Get-entity-default-attributes.patch | 6 +++--- patches/server/0993-Registry-Modification-API.patch | 4 ++-- patches/server/0994-Add-registry-entry-and-builders.patch | 6 +++--- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch b/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch index 5700837572..fbb76f2784 100644 --- a/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch +++ b/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch @@ -12,7 +12,7 @@ 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..24a763b2ae635f19032696bb1feeb3b3aa72f0fd +index 0000000000000000000000000000000000000000..b5df90b500a64ee3ba1026fa3449ca6441293367 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java @@ -0,0 +1,152 @@ @@ -28,6 +28,7 @@ index 0000000000000000000000000000000000000000..24a763b2ae635f19032696bb1feeb3b3 +import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; ++import org.bukkit.Fluid; +import org.bukkit.GameEvent; +import org.bukkit.JukeboxSong; +import org.bukkit.Keyed; @@ -36,6 +37,7 @@ index 0000000000000000000000000000000000000000..24a763b2ae635f19032696bb1feeb3b3 +import org.bukkit.block.Biome; +import org.bukkit.block.BlockType; +import org.bukkit.block.banner.PatternType; ++import org.bukkit.craftbukkit.CraftFluid; +import org.bukkit.craftbukkit.CraftGameEvent; +import org.bukkit.craftbukkit.CraftJukeboxSong; +import org.bukkit.craftbukkit.CraftMusicInstrument; @@ -103,6 +105,7 @@ index 0000000000000000000000000000000000000000..24a763b2ae635f19032696bb1feeb3b3 + entry(Registries.MAP_DECORATION_TYPE, RegistryKey.MAP_DECORATION_TYPE, MapCursor.Type.class, CraftMapCursor.CraftType::new), + entry(Registries.MENU, RegistryKey.MENU, MenuType.class, CraftMenuType::new), + entry(Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, Attribute.class, CraftAttribute::new), ++ entry(Registries.FLUID, RegistryKey.FLUID, Fluid.class, CraftFluid::new), + + // data-drivens + entry(Registries.STRUCTURE, RegistryKey.STRUCTURE, Structure.class, CraftStructure::new).delayed(), @@ -116,15 +119,12 @@ index 0000000000000000000000000000000000000000..24a763b2ae635f19032696bb1feeb3b3 + entry(Registries.BIOME, RegistryKey.BIOME, Biome.class, CraftBiome::new).delayed(), + + // api-only -+ apiOnly(Registries.BIOME, RegistryKey.BIOME, () -> org.bukkit.Registry.BIOME), + apiOnly(Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT, () -> org.bukkit.Registry.ART), -+ apiOnly(Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, () -> org.bukkit.Registry.ATTRIBUTE), + 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.SOUND_EVENT, RegistryKey.SOUND_EVENT, () -> org.bukkit.Registry.SOUNDS), -+ apiOnly(Registries.MEMORY_MODULE_TYPE, RegistryKey.MEMORY_MODULE_TYPE, () -> (org.bukkit.Registry>) (org.bukkit.Registry) org.bukkit.Registry.MEMORY_MODULE_TYPE), -+ apiOnly(Registries.FLUID, RegistryKey.FLUID, () -> org.bukkit.Registry.FLUID) ++ 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()); @@ -1259,7 +1259,7 @@ index bbd5dd5b27937ddc3d8c57f2b604331495b0f311..626c3033e36897846fe84a77d05e2e91 CraftRegistry.setMinecraftRegistry(RegistryHelper.getRegistry()); } diff --git a/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java b/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java -index c0e02198200c93e3d0ff2461d267e856db087532..949094070455fdc73c1dca16276e051a0a35a5e2 100644 +index c0e02198200c93e3d0ff2461d267e856db087532..bbabfad54c58f74cb5d70cbce4d140ad69a56abb 100644 --- a/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java +++ b/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java @@ -1,6 +1,7 @@ @@ -1270,7 +1270,7 @@ index c0e02198200c93e3d0ff2461d267e856db087532..949094070455fdc73c1dca16276e051a import java.util.List; import java.util.stream.Stream; import net.minecraft.core.registries.Registries; -@@ -67,39 +68,37 @@ public class RegistriesArgumentProvider implements ArgumentsProvider { +@@ -67,39 +68,38 @@ public class RegistriesArgumentProvider implements ArgumentsProvider { private static final List DATA = Lists.newArrayList(); static { @@ -1303,6 +1303,7 @@ index c0e02198200c93e3d0ff2461d267e856db087532..949094070455fdc73c1dca16276e051a + register(RegistryKey.ATTRIBUTE, Attribute.class, Registries.ATTRIBUTE, CraftAttribute.class, net.minecraft.world.entity.ai.attributes.Attribute.class); + register(RegistryKey.BIOME, Biome.class, Registries.BIOME, CraftBiome.class, net.minecraft.world.level.biome.Biome.class); + register(RegistryKey.ENCHANTMENT, Enchantment.class, Registries.ENCHANTMENT, CraftEnchantment.class, net.minecraft.world.item.enchantment.Enchantment.class); ++ register(RegistryKey.FLUID, Fluid.class, Registries.FLUID, CraftFluid.class, net.minecraft.world.level.material.Fluid.class); + register(RegistryKey.GAME_EVENT, GameEvent.class, Registries.GAME_EVENT, CraftGameEvent.class, net.minecraft.world.level.gameevent.GameEvent.class); + register(RegistryKey.INSTRUMENT, MusicInstrument.class, Registries.INSTRUMENT, CraftMusicInstrument.class, Instrument.class); + register(RegistryKey.MOB_EFFECT, PotionEffectType.class, Registries.MOB_EFFECT, CraftPotionEffectType.class, MobEffect.class); diff --git a/patches/server/0580-Get-entity-default-attributes.patch b/patches/server/0580-Get-entity-default-attributes.patch index 468e4b22e5..9c95ca3611 100644 --- a/patches/server/0580-Get-entity-default-attributes.patch +++ b/patches/server/0580-Get-entity-default-attributes.patch @@ -105,7 +105,7 @@ index 6855210dc58f455b5af05d9c039da55e8dfc93f1..1dd9a5cc45d5073adb150abdcbe2025e /** diff --git a/src/test/java/io/papermc/paper/attribute/EntityTypeAttributesTest.java b/src/test/java/io/papermc/paper/attribute/EntityTypeAttributesTest.java new file mode 100644 -index 0000000000000000000000000000000000000000..f512d416df883036965ff6c802fd242a4c9c8079 +index 0000000000000000000000000000000000000000..fa9fb37993f4025f85dac084efb4b5eda0ede637 --- /dev/null +++ b/src/test/java/io/papermc/paper/attribute/EntityTypeAttributesTest.java @@ -0,0 +1,40 @@ @@ -142,8 +142,8 @@ index 0000000000000000000000000000000000000000..f512d416df883036965ff6c802fd242a + @Test + public void testUnmodifiabilityOfAttributable() { + Attributable attributable = EntityType.ZOMBIE.getDefaultAttributes(); -+ assertThrows(UnsupportedOperationException.class, () -> attributable.registerAttribute(Attribute.GENERIC_ATTACK_DAMAGE)); -+ AttributeInstance instance = attributable.getAttribute(Attribute.GENERIC_FOLLOW_RANGE); ++ assertThrows(UnsupportedOperationException.class, () -> attributable.registerAttribute(Attribute.ATTACK_DAMAGE)); ++ AttributeInstance instance = attributable.getAttribute(Attribute.FOLLOW_RANGE); + assertNotNull(instance); + assertThrows(UnsupportedOperationException.class, () -> instance.addModifier(new AttributeModifier("test", 3, AttributeModifier.Operation.ADD_NUMBER))); + assertThrows(UnsupportedOperationException.class, () -> instance.setBaseValue(3.2)); diff --git a/patches/server/0993-Registry-Modification-API.patch b/patches/server/0993-Registry-Modification-API.patch index 166ad90f90..3e652cd1d0 100644 --- a/patches/server/0993-Registry-Modification-API.patch +++ b/patches/server/0993-Registry-Modification-API.patch @@ -9,7 +9,7 @@ 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 24a763b2ae635f19032696bb1feeb3b3aa72f0fd..9c7f03abda5175b837ed8592a91ec0cab28f28df 100644 +index b5df90b500a64ee3ba1026fa3449ca6441293367..36bc8d005de14622eb8a0bf4736d964276c95344 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; @@ -20,7 +20,7 @@ index 24a763b2ae635f19032696bb1feeb3b3aa72f0fd..9c7f03abda5175b837ed8592a91ec0ca import java.util.Collections; import java.util.IdentityHashMap; import java.util.List; -@@ -62,6 +63,7 @@ import org.checkerframework.framework.qual.DefaultQualifier; +@@ -64,6 +65,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; diff --git a/patches/server/0994-Add-registry-entry-and-builders.patch b/patches/server/0994-Add-registry-entry-and-builders.patch index 8edd2ba956..61941d6748 100644 --- a/patches/server/0994-Add-registry-entry-and-builders.patch +++ b/patches/server/0994-Add-registry-entry-and-builders.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add registry entry and builders diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java -index 9c7f03abda5175b837ed8592a91ec0cab28f28df..8000eaccc9bf60702feabde71d09db04e26106e8 100644 +index 36bc8d005de14622eb8a0bf4736d964276c95344..3ad1ba8c14fe3745cedcbbd9bb28dad36eb6c7bb 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 @@ @@ -17,7 +17,7 @@ index 9c7f03abda5175b837ed8592a91ec0cab28f28df..8000eaccc9bf60702feabde71d09db04 import io.papermc.paper.registry.entry.RegistryEntry; import io.papermc.paper.registry.tag.TagKey; import java.util.Collections; -@@ -74,7 +76,7 @@ public final class PaperRegistries { +@@ -76,7 +78,7 @@ public final class PaperRegistries { static { REGISTRY_ENTRIES = List.of( // built-ins @@ -26,7 +26,7 @@ index 9c7f03abda5175b837ed8592a91ec0cab28f28df..8000eaccc9bf60702feabde71d09db04 entry(Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, StructureType.class, CraftStructureType::new), entry(Registries.INSTRUMENT, RegistryKey.INSTRUMENT, MusicInstrument.class, CraftMusicInstrument::new), entry(Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, PotionEffectType.class, CraftPotionEffectType::new), -@@ -94,7 +96,7 @@ public final class PaperRegistries { +@@ -97,7 +99,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(), -- cgit v1.2.3