make hoppers use markDirty properly

This commit is contained in:
Adrian Siekierka 2014-11-09 09:17:05 +01:00
parent 9e2795d235
commit 86e2fde283
2 changed files with 10 additions and 8 deletions

View file

@ -25,7 +25,12 @@ public class TileHopper extends TileBuildCraft implements IInventory {
private final SimpleInventory inventory = new SimpleInventory(4, "Hopper", 64);
private boolean isEmpty;
private TileEntity outputTile;
@Override
public void initialize() {
inventory.addListener(this);
}
@Override
public void readFromNBT(NBTTagCompound nbtTagCompound) {
super.readFromNBT(nbtTagCompound);
@ -38,8 +43,7 @@ public class TileHopper extends TileBuildCraft implements IInventory {
}
inventory.readFromNBT(p);
refreshInventoryFlags();
inventory.markDirty();
}
@Override
@ -90,7 +94,8 @@ public class TileHopper extends TileBuildCraft implements IInventory {
}
}
private void refreshInventoryFlags() {
@Override
public void markDirty() {
isEmpty = true;
for (int internalSlot = 0; internalSlot < inventory.getSizeInventory(); internalSlot++) {
@ -118,21 +123,18 @@ public class TileHopper extends TileBuildCraft implements IInventory {
@Override
public ItemStack decrStackSize(int slotId, int count) {
ItemStack output = inventory.decrStackSize(slotId, count);
refreshInventoryFlags();
return output;
}
@Override
public ItemStack getStackInSlotOnClosing(int slotId) {
ItemStack output = inventory.getStackInSlotOnClosing(slotId);
refreshInventoryFlags();
return output;
}
@Override
public void setInventorySlotContents(int slotId, ItemStack itemStack) {
inventory.setInventorySlotContents(slotId, itemStack);
refreshInventoryFlags();
}
@Override

View file

@ -97,7 +97,7 @@ public class PipeRendererWorld implements ISimpleBlockRenderingHandler {
fakeBlock.setColor(0xFFFFFF);
} else if (renderPass == 1) {
// Fix a bug in Minecraft 1.7.2-1.7.10
// Remove in 1.8
// TODO: Remove in 1.8
renderblocks.renderFaceXNeg(fakeBlock, x, y, z, PipeIconProvider.TYPE.Transparent.getIcon());
}