Fix barrels not sending visual data to the client. Closes #35

This commit is contained in:
thedarkcolour 2024-01-14 13:32:27 -08:00
parent 079cf10ee8
commit ffe9225a25
3 changed files with 24 additions and 0 deletions

View File

@ -3,6 +3,7 @@
## Ex Deorum 1.15
- Fixed not being able to enchant sieve meshes in the Enchanting Table.
- Fixed Barrels not rendering their contents properly
- Improved appearance of witch water to better match water so that the transformation animation looks smoother.
## Ex Deorum 1.14

View File

@ -22,6 +22,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.FluidTags;
@ -129,6 +130,28 @@ public class BarrelBlockEntity extends EBlockEntity {
this.b = nbt.getShort("b");
}
@Override
public void writeVisualData(FriendlyByteBuf buffer) {
buffer.writeItem(this.item.getStackInSlot(0));
buffer.writeFluidStack(this.tank.getFluid());
buffer.writeShort(this.compost);
buffer.writeFloat(this.progress);
buffer.writeShort(this.r);
buffer.writeShort(this.g);
buffer.writeShort(this.b);
}
@Override
public void readVisualData(FriendlyByteBuf buffer) {
this.item.setStackInSlot(0, buffer.readItem());
this.tank.setFluid(buffer.readFluidStack());
this.compost = buffer.readShort();
this.progress = buffer.readFloat();
this.r = buffer.readShort();
this.g = buffer.readShort();
this.b = buffer.readShort();
}
public boolean isBrewing() {
return this.tank.getFluidAmount() == 1000 && this.progress != 0.0f && !isBurning();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 248 B