Class ModelDataCompat
java.lang.Object
tech.guilhermekaua.spigotboot.core.spigot.utils.ModelDataCompat
Version-safe item model data helpers for the Bukkit/Spigot API surface.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleansetCustomModelData(org.bukkit.inventory.meta.ItemMeta meta, Integer data) Sets integer custom model data.static booleansetCustomModelDataComponent(org.bukkit.inventory.meta.ItemMeta meta, List<Float> floats, List<Boolean> flags, List<String> strings, List<org.bukkit.Color> colors) Sets the custom model data component values introduced for the component-backed model data API.static booleansetItemModel(org.bukkit.inventory.meta.ItemMeta meta, String itemModel) Sets the direct item model key added by newer Spigot/Paper APIs.static booleansetLegacyData(org.bukkit.inventory.ItemStack item, Integer data) Sets the legacy durability/data value used by old pre-flattening item variants.
-
Method Details
-
setLegacyData
Sets the legacy durability/data value used by old pre-flattening item variants.- Parameters:
item- the item to mutatedata- the data value, or null to leave it unchanged- Returns:
- true when the value was applied
-
setCustomModelData
Sets integer custom model data. On 1.21.5+ this writes the equivalent single float into the custom model data component when that API is available; on 1.14-1.21.4 it falls back toItemMeta#setCustomModelData(Integer)reflectively.- Parameters:
meta- the meta to mutatedata- the custom model data value, or null to leave it unchanged- Returns:
- true when a compatible API accepted the value
-
setCustomModelDataComponent
public static boolean setCustomModelDataComponent(org.bukkit.inventory.meta.ItemMeta meta, List<Float> floats, List<Boolean> flags, List<String> strings, List<org.bukkit.Color> colors) Sets the custom model data component values introduced for the component-backed model data API. Any null list is left unchanged on the component snapshot.- Parameters:
meta- the meta to mutatefloats- range dispatch float values, or null to leave unchangedflags- condition flag values, or null to leave unchangedstrings- select string values, or null to leave unchangedcolors- tint colors, or null to leave unchanged- Returns:
- true when the component API is present and accepted the values
-
setItemModel
Sets the direct item model key added by newer Spigot/Paper APIs.- Parameters:
meta- the meta to mutateitemModel- a namespaced key such asmy_pack:bronze_sword; keys without a namespace useminecraft- Returns:
- true when the item model API is present and accepted the key
-