From 19e3aec827954ef850669949ccaac57c426a96f0 Mon Sep 17 00:00:00 2001 From: Oliver Kahrmann Date: Sat, 15 Dec 2018 23:51:26 +0100 Subject: [PATCH] Fix visual glitches and desyncs with item bag (fixes #252) * Render update would not trigger recalculation of fill level * Updates via GUI/ItemHandler would not sync from server NOR trigger recalculation --- .../conveyors/TileEntityConveyorItemBag.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/common/net/teamio/taam/content/conveyors/TileEntityConveyorItemBag.java b/common/net/teamio/taam/content/conveyors/TileEntityConveyorItemBag.java index ec415e80..c6bdfeea 100644 --- a/common/net/teamio/taam/content/conveyors/TileEntityConveyorItemBag.java +++ b/common/net/teamio/taam/content/conveyors/TileEntityConveyorItemBag.java @@ -24,10 +24,18 @@ public class TileEntityConveyorItemBag extends ATileEntityAttachable { public float fillPercent; public TileEntityConveyorItemBag() { - itemHandler = new ItemStackHandler(5); + itemHandler = new ItemStackHandler(5) { + @Override + protected void onContentsChanged(int slot) { + renderUpdate(); + updateState(true, false, false); + } + }; + conveyorSlots = new ConveyorSlotsInventory(itemHandler, SLOT_MATRIX) { @Override public void onChangeHook() { + renderUpdate(); updateState(true, false, false); } }; @@ -41,6 +49,11 @@ public String getName() { @Override public void blockUpdate() { + renderUpdate(); + } + + @Override + public void renderUpdate() { if (world != null && world.isRemote) { /* * Fill display calculation is only needed on the client..