diff --git a/api/src/main/java/org/geysermc/geyser/api/item/custom/v2/component/Consumable.java b/api/src/main/java/org/geysermc/geyser/api/item/custom/v2/component/Consumable.java index 3e4ec86832..561b2dc7c4 100644 --- a/api/src/main/java/org/geysermc/geyser/api/item/custom/v2/component/Consumable.java +++ b/api/src/main/java/org/geysermc/geyser/api/item/custom/v2/component/Consumable.java @@ -36,7 +36,7 @@ public record Consumable(@Positive float consumeSeconds, Animation animation) { } /** - * Not all animations work perfectly on bedrock. Bedrock behaviour is noted per animation. + * Not all animations work perfectly on bedrock. Bedrock behaviour is noted per animation. The {@code toot_horn} animation doesn't exist on bedrock, and is therefore not listed here. */ public enum Animation { /** @@ -71,7 +71,6 @@ public enum Animation { * Does nothing in 1st person, but looks like spyglass in 3rd person. */ SPYGLASS, - TOOT_HORN, /** * Brush in 1st and 3rd person. Will look weird when not displayed handheld. */ 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 ab1a42b478..5b619186c8 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 @@ -88,7 +88,6 @@ public class CustomItemRegistryPopulator { Consumable.ItemUseAnimation.SPEAR, 6, Consumable.ItemUseAnimation.CROSSBOW, 9, Consumable.ItemUseAnimation.SPYGLASS, 10, - Consumable.ItemUseAnimation.TOOT_HORN, 11, Consumable.ItemUseAnimation.BRUSH, 12 ); @@ -509,11 +508,14 @@ private static void computeChargeableProperties(NbtMapBuilder itemProperties, Nb private static void computeConsumableProperties(Consumable consumable, @Nullable FoodProperties foodProperties, NbtMapBuilder itemProperties, NbtMapBuilder componentBuilder) { // this is the duration of the use animation in ticks; note that in behavior packs this is set as a float in seconds, but over the network it is an int in ticks itemProperties.putInt("use_duration", (int) (consumable.consumeSeconds() * 20)); - itemProperties.putInt("use_animation", BEDROCK_ANIMATIONS.get(consumable.animation())); - componentBuilder.putCompound("minecraft:use_animation", NbtMap.builder() - .putString("value", consumable.animation().toString().toLowerCase()) - .build()); + Integer animationId = BEDROCK_ANIMATIONS.get(consumable.animation()); + if (animationId != null) { + itemProperties.putInt("use_animation", animationId); + componentBuilder.putCompound("minecraft:use_animation", NbtMap.builder() + .putString("value", consumable.animation().toString().toLowerCase()) + .build()); + } int nutrition = foodProperties == null ? 0 : foodProperties.getNutrition(); float saturationModifier = foodProperties == null ? 0.0F : foodProperties.getSaturationModifier();