diff --git a/api/src/main/java/org/geysermc/geyser/api/item/custom/NonVanillaCustomItemData.java b/api/src/main/java/org/geysermc/geyser/api/item/custom/NonVanillaCustomItemData.java index 317c240b3..13b37096d 100644 --- a/api/src/main/java/org/geysermc/geyser/api/item/custom/NonVanillaCustomItemData.java +++ b/api/src/main/java/org/geysermc/geyser/api/item/custom/NonVanillaCustomItemData.java @@ -129,6 +129,13 @@ public interface NonVanillaCustomItemData extends CustomItemData { */ boolean isHat(); + /** + * Gets if the item is a foil. This is used to determine if the item should be rendered with an enchantment glint effect. + * + * @return if the item is a foil + */ + boolean isFoil(); + /** * @deprecated Use {@link #displayHandheld()} instead. * Gets if the item is a tool. This is used to set the render type of the item, if the item is handheld. @@ -174,6 +181,8 @@ public interface NonVanillaCustomItemData extends CustomItemData { Builder hat(boolean isHat); + Builder foil(boolean isFoil); + /** * @deprecated Use {@link #displayHandheld(boolean)} instead. */ diff --git a/core/src/main/java/org/geysermc/geyser/item/GeyserNonVanillaCustomItemData.java b/core/src/main/java/org/geysermc/geyser/item/GeyserNonVanillaCustomItemData.java index 892e22693..569ab2300 100644 --- a/core/src/main/java/org/geysermc/geyser/item/GeyserNonVanillaCustomItemData.java +++ b/core/src/main/java/org/geysermc/geyser/item/GeyserNonVanillaCustomItemData.java @@ -53,6 +53,7 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i private final OptionalInt creativeCategory; private final String creativeGroup; private final boolean isHat; + private final boolean isFoil; private final boolean isTool; public GeyserNonVanillaCustomItemData(NonVanillaCustomItemDataBuilder builder) { @@ -72,6 +73,7 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i this.creativeCategory = builder.creativeCategory; this.creativeGroup = builder.creativeGroup; this.isHat = builder.hat; + this.isFoil = builder.foil; this.isTool = builder.tool; } @@ -140,6 +142,11 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i return isHat; } + @Override + public boolean isFoil() { + return isFoil; + } + public static class NonVanillaCustomItemDataBuilder extends GeyserCustomItemData.CustomItemDataBuilder implements NonVanillaCustomItemData.Builder { private String identifier = null; private int javaId = -1; @@ -162,6 +169,7 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i private String creativeGroup = null; private boolean hat = false; + private boolean foil = false; private boolean tool = false; @Override @@ -283,6 +291,12 @@ public final class GeyserNonVanillaCustomItemData extends GeyserCustomItemData i return this; } + @Override + public NonVanillaCustomItemData.Builder foil(boolean isFoil) { + this.foil = isFoil; + return this; + } + @Override public NonVanillaCustomItemData build() { if (identifier == null || javaId == -1) { diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/CustomItemRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/CustomItemRegistryPopulator.java index 3c037988f..ca0d7aad1 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/CustomItemRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/CustomItemRegistryPopulator.java @@ -247,6 +247,10 @@ public class CustomItemRegistryPopulator { itemProperties.putInt("creative_category", creativeCategory.getAsInt()); } + if (customItemData.isFoil()) { + itemProperties.putBoolean("foil", true); + } + componentBuilder.putCompound("item_properties", itemProperties.build()); builder.putCompound("components", componentBuilder.build());