Fix jukebox component (#11642)

This commit is contained in:
Lulu13022002
2024-11-23 20:09:34 +01:00
parent c72a463cb5
commit 00e253fdf9
4 changed files with 137 additions and 142 deletions

View File

@@ -322,9 +322,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * If not present, has an implicit default value of: {@code 0}.
+ */
+ public static final DataComponentType.Valued<@NonNegative Integer> REPAIR_COST = valued("repair_cost");
+ /**
+ * Causes an item to not be pickable in the creative menu, currently not very useful.
+ */
+ // /**
+ // * 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");
+ /**
+ * Overrides the enchantment glint effect on an item.
@@ -515,7 +515,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+package io.papermc.paper.datacomponent.item;
+
+import io.papermc.paper.datacomponent.DataComponentBuilder;
+import java.util.Arrays;
+import java.util.List;
+import org.bukkit.block.banner.Pattern;
+import org.jetbrains.annotations.ApiStatus;
@@ -644,7 +643,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+package io.papermc.paper.datacomponent.item;
+
+import io.papermc.paper.datacomponent.DataComponentBuilder;
+import java.util.Arrays;
+import java.util.List;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.ApiStatus;
@@ -716,7 +714,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+package io.papermc.paper.datacomponent.item;
+
+import io.papermc.paper.datacomponent.DataComponentBuilder;
+import java.util.Arrays;
+import java.util.List;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.ApiStatus;
@@ -791,7 +788,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import io.papermc.paper.datacomponent.DataComponentBuilder;
+import io.papermc.paper.datacomponent.item.consumable.ConsumeEffect;
+import io.papermc.paper.datacomponent.item.consumable.ItemUseAnimation;
+import java.util.Collection;
+import java.util.List;
+import net.kyori.adventure.key.Key;
+import org.checkerframework.checker.index.qual.NonNegative;
@@ -935,8 +931,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+import io.papermc.paper.datacomponent.DataComponentBuilder;
+import io.papermc.paper.datacomponent.item.consumable.ConsumeEffect;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Contract;
@@ -1069,8 +1063,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * 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
+ * @see <a href="https://minecraft.wiki/w/Enchanting_mechanics#Java_Edition_2">Minecraft Wiki</a>
+ */
+ @Contract(pure = true)
+ @Positive int value();
@@ -1094,7 +1088,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.jspecify.annotations.NullMarked;
+import org.jspecify.annotations.Nullable;
+
+
+/**
+ * Holds the equippable properties of an item.
+ * @see io.papermc.paper.datacomponent.DataComponentTypes#EQUIPPABLE
@@ -1106,8 +1099,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ /**
+ * Creates a new {@link Equippable.Builder} instance.
+ * @param slot The slot for the new equippable to be equippable in.
+ *
+ * @param slot The slot for the new equippable to be equippable in.
+ * @return a new builder
+ */
+ @Contract(value = "_ -> new", pure = true)
@@ -1190,11 +1183,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * Sets the equip sound key for this item.
+ *
+ * @param equipSound the equip sound key
+ * @param sound the equip sound key
+ * @return the builder for chaining
+ */
+ @Contract(value = "_ -> this", mutates = "this")
+ Builder equipSound(Key equipSound);
+ Builder equipSound(Key sound);
+
+ /**
+ * Sets the model key for this item.
@@ -1431,7 +1424,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ @Contract(value = "_ -> this", mutates = "this")
+ Builder nutrition(@NonNegative int nutrition);
+
+ }
+}
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/ItemAdventurePredicate.java b/src/main/java/io/papermc/paper/datacomponent/item/ItemAdventurePredicate.java
@@ -1584,7 +1576,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+/**
+ * Holds attribute modifiers applied to any item.
+ *
+ * @see io.papermc.paper.datacomponent.DataComponentTypes#ATTRIBUTE_MODIFIERS
+ */
+@NullMarked
@@ -1652,7 +1643,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return the builder for chaining
+ * @see #modifiers()
+ */
+ @Contract(value = "_, _, _ -> this", mutates = "this")
+ @Contract(value = "_, _ -> this", mutates = "this")
+ Builder addModifier(Attribute attribute, AttributeModifier modifier);
+
+ /**
@@ -1795,7 +1786,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+package io.papermc.paper.datacomponent.item;
+
+import io.papermc.paper.datacomponent.DataComponentBuilder;
+import java.util.Arrays;
+import java.util.List;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.ApiStatus;
@@ -2406,7 +2396,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.jspecify.annotations.NullMarked;
+import org.jspecify.annotations.Nullable;
+
+// CONTRIBUTORS: LEAVE THIS AS ITEM TYPE!!!
+/**
+ * Holds the item types for the decorations on a flower pot.
+ * @see io.papermc.paper.datacomponent.DataComponentTypes#POT_DECORATIONS
@@ -2593,8 +2582,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @param color color
+ * @return the builder for chaining
+ * @see #customColor()
+ * @apiNote alpha channel of the color is supported only for Tipped Arrow
+ * @see #customColor()
+ */
+ @Contract(value = "_ -> this", mutates = "this")
+ Builder customColor(@Nullable Color color);
@@ -2613,7 +2602,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Adds a custom effect instance to this builder.
+ *
+ * @param effect effect
+ * @see #customEffects()
+ * @return the builder for chaining
+ * @see #customEffects()
+ */
@@ -2624,7 +2612,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Adds custom effect instances to this builder.
+ *
+ * @param effects effects
+ * @see #customEffects()
+ * @return the builder for chaining
+ * @see #customEffects()
+ */
@@ -2889,6 +2876,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+/**
+ * Holds the state of whether a data component should be shown
+ * in an item's tooltip.
+ *
+ * @param <T> the data component type
+ */
+@NullMarked
@@ -2907,6 +2895,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * Returns a copy of this data component with the specified
+ * show-in-tooltip state.
+ *
+ * @param showInTooltip {@code true} to show in the tooltip
+ * @return the new data component
+ */
@@ -2915,6 +2904,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ /**
+ * A builder for creating a {@link ShownInTooltip} data component.
+ *
+ * @param <B> builder type
+ */
+ @ApiStatus.Experimental
@@ -2942,7 +2932,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+import io.papermc.paper.datacomponent.DataComponentBuilder;
+import io.papermc.paper.potion.SuspiciousEffectEntry;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import org.jetbrains.annotations.ApiStatus;
@@ -3279,7 +3268,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
+package io.papermc.paper.datacomponent.item;
+
+import io.papermc.paper.datacomponent.DataComponentBuilder;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Contract;
@@ -3306,7 +3294,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ @Contract(value = "-> new", pure = true)
+ ItemStack transformInto();
+
+}
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
@@ -3619,13 +3606,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+package io.papermc.paper.datacomponent.item.consumable;
+
+import io.papermc.paper.registry.set.RegistryKeySet;
+import java.util.List;
+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.
@@ -3690,7 +3677,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return ConsumableTypesBridge.bridge().applyStatusEffects(effects, probability);
+ }
+
+ @NullMarked
+ @ApiStatus.Experimental
+ @ApiStatus.NonExtendable
+ interface TeleportRandomly extends ConsumeEffect {
@@ -3706,7 +3692,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * Represents a consumable effect that removes status effects on consumption
+ */
+ @NullMarked
+ @ApiStatus.Experimental
+ @ApiStatus.NonExtendable
+ interface RemoveStatusEffects extends ConsumeEffect {
@@ -3722,7 +3707,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * Represents a consumable effect that plays a sound on consumption.
+ */
+ @NullMarked
+ @ApiStatus.Experimental
+ @ApiStatus.NonExtendable
+ interface PlaySound extends ConsumeEffect {
@@ -3738,7 +3722,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * Represents a consumable effect that clears all effects on consumption.
+ */
+ @NullMarked
+ @ApiStatus.Experimental
+ @ApiStatus.NonExtendable
+ interface ClearAllStatusEffects extends ConsumeEffect {
+
+ }
@@ -3746,7 +3731,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * Represents a consumable effect that applies effects based on a probability on consumption.
+ */
+ @NullMarked
+ @ApiStatus.Experimental
+ @ApiStatus.NonExtendable
+ interface ApplyStatusEffects extends ConsumeEffect {