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

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

View file

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