diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/data/FoodProperties1_20_5.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/data/FoodProperties1_20_5.java index 483f949ca..c50113c7b 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/data/FoodProperties1_20_5.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/data/FoodProperties1_20_5.java @@ -28,9 +28,10 @@ import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.ArrayType; import com.viaversion.viaversion.api.type.types.version.Types1_21; import io.netty.buffer.ByteBuf; +import org.checkerframework.checker.nullness.qual.Nullable; public record FoodProperties1_20_5(int nutrition, float saturationModifier, boolean canAlwaysEat, float eatSeconds, - Item usingConvertsTo, FoodEffect[] possibleEffects) { + @Nullable Item usingConvertsTo, FoodEffect[] possibleEffects) { public static final Type TYPE1_20_5 = new Type<>(FoodProperties1_20_5.class) { @Override diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/rewriter/BlockItemPacketRewriter1_21_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/rewriter/BlockItemPacketRewriter1_21_2.java index 2f9a58584..9a3865987 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/rewriter/BlockItemPacketRewriter1_21_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/rewriter/BlockItemPacketRewriter1_21_2.java @@ -423,12 +423,20 @@ public final class BlockItemPacketRewriter1_21_2 extends StructuredItemRewriter< } super.handleItemToClient(connection, item); + + // Handle food properties item manually here - the only protocol that has it + // The other way around it's handled by the super handleItemToServer method + final StructuredDataContainer data = item.dataContainer(); + final FoodProperties1_20_5 food = data.get(StructuredDataKey.FOOD1_21); + if (food != null && food.usingConvertsTo() != null) { + this.handleItemToClient(connection, food.usingConvertsTo()); + } + updateItemData(item); // Add data components to fix issues in older protocols appendItemDataFixComponents(connection, item); - final StructuredDataContainer data = item.dataContainer(); final Enchantments enchantments = data.get(StructuredDataKey.ENCHANTMENTS); if (enchantments != null && enchantments.size() != 0) { // Level 0 is no longer allowed