Skip to content

Commit

Permalink
Fix visual glitches and desyncs with item bag (fixes #252)
Browse files Browse the repository at this point in the history
* Render update would not trigger recalculation of fill level
* Updates via GUI/ItemHandler would not sync from server NOR trigger recalculation
  • Loading branch information
founderio committed Dec 15, 2018
1 parent d7a677e commit 19e3aec
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
Expand All @@ -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..
Expand Down

0 comments on commit 19e3aec

Please sign in to comment.