diff options
author | Owen1212055 <[email protected]> | 2024-11-16 16:47:32 -0500 |
---|---|---|
committer | Owen1212055 <[email protected]> | 2024-11-18 14:50:38 -0500 |
commit | 22a285770379b5db85f682f85df9882b09cd99af (patch) | |
tree | 738c3787f036c536152489912e14bca9c5275703 | |
parent | bc985c1b878491711439836f269d985cb45ddef0 (diff) | |
download | Paper-22a285770379b5db85f682f85df9882b09cd99af.tar.gz Paper-22a285770379b5db85f682f85df9882b09cd99af.zip |
Implement suggested changes
4 files changed, 328 insertions, 936 deletions
diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/DataComponentTypeKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/DataComponentTypeKeys.java deleted file mode 100644 index 121c3ac39e..0000000000 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/DataComponentTypeKeys.java +++ /dev/null @@ -1,462 +0,0 @@ -package io.papermc.paper.registry.keys; - -import static net.kyori.adventure.key.Key.key; - -import io.papermc.paper.datacomponent.DataComponentType; -import io.papermc.paper.generated.GeneratedFrom; -import io.papermc.paper.registry.RegistryKey; -import io.papermc.paper.registry.TypedKey; -import net.kyori.adventure.key.Key; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.jetbrains.annotations.ApiStatus; - -/** - * Vanilla keys for {@link RegistryKey#DATA_COMPONENT_TYPE}. - * - * @apiNote The fields provided here are a direct representation of - * what is available from the vanilla game source. They may be - * changed (including removals) on any Minecraft version - * bump, so cross-version compatibility is not provided on the - * same level as it is on most of the other API. - */ -@SuppressWarnings({ - "unused", - "SpellCheckingInspection" -}) -@GeneratedFrom("1.21.3") -public final class DataComponentTypeKeys { - /** - * {@code minecraft:attribute_modifiers} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> ATTRIBUTE_MODIFIERS = create(key("attribute_modifiers")); - - /** - * {@code minecraft:banner_patterns} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> BANNER_PATTERNS = create(key("banner_patterns")); - - /** - * {@code minecraft:base_color} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> BASE_COLOR = create(key("base_color")); - - /** - * {@code minecraft:block_state} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> BLOCK_STATE = create(key("block_state")); - - /** - * {@code minecraft:bundle_contents} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> BUNDLE_CONTENTS = create(key("bundle_contents")); - - /** - * {@code minecraft:can_break} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> CAN_BREAK = create(key("can_break")); - - /** - * {@code minecraft:can_place_on} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> CAN_PLACE_ON = create(key("can_place_on")); - - /** - * {@code minecraft:charged_projectiles} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> CHARGED_PROJECTILES = create(key("charged_projectiles")); - - /** - * {@code minecraft:consumable} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> CONSUMABLE = create(key("consumable")); - - /** - * {@code minecraft:container} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> CONTAINER = create(key("container")); - - /** - * {@code minecraft:container_loot} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> CONTAINER_LOOT = create(key("container_loot")); - - /** - * {@code minecraft:creative_slot_lock} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> CREATIVE_SLOT_LOCK = create(key("creative_slot_lock")); - - /** - * {@code minecraft:custom_model_data} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> CUSTOM_MODEL_DATA = create(key("custom_model_data")); - - /** - * {@code minecraft:custom_name} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> CUSTOM_NAME = create(key("custom_name")); - - /** - * {@code minecraft:damage} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> DAMAGE = create(key("damage")); - - /** - * {@code minecraft:damage_resistant} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> DAMAGE_RESISTANT = create(key("damage_resistant")); - - /** - * {@code minecraft:death_protection} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> DEATH_PROTECTION = create(key("death_protection")); - - /** - * {@code minecraft:dyed_color} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> DYED_COLOR = create(key("dyed_color")); - - /** - * {@code minecraft:enchantable} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> ENCHANTABLE = create(key("enchantable")); - - /** - * {@code minecraft:enchantment_glint_override} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> ENCHANTMENT_GLINT_OVERRIDE = create(key("enchantment_glint_override")); - - /** - * {@code minecraft:enchantments} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> ENCHANTMENTS = create(key("enchantments")); - - /** - * {@code minecraft:equippable} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> EQUIPPABLE = create(key("equippable")); - - /** - * {@code minecraft:firework_explosion} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> FIREWORK_EXPLOSION = create(key("firework_explosion")); - - /** - * {@code minecraft:fireworks} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> FIREWORKS = create(key("fireworks")); - - /** - * {@code minecraft:food} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> FOOD = create(key("food")); - - /** - * {@code minecraft:glider} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> GLIDER = create(key("glider")); - - /** - * {@code minecraft:hide_additional_tooltip} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> HIDE_ADDITIONAL_TOOLTIP = create(key("hide_additional_tooltip")); - - /** - * {@code minecraft:hide_tooltip} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> HIDE_TOOLTIP = create(key("hide_tooltip")); - - /** - * {@code minecraft:instrument} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> INSTRUMENT = create(key("instrument")); - - /** - * {@code minecraft:intangible_projectile} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> INTANGIBLE_PROJECTILE = create(key("intangible_projectile")); - - /** - * {@code minecraft:item_model} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> ITEM_MODEL = create(key("item_model")); - - /** - * {@code minecraft:item_name} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> ITEM_NAME = create(key("item_name")); - - /** - * {@code minecraft:jukebox_playable} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> JUKEBOX_PLAYABLE = create(key("jukebox_playable")); - - /** - * {@code minecraft:lock} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> LOCK = create(key("lock")); - - /** - * {@code minecraft:lodestone_tracker} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> LODESTONE_TRACKER = create(key("lodestone_tracker")); - - /** - * {@code minecraft:lore} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> LORE = create(key("lore")); - - /** - * {@code minecraft:map_color} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> MAP_COLOR = create(key("map_color")); - - /** - * {@code minecraft:map_decorations} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> MAP_DECORATIONS = create(key("map_decorations")); - - /** - * {@code minecraft:map_id} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> MAP_ID = create(key("map_id")); - - /** - * {@code minecraft:map_post_processing} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> MAP_POST_PROCESSING = create(key("map_post_processing")); - - /** - * {@code minecraft:max_damage} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> MAX_DAMAGE = create(key("max_damage")); - - /** - * {@code minecraft:max_stack_size} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> MAX_STACK_SIZE = create(key("max_stack_size")); - - /** - * {@code minecraft:note_block_sound} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> NOTE_BLOCK_SOUND = create(key("note_block_sound")); - - /** - * {@code minecraft:ominous_bottle_amplifier} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> OMINOUS_BOTTLE_AMPLIFIER = create(key("ominous_bottle_amplifier")); - - /** - * {@code minecraft:pot_decorations} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> POT_DECORATIONS = create(key("pot_decorations")); - - /** - * {@code minecraft:potion_contents} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> POTION_CONTENTS = create(key("potion_contents")); - - /** - * {@code minecraft:profile} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> PROFILE = create(key("profile")); - - /** - * {@code minecraft:rarity} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> RARITY = create(key("rarity")); - - /** - * {@code minecraft:recipes} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> RECIPES = create(key("recipes")); - - /** - * {@code minecraft:repair_cost} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> REPAIR_COST = create(key("repair_cost")); - - /** - * {@code minecraft:repairable} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> REPAIRABLE = create(key("repairable")); - - /** - * {@code minecraft:stored_enchantments} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> STORED_ENCHANTMENTS = create(key("stored_enchantments")); - - /** - * {@code minecraft:suspicious_stew_effects} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> SUSPICIOUS_STEW_EFFECTS = create(key("suspicious_stew_effects")); - - /** - * {@code minecraft:tool} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> TOOL = create(key("tool")); - - /** - * {@code minecraft:tooltip_style} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> TOOLTIP_STYLE = create(key("tooltip_style")); - - /** - * {@code minecraft:trim} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> TRIM = create(key("trim")); - - /** - * {@code minecraft:unbreakable} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> UNBREAKABLE = create(key("unbreakable")); - - /** - * {@code minecraft:use_cooldown} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> USE_COOLDOWN = create(key("use_cooldown")); - - /** - * {@code minecraft:use_remainder} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> USE_REMAINDER = create(key("use_remainder")); - - /** - * {@code minecraft:writable_book_content} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> WRITABLE_BOOK_CONTENT = create(key("writable_book_content")); - - /** - * {@code minecraft:written_book_content} - * - * @apiNote This field is version-dependant and may be removed in future Minecraft versions - */ - public static final TypedKey<DataComponentType> WRITTEN_BOOK_CONTENT = create(key("written_book_content")); - - private DataComponentTypeKeys() { - } - - private static @NonNull TypedKey<DataComponentType> create(final @NonNull Key key) { - return TypedKey.create(RegistryKey.DATA_COMPONENT_TYPE, key); - } -} diff --git a/paper-api-generator/src/main/java/io/papermc/generator/Generators.java b/paper-api-generator/src/main/java/io/papermc/generator/Generators.java index dbde55b377..9bf5ac92aa 100644 --- a/paper-api-generator/src/main/java/io/papermc/generator/Generators.java +++ b/paper-api-generator/src/main/java/io/papermc/generator/Generators.java @@ -58,22 +58,6 @@ public interface Generators { simpleKey("AttributeKeys", Attribute.class, Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, false), simpleKey("FluidKeys", Fluid.class, Registries.FLUID, RegistryKey.FLUID, false), simpleKey("SoundEventKeys", Sound.class, Registries.SOUND_EVENT, RegistryKey.SOUND_EVENT, false), - new GeneratedKeyType<>("DataComponentTypeKeys", DataComponentType.class, "io.papermc.paper.registry.keys", Registries.DATA_COMPONENT_TYPE, RegistryKey.DATA_COMPONENT_TYPE, false) { - - private static final Set<net.minecraft.core.component.DataComponentType<?>> UNSUPPORTED_TYPES = Set.of( - DataComponents.CUSTOM_DATA, - DataComponents.DEBUG_STICK_STATE, // Block Property API - DataComponents.ENTITY_DATA, - DataComponents.BUCKET_ENTITY_DATA, - DataComponents.BLOCK_ENTITY_DATA, - DataComponents.BEES - ); - - @Override - protected boolean canPrintKey(Holder.Reference<net.minecraft.core.component.DataComponentType<?>> reference) { - return !UNSUPPORTED_TYPES.contains(reference.value()); - } - }, // data-driven simpleKey("BiomeKeys", Biome.class, Registries.BIOME, RegistryKey.BIOME, true), diff --git a/patches/api/0496-WIP-DataComponent-API.patch b/patches/api/0496-WIP-DataComponent-API.patch index 476c9830c1..d65b928abe 100644 --- a/patches/api/0496-WIP-DataComponent-API.patch +++ b/patches/api/0496-WIP-DataComponent-API.patch @@ -153,10 +153,10 @@ index 0000000000000000000000000000000000000000..e2266d86a4dd1bf20346e48c428f8baf +} diff --git a/src/main/java/io/papermc/paper/datacomponent/DataComponentTypes.java b/src/main/java/io/papermc/paper/datacomponent/DataComponentTypes.java new file mode 100644 -index 0000000000000000000000000000000000000000..dbdd5c1540742f642cb4ebed2a978cade0cdd627 +index 0000000000000000000000000000000000000000..d442d0069b3de59e819900fc66ef77afcd812356 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/DataComponentTypes.java -@@ -0,0 +1,346 @@ +@@ -0,0 +1,345 @@ +package io.papermc.paper.datacomponent; + +import io.papermc.paper.datacomponent.item.BannerPatternLayers; @@ -179,7 +179,6 @@ index 0000000000000000000000000000000000000000..dbdd5c1540742f642cb4ebed2a978cad +import io.papermc.paper.datacomponent.item.ItemEnchantments; +import io.papermc.paper.datacomponent.item.ItemLore; +import io.papermc.paper.datacomponent.item.JukeboxPlayable; -+import io.papermc.paper.datacomponent.item.LockCode; +import io.papermc.paper.datacomponent.item.LodestoneTracker; +import io.papermc.paper.datacomponent.item.MapDecorations; +import io.papermc.paper.datacomponent.item.MapId; @@ -322,7 +321,7 @@ index 0000000000000000000000000000000000000000..dbdd5c1540742f642cb4ebed2a978cad + /** + * Causes an item to not be pickable in the creative menu, currently not very useful. + */ -+ public static final DataComponentType.NonValued CREATIVE_SLOT_LOCK = unvalued("creative_slot_lock"); ++ // public static final DataComponentType.NonValued CREATIVE_SLOT_LOCK = unvalued("creative_slot_lock"); + /** + * Overrides the enchantment glint effect on an item. + * If not present, default behaviour is used. @@ -478,14 +477,14 @@ index 0000000000000000000000000000000000000000..dbdd5c1540742f642cb4ebed2a978cad + */ + public static final DataComponentType.Valued<BlockItemDataProperties> BLOCK_DATA = valued("block_state"); + // bees -+ /** -+ * Holds the lock state of a container-like block, -+ * copied to container block when placed. -+ * <br> -+ * An item with a custom name of the same value must be used -+ * to open this container. -+ */ -+ public static final DataComponentType.Valued<LockCode> LOCK = valued("lock"); ++ // /** ++ // * Holds the lock state of a container-like block, ++ // * copied to container block when placed. ++ // * <br> ++ // * An item with a custom name of the same value must be used ++ // * to open this container. ++ // */ ++ // public static final DataComponentType.Valued<LockCode> LOCK = valued("lock"); + /** + * Holds the unresolved loot table and seed of a container-like block. + */ @@ -505,10 +504,10 @@ index 0000000000000000000000000000000000000000..dbdd5c1540742f642cb4ebed2a978cad +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/BannerPatternLayers.java b/src/main/java/io/papermc/paper/datacomponent/item/BannerPatternLayers.java new file mode 100644 -index 0000000000000000000000000000000000000000..2f9b006c906aa07af705b7cd0cb8d36b160e6edf +index 0000000000000000000000000000000000000000..12cfae82234b8c4cb231ab91e72ad82d28b85183 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/BannerPatternLayers.java -@@ -0,0 +1,71 @@ +@@ -0,0 +1,66 @@ +package io.papermc.paper.datacomponent.item; + +import io.papermc.paper.datacomponent.DataComponentBuilder; @@ -530,11 +529,6 @@ index 0000000000000000000000000000000000000000..2f9b006c906aa07af705b7cd0cb8d36b +public interface BannerPatternLayers { + + @Contract(value = "_ -> new", pure = true) -+ static BannerPatternLayers bannerPatternLayers(final Pattern ...patterns) { -+ return bannerPatternLayers(Arrays.asList(patterns)); -+ } -+ -+ @Contract(value = "_ -> new", pure = true) + static BannerPatternLayers bannerPatternLayers(final List<Pattern> patterns) { + return bannerPatternLayers().addAll(patterns).build(); + } @@ -639,10 +633,10 @@ index 0000000000000000000000000000000000000000..65f1bc8d1bea0042dca9683c43956113 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/BundleContents.java b/src/main/java/io/papermc/paper/datacomponent/item/BundleContents.java new file mode 100644 -index 0000000000000000000000000000000000000000..de43ba7f000e5aae35add19651cf23ab803f97e9 +index 0000000000000000000000000000000000000000..c0f671aef8225c87632d2368d1b28fc8b1bce686 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/BundleContents.java -@@ -0,0 +1,71 @@ +@@ -0,0 +1,66 @@ +package io.papermc.paper.datacomponent.item; + +import io.papermc.paper.datacomponent.DataComponentBuilder; @@ -664,11 +658,6 @@ index 0000000000000000000000000000000000000000..de43ba7f000e5aae35add19651cf23ab +public interface BundleContents { + + @Contract(value = "_ -> new", pure = true) -+ static BundleContents bundleContents(final ItemStack ...contents) { -+ return bundleContents(Arrays.asList(contents)); -+ } -+ -+ @Contract(value = "_ -> new", pure = true) + static BundleContents bundleContents(final List<ItemStack> contents) { + return ItemComponentTypesBridge.bridge().bundleContents().addAll(contents).build(); + } @@ -716,10 +705,10 @@ index 0000000000000000000000000000000000000000..de43ba7f000e5aae35add19651cf23ab +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ChargedProjectiles.java b/src/main/java/io/papermc/paper/datacomponent/item/ChargedProjectiles.java new file mode 100644 -index 0000000000000000000000000000000000000000..09240fe94f7f48d4d24e99cc362aed55b13d31b5 +index 0000000000000000000000000000000000000000..d0a6e7db06f540e13ac00e8da3acabd9f7838f1f --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/ChargedProjectiles.java -@@ -0,0 +1,71 @@ +@@ -0,0 +1,66 @@ +package io.papermc.paper.datacomponent.item; + +import io.papermc.paper.datacomponent.DataComponentBuilder; @@ -741,11 +730,6 @@ index 0000000000000000000000000000000000000000..09240fe94f7f48d4d24e99cc362aed55 +public interface ChargedProjectiles { + + @Contract(value = "_ -> new", pure = true) -+ static ChargedProjectiles chargedProjectiles(final ItemStack ...projectiles) { -+ return chargedProjectiles(Arrays.asList(projectiles)); -+ } -+ -+ @Contract(value = "_ -> new", pure = true) + static ChargedProjectiles chargedProjectiles(final List<ItemStack> projectiles) { + return chargedProjectiles().addAll(projectiles).build(); + } @@ -939,10 +923,10 @@ index 0000000000000000000000000000000000000000..6cbd73cb2a11f4858b44a2f57d2fe0ac +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/DeathProtection.java b/src/main/java/io/papermc/paper/datacomponent/item/DeathProtection.java new file mode 100644 -index 0000000000000000000000000000000000000000..f2dd5407c7a91867308eff01f8753a207dbfac2b +index 0000000000000000000000000000000000000000..d7983ca5c45ddfa68766cdfe89956ceebe4b8da7 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/DeathProtection.java -@@ -0,0 +1,53 @@ +@@ -0,0 +1,48 @@ +package io.papermc.paper.datacomponent.item; + +import io.papermc.paper.datacomponent.DataComponentBuilder; @@ -965,11 +949,6 @@ index 0000000000000000000000000000000000000000..f2dd5407c7a91867308eff01f8753a20 +public interface DeathProtection { + + @Contract(value = "_ -> new", pure = true) -+ static DeathProtection deathProtection(final ConsumeEffect ...deathEffects) { -+ return deathProtection(Arrays.asList(deathEffects)); -+ } -+ -+ @Contract(value = "_ -> new", pure = true) + static DeathProtection deathProtection(final List<ConsumeEffect> deathEffects) { + return deathProtection().addEffects(deathEffects).build(); + } @@ -1057,10 +1036,10 @@ index 0000000000000000000000000000000000000000..d80581fc8b894cc4d4af9741244b1bb0 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/Enchantable.java b/src/main/java/io/papermc/paper/datacomponent/item/Enchantable.java new file mode 100644 -index 0000000000000000000000000000000000000000..91a17840755d652fa94cf357f1951efad644798c +index 0000000000000000000000000000000000000000..5169b9cd73dc0ffc8297f8d5f63d3d707a47d279 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/Enchantable.java -@@ -0,0 +1,30 @@ +@@ -0,0 +1,31 @@ +package io.papermc.paper.datacomponent.item; + +import org.checkerframework.checker.index.qual.Positive; @@ -1086,6 +1065,7 @@ index 0000000000000000000000000000000000000000..91a17840755d652fa94cf357f1951efa + * Gets the current enchantment value level allowed, + * a higher value allows enchantments with a higher cost to be picked. + * ++ * @see <a href="https://minecraft.wiki/w/Enchanting_mechanics#Java_Edition_2">Minecraft Wiki</a> + * @return the value + */ + @Contract(pure = true) @@ -1452,10 +1432,10 @@ index 0000000000000000000000000000000000000000..369208e15a0e7fc91a9505fef2097c42 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemAdventurePredicate.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemAdventurePredicate.java new file mode 100644 -index 0000000000000000000000000000000000000000..eefff688896d6705e09abf2f1423a8ba7db5d4c6 +index 0000000000000000000000000000000000000000..f5061d1f349b35e5ec57d2d1c64eafb096141404 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemAdventurePredicate.java -@@ -0,0 +1,70 @@ +@@ -0,0 +1,65 @@ +package io.papermc.paper.datacomponent.item; + +import io.papermc.paper.block.BlockPredicate; @@ -1477,11 +1457,6 @@ index 0000000000000000000000000000000000000000..eefff688896d6705e09abf2f1423a8ba +public interface ItemAdventurePredicate extends ShownInTooltip<ItemAdventurePredicate> { + + @Contract(value = "_ -> new", pure = true) -+ static ItemAdventurePredicate itemAdventurePredicate(final BlockPredicate ...predicates) { -+ return itemAdventurePredicate(List.of(predicates)); -+ } -+ -+ @Contract(value = "_ -> new", pure = true) + static ItemAdventurePredicate itemAdventurePredicate(final List<BlockPredicate> predicates) { + return itemAdventurePredicate().addPredicates(predicates).build(); + } @@ -1587,16 +1562,17 @@ index 0000000000000000000000000000000000000000..0309ae59ab7945ddfb5410930d161e2c +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemAttributeModifiers.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemAttributeModifiers.java new file mode 100644 -index 0000000000000000000000000000000000000000..e33e709363ba4fea0a868e548f97ee5c89902653 +index 0000000000000000000000000000000000000000..add54d898ad207ddf88f3a840342ab60a83bf565 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemAttributeModifiers.java -@@ -0,0 +1,75 @@ +@@ -0,0 +1,85 @@ +package io.papermc.paper.datacomponent.item; + +import io.papermc.paper.datacomponent.DataComponentBuilder; +import java.util.List; +import org.bukkit.attribute.Attribute; +import org.bukkit.attribute.AttributeModifier; ++import org.bukkit.inventory.EquipmentSlotGroup; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.Unmodifiable; @@ -1645,6 +1621,15 @@ index 0000000000000000000000000000000000000000..e33e709363ba4fea0a868e548f97ee5c + */ + @Contract(pure = true) + AttributeModifier modifier(); ++ ++ /** ++ * Gets the slot group for this attribute. ++ * ++ * @return the slot group ++ */ ++ default EquipmentSlotGroup getGroup() { ++ return this.modifier().getSlotGroup(); ++ } + } + + /** @@ -1786,10 +1771,10 @@ index 0000000000000000000000000000000000000000..1097a6e0d0921abc6714017a123176ea +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemContainerContents.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemContainerContents.java new file mode 100644 -index 0000000000000000000000000000000000000000..72ab4707f85a06a05a238f52b0d165e359e1d66b +index 0000000000000000000000000000000000000000..7d1c973ba566752d7a85496327b1352d973f2218 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemContainerContents.java -@@ -0,0 +1,68 @@ +@@ -0,0 +1,63 @@ +package io.papermc.paper.datacomponent.item; + +import io.papermc.paper.datacomponent.DataComponentBuilder; @@ -1811,11 +1796,6 @@ index 0000000000000000000000000000000000000000..72ab4707f85a06a05a238f52b0d165e3 +public interface ItemContainerContents { + + @Contract(value = "_ -> new", pure = true) -+ static ItemContainerContents containerContents(final ItemStack ...contents) { -+ return containerContents(Arrays.asList(contents)); -+ } -+ -+ @Contract(value = "_ -> new", pure = true) + static ItemContainerContents containerContents(final List<ItemStack> contents) { + return containerContents().addAll(contents).build(); + } @@ -2071,34 +2051,6 @@ index 0000000000000000000000000000000000000000..c59942df7101c7630eabeb247b9690b9 + Builder jukeboxSong(JukeboxSong song); + } +} -diff --git a/src/main/java/io/papermc/paper/datacomponent/item/LockCode.java b/src/main/java/io/papermc/paper/datacomponent/item/LockCode.java -new file mode 100644 -index 0000000000000000000000000000000000000000..42cfb5c6cd5ad4c6475def221eb653b9d4dfe568 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datacomponent/item/LockCode.java -@@ -0,0 +1,22 @@ -+package io.papermc.paper.datacomponent.item; -+ -+import org.jetbrains.annotations.ApiStatus; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Holds the lock code for an item. -+ * @see io.papermc.paper.datacomponent.DataComponentTypes#LOCK -+ */ -+@NullMarked -+public interface LockCode { -+ -+ // @Contract(value = "_ -> new", pure = true) -+ // static LockCode lockCode(final String code) { -+ // return ItemComponentTypesBridge.bridge().lockCode(code); -+ // } -+ // -+ // @Contract(pure = true) -+ // String key(); -+} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/LodestoneTracker.java b/src/main/java/io/papermc/paper/datacomponent/item/LodestoneTracker.java new file mode 100644 index 0000000000000000000000000000000000000000..b919672ceea74ae09324653847b30fde293054d8 @@ -2179,7 +2131,7 @@ index 0000000000000000000000000000000000000000..b919672ceea74ae09324653847b30fde +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/MapDecorations.java b/src/main/java/io/papermc/paper/datacomponent/item/MapDecorations.java new file mode 100644 -index 0000000000000000000000000000000000000000..d1674197d3663a876c37589dc22c3b40a8790972 +index 0000000000000000000000000000000000000000..ec3a1cdcafe5b21989de8d87f0f592936e5db409 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/MapDecorations.java @@ -0,0 +1,121 @@ @@ -2220,7 +2172,7 @@ index 0000000000000000000000000000000000000000..d1674197d3663a876c37589dc22c3b40 + * @return decoration entry, or {@code null} if not present + */ + @Contract(pure = true) -+ @Nullable DecorationEntry getDecoration(String id); ++ @Nullable DecorationEntry decoration(String id); + + /** + * Gets the decoration entries. @@ -2539,7 +2491,7 @@ index 0000000000000000000000000000000000000000..6da78b8735a6cadd1282fa2fafd8b0f7 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PotionContents.java b/src/main/java/io/papermc/paper/datacomponent/item/PotionContents.java new file mode 100644 -index 0000000000000000000000000000000000000000..7bfb093d6802828499fb06be1d900f41bd52daba +index 0000000000000000000000000000000000000000..7f46b2d891855719ff48b8f45f23bc4cdb14a7d4 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/PotionContents.java @@ -0,0 +1,120 @@ @@ -2566,7 +2518,7 @@ index 0000000000000000000000000000000000000000..7bfb093d6802828499fb06be1d900f41 +public interface PotionContents { + + @Contract(value = "-> new", pure = true) -+ static PotionContents.Builder potionContents() { // can't name it just "enchantments" ++ static PotionContents.Builder potionContents() { + return ItemComponentTypesBridge.bridge().potionContents(); + } + @@ -2701,10 +2653,10 @@ index 0000000000000000000000000000000000000000..ff84d9123aab0ad2f93b397e20a37f21 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ResolvableProfile.java b/src/main/java/io/papermc/paper/datacomponent/item/ResolvableProfile.java new file mode 100644 -index 0000000000000000000000000000000000000000..c9fa347f068e2b7b90d1024ea554b2bf3cff3080 +index 0000000000000000000000000000000000000000..dc6cd191553e7ca5b6c5768f594924e4c39fcbbe --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/ResolvableProfile.java -@@ -0,0 +1,95 @@ +@@ -0,0 +1,123 @@ +package io.papermc.paper.datacomponent.item; + +import com.destroystokyo.paper.profile.PlayerProfile; @@ -2748,6 +2700,34 @@ index 0000000000000000000000000000000000000000..c9fa347f068e2b7b90d1024ea554b2bf + @Contract(pure = true) + @Unmodifiable Collection<ProfileProperty> properties(); + ++ /** ++ * Produces an updated player profile based on this. ++ * <p> ++ * This tries to produce a completed profile by filling in missing ++ * properties (name, unique id, textures, etc.), and updates existing ++ * properties (e.g. name, textures, etc.) to their official and up-to-date ++ * values. This operation does not alter the current profile, but produces a ++ * new updated {@link PlayerProfile}. ++ * <p> ++ * If no player exists for the unique id or name of this profile, this ++ * operation yields a profile that is equal to the current profile, which ++ * might not be complete. ++ * <p> ++ * This is an asynchronous operation: Updating the profile can result in an ++ * outgoing connection in another thread in order to fetch the latest ++ * profile properties. The returned {@link CompletableFuture} will be ++ * completed once the updated profile is available. In order to not block ++ * the server's main thread, you should not wait for the result of the ++ * returned CompletableFuture on the server's main thread. Instead, if you ++ * want to do something with the updated player profile on the server's main ++ * thread once it is available, you could do something like this: ++ * <pre> ++ * profile.resolve().thenAcceptAsync(updatedProfile -> { ++ * // Do something with the updated profile: ++ * // ... ++ * }, runnable -> Bukkit.getScheduler().runTask(plugin, runnable)); ++ * </pre> ++ */ + @Contract(pure = true) + CompletableFuture<PlayerProfile> resolve(); + @@ -2937,10 +2917,10 @@ index 0000000000000000000000000000000000000000..7e058aebcbd768517f6db51540598721 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/SuspiciousStewEffects.java b/src/main/java/io/papermc/paper/datacomponent/item/SuspiciousStewEffects.java new file mode 100644 -index 0000000000000000000000000000000000000000..f834512224fb8eb523442e9faa9c9aa2221df9f0 +index 0000000000000000000000000000000000000000..422bb5ccc42b94b60fba6714e9e6fb8aced6eb0c --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/SuspiciousStewEffects.java -@@ -0,0 +1,72 @@ +@@ -0,0 +1,67 @@ +package io.papermc.paper.datacomponent.item; + +import io.papermc.paper.datacomponent.DataComponentBuilder; @@ -2963,11 +2943,6 @@ index 0000000000000000000000000000000000000000..f834512224fb8eb523442e9faa9c9aa2 +public interface SuspiciousStewEffects { + + @Contract(value = "_ -> new", pure = true) -+ static SuspiciousStewEffects suspiciousStewEffects(final SuspiciousEffectEntry ...effects) { -+ return suspiciousStewEffects(Arrays.asList(effects)); -+ } -+ -+ @Contract(value = "_ -> new", pure = true) + static SuspiciousStewEffects suspiciousStewEffects(final Collection<SuspiciousEffectEntry> effects) { + return suspiciousStewEffects().addAll(effects).build(); + } @@ -3015,10 +2990,10 @@ index 0000000000000000000000000000000000000000..f834512224fb8eb523442e9faa9c9aa2 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/Tool.java b/src/main/java/io/papermc/paper/datacomponent/item/Tool.java new file mode 100644 -index 0000000000000000000000000000000000000000..4dfa518a2038df3ba4fa628f37eaf23414a66e6b +index 0000000000000000000000000000000000000000..4e87feb83204266e1fefdafe7b7e5ac53da3160e --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/Tool.java -@@ -0,0 +1,145 @@ +@@ -0,0 +1,149 @@ +package io.papermc.paper.datacomponent.item; + +import io.papermc.paper.datacomponent.DataComponentBuilder; @@ -3049,6 +3024,26 @@ index 0000000000000000000000000000000000000000..4dfa518a2038df3ba4fa628f37eaf234 + } + + /** ++ * Creates a mining rule that specifies how an item interacts with certain block types. ++ * ++ * <p>This method allows you to define a rule for a set of block types, optionally setting a custom mining speed ++ * and determining whether the item should correct for drops when mining these blocks.</p> ++ * ++ * @param blocks The set of block types this rule applies to. ++ * @param speed The custom mining speed multiplier for these blocks. If {@code null}, the default speed is used. ++ * @param correctForDrops A {@link TriState} indicating how to handle item drops: ++ * <ul> ++ * <li>{@link TriState#TRUE} - Items will be dropped.</li> ++ * <li>{@link TriState#FALSE} - Items will not be dropped.</li> ++ * <li>{@link TriState#NOT_SET} - The default drop behavior is used.</li> ++ * </ul> ++ * @return A new {@link Rule} instance representing the mining rule. ++ */ ++ static Rule rule(final RegistryKeySet<BlockType> blocks, final @Nullable Float speed, final TriState correctForDrops) { ++ return ItemComponentTypesBridge.bridge().rule(blocks, speed, correctForDrops); ++ } ++ ++ /** + * Mining speed to use if no rules match and don't override mining speed. + * + * @return default mining speed @@ -3076,22 +3071,6 @@ index 0000000000000000000000000000000000000000..4dfa518a2038df3ba4fa628f37eaf234 + @ApiStatus.NonExtendable + interface Rule { + -+ static Rule rule(final RegistryKeySet<BlockType> blocks, final @Nullable Float speed, final TriState correctForDrops) { -+ return ItemComponentTypesBridge.bridge().rule(blocks, speed, correctForDrops); -+ } -+ -+ static Rule minesAndDrops(final RegistryKeySet<BlockType> blocks, final float speed) { -+ return rule(blocks, speed, TriState.TRUE); -+ } -+ -+ static Rule deniesDrops(final RegistryKeySet<BlockType> blocks) { -+ return rule(blocks, null, TriState.FALSE); -+ } -+ -+ static Rule overrideSpeed(final RegistryKeySet<BlockType> blocks, final float speed) { -+ return rule(blocks, speed, TriState.NOT_SET); -+ } -+ + /** + * Blocks to match. + * @@ -3278,10 +3257,10 @@ index 0000000000000000000000000000000000000000..5840f12286aedfb89d3fc4882508e11a +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/UseRemainder.java b/src/main/java/io/papermc/paper/datacomponent/item/UseRemainder.java new file mode 100644 -index 0000000000000000000000000000000000000000..31343f5068b3ca60bc237323063a012faa0141b7 +index 0000000000000000000000000000000000000000..50e42e073311332142980828d0beec1828570512 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/UseRemainder.java -@@ -0,0 +1,48 @@ +@@ -0,0 +1,31 @@ +package io.papermc.paper.datacomponent.item; + +import io.papermc.paper.datacomponent.DataComponentBuilder; @@ -3312,23 +3291,6 @@ index 0000000000000000000000000000000000000000..31343f5068b3ca60bc237323063a012f + @Contract(value = "-> new", pure = true) + ItemStack transformInto(); + -+ /** -+ * Builder for {@link UseRemainder}. -+ */ -+ @ApiStatus.Experimental -+ @ApiStatus.NonExtendable -+ interface Builder extends ShownInTooltip.Builder<Builder>, DataComponentBuilder<UseRemainder> { -+ -+ /** -+ * Sets the transform item of this builder. -+ * -+ * @param itemStack item -+ * @return the builder for chaining -+ * @see #transformInto() -+ */ -+ @Contract(value = "_ -> this", mutates = "this") -+ Builder transformInto(ItemStack itemStack); -+ } +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/WritableBookContent.java b/src/main/java/io/papermc/paper/datacomponent/item/WritableBookContent.java new file mode 100644 @@ -3596,84 +3558,9 @@ index 0000000000000000000000000000000000000000..86915d2c1435d4a5df2bce0318bdf169 + Builder addFilteredPages(Collection<Filtered<? extends ComponentLike>> pages); + } +} -diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ApplyStatusEffectsConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ApplyStatusEffectsConsumeEffect.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0dac27dc6002b599deed7fb779de86f96907a942 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ApplyStatusEffectsConsumeEffect.java -@@ -0,0 +1,42 @@ -+package io.papermc.paper.datacomponent.item.consumable; -+ -+import java.util.List; -+import org.bukkit.potion.PotionEffect; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Represents a consumable effect that applies effects based on a probability on consumption. -+ */ -+@NullMarked -+public interface ApplyStatusEffectsConsumeEffect extends ConsumeEffect { -+ -+ /** -+ * Creates a consume effect that gives status effects on consumption. -+ * -+ * @param effects the potion effects to apply -+ * @param probability the probability of these effects being applied, between 0 and 1 inclusive. -+ * @return the effect -+ */ -+ @Contract(value = "_, _ -> new", pure = true) -+ static ApplyStatusEffectsConsumeEffect applyStatusEffects(final List<PotionEffect> effects, final float probability) { -+ return ConsumableTypesBridge.bridge().applyStatusEffects(effects, probability); -+ } -+ -+ /** -+ * Effect instances to grant -+ * -+ * @return effect -+ */ -+ List<PotionEffect> effects(); -+ -+ /** -+ * Float between 0 and 1, chance for the effect to be applied. -+ * -+ * @return chance -+ */ -+ float probability(); -+} -diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ClearAllStatusEffectsConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ClearAllStatusEffectsConsumeEffect.java -new file mode 100644 -index 0000000000000000000000000000000000000000..d6399bc32c5c330dc9969bdfc8f98f43bcbaf2d4 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ClearAllStatusEffectsConsumeEffect.java -@@ -0,0 +1,21 @@ -+package io.papermc.paper.datacomponent.item.consumable; -+ -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Represents a consumable effect that clears all effects on consumption. -+ */ -+@NullMarked -+public interface ClearAllStatusEffectsConsumeEffect extends ConsumeEffect { -+ -+ /** -+ * Creates a consume effect that clears all status effects. -+ * -+ * @return effect instance -+ */ -+ @Contract(value = "-> new", pure = true) -+ static ClearAllStatusEffectsConsumeEffect clearAllStatusEffects() { -+ return ConsumableTypesBridge.bridge().clearAllStatusEffects(); -+ } -+} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridge.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridge.java new file mode 100644 -index 0000000000000000000000000000000000000000..85cb8c4ebc7b372842f8a262790f3c5dcb86f161 +index 0000000000000000000000000000000000000000..a845ccfc21f101f0632249745bbd8b334f85e72c --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridge.java @@ -0,0 +1,32 @@ @@ -3699,26 +3586,32 @@ index 0000000000000000000000000000000000000000..85cb8c4ebc7b372842f8a262790f3c5d + return BRIDGE.orElseThrow(); + } + -+ ApplyStatusEffectsConsumeEffect applyStatusEffects(List<PotionEffect> effectList, float probability); ++ ConsumeEffect.ApplyStatusEffects applyStatusEffects(List<PotionEffect> effectList, float probability); + -+ RemoveStatusEffectsConsumeEffect removeStatusEffects(RegistryKeySet<PotionEffectType> potionEffectTypeTagKey); ++ ConsumeEffect.RemoveStatusEffects removeStatusEffects(RegistryKeySet<PotionEffectType> potionEffectTypeTagKey); + -+ ClearAllStatusEffectsConsumeEffect clearAllStatusEffects(); ++ ConsumeEffect.ClearAllStatusEffects clearAllStatusEffects(); + -+ PlaySoundConsumeEffect playSoundEffect(Key sound); ++ ConsumeEffect.PlaySound playSoundEffect(Key sound); + -+ TeleportRandomlyConsumeEffect teleportRandomlyEffect(float diameter); ++ ConsumeEffect.TeleportRandomly teleportRandomlyEffect(float diameter); +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumeEffect.java new file mode 100644 -index 0000000000000000000000000000000000000000..c5889c75c421ff10e51faf3fd769a38dc1287152 +index 0000000000000000000000000000000000000000..45d674b68ab0e532c2f87bc528c1b095a50b5068 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumeEffect.java -@@ -0,0 +1,14 @@ +@@ -0,0 +1,149 @@ +package io.papermc.paper.datacomponent.item.consumable; + ++import io.papermc.paper.registry.set.RegistryKeySet; ++import net.kyori.adventure.key.Key; ++import org.bukkit.potion.PotionEffect; ++import org.bukkit.potion.PotionEffectType; +import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; +import org.jspecify.annotations.NullMarked; ++import java.util.List; + +/** + * Effect that occurs when consuming an item. @@ -3728,50 +3621,27 @@ index 0000000000000000000000000000000000000000..c5889c75c421ff10e51faf3fd769a38d +public interface ConsumeEffect { + -+} -diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ItemUseAnimation.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ItemUseAnimation.java -new file mode 100644 -index 0000000000000000000000000000000000000000..8cd6dbe4ea5ee3270b9428a9c29cbd88823d9f6c ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ItemUseAnimation.java -@@ -0,0 +1,17 @@ -+package io.papermc.paper.datacomponent.item.consumable; -+ -+/** -+ * Represents the hand animation that is used when a player is consuming this item. -+ */ -+public enum ItemUseAnimation { -+ NONE, -+ EAT, -+ DRINK, -+ BLOCK, -+ BOW, -+ SPEAR, -+ CROSSBOW, -+ SPYGLASS, -+ TOOT_HORN, -+ BRUSH -+} -diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PlaySoundConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PlaySoundConsumeEffect.java -new file mode 100644 -index 0000000000000000000000000000000000000000..aca3a7d5f78385b34ffe39c2e293b23d2fc138b5 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PlaySoundConsumeEffect.java -@@ -0,0 +1,33 @@ -+package io.papermc.paper.datacomponent.item.consumable; -+ -+import net.kyori.adventure.key.Key; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; ++ /** ++ * Creates a consume effect that randomly teleports the entity on consumption. ++ * ++ * @param diameter diameter of random teleportation ++ * @return the effect ++ */ ++ @Contract(value = "_ -> new", pure = true) ++ static TeleportRandomly teleportRandomlyEffect(final float diameter) { ++ return ConsumableTypesBridge.bridge().teleportRandomlyEffect(diameter); ++ } + -+/** -+ * Represents a consumable effect that plays a sound on consumption. -+ */ -+@NullMarked -+public interface PlaySoundConsumeEffect extends ConsumeEffect { ++ /** ++ * Creates a consume effect that gives status effects on consumption. ++ * ++ * @param key the sound effect to play ++ * @return the effect ++ */ ++ @Contract(value = "_ -> new", pure = true) ++ static RemoveStatusEffects removeEffects(final RegistryKeySet<PotionEffectType> key) { ++ return ConsumableTypesBridge.bridge().removeStatusEffects(key); ++ } + + /** + * Creates a consume effect that plays a sound on consumption. @@ -3780,91 +3650,129 @@ index 0000000000000000000000000000000000000000..aca3a7d5f78385b34ffe39c2e293b23d + * @return the effect + */ + @Contract(value = "_ -> new", pure = true) -+ static PlaySoundConsumeEffect playSoundConsumeEffect(final Key key) { ++ static PlaySound playSoundConsumeEffect(final Key key) { + return ConsumableTypesBridge.bridge().playSoundEffect(key); + } + + /** -+ * Sound effect to play in the world ++ * Creates a consume effect that clears all status effects. + * -+ * @return sound effect ++ * @return effect instance + */ -+ Key sound(); -+} -diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/RemoveStatusEffectsConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/RemoveStatusEffectsConsumeEffect.java -new file mode 100644 -index 0000000000000000000000000000000000000000..70b406a124dfb16a7354dab457f5bd5dc8f36832 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/RemoveStatusEffectsConsumeEffect.java -@@ -0,0 +1,34 @@ -+package io.papermc.paper.datacomponent.item.consumable; -+ -+import io.papermc.paper.registry.set.RegistryKeySet; -+import org.bukkit.potion.PotionEffectType; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; -+ -+/** -+ * Represents a consumable effect that removes status effects on consumption -+ */ -+@NullMarked -+public interface RemoveStatusEffectsConsumeEffect extends ConsumeEffect { ++ @Contract(value = "-> new", pure = true) ++ static ClearAllStatusEffects clearAllStatusEffects() { ++ return ConsumableTypesBridge.bridge().clearAllStatusEffects(); ++ } + + /** + * Creates a consume effect that gives status effects on consumption. + * -+ * @param key the sound effect to play ++ * @param effects the potion effects to apply ++ * @param probability the probability of these effects being applied, between 0 and 1 inclusive. + * @return the effect + */ -+ @Contract(value = "_ -> new", pure = true) -+ static RemoveStatusEffectsConsumeEffect removeEffects(final RegistryKeySet<PotionEffectType> key) { -+ return ConsumableTypesBridge.bridge().removeStatusEffects(key); ++ @Contract(value = "_, _ -> new", pure = true) ++ static ApplyStatusEffects applyStatusEffects(final List<PotionEffect> effects, final float probability) { ++ return ConsumableTypesBridge.bridge().applyStatusEffects(effects, probability); + } + ++ @NullMarked ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface TeleportRandomly extends ConsumeEffect { ++ ++ /** ++ * The max range that the entity can be teleported to. ++ * ++ * @return teleportation diameter ++ */ ++ float diameter(); ++ } + /** -+ * Potion effects to remove -+ * -+ * @return effects ++ * Represents a consumable effect that removes status effects on consumption + */ -+ RegistryKeySet<PotionEffectType> removeEffects(); -+} -diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/TeleportRandomlyConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/TeleportRandomlyConsumeEffect.java -new file mode 100644 -index 0000000000000000000000000000000000000000..f0751babbaaaedb188c109589aff1a65cde3bec1 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/TeleportRandomlyConsumeEffect.java -@@ -0,0 +1,29 @@ -+package io.papermc.paper.datacomponent.item.consumable; ++ @NullMarked ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface RemoveStatusEffects extends ConsumeEffect { + -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jspecify.annotations.NullMarked; ++ /** ++ * Potion effects to remove ++ * ++ * @return effects ++ */ ++ RegistryKeySet<PotionEffectType> removeEffects(); ++ } + -+@NullMarked -+public interface TeleportRandomlyConsumeEffect extends ConsumeEffect { ++ /** ++ * Represents a consumable effect that plays a sound on consumption. ++ */ ++ @NullMarked ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface PlaySound extends ConsumeEffect { ++ ++ /** ++ * Sound effect to play in the world ++ * ++ * @return sound effect ++ */ ++ Key sound(); ++ } + + /** -+ * Creates a consume effect that randomly teleports the entity on consumption. -+ * -+ * @param diameter diameter of random teleportation -+ * @return the effect ++ * Represents a consumable effect that clears all effects on consumption. + */ -+ @Contract(value = "_ -> new", pure = true) -+ static TeleportRandomlyConsumeEffect teleportRandomlyEffect(final float diameter) { -+ return ConsumableTypesBridge.bridge().teleportRandomlyEffect(diameter); ++ @NullMarked ++ interface ClearAllStatusEffects extends ConsumeEffect { ++ + } + + /** -+ * The max range that the entity can be teleported to. -+ * -+ * @return teleportation diameter ++ * Represents a consumable effect that applies effects based on a probability on consumption. + */ -+ float diameter(); ++ @NullMarked ++ @ApiStatus.Experimental ++ @ApiStatus.NonExtendable ++ interface ApplyStatusEffects extends ConsumeEffect { ++ ++ /** ++ * Effect instances to grant ++ * ++ * @return effect ++ */ ++ List<PotionEffect> effects(); ++ ++ /** ++ * Float between 0 and 1, chance for the effect to be applied. ++ * ++ * @return chance ++ */ ++ float probability(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ItemUseAnimation.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ItemUseAnimation.java +new file mode 100644 +index 0000000000000000000000000000000000000000..8cd6dbe4ea5ee3270b9428a9c29cbd88823d9f6c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ItemUseAnimation.java +@@ -0,0 +1,17 @@ ++package io.papermc.paper.datacomponent.item.consumable; ++ ++/** ++ * Represents the hand animation that is used when a player is consuming this item. ++ */ ++public enum ItemUseAnimation { ++ NONE, ++ EAT, ++ DRINK, ++ BLOCK, ++ BOW, ++ SPEAR, ++ CROSSBOW, ++ SPYGLASS, ++ TOOT_HORN, ++ BRUSH +} diff --git a/src/main/java/io/papermc/paper/item/MapPostProcessing.java b/src/main/java/io/papermc/paper/item/MapPostProcessing.java new file mode 100644 @@ -4019,7 +3927,7 @@ index 7cf7c6d05aa6cbf3f0c8612831404552c6a7b84a..c60e31425efd7b863941f5538faef6c0 * Get the object by its key. * diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index b59222b8c262545d100a9fd28b3bf1d2a4cf4eb0..8071624df30b36e2f96dcf7a0b2ada20179b1641 100644 +index b59222b8c262545d100a9fd28b3bf1d2a4cf4eb0..0fcc5361558cc5718931415f4d42ae91f3a38def 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java @@ -1,10 +1,11 @@ @@ -4106,29 +4014,29 @@ index b59222b8c262545d100a9fd28b3bf1d2a4cf4eb0..8071624df30b36e2f96dcf7a0b2ada20 + this.setData(type, valueBuilder.build()); + } + -+ /** -+ * Modifies the value of the specified data component type for this item stack based on the result -+ * of applying a given function to the current value. -+ * -+ * <p>If the function returns {@code null}, the data component type will be reset using -+ * {@link #unsetData(DataComponentType)}. Otherwise, the -+ * component value will be updated with the new result using {@link #setData(DataComponentType.Valued, Object)}.</p> -+ * -+ * @param <T> the type of the data component's value -+ * @param type the data component type to be modified -+ * @param consumer a function that takes the current component value (can be {@code null}) and -+ * returns the modified value (or {@code null} to unset) -+ */ -+ @Utility -+ public <T> void editData(final io.papermc.paper.datacomponent.DataComponentType.@NotNull Valued<T> type, final @NotNull java.util.function.Function<@Nullable T, @Nullable T> consumer) { -+ T value = getData(type); -+ T newType = consumer.apply(value); -+ if (newType == null) { -+ unsetData(type); -+ } else { -+ setData(type, newType); -+ } -+ } ++ // /** ++ // * Modifies the value of the specified data component type for this item stack based on the result ++ // * of applying a given function to the current value. ++ // * ++ // * <p>If the function returns {@code null}, the data component type will be reset using ++ // * {@link #unsetData(DataComponentType)}. Otherwise, the ++ // * component value will be updated with the new result using {@link #setData(DataComponentType.Valued, Object)}.</p> ++ // * ++ // * @param <T> the type of the data component's value ++ // * @param type the data component type to be modified ++ // * @param consumer a function that takes the current component value (can be {@code null}) and ++ // * returns the modified value (or {@code null} to unset) ++ // */ ++ // @Utility ++ // public <T> void editData(final io.papermc.paper.datacomponent.DataComponentType.@NotNull Valued<T> type, final @NotNull java.util.function.Function<@Nullable T, @Nullable T> consumer) { ++ // T value = getData(type); ++ // T newType = consumer.apply(value); ++ // if (newType == null) { ++ // unsetData(type); ++ // } else { ++ // setData(type, newType); ++ // } ++ // } + + /** + * Sets the value of the data component type for this itemstack. To @@ -4191,7 +4099,7 @@ index b59222b8c262545d100a9fd28b3bf1d2a4cf4eb0..8071624df30b36e2f96dcf7a0b2ada20 + * @param excludeTypes the data component types to ignore + * @return {@code true} if the provided item is equal, ignoring the provided components + */ -+ public boolean matchesWithoutData(final @NotNull ItemStack item, final @NotNull io.papermc.paper.registry.set.RegistrySet<io.papermc.paper.datacomponent.@NotNull DataComponentType> excludeTypes) { ++ public boolean matchesWithoutData(final @NotNull ItemStack item, final @NotNull java.util.Collection<io.papermc.paper.datacomponent.@NotNull DataComponentType> excludeTypes) { + return this.matchesWithoutData(item, excludeTypes, false); + } + @@ -4204,7 +4112,7 @@ index b59222b8c262545d100a9fd28b3bf1d2a4cf4eb0..8071624df30b36e2f96dcf7a0b2ada20 + * @param ignoreCount ignore the count of the item + * @return {@code true} if the provided item is equal, ignoring the provided components + */ -+ public boolean matchesWithoutData(final @NotNull ItemStack item, final @NotNull io.papermc.paper.registry.set.RegistrySet<io.papermc.paper.datacomponent.@NotNull DataComponentType> excludeTypes, final boolean ignoreCount) { ++ public boolean matchesWithoutData(final @NotNull ItemStack item, final @NotNull java.util.Collection<io.papermc.paper.datacomponent.@NotNull DataComponentType> excludeTypes, final boolean ignoreCount) { + return this.craftDelegate.matchesWithoutData(item, excludeTypes, ignoreCount); + } + // Paper end - data component API diff --git a/patches/server/1065-WIP-DataComponent-API.patch b/patches/server/1065-WIP-DataComponent-API.patch index 2048518902..bb85aa06a1 100644 --- a/patches/server/1065-WIP-DataComponent-API.patch +++ b/patches/server/1065-WIP-DataComponent-API.patch @@ -66,10 +66,10 @@ index 0000000000000000000000000000000000000000..08c717590a34584c359408c49c69379c +} diff --git a/src/main/java/io/papermc/paper/datacomponent/ComponentAdapters.java b/src/main/java/io/papermc/paper/datacomponent/ComponentAdapters.java new file mode 100644 -index 0000000000000000000000000000000000000000..e821b336b4c9e1c2fafd1ef21b559ebc9e46b13b +index 0000000000000000000000000000000000000000..139e0ab98d4676eef07804c68bd9354b9e33be01 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/ComponentAdapters.java -@@ -0,0 +1,189 @@ +@@ -0,0 +1,177 @@ +package io.papermc.paper.datacomponent; + +import com.mojang.brigadier.exceptions.CommandSyntaxException; @@ -95,7 +95,6 @@ index 0000000000000000000000000000000000000000..e821b336b4c9e1c2fafd1ef21b559ebc +import io.papermc.paper.datacomponent.item.PaperItemLore; +import io.papermc.paper.datacomponent.item.PaperItemTool; +import io.papermc.paper.datacomponent.item.PaperJukeboxPlayable; -+import io.papermc.paper.datacomponent.item.PaperLockCode; +import io.papermc.paper.datacomponent.item.PaperLodestoneTracker; +import io.papermc.paper.datacomponent.item.PaperMapDecorations; +import io.papermc.paper.datacomponent.item.PaperMapId; @@ -148,17 +147,6 @@ index 0000000000000000000000000000000000000000..e821b336b4c9e1c2fafd1ef21b559ebc + + public static void bootstrap() { + //noinspection deprecation -+ register(DataComponents.CUSTOM_DATA, data -> PaperAdventure.asBinaryTagHolder(data.getUnsafe()), holder -> { // unsafe is fine because it serializes right away -+ try { -+ final Tag tag = holder.get(PaperAdventure.NBT_CODEC); -+ if (!(tag instanceof final CompoundTag compoundTag)) { -+ throw new IllegalArgumentException(holder + " doesn't represent a compound tag"); -+ } -+ return CustomData.of(compoundTag); -+ } catch (final CommandSyntaxException e) { -+ throw new RuntimeException(e); -+ } -+ }); + registerIdentity(DataComponents.MAX_STACK_SIZE); + registerIdentity(DataComponents.MAX_DAMAGE); + registerIdentity(DataComponents.DAMAGE); @@ -177,7 +165,7 @@ index 0000000000000000000000000000000000000000..e821b336b4c9e1c2fafd1ef21b559ebc + registerUntyped(DataComponents.HIDE_ADDITIONAL_TOOLTIP); + registerUntyped(DataComponents.HIDE_TOOLTIP); + registerIdentity(DataComponents.REPAIR_COST); -+ registerUntyped(DataComponents.CREATIVE_SLOT_LOCK); ++ // registerUntyped(DataComponents.CREATIVE_SLOT_LOCK); + registerIdentity(DataComponents.ENCHANTMENT_GLINT_OVERRIDE); + registerUntyped(DataComponents.INTANGIBLE_PROJECTILE); + register(DataComponents.FOOD, PaperFoodProperties::new); @@ -224,7 +212,7 @@ index 0000000000000000000000000000000000000000..e821b336b4c9e1c2fafd1ef21b559ebc + register(DataComponents.CONTAINER, PaperItemContainerContents::new); + register(DataComponents.BLOCK_STATE, PaperBlockItemDataProperties::new); + // bees -+ register(DataComponents.LOCK, PaperLockCode::new); ++ //register(DataComponents.LOCK, PaperLockCode::new); + register(DataComponents.CONTAINER_LOOT, PaperSeededContainerLoot::new); + + // TODO: REMOVE THIS... we want to build the PR... so lets just make things UNTYPED! @@ -248,7 +236,7 @@ index 0000000000000000000000000000000000000000..e821b336b4c9e1c2fafd1ef21b559ebc + } + + private static <NMS, API> void register(final DataComponentType<NMS> type, final Function<NMS, API> vanillaToApi, final Function<API, NMS> apiToVanilla) { -+ registerInternal(type, vanillaToApi, apiToVanilla, true); ++ registerInternal(type, vanillaToApi, apiToVanilla, false); + } + + private static <NMS, API> void registerInternal(final DataComponentType<NMS> type, final Function<NMS, API> vanillaToApi, final Function<API, NMS> apiToVanilla, final boolean codecValidation) { @@ -427,10 +415,10 @@ index 0000000000000000000000000000000000000000..74e883d50477b3b4dabdcb674d95e92e +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridgesImpl.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridgesImpl.java new file mode 100644 -index 0000000000000000000000000000000000000000..518e0f5fa985b8f10a8c1e90bd1475f827acbf46 +index 0000000000000000000000000000000000000000..1da874aa3ce10081b8e5e5334c4ff1f92a9ef281 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/ItemComponentTypesBridgesImpl.java -@@ -0,0 +1,240 @@ +@@ -0,0 +1,241 @@ +package io.papermc.paper.datacomponent.item; + +import com.destroystokyo.paper.profile.PlayerProfile; @@ -612,6 +600,7 @@ index 0000000000000000000000000000000000000000..518e0f5fa985b8f10a8c1e90bd1475f8 + + @Override + public UseRemainder useRemainder(final ItemStack itemStack) { ++ Preconditions.checkNotNull(itemStack); + Preconditions.checkArgument(!itemStack.isEmpty(), "Remaining item cannot be empty!"); + return new PaperUseRemainder( + new net.minecraft.world.item.component.UseRemainder(CraftItemStack.asNMSCopy(itemStack)) @@ -804,10 +793,10 @@ index 0000000000000000000000000000000000000000..1d33a3baa7aedaf7b350835798f9cf4b +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperBundleContents.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperBundleContents.java new file mode 100644 -index 0000000000000000000000000000000000000000..3cc69c43001e0cd149c29a84741078cb8a8b5c70 +index 0000000000000000000000000000000000000000..d4d5b896f3523daeb38de89a0c3b6fdd4d9a11f9 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperBundleContents.java -@@ -0,0 +1,55 @@ +@@ -0,0 +1,56 @@ +package io.papermc.paper.datacomponent.item; + +import java.util.ArrayList; @@ -843,6 +832,7 @@ index 0000000000000000000000000000000000000000..3cc69c43001e0cd149c29a84741078cb + + @Override + public BundleContents.Builder add(final ItemStack stack) { ++ Preconditions.checkNotNull(stack); + Preconditions.checkArgument(!stack.isEmpty(), "stack cannot be empty"); + this.items.add(CraftItemStack.asNMSCopy(stack)); + return this; @@ -865,10 +855,10 @@ index 0000000000000000000000000000000000000000..3cc69c43001e0cd149c29a84741078cb +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperChargedProjectiles.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperChargedProjectiles.java new file mode 100644 -index 0000000000000000000000000000000000000000..db00e0d68dba2b844377248c8e70b5e2fcc02fbe +index 0000000000000000000000000000000000000000..91b273c04ce235f350cc7281956fbe795cc318d3 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperChargedProjectiles.java -@@ -0,0 +1,54 @@ +@@ -0,0 +1,55 @@ +package io.papermc.paper.datacomponent.item; + +import java.util.ArrayList; @@ -903,6 +893,7 @@ index 0000000000000000000000000000000000000000..db00e0d68dba2b844377248c8e70b5e2 + + @Override + public ChargedProjectiles.Builder add(final ItemStack stack) { ++ Preconditions.checkNotNull(stack); + Preconditions.checkArgument(!stack.isEmpty(), "stack cannot be empty"); + this.items.add(CraftItemStack.asNMSCopy(stack)); + return this; @@ -1908,15 +1899,16 @@ index 0000000000000000000000000000000000000000..d863e0ce6ba7b0f5b48b3abe4bb642f7 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperItemContainerContents.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemContainerContents.java new file mode 100644 -index 0000000000000000000000000000000000000000..2b85b8ebe77594f01bff612cd88007e0daa68088 +index 0000000000000000000000000000000000000000..4e95068c72feae7a623d6e1ecf72c1d04eec2430 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperItemContainerContents.java -@@ -0,0 +1,66 @@ +@@ -0,0 +1,71 @@ +package io.papermc.paper.datacomponent.item; + +import com.google.common.base.Preconditions; +import java.util.ArrayList; +import java.util.List; ++import java.util.function.Function; +import org.bukkit.craftbukkit.inventory.CraftItemStack; +import org.bukkit.craftbukkit.util.Handleable; +import org.bukkit.inventory.ItemStack; @@ -1947,6 +1939,7 @@ index 0000000000000000000000000000000000000000..2b85b8ebe77594f01bff612cd88007e0 + + @Override + public ItemContainerContents.Builder add(final ItemStack stack) { ++ Preconditions.checkNotNull(stack); + Preconditions.checkArgument( + this.items.size() + 1 <= net.minecraft.world.item.component.ItemContainerContents.MAX_SIZE, + "Cannot have more than %s items, had %s", @@ -1965,7 +1958,10 @@ index 0000000000000000000000000000000000000000..2b85b8ebe77594f01bff612cd88007e0 + net.minecraft.world.item.component.ItemContainerContents.MAX_SIZE, + this.items.size() + stacks.size() + ); -+ addAndConvert(this.items, stacks, CraftItemStack::asNMSCopy); ++ addAndConvert(this.items, stacks, itemStack -> { ++ Preconditions.checkNotNull(itemStack, "Cannot pass null itemstacks!"); ++ return CraftItemStack.asNMSCopy(itemStack); ++ }); + return this; + } + @@ -2341,29 +2337,6 @@ index 0000000000000000000000000000000000000000..1afafbc43cbf1a0ce07b43ceeefdeaf9 + } + } +} -diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperLockCode.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperLockCode.java -new file mode 100644 -index 0000000000000000000000000000000000000000..42bd5d5bd739f3dcfd8f2945c53ca3cc34cd11c9 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperLockCode.java -@@ -0,0 +1,17 @@ -+package io.papermc.paper.datacomponent.item; -+ -+import org.bukkit.craftbukkit.util.Handleable; -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.framework.qual.DefaultQualifier; -+ -+@DefaultQualifier(NonNull.class) -+public record PaperLockCode( -+ net.minecraft.world.LockCode impl -+) implements LockCode, Handleable<net.minecraft.world.LockCode> { -+ -+ @Override -+ public net.minecraft.world.LockCode getHandle() { -+ return this.impl; -+ } -+ -+} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperLodestoneTracker.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperLodestoneTracker.java new file mode 100644 index 0000000000000000000000000000000000000000..104796a363d42c3dea7519e58b1ddafba29c4c00 @@ -2428,7 +2401,7 @@ index 0000000000000000000000000000000000000000..104796a363d42c3dea7519e58b1ddafb +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperMapDecorations.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperMapDecorations.java new file mode 100644 -index 0000000000000000000000000000000000000000..c6fb021149bf5e5db56bdac9efcc05a4037035d3 +index 0000000000000000000000000000000000000000..785398f6202de9870b2aa6220a27533d5b8bffe6 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperMapDecorations.java @@ -0,0 +1,100 @@ @@ -2456,7 +2429,7 @@ index 0000000000000000000000000000000000000000..c6fb021149bf5e5db56bdac9efcc05a4 + } + + @Override -+ public @Nullable DecorationEntry getDecoration(final String id) { ++ public @Nullable DecorationEntry decoration(final String id) { + final net.minecraft.world.item.component.MapDecorations.Entry decoration = this.impl.decorations().get(id); + if (decoration == null) { + return null; @@ -2879,10 +2852,10 @@ index 0000000000000000000000000000000000000000..a55c759cef85eb1a619289a9c7e8ecdc +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/PaperResolvableProfile.java b/src/main/java/io/papermc/paper/datacomponent/item/PaperResolvableProfile.java new file mode 100644 -index 0000000000000000000000000000000000000000..c5e2f645d05c73f2a6a7902c8c3aaa92816bcca3 +index 0000000000000000000000000000000000000000..f9d13a1284cd170f6c684695856f9025b5c4d008 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/PaperResolvableProfile.java -@@ -0,0 +1,109 @@ +@@ -0,0 +1,108 @@ +package io.papermc.paper.datacomponent.item; + +import com.destroystokyo.paper.profile.CraftPlayerProfile; @@ -2983,7 +2956,6 @@ index 0000000000000000000000000000000000000000..c5e2f645d05c73f2a6a7902c8c3aaa92 + + @Override + public ResolvableProfile build() { -+ Preconditions.checkState(this.name != null || this.uuid != null || !this.propertyMap.isEmpty(), "Must specify at least a name, a uuid or a property"); + return new PaperResolvableProfile(new net.minecraft.world.item.component.ResolvableProfile( + Optional.ofNullable(this.name), + Optional.ofNullable(this.uuid), @@ -3587,7 +3559,7 @@ index 0000000000000000000000000000000000000000..2e3a94c539e57832bcfad237401d8986 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridgeImpl.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridgeImpl.java new file mode 100644 -index 0000000000000000000000000000000000000000..ff0c55662b79ee412e64e2532ab5c9495fdf42f4 +index 0000000000000000000000000000000000000000..9bc9dc80dde84abb7839ddee8130b6ee09ce53db --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumableTypesBridgeImpl.java @@ -0,0 +1,64 @@ @@ -3612,9 +3584,9 @@ index 0000000000000000000000000000000000000000..ff0c55662b79ee412e64e2532ab5c949 +public class ConsumableTypesBridgeImpl implements ConsumableTypesBridge { + + @Override -+ public ApplyStatusEffectsConsumeEffect applyStatusEffects(final List<PotionEffect> effectList, final float probability) { ++ public ConsumeEffect.ApplyStatusEffects applyStatusEffects(final List<PotionEffect> effectList, final float probability) { + Preconditions.checkArgument(0 <= probability && probability <= 1, "probability must be between 0-1, was %s", probability); -+ return new PaperApplyStatusEffectsConsumeEffect( ++ return new PaperApplyStatusEffects( + new net.minecraft.world.item.consume_effects.ApplyStatusEffectsConsumeEffect( + new ArrayList<>(Lists.transform(effectList, CraftPotionUtil::fromBukkit)), + probability @@ -3623,8 +3595,8 @@ index 0000000000000000000000000000000000000000..ff0c55662b79ee412e64e2532ab5c949 + } + + @Override -+ public RemoveStatusEffectsConsumeEffect removeStatusEffects(final RegistryKeySet<PotionEffectType> potionEffectTypeTagKey) { -+ return new PaperRemoveStatusEffectsConsumeEffect( ++ public ConsumeEffect.RemoveStatusEffects removeStatusEffects(final RegistryKeySet<PotionEffectType> potionEffectTypeTagKey) { ++ return new PaperRemoveStatusEffects( + new net.minecraft.world.item.consume_effects.RemoveStatusEffectsConsumeEffect( + PaperRegistrySets.convertToNms(Registries.MOB_EFFECT, BuiltInRegistries.BUILT_IN_CONVERSIONS.lookup(), potionEffectTypeTagKey) + ) @@ -3632,15 +3604,15 @@ index 0000000000000000000000000000000000000000..ff0c55662b79ee412e64e2532ab5c949 + } + + @Override -+ public ClearAllStatusEffectsConsumeEffect clearAllStatusEffects() { -+ return new PaperClearAllStatusEffectsConsumeEffect( ++ public ConsumeEffect.ClearAllStatusEffects clearAllStatusEffects() { ++ return new PaperClearAllStatusEffects( + new net.minecraft.world.item.consume_effects.ClearAllStatusEffectsConsumeEffect() + ); + } + + @Override -+ public PlaySoundConsumeEffect playSoundEffect(final Key sound) { -+ return new PaperPlaySoundConsumeEffect( ++ public ConsumeEffect.PlaySound playSoundEffect(final Key sound) { ++ return new PaperPlaySound( + new net.minecraft.world.item.consume_effects.PlaySoundConsumeEffect( + ComponentUtils.keyToSound(sound) + ) @@ -3648,18 +3620,18 @@ index 0000000000000000000000000000000000000000..ff0c55662b79ee412e64e2532ab5c949 + } + + @Override -+ public TeleportRandomlyConsumeEffect teleportRandomlyEffect(final float diameter) { ++ public ConsumeEffect.TeleportRandomly teleportRandomlyEffect(final float diameter) { + Preconditions.checkArgument(diameter > 0, "diameter must be positive, was %s", diameter); -+ return new PaperTeleportRandomlyConsumeEffect( ++ return new PaperTeleportRandomly( + new net.minecraft.world.item.consume_effects.TeleportRandomlyConsumeEffect(diameter) + ); + } +} -diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperApplyStatusEffectsConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperApplyStatusEffectsConsumeEffect.java +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperApplyStatusEffects.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperApplyStatusEffects.java new file mode 100644 -index 0000000000000000000000000000000000000000..8fc1648885fb3ca89e318377cb85039afb4def5e +index 0000000000000000000000000000000000000000..3a7f23fd3599cae9f89dae001da2bb03743cba48 --- /dev/null -+++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperApplyStatusEffectsConsumeEffect.java ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperApplyStatusEffects.java @@ -0,0 +1,29 @@ +package io.papermc.paper.datacomponent.item.consumable; + @@ -3671,9 +3643,9 @@ index 0000000000000000000000000000000000000000..8fc1648885fb3ca89e318377cb85039a + +import static io.papermc.paper.datacomponent.ComponentUtils.transform; + -+public record PaperApplyStatusEffectsConsumeEffect( ++public record PaperApplyStatusEffects( + ApplyStatusEffectsConsumeEffect impl -+) implements io.papermc.paper.datacomponent.item.consumable.ApplyStatusEffectsConsumeEffect, PaperConsumableEffectImpl<ApplyStatusEffectsConsumeEffect> { ++) implements ConsumeEffect.ApplyStatusEffects, PaperConsumableEffectImpl<ApplyStatusEffectsConsumeEffect> { + + @Override + public @NonNull List<PotionEffect> effects() { @@ -3690,17 +3662,17 @@ index 0000000000000000000000000000000000000000..8fc1648885fb3ca89e318377cb85039a + return this.impl; + } +} -diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperClearAllStatusEffectsConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperClearAllStatusEffectsConsumeEffect.java +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperClearAllStatusEffects.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperClearAllStatusEffects.java new file mode 100644 -index 0000000000000000000000000000000000000000..8641f6f49171dd29dbf3e14f6198f8bfb3e38b03 +index 0000000000000000000000000000000000000000..2afcbbbeb486783737fd606113b6f938d0a18cb5 --- /dev/null -+++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperClearAllStatusEffectsConsumeEffect.java ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperClearAllStatusEffects.java @@ -0,0 +1,11 @@ +package io.papermc.paper.datacomponent.item.consumable; + -+public record PaperClearAllStatusEffectsConsumeEffect( ++public record PaperClearAllStatusEffects( + net.minecraft.world.item.consume_effects.ClearAllStatusEffectsConsumeEffect impl -+) implements io.papermc.paper.datacomponent.item.consumable.ClearAllStatusEffectsConsumeEffect, PaperConsumableEffectImpl<net.minecraft.world.item.consume_effects.ClearAllStatusEffectsConsumeEffect> { ++) implements ConsumeEffect.ClearAllStatusEffects, PaperConsumableEffectImpl<net.minecraft.world.item.consume_effects.ClearAllStatusEffectsConsumeEffect> { + + @Override + public net.minecraft.world.item.consume_effects.ClearAllStatusEffectsConsumeEffect getHandle() { @@ -3722,7 +3694,7 @@ index 0000000000000000000000000000000000000000..05ede1d3f5b0b5ea3a5004cb4a7a153e +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperConsumableEffects.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperConsumableEffects.java new file mode 100644 -index 0000000000000000000000000000000000000000..3be0636e9e0b0f0c3b2834e8e8a29864a873b166 +index 0000000000000000000000000000000000000000..6b6f04af380b54ddb1781f0cac054a5cc915afc7 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperConsumableEffects.java @@ -0,0 +1,29 @@ @@ -3738,11 +3710,11 @@ index 0000000000000000000000000000000000000000..3be0636e9e0b0f0c3b2834e8e8a29864 + + public static ConsumeEffect fromNms(net.minecraft.world.item.consume_effects.ConsumeEffect consumable) { + return switch (consumable) { -+ case ApplyStatusEffectsConsumeEffect effect -> new PaperApplyStatusEffectsConsumeEffect(effect); -+ case ClearAllStatusEffectsConsumeEffect effect -> new PaperClearAllStatusEffectsConsumeEffect(effect); -+ case PlaySoundConsumeEffect effect -> new PaperPlaySoundConsumeEffect(effect); -+ case RemoveStatusEffectsConsumeEffect effect -> new PaperRemoveStatusEffectsConsumeEffect(effect); -+ case TeleportRandomlyConsumeEffect effect -> new PaperTeleportRandomlyConsumeEffect(effect); ++ case ApplyStatusEffectsConsumeEffect effect -> new PaperApplyStatusEffects(effect); ++ case ClearAllStatusEffectsConsumeEffect effect -> new PaperClearAllStatusEffects(effect); ++ case PlaySoundConsumeEffect effect -> new PaperPlaySound(effect); ++ case RemoveStatusEffectsConsumeEffect effect -> new PaperRemoveStatusEffects(effect); ++ case TeleportRandomlyConsumeEffect effect -> new PaperTeleportRandomly(effect); + default -> throw new UnsupportedOperationException("Don't know how to convert " + consumable.getClass()); + }; + } @@ -3755,11 +3727,11 @@ index 0000000000000000000000000000000000000000..3be0636e9e0b0f0c3b2834e8e8a29864 + } + } +} -diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperPlaySoundConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperPlaySoundConsumeEffect.java +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperPlaySound.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperPlaySound.java new file mode 100644 -index 0000000000000000000000000000000000000000..406d7d52e2e29d25ebba78fecaed36dc839e910a +index 0000000000000000000000000000000000000000..40fc94497f99cdcde35e5f5a207601e8a01af27b --- /dev/null -+++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperPlaySoundConsumeEffect.java ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperPlaySound.java @@ -0,0 +1,22 @@ +package io.papermc.paper.datacomponent.item.consumable; + @@ -3768,9 +3740,9 @@ index 0000000000000000000000000000000000000000..406d7d52e2e29d25ebba78fecaed36dc +import net.minecraft.world.item.consume_effects.PlaySoundConsumeEffect; +import org.checkerframework.checker.nullness.qual.NonNull; + -+public record PaperPlaySoundConsumeEffect( ++public record PaperPlaySound( + PlaySoundConsumeEffect impl -+) implements io.papermc.paper.datacomponent.item.consumable.PlaySoundConsumeEffect, PaperConsumableEffectImpl<PlaySoundConsumeEffect> { ++) implements ConsumeEffect.PlaySound, PaperConsumableEffectImpl<PlaySoundConsumeEffect> { + + @NonNull + @Override @@ -3783,11 +3755,11 @@ index 0000000000000000000000000000000000000000..406d7d52e2e29d25ebba78fecaed36dc + return this.impl; + } +} -diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperRemoveStatusEffectsConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperRemoveStatusEffectsConsumeEffect.java +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperRemoveStatusEffects.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperRemoveStatusEffects.java new file mode 100644 -index 0000000000000000000000000000000000000000..81ce88451c550085eb792d1a05d9abd28f8a83da +index 0000000000000000000000000000000000000000..31ac641286adccab6a82d2eeff380a863934ea9f --- /dev/null -+++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperRemoveStatusEffectsConsumeEffect.java ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperRemoveStatusEffects.java @@ -0,0 +1,22 @@ +package io.papermc.paper.datacomponent.item.consumable; + @@ -3797,9 +3769,9 @@ index 0000000000000000000000000000000000000000..81ce88451c550085eb792d1a05d9abd2 +import org.bukkit.potion.PotionEffectType; +import org.checkerframework.checker.nullness.qual.NonNull; + -+public record PaperRemoveStatusEffectsConsumeEffect( ++public record PaperRemoveStatusEffects( + net.minecraft.world.item.consume_effects.RemoveStatusEffectsConsumeEffect impl -+) implements RemoveStatusEffectsConsumeEffect, PaperConsumableEffectImpl<net.minecraft.world.item.consume_effects.RemoveStatusEffectsConsumeEffect> { ++) implements ConsumeEffect.RemoveStatusEffects, PaperConsumableEffectImpl<net.minecraft.world.item.consume_effects.RemoveStatusEffectsConsumeEffect> { + + @Override + public @NonNull RegistryKeySet<PotionEffectType> removeEffects() { @@ -3811,17 +3783,17 @@ index 0000000000000000000000000000000000000000..81ce88451c550085eb792d1a05d9abd2 + return this.impl; + } +} -diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperTeleportRandomlyConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperTeleportRandomlyConsumeEffect.java +diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperTeleportRandomly.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperTeleportRandomly.java new file mode 100644 -index 0000000000000000000000000000000000000000..724e889cd668191e0472f3f56d6833e5e2a566b9 +index 0000000000000000000000000000000000000000..c21889e9984f7c36d9f19771c2e23b6efba5197d --- /dev/null -+++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperTeleportRandomlyConsumeEffect.java ++++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/PaperTeleportRandomly.java @@ -0,0 +1,15 @@ +package io.papermc.paper.datacomponent.item.consumable; + -+public record PaperTeleportRandomlyConsumeEffect( ++public record PaperTeleportRandomly( + net.minecraft.world.item.consume_effects.TeleportRandomlyConsumeEffect impl -+) implements TeleportRandomlyConsumeEffect, PaperConsumableEffectImpl<net.minecraft.world.item.consume_effects.TeleportRandomlyConsumeEffect> { ++) implements ConsumeEffect.TeleportRandomly, PaperConsumableEffectImpl<net.minecraft.world.item.consume_effects.TeleportRandomlyConsumeEffect> { + @Override + public float diameter() { + return this.impl.diameter(); @@ -3854,7 +3826,7 @@ index f8c6da955e4bd0e480c7b581d2a4325738f9dd6f..ee1fce58c6e57dd93a30ee66e7488a92 // data-drivens entry(Registries.BIOME, RegistryKey.BIOME, Biome.class, CraftBiome::new).delayed(), diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index 756c73a401437566258813946fa10c7caa8f2469..4fe0543754ba644a7ce2231ec267007215f823c4 100644 +index 756c73a401437566258813946fa10c7caa8f2469..fc18f72260f3dc1643c35169aad3ad32fa7a19dd 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -206,7 +206,7 @@ public final class CraftItemStack extends ItemStack { @@ -3948,7 +3920,7 @@ index 756c73a401437566258813946fa10c7caa8f2469..4fe0543754ba644a7ce2231ec2670072 } static Map<Enchantment, Integer> getEnchantments(net.minecraft.world.item.ItemStack item) { -@@ -526,4 +545,129 @@ public final class CraftItemStack extends ItemStack { +@@ -526,4 +545,119 @@ public final class CraftItemStack extends ItemStack { return this.pdcView; } // Paper end - pdc @@ -4033,7 +4005,7 @@ index 756c73a401437566258813946fa10c7caa8f2469..4fe0543754ba644a7ce2231ec2670072 + } + + @Override -+ public boolean matchesWithoutData(final ItemStack item, final io.papermc.paper.registry.set.RegistrySet<io.papermc.paper.datacomponent.DataComponentType> excludeTypes, final boolean ignoreCount) { ++ public boolean matchesWithoutData(final ItemStack item, final java.util.Collection<io.papermc.paper.datacomponent.DataComponentType> exclude, final boolean ignoreCount) { + // Extracted from base equals + final CraftItemStack craftStack = getCraftStack(item); + if (this.handle == craftStack.handle) return true; @@ -4052,20 +4024,10 @@ index 756c73a401437566258813946fa10c7caa8f2469..4fe0543754ba644a7ce2231ec2670072 + // It can be assumed that the prototype is equal since the type is the same. This way all we need to check is the patch + + // Fast path when excluded types is empty to not flatten the set -+ if (excludeTypes.isEmpty()) { ++ if (exclude.isEmpty()) { + return left.getComponentsPatch().equals(right.getComponentsPatch()); + } + -+ // Flatten registry set into registry elements -+ java.util.Collection<io.papermc.paper.datacomponent.DataComponentType> exclude; -+ if (excludeTypes instanceof io.papermc.paper.registry.set.RegistryKeySet<io.papermc.paper.datacomponent.DataComponentType> keySet) { -+ exclude = keySet.resolve(org.bukkit.Registry.DATA_COMPONENT_TYPE); -+ } else if (excludeTypes instanceof io.papermc.paper.registry.set.RegistryValueSet<io.papermc.paper.datacomponent.DataComponentType> valueSet) { -+ exclude = valueSet.values(); -+ } else { -+ throw new UnsupportedOperationException(); -+ } -+ + // Collect all the NMS types into a set + java.util.Set<net.minecraft.core.component.DataComponentType<?>> skippingTypes = new java.util.HashSet<>(exclude.size()); + for (io.papermc.paper.datacomponent.DataComponentType api : exclude) { |