SPIGOT-8032: Improve ItemMeta#hasCustomModelData compatibility

This commit is contained in:
md_5 2025-04-01 20:24:38 +11:00
parent fe18cbabd8
commit 47480cd07c
No known key found for this signature in database
GPG key ID: E8E901AC7C617C11
2 changed files with 30 additions and 8 deletions

View file

@ -165,7 +165,12 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
* custom item model.
*
* @return true if this has custom model data
* @deprecated more complex custom model data can be specified with
* {@link #hasCustomModelDataComponent()}. Integers from the old custom
* model data are equivalent to a single float in the
* {@link CustomModelDataComponent#getFloats()} list.
*/
@Deprecated(since = "1.21.5")
boolean hasCustomModelData();
/**
@ -178,7 +183,12 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
* before calling this method.
*
* @return the custom model data that is set
* @deprecated more complex custom model data can be specified with
* {@link #getCustomModelDataComponent()}. Integers from the old custom
* model data are equivalent to a single float in the
* {@link CustomModelDataComponent#getFloats()} list.
*/
@Deprecated(since = "1.21.5")
int getCustomModelData();
/**
@ -203,9 +213,21 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
* custom item model.
*
* @param data the data to set, or null to clear
* @deprecated more complex custom model data can be specified with
* {@link #setCustomModelDataComponent(org.bukkit.inventory.meta.components.CustomModelDataComponent)}.
* Integers from the old custom model data are equivalent to a single float
* in the {@link CustomModelDataComponent#setFloats(java.util.List)} list.
*/
@Deprecated(since = "1.21.5")
void setCustomModelData(@Nullable Integer data);
/**
* Checks if the custom model data component is set.
*
* @return if a custom model data component is set
*/
boolean hasCustomModelDataComponent();
/**
* Sets the custom model data component.
*

View file

@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
public interface CustomModelDataComponent extends ConfigurationSerializable {
/**
* Gets a list of the custom floats.
* Gets a list of the floats for the range_dispatch model type.
*
* @return unmodifiable list
*/
@ -21,14 +21,14 @@ public interface CustomModelDataComponent extends ConfigurationSerializable {
List<Float> getFloats();
/**
* Sets a list of the custom floats.
* Sets a list of the floats for the range_dispatch model type.
*
* @param floats new list
*/
void setFloats(@NotNull List<Float> floats);
/**
* Gets a list of the custom flags.
* Gets a list of the booleans for the condition model type.
*
* @return unmodifiable list
*/
@ -36,14 +36,14 @@ public interface CustomModelDataComponent extends ConfigurationSerializable {
List<Boolean> getFlags();
/**
* Sets a list of the custom flags.
* Sets a list of the booleans for the condition model type.
*
* @param flags new list
*/
void setFlags(@NotNull List<Boolean> flags);
/**
* Gets a list of the custom strings.
* Gets a list of strings for the select model type.
*
* @return unmodifiable list
*/
@ -51,14 +51,14 @@ public interface CustomModelDataComponent extends ConfigurationSerializable {
List<String> getStrings();
/**
* Sets a list of the custom strings.
* Sets a list of strings for the select model type.
*
* @param strings new list
*/
void setStrings(@NotNull List<String> strings);
/**
* Gets a list of the custom colors.
* Gets a list of colors for the model type's tints.
*
* @return unmodifiable list
*/
@ -66,7 +66,7 @@ public interface CustomModelDataComponent extends ConfigurationSerializable {
List<Color> getColors();
/**
* Sets a list of the custom colors.
* Sets a list of colors for the model type's tints.
*
* @param colors new list
*/