Skip to content

Commit

Permalink
Properly read/write food components (#843)
Browse files Browse the repository at this point in the history
  • Loading branch information
eclipseisoffline authored Jul 25, 2024
1 parent 30309ce commit ab9bcbe
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public FoodProperties readFoodProperties(ByteBuf buf) {
float saturationModifier = buf.readFloat();
boolean canAlwaysEat = buf.readBoolean();
float eatSeconds = buf.readFloat();
ItemStack usingConvertsTo = this.readOptionalItemStack(buf);
ItemStack usingConvertsTo = this.readNullable(buf, this::readOptionalItemStack);

List<FoodProperties.PossibleEffect> effects = this.readList(buf, (input) -> {
MobEffectInstance effect = this.readEffectInstance(input);
Expand All @@ -249,7 +249,7 @@ public void writeFoodProperties(ByteBuf buf, FoodProperties properties) {
buf.writeFloat(properties.getSaturationModifier());
buf.writeBoolean(properties.isCanAlwaysEat());
buf.writeFloat(properties.getEatSeconds());
this.writeOptionalItemStack(buf, properties.getUsingConvertsTo());
this.writeNullable(buf, properties.getUsingConvertsTo(), this::writeOptionalItemStack);

this.writeList(buf, properties.getEffects(), (output, effect) -> {
this.writeEffectInstance(output, effect.getEffect());
Expand Down

0 comments on commit ab9bcbe

Please sign in to comment.