From ffe9225a25e2979c24d47edeb92e118a9628c4b7 Mon Sep 17 00:00:00 2001 From: thedarkcolour <30441001+thedarkcolour@users.noreply.github.com> Date: Sun, 14 Jan 2024 13:32:27 -0800 Subject: [PATCH] Fix barrels not sending visual data to the client. Closes #35 --- changelog.md | 1 + .../blockentity/BarrelBlockEntity.java | 23 ++++++++++++++++++ .../exdeorum/textures/block/compost_dirt.png | Bin 250 -> 248 bytes 3 files changed, 24 insertions(+) diff --git a/changelog.md b/changelog.md index 04b80d9d..b1485e37 100644 --- a/changelog.md +++ b/changelog.md @@ -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 diff --git a/src/main/java/thedarkcolour/exdeorum/blockentity/BarrelBlockEntity.java b/src/main/java/thedarkcolour/exdeorum/blockentity/BarrelBlockEntity.java index d3f2b37f..a121bdba 100644 --- a/src/main/java/thedarkcolour/exdeorum/blockentity/BarrelBlockEntity.java +++ b/src/main/java/thedarkcolour/exdeorum/blockentity/BarrelBlockEntity.java @@ -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(); } diff --git a/src/main/resources/assets/exdeorum/textures/block/compost_dirt.png b/src/main/resources/assets/exdeorum/textures/block/compost_dirt.png index 94a8e294bc7ba3461a5341afc123e0628c59f98b..0a52a21dc30a7fc1ed65bbde1464e7f0cf8eb612 100644 GIT binary patch delta 183 zcmV;o07(D(0r&xsNq<8_LtR~6b#--zhlgxzY+hboHQ7zT00009a7bBm000ib000ib z0l1NC?EnA(Y)M2xR2b78%)t!;K@0@JVJCr;PxrUS5P)q&01yHBC&P+oOQpt5J{c?o zE$z()k8U4NxJh10D8H0NCpdeZ<%P7`^$& l9bzNOuLqkJ{hlgxzY+hboDk;Sw00009a7bBm000ic000ic z0Tn1pfB*mhZb?KzR2b6@jKK}VFbo4}Wr0XW|00F{6M2Jlg09g0hp2x?9C#R!uFeFT zpNz3!Wil|O9|7H1`>j6x*S0kL%loI5;6#;jqC7dtCQcj3l(nK n4%E-<$o;yi_S!Jwae4g#_+<_-W-90v00000NkvXXu0mjf!Q4y`