From 0c4dc47d046a6e7d888337fb4bf56879ae3d22ac Mon Sep 17 00:00:00 2001 From: kokiriglade <60290002+celerry@users.noreply.github.com> Date: Sun, 24 Nov 2024 08:51:14 +0000 Subject: [PATCH 1/5] banner pattern registry modification --- ...ntroduce-registry-entry-and-builders.patch | 82 +++++++++++++++- ...0991-Add-registry-entry-and-builders.patch | 94 ++++++++++++++++++- patches/server/1033-DataComponent-API.patch | 2 +- 3 files changed, 170 insertions(+), 8 deletions(-) diff --git a/patches/api/0472-Introduce-registry-entry-and-builders.patch b/patches/api/0472-Introduce-registry-entry-and-builders.patch index 9220cd4bb6b7..800b392580c7 100644 --- a/patches/api/0472-Introduce-registry-entry-and-builders.patch +++ b/patches/api/0472-Introduce-registry-entry-and-builders.patch @@ -22,6 +22,79 @@ index 647f6a1ec1f9d3c203b41f90a99bfd415bf67366..9b39e33514b15a9d07104e2ad826d0da RegistryKey ITEM = create("item"); /** * Built-in registry for cat variants. +diff --git a/src/main/java/io/papermc/paper/registry/data/BannerPatternRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/BannerPatternRegistryEntry.java +new file mode 100644 +index 0000000000000000000000000000000000000000..67135aec187cfe4bef2ec11482a78d1a94da9b7e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/data/BannerPatternRegistryEntry.java +@@ -0,0 +1,67 @@ ++package io.papermc.paper.registry.data; ++ ++import io.papermc.paper.registry.RegistryBuilder; ++import net.kyori.adventure.key.Key; ++import org.bukkit.block.banner.PatternType; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jspecify.annotations.NullMarked; ++ ++/** ++ * A data-centric version-specific registry entry for the {@link PatternType} type. ++ */ ++@ApiStatus.Experimental ++@NullMarked ++@ApiStatus.NonExtendable ++public interface BannerPatternRegistryEntry { ++ ++ /** ++ * Provides the location of the texture asset. ++ * ++ * @return the width ++ */ ++ Key assetId(); ++ ++ /** ++ * Provides the translation key for displaying the banner tooltip. ++ * ++ * @return the translation key ++ */ ++ String translationKey(); ++ ++ /** ++ * A mutable builder for the {@link BannerPatternRegistryEntry} plugins may change in applicable registry events. ++ *

++ * The following values are required for each builder: ++ *

++ */ ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface Builder extends BannerPatternRegistryEntry, RegistryBuilder { ++ ++ /** ++ * Sets the location of the texture asset. ++ * ++ * @param assetId the asset id ++ * @return this builder instance ++ * @see BannerPatternRegistryEntry#assetId() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder assetId(Key assetId); ++ ++ /** ++ * Sets the translation key for displaying the banner tooltip. ++ * ++ * @param translationKey the translation key ++ * @return this builder instance ++ * @see BannerPatternRegistryEntry#translationKey() ++ */ ++ @Contract(value = "_ -> this", mutates = "this") ++ Builder translationKey(String translationKey); ++ ++ } ++ ++} diff --git a/src/main/java/io/papermc/paper/registry/data/EnchantmentRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/EnchantmentRegistryEntry.java new file mode 100644 index 0000000000000000000000000000000000000000..f092077453cb13dd8d849550896c2ef1cfa81b7a @@ -567,18 +640,20 @@ index 0000000000000000000000000000000000000000..4f8f536f437c5f483ac7bce393e664fd + */ +package io.papermc.paper.registry.data; diff --git a/src/main/java/io/papermc/paper/registry/event/RegistryEvents.java b/src/main/java/io/papermc/paper/registry/event/RegistryEvents.java -index 91ae9c0d3ec55ce417d4b447bf3d1b0d0c174b5e..40deffbd0930508bb04e9aedfd62ad2144855198 100644 +index 91ae9c0d3ec55ce417d4b447bf3d1b0d0c174b5e..cfda2a7e2ecd826238c28b3267146d9b06ac13b9 100644 --- a/src/main/java/io/papermc/paper/registry/event/RegistryEvents.java +++ b/src/main/java/io/papermc/paper/registry/event/RegistryEvents.java -@@ -1,8 +1,17 @@ +@@ -1,8 +1,19 @@ package io.papermc.paper.registry.event; +import io.papermc.paper.registry.RegistryKey; ++import io.papermc.paper.registry.data.BannerPatternRegistryEntry; +import io.papermc.paper.registry.data.EnchantmentRegistryEntry; +import io.papermc.paper.registry.data.GameEventRegistryEntry; +import io.papermc.paper.registry.data.PaintingVariantRegistryEntry; +import org.bukkit.Art; +import org.bukkit.GameEvent; ++import org.bukkit.block.banner.PatternType; +import org.bukkit.enchantments.Enchantment; import org.jetbrains.annotations.ApiStatus; import org.jspecify.annotations.NullMarked; @@ -588,13 +663,14 @@ index 91ae9c0d3ec55ce417d4b447bf3d1b0d0c174b5e..40deffbd0930508bb04e9aedfd62ad21 /** * Holds providers for {@link RegistryEntryAddEvent} and {@link RegistryFreezeEvent} * handlers for each applicable registry. -@@ -11,6 +20,10 @@ import org.jspecify.annotations.NullMarked; +@@ -11,6 +22,11 @@ import org.jspecify.annotations.NullMarked; @NullMarked public final class RegistryEvents { + public static final RegistryEventProvider GAME_EVENT = create(RegistryKey.GAME_EVENT); + public static final RegistryEventProvider ENCHANTMENT = create(RegistryKey.ENCHANTMENT); + public static final RegistryEventProvider PAINTING_VARIANT = create(RegistryKey.PAINTING_VARIANT); ++ public static final RegistryEventProvider BANNER_PATTERN = create(RegistryKey.BANNER_PATTERN); + private RegistryEvents() { } diff --git a/patches/server/0991-Add-registry-entry-and-builders.patch b/patches/server/0991-Add-registry-entry-and-builders.patch index 36bfa68a40f6..a452c66c0983 100644 --- a/patches/server/0991-Add-registry-entry-and-builders.patch +++ b/patches/server/0991-Add-registry-entry-and-builders.patch @@ -9,17 +9,18 @@ diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/ index 86c9f87cdb41c0d1ccc2a61b501f969cfaae47bc..fd024576e70e0c121c1477a0b7777af18159b7c4 100644 --- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java +++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java -@@ -2,6 +2,9 @@ package io.papermc.paper.registry; +@@ -2,6 +2,10 @@ 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.data.PaperPaintingVariantRegistryEntry; ++import io.papermc.paper.registry.data.PaperBannerPatternRegistryEntry; import io.papermc.paper.registry.entry.RegistryEntry; import io.papermc.paper.registry.tag.TagKey; import java.util.Collections; -@@ -78,7 +81,7 @@ public final class PaperRegistries { +@@ -81,7 +85,7 @@ public final class PaperRegistries { static { REGISTRY_ENTRIES = List.of( // built-ins @@ -28,19 +29,104 @@ index 86c9f87cdb41c0d1ccc2a61b501f969cfaae47bc..fd024576e70e0c121c1477a0b7777af1 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), -@@ -100,10 +103,10 @@ public final class PaperRegistries { +@@ -103,10 +107,10 @@ 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(), - entry(Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, Enchantment.class, CraftEnchantment::new).withSerializationUpdater(FieldRename.ENCHANTMENT_RENAME).delayed(), + writable(Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, Enchantment.class, CraftEnchantment::new, PaperEnchantmentRegistryEntry.PaperBuilder::new).withSerializationUpdater(FieldRename.ENCHANTMENT_RENAME).delayed(), entry(Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, JukeboxSong.class, CraftJukeboxSong::new).delayed(), - entry(Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, PatternType.class, CraftPatternType::new).delayed(), +- entry(Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, PatternType.class, CraftPatternType::new).delayed(), - entry(Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT, Art.class, CraftArt::new).delayed(), ++ writable(Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, PatternType.class, CraftPatternType::new, PaperBannerPatternRegistryEntry.PaperBuilder::new).delayed(), + writable(Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT, Art.class, CraftArt::new, PaperPaintingVariantRegistryEntry.PaperBuilder::new).delayed(), entry(Registries.INSTRUMENT, RegistryKey.INSTRUMENT, MusicInstrument.class, CraftMusicInstrument::new).delayed(), // api-only +diff --git a/src/main/java/io/papermc/paper/registry/data/PaperBannerPatternRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/PaperBannerPatternRegistryEntry.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c720b9fe926e8cbb493f4c43afa0d2793aa55cd4 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/data/PaperBannerPatternRegistryEntry.java +@@ -0,0 +1,78 @@ ++package io.papermc.paper.registry.data; ++ ++import io.papermc.paper.adventure.PaperAdventure; ++import io.papermc.paper.registry.PaperRegistryBuilder; ++import io.papermc.paper.registry.TypedKey; ++import io.papermc.paper.registry.data.util.Conversions; ++import net.kyori.adventure.key.Key; ++import net.minecraft.network.chat.Component; ++import net.minecraft.resources.ResourceLocation; ++import net.minecraft.world.entity.decoration.PaintingVariant; ++import net.minecraft.world.level.block.entity.BannerPattern; ++import org.bukkit.Art; ++import org.bukkit.block.banner.PatternType; ++import org.jetbrains.annotations.Range; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; ++import java.util.Optional; ++import java.util.OptionalInt; ++ ++import static io.papermc.paper.registry.data.util.Checks.*; ++ ++@NullMarked ++public class PaperBannerPatternRegistryEntry implements BannerPatternRegistryEntry { ++ ++ protected @Nullable ResourceLocation assetId; ++ protected @Nullable String translationKey; ++ ++ protected final Conversions conversions; ++ ++ public PaperBannerPatternRegistryEntry( ++ final Conversions conversions, ++ final TypedKey ignoredKey, ++ final @Nullable BannerPattern nms ++ ) { ++ this.conversions = conversions; ++ if(nms == null) return; ++ ++ this.assetId = nms.assetId(); ++ this.translationKey = nms.translationKey(); ++ } ++ ++ @Override ++ public Key assetId() { ++ return PaperAdventure.asAdventure(asConfigured(this.assetId, "assetId")); ++ } ++ ++ @Override ++ public String translationKey() { ++ return asConfigured(this.translationKey, "translationKey"); ++ } ++ ++ public static final class PaperBuilder extends PaperBannerPatternRegistryEntry implements Builder, PaperRegistryBuilder { ++ ++ public PaperBuilder(final Conversions conversions, final TypedKey key, final @Nullable BannerPattern nms) { ++ super(conversions, key, nms); ++ } ++ ++ @Override ++ public Builder assetId(final Key assetId) { ++ this.assetId = PaperAdventure.asVanilla(asArgument(assetId, "assetId")); ++ return this; ++ } ++ ++ @Override ++ public Builder translationKey(final String translationKey) { ++ this.translationKey = asArgument(translationKey, "translationKey"); ++ return this; ++ } ++ ++ @Override ++ public BannerPattern build() { ++ return new BannerPattern( ++ asConfigured(this.assetId, "assetId"), ++ this.translationKey() ++ ); ++ } ++ } ++} diff --git a/src/main/java/io/papermc/paper/registry/data/PaperEnchantmentRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/PaperEnchantmentRegistryEntry.java new file mode 100644 index 0000000000000000000000000000000000000000..1b1c6838452d3001070a5d43cc49e3a09de7153d diff --git a/patches/server/1033-DataComponent-API.patch b/patches/server/1033-DataComponent-API.patch index baa3aaef48b9..e533fa68f0e8 100644 --- a/patches/server/1033-DataComponent-API.patch +++ b/patches/server/1033-DataComponent-API.patch @@ -3600,7 +3600,7 @@ index fd024576e70e0c121c1477a0b7777af18159b7c4..132afec6bceb6c866de0aeb83db9613d import io.papermc.paper.registry.data.PaperEnchantmentRegistryEntry; import io.papermc.paper.registry.data.PaperGameEventRegistryEntry; import io.papermc.paper.registry.data.PaperPaintingVariantRegistryEntry; -@@ -95,6 +97,7 @@ public final class PaperRegistries { +@@ -96,6 +98,7 @@ public final class PaperRegistries { entry(Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, Attribute.class, CraftAttribute::new), entry(Registries.FLUID, RegistryKey.FLUID, Fluid.class, CraftFluid::new), entry(Registries.SOUND_EVENT, RegistryKey.SOUND_EVENT, Sound.class, CraftSound::new), From 4724d9ed24af73822d5ae88426d7221d676220d9 Mon Sep 17 00:00:00 2001 From: kokiriglade <60290002+celerry@users.noreply.github.com> Date: Sun, 24 Nov 2024 10:23:35 +0000 Subject: [PATCH 2/5] remove useless imports and add co author to patch --- .../0991-Add-registry-entry-and-builders.patch | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/patches/server/0991-Add-registry-entry-and-builders.patch b/patches/server/0991-Add-registry-entry-and-builders.patch index a452c66c0983..2c16318399b6 100644 --- a/patches/server/0991-Add-registry-entry-and-builders.patch +++ b/patches/server/0991-Add-registry-entry-and-builders.patch @@ -5,6 +5,8 @@ Subject: [PATCH] Add registry entry and builders Feature patch +Co-authored-by: kokiriglade + diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java index 86c9f87cdb41c0d1ccc2a61b501f969cfaae47bc..fd024576e70e0c121c1477a0b7777af18159b7c4 100644 --- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java @@ -45,10 +47,10 @@ index 86c9f87cdb41c0d1ccc2a61b501f969cfaae47bc..fd024576e70e0c121c1477a0b7777af1 // api-only diff --git a/src/main/java/io/papermc/paper/registry/data/PaperBannerPatternRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/PaperBannerPatternRegistryEntry.java new file mode 100644 -index 0000000000000000000000000000000000000000..c720b9fe926e8cbb493f4c43afa0d2793aa55cd4 +index 0000000000000000000000000000000000000000..d4a605104a96a9006cf3a9c32351b5272031d687 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/data/PaperBannerPatternRegistryEntry.java -@@ -0,0 +1,78 @@ +@@ -0,0 +1,72 @@ +package io.papermc.paper.registry.data; + +import io.papermc.paper.adventure.PaperAdventure; @@ -56,17 +58,11 @@ index 0000000000000000000000000000000000000000..c720b9fe926e8cbb493f4c43afa0d279 +import io.papermc.paper.registry.TypedKey; +import io.papermc.paper.registry.data.util.Conversions; +import net.kyori.adventure.key.Key; -+import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; -+import net.minecraft.world.entity.decoration.PaintingVariant; +import net.minecraft.world.level.block.entity.BannerPattern; -+import org.bukkit.Art; +import org.bukkit.block.banner.PatternType; -+import org.jetbrains.annotations.Range; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; -+import java.util.Optional; -+import java.util.OptionalInt; + +import static io.papermc.paper.registry.data.util.Checks.*; + From 1f2103a443f50625e8d48e44fda600363c2d19d0 Mon Sep 17 00:00:00 2001 From: kokiriglade <60290002+celerry@users.noreply.github.com> Date: Mon, 25 Nov 2024 10:51:23 +0000 Subject: [PATCH 3/5] rebased --- patches/server/0991-Add-registry-entry-and-builders.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/server/0991-Add-registry-entry-and-builders.patch b/patches/server/0991-Add-registry-entry-and-builders.patch index 2c16318399b6..9349e6c0ac2c 100644 --- a/patches/server/0991-Add-registry-entry-and-builders.patch +++ b/patches/server/0991-Add-registry-entry-and-builders.patch @@ -8,7 +8,7 @@ Feature patch Co-authored-by: kokiriglade diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java -index 86c9f87cdb41c0d1ccc2a61b501f969cfaae47bc..fd024576e70e0c121c1477a0b7777af18159b7c4 100644 +index 86c9f87cdb41c0d1ccc2a61b501f969cfaae47bc..3c47207d9781ac5005d5ac15bdb885add7e66240 100644 --- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java +++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java @@ -2,6 +2,10 @@ package io.papermc.paper.registry; @@ -22,7 +22,7 @@ index 86c9f87cdb41c0d1ccc2a61b501f969cfaae47bc..fd024576e70e0c121c1477a0b7777af1 import io.papermc.paper.registry.entry.RegistryEntry; import io.papermc.paper.registry.tag.TagKey; import java.util.Collections; -@@ -81,7 +85,7 @@ public final class PaperRegistries { +@@ -78,7 +82,7 @@ public final class PaperRegistries { static { REGISTRY_ENTRIES = List.of( // built-ins @@ -31,7 +31,7 @@ index 86c9f87cdb41c0d1ccc2a61b501f969cfaae47bc..fd024576e70e0c121c1477a0b7777af1 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), -@@ -103,10 +107,10 @@ public final class PaperRegistries { +@@ -100,10 +104,10 @@ 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(), From 049c8da22283e7d08aab7e475b3e7abe92d2c6e8 Mon Sep 17 00:00:00 2001 From: kokiriglade <60290002+celerry@users.noreply.github.com> Date: Mon, 25 Nov 2024 10:59:12 +0000 Subject: [PATCH 4/5] rename some stuff, improve javadoc --- ...ntroduce-registry-entry-and-builders.patch | 10 +++++----- ...0991-Add-registry-entry-and-builders.patch | 19 +++++++------------ 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/patches/api/0472-Introduce-registry-entry-and-builders.patch b/patches/api/0472-Introduce-registry-entry-and-builders.patch index 800b392580c7..0a4a272f63e6 100644 --- a/patches/api/0472-Introduce-registry-entry-and-builders.patch +++ b/patches/api/0472-Introduce-registry-entry-and-builders.patch @@ -24,7 +24,7 @@ index 647f6a1ec1f9d3c203b41f90a99bfd415bf67366..9b39e33514b15a9d07104e2ad826d0da * Built-in registry for cat variants. diff --git a/src/main/java/io/papermc/paper/registry/data/BannerPatternRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/BannerPatternRegistryEntry.java new file mode 100644 -index 0000000000000000000000000000000000000000..67135aec187cfe4bef2ec11482a78d1a94da9b7e +index 0000000000000000000000000000000000000000..878867eb2b3270973b6b8638de6bf913091d8303 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/data/BannerPatternRegistryEntry.java @@ -0,0 +1,67 @@ @@ -46,14 +46,14 @@ index 0000000000000000000000000000000000000000..67135aec187cfe4bef2ec11482a78d1a +public interface BannerPatternRegistryEntry { + + /** -+ * Provides the location of the texture asset. ++ * Provides the asset id of the pattern type, which is the location of the sprite to use. + * + * @return the width + */ + Key assetId(); + + /** -+ * Provides the translation key for displaying the banner tooltip. ++ * Provides the translation key for displaying the pattern inside the banner's tooltip. + * + * @return the translation key + */ @@ -73,7 +73,7 @@ index 0000000000000000000000000000000000000000..67135aec187cfe4bef2ec11482a78d1a + interface Builder extends BannerPatternRegistryEntry, RegistryBuilder { + + /** -+ * Sets the location of the texture asset. ++ * Sets the asset id of the pattern type, which is the location of the sprite to use. + * + * @param assetId the asset id + * @return this builder instance @@ -83,7 +83,7 @@ index 0000000000000000000000000000000000000000..67135aec187cfe4bef2ec11482a78d1a + Builder assetId(Key assetId); + + /** -+ * Sets the translation key for displaying the banner tooltip. ++ * Sets the translation key for displaying the pattern inside the banner's tooltip. + * + * @param translationKey the translation key + * @return this builder instance diff --git a/patches/server/0991-Add-registry-entry-and-builders.patch b/patches/server/0991-Add-registry-entry-and-builders.patch index 9349e6c0ac2c..7c7ed508fde0 100644 --- a/patches/server/0991-Add-registry-entry-and-builders.patch +++ b/patches/server/0991-Add-registry-entry-and-builders.patch @@ -47,10 +47,10 @@ index 86c9f87cdb41c0d1ccc2a61b501f969cfaae47bc..3c47207d9781ac5005d5ac15bdb885ad // api-only diff --git a/src/main/java/io/papermc/paper/registry/data/PaperBannerPatternRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/PaperBannerPatternRegistryEntry.java new file mode 100644 -index 0000000000000000000000000000000000000000..d4a605104a96a9006cf3a9c32351b5272031d687 +index 0000000000000000000000000000000000000000..6271aa3bc5961a824a6c0f4f5bb0a76b13e137e8 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/data/PaperBannerPatternRegistryEntry.java -@@ -0,0 +1,72 @@ +@@ -0,0 +1,67 @@ +package io.papermc.paper.registry.data; + +import io.papermc.paper.adventure.PaperAdventure; @@ -61,29 +61,24 @@ index 0000000000000000000000000000000000000000..d4a605104a96a9006cf3a9c32351b527 +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.entity.BannerPattern; +import org.bukkit.block.banner.PatternType; -+import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; + +import static io.papermc.paper.registry.data.util.Checks.*; + -+@NullMarked +public class PaperBannerPatternRegistryEntry implements BannerPatternRegistryEntry { + + protected @Nullable ResourceLocation assetId; + protected @Nullable String translationKey; + -+ protected final Conversions conversions; -+ + public PaperBannerPatternRegistryEntry( -+ final Conversions conversions, ++ final Conversions ignoredConversions, + final TypedKey ignoredKey, -+ final @Nullable BannerPattern nms ++ final @Nullable BannerPattern internal + ) { -+ this.conversions = conversions; -+ if(nms == null) return; ++ if(internal == null) return; + -+ this.assetId = nms.assetId(); -+ this.translationKey = nms.translationKey(); ++ this.assetId = internal.assetId(); ++ this.translationKey = internal.translationKey(); + } + + @Override From 91a219ef32ef3d32eb7661d53377400302b4cde7 Mon Sep 17 00:00:00 2001 From: kokiriglade <60290002+celerry@users.noreply.github.com> Date: Mon, 25 Nov 2024 11:07:07 +0000 Subject: [PATCH 5/5] javadoc --- ...472-Introduce-registry-entry-and-builders.patch | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/patches/api/0472-Introduce-registry-entry-and-builders.patch b/patches/api/0472-Introduce-registry-entry-and-builders.patch index 0a4a272f63e6..8d65cb27469b 100644 --- a/patches/api/0472-Introduce-registry-entry-and-builders.patch +++ b/patches/api/0472-Introduce-registry-entry-and-builders.patch @@ -24,7 +24,7 @@ index 647f6a1ec1f9d3c203b41f90a99bfd415bf67366..9b39e33514b15a9d07104e2ad826d0da * Built-in registry for cat variants. diff --git a/src/main/java/io/papermc/paper/registry/data/BannerPatternRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/BannerPatternRegistryEntry.java new file mode 100644 -index 0000000000000000000000000000000000000000..878867eb2b3270973b6b8638de6bf913091d8303 +index 0000000000000000000000000000000000000000..efdbe890c6f4a9ef8ef3c0d9985c3fce5a7ef692 --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/data/BannerPatternRegistryEntry.java @@ -0,0 +1,67 @@ @@ -48,14 +48,14 @@ index 0000000000000000000000000000000000000000..878867eb2b3270973b6b8638de6bf913 + /** + * Provides the asset id of the pattern type, which is the location of the sprite to use. + * -+ * @return the width ++ * @return the asset id. + */ + Key assetId(); + + /** + * Provides the translation key for displaying the pattern inside the banner's tooltip. + * -+ * @return the translation key ++ * @return the translation key. + */ + String translationKey(); + @@ -75,8 +75,8 @@ index 0000000000000000000000000000000000000000..878867eb2b3270973b6b8638de6bf913 + /** + * Sets the asset id of the pattern type, which is the location of the sprite to use. + * -+ * @param assetId the asset id -+ * @return this builder instance ++ * @param assetId the asset id. ++ * @return this builder instance. + * @see BannerPatternRegistryEntry#assetId() + */ + @Contract(value = "_ -> this", mutates = "this") @@ -85,8 +85,8 @@ index 0000000000000000000000000000000000000000..878867eb2b3270973b6b8638de6bf913 + /** + * Sets the translation key for displaying the pattern inside the banner's tooltip. + * -+ * @param translationKey the translation key -+ * @return this builder instance ++ * @param translationKey the translation key. ++ * @return this builder instance. + * @see BannerPatternRegistryEntry#translationKey() + */ + @Contract(value = "_ -> this", mutates = "this")