Some fixes, start updating CustomModelData API

This commit is contained in:
Nassim Jahnke
2024-12-03 20:58:25 +01:00
parent 2c2dadf75b
commit a894c3a437
28 changed files with 56 additions and 16 deletions

View File

@@ -859,12 +859,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
+package io.papermc.paper.datacomponent.item;
+
+import java.util.List;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Contract;
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * Holds the custom model data.
+ *
+ * @see io.papermc.paper.datacomponent.DataComponentTypes#CUSTOM_MODEL_DATA
+ */
+@NullMarked
@@ -872,18 +874,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+@ApiStatus.NonExtendable
+public interface CustomModelData {
+
+ @Contract(value = "_ -> new", pure = true)
+ static CustomModelData customModelData(final int id) {
+ return ItemComponentTypesBridge.bridge().customModelData(id);
+ }
+ // TODO
+
+ /**
+ * Gets the custom model data id.
+ * Gets the custom model data float values.
+ *
+ * @return the id
+ * @return the float values
+ */
+ @Contract(pure = true)
+ int id();
+ List<Float> floats();
+
+ /**
+ * Gets the custom model data boolean values.
+ *
+ * @return the boolean values
+ */
+ @Contract(pure = true)
+ List<Boolean> flags();
+
+ /**
+ * Gets the custom model data string values.
+ *
+ * @return the string values
+ */
+ @Contract(pure = true)
+ List<String> strings();
+
+ /**
+ * Gets the custom model data color values.
+ *
+ * @return the color values
+ */
+ @Contract(pure = true)
+ List<Integer> 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