mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-02 21:22:05 -07:00
Implement new CustomModelData
This commit is contained in:
@@ -860,6 +860,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+package io.papermc.paper.datacomponent.item;
|
||||
+
|
||||
+import java.util.List;
|
||||
+import io.papermc.paper.datacomponent.DataComponentBuilder;
|
||||
+import org.bukkit.Color;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
@@ -874,7 +876,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface CustomModelData {
|
||||
+
|
||||
+ // TODO
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ static CustomModelData.Builder customModelData() {
|
||||
+ return ItemComponentTypesBridge.bridge().customModelData();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the custom model data float values.
|
||||
@@ -906,7 +911,95 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @return the color values
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ List<Integer> colors();
|
||||
+ List<Color> colors();
|
||||
+
|
||||
+ /**
|
||||
+ * Builder for {@link CustomModelData}.
|
||||
+ */
|
||||
+ @ApiStatus.Experimental
|
||||
+ @ApiStatus.NonExtendable
|
||||
+ interface Builder extends DataComponentBuilder<CustomModelData> {
|
||||
+
|
||||
+ /**
|
||||
+ * Adds a float to this custom model data.
|
||||
+ *
|
||||
+ * @param num the float
|
||||
+ * @return the builder for chaining
|
||||
+ * @see #floats()
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ CustomModelData.Builder addFloat(float num);
|
||||
+
|
||||
+ /**
|
||||
+ * Adds multiple floats to this custom model data.
|
||||
+ *
|
||||
+ * @param nums the floats
|
||||
+ * @return the builder for chaining
|
||||
+ * @see #floats()
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ CustomModelData.Builder addFloats(List<Float> nums);
|
||||
+
|
||||
+ /**
|
||||
+ * Adds a flag to this custom model data.
|
||||
+ *
|
||||
+ * @param flag the flag
|
||||
+ * @return the builder for chaining
|
||||
+ * @see #floats()
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ CustomModelData.Builder addFlag(boolean flag);
|
||||
+
|
||||
+ /**
|
||||
+ * Adds multiple flags to this custom model data.
|
||||
+ *
|
||||
+ * @param flags the flags
|
||||
+ * @return the builder for chaining
|
||||
+ * @see #flags()
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ CustomModelData.Builder addFlags(List<Boolean> flags);
|
||||
+
|
||||
+ /**
|
||||
+ * Adds a string to this custom model data.
|
||||
+ *
|
||||
+ * @param string the string
|
||||
+ * @return the builder for chaining
|
||||
+ * @see #strings()
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ CustomModelData.Builder addString(String string);
|
||||
+
|
||||
+ /**
|
||||
+ * Adds multiple strings to this custom model data.
|
||||
+ *
|
||||
+ * @param strings the strings
|
||||
+ * @return the builder for chaining
|
||||
+ * @see #strings()
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ CustomModelData.Builder addStrings(List<String> strings);
|
||||
+
|
||||
+ /**
|
||||
+ * Adds a color to this custom model data.
|
||||
+ *
|
||||
+ * @param color the float
|
||||
+ * @return the builder for chaining
|
||||
+ * @see #colors()
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ CustomModelData.Builder addColor(Color color);
|
||||
+
|
||||
+ /**
|
||||
+ * Adds multiple colors to this custom model data.
|
||||
+ *
|
||||
+ * @param colors the colors
|
||||
+ * @return the builder for chaining
|
||||
+ * @see #colors()
|
||||
+ */
|
||||
+ @Contract(value = "_ -> this", mutates = "this")
|
||||
+ CustomModelData.Builder addColors(List<Color> colors);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datacomponent/item/DamageResistant.java b/src/main/java/io/papermc/paper/datacomponent/item/DamageResistant.java
|
||||
new file mode 100644
|
||||
@@ -1778,7 +1871,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ ItemAdventurePredicate.Builder itemAdventurePredicate();
|
||||
+
|
||||
+ CustomModelData customModelData(int id);
|
||||
+ CustomModelData.Builder customModelData();
|
||||
+
|
||||
+ MapId mapId(int id);
|
||||
+
|
||||
|
Reference in New Issue
Block a user