mark dirty on places
This commit is contained in:
@@ -17,6 +17,8 @@ import storagecraft.network.MessageTileUpdate;
|
|||||||
|
|
||||||
public abstract class TileBase extends TileEntity implements IUpdatePlayerListBox
|
public abstract class TileBase extends TileEntity implements IUpdatePlayerListBox
|
||||||
{
|
{
|
||||||
|
public static final String NBT_DIRECTION = "Direction";
|
||||||
|
|
||||||
public static final int UPDATE_RANGE = 256;
|
public static final int UPDATE_RANGE = 256;
|
||||||
|
|
||||||
private EnumFacing direction = EnumFacing.NORTH;
|
private EnumFacing direction = EnumFacing.NORTH;
|
||||||
@@ -54,7 +56,7 @@ public abstract class TileBase extends TileEntity implements IUpdatePlayerListBo
|
|||||||
{
|
{
|
||||||
super.readFromNBT(nbt);
|
super.readFromNBT(nbt);
|
||||||
|
|
||||||
direction = EnumFacing.getFront(nbt.getInteger("Direction"));
|
direction = EnumFacing.getFront(nbt.getInteger(NBT_DIRECTION));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -62,7 +64,7 @@ public abstract class TileBase extends TileEntity implements IUpdatePlayerListBo
|
|||||||
{
|
{
|
||||||
super.writeToNBT(nbt);
|
super.writeToNBT(nbt);
|
||||||
|
|
||||||
nbt.setInteger("Direction", direction.ordinal());
|
nbt.setInteger(NBT_DIRECTION, direction.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -70,7 +72,7 @@ public abstract class TileBase extends TileEntity implements IUpdatePlayerListBo
|
|||||||
{
|
{
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
|
|
||||||
nbt.setInteger("Direction", direction.ordinal());
|
nbt.setInteger(NBT_DIRECTION, direction.ordinal());
|
||||||
|
|
||||||
return new S35PacketUpdateTileEntity(pos, 1, nbt);
|
return new S35PacketUpdateTileEntity(pos, 1, nbt);
|
||||||
}
|
}
|
||||||
@@ -78,7 +80,7 @@ public abstract class TileBase extends TileEntity implements IUpdatePlayerListBo
|
|||||||
@Override
|
@Override
|
||||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
|
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||||
{
|
{
|
||||||
direction = EnumFacing.getFront(packet.getNbtCompound().getInteger("Direction"));
|
direction = EnumFacing.getFront(packet.getNbtCompound().getInteger(NBT_DIRECTION));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -55,6 +55,8 @@ public class TileConstructor extends TileMachine implements IInventory, ISidedIn
|
|||||||
@Override
|
@Override
|
||||||
public void setCompare(int compare)
|
public void setCompare(int compare)
|
||||||
{
|
{
|
||||||
|
markDirty();
|
||||||
|
|
||||||
this.compare = compare;
|
this.compare = compare;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -118,6 +118,7 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
|||||||
if (lastEnergy != energy.getEnergyStored())
|
if (lastEnergy != energy.getEnergyStored())
|
||||||
{
|
{
|
||||||
worldObj.setBlockState(pos, worldObj.getBlockState(pos).withProperty(BlockController.ENERGY, getEnergyScaled(15)));
|
worldObj.setBlockState(pos, worldObj.getBlockState(pos).withProperty(BlockController.ENERGY, getEnergyScaled(15)));
|
||||||
|
// @TODO: Is this needed?
|
||||||
worldObj.markBlockForUpdate(pos);
|
worldObj.markBlockForUpdate(pos);
|
||||||
worldObj.notifyNeighborsOfStateChange(pos, StorageCraftBlocks.CONTROLLER);
|
worldObj.notifyNeighborsOfStateChange(pos, StorageCraftBlocks.CONTROLLER);
|
||||||
}
|
}
|
||||||
@@ -227,16 +228,22 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
|||||||
|
|
||||||
syncItems();
|
syncItems();
|
||||||
|
|
||||||
|
markDirty();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack take(ItemStack stack)
|
public ItemStack take(ItemStack stack)
|
||||||
{
|
{
|
||||||
|
markDirty();
|
||||||
|
|
||||||
return take(stack, InventoryUtils.COMPARE_DAMAGE | InventoryUtils.COMPARE_NBT);
|
return take(stack, InventoryUtils.COMPARE_DAMAGE | InventoryUtils.COMPARE_NBT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack take(ItemStack stack, int flags)
|
public ItemStack take(ItemStack stack, int flags)
|
||||||
{
|
{
|
||||||
|
markDirty();
|
||||||
|
|
||||||
int requested = stack.stackSize;
|
int requested = stack.stackSize;
|
||||||
int receiving = 0;
|
int receiving = 0;
|
||||||
|
|
||||||
@@ -343,6 +350,8 @@ public class TileController extends TileBase implements IEnergyReceiver, INetwor
|
|||||||
@Override
|
@Override
|
||||||
public void setRedstoneMode(RedstoneMode mode)
|
public void setRedstoneMode(RedstoneMode mode)
|
||||||
{
|
{
|
||||||
|
markDirty();
|
||||||
|
|
||||||
this.redstoneMode = mode;
|
this.redstoneMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -121,6 +121,8 @@ public class TileDetector extends TileMachine implements IInventory, ISidedInven
|
|||||||
@Override
|
@Override
|
||||||
public void setCompare(int compare)
|
public void setCompare(int compare)
|
||||||
{
|
{
|
||||||
|
markDirty();
|
||||||
|
|
||||||
this.compare = compare;
|
this.compare = compare;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,6 +133,8 @@ public class TileDetector extends TileMachine implements IInventory, ISidedInven
|
|||||||
|
|
||||||
public void setMode(int mode)
|
public void setMode(int mode)
|
||||||
{
|
{
|
||||||
|
markDirty();
|
||||||
|
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -98,6 +98,8 @@ public class TileExporter extends TileMachine implements IInventory, ISidedInven
|
|||||||
@Override
|
@Override
|
||||||
public void setCompare(int compare)
|
public void setCompare(int compare)
|
||||||
{
|
{
|
||||||
|
markDirty();
|
||||||
|
|
||||||
this.compare = compare;
|
this.compare = compare;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,6 +44,8 @@ public class TileGrid extends TileMachine
|
|||||||
|
|
||||||
public void onCraftingMatrixChanged()
|
public void onCraftingMatrixChanged()
|
||||||
{
|
{
|
||||||
|
markDirty();
|
||||||
|
|
||||||
craftingResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftingMatrix, worldObj));
|
craftingResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftingMatrix, worldObj));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -131,6 +131,8 @@ public class TileImporter extends TileMachine implements IInventory, ISidedInven
|
|||||||
@Override
|
@Override
|
||||||
public void setCompare(int compare)
|
public void setCompare(int compare)
|
||||||
{
|
{
|
||||||
|
markDirty();
|
||||||
|
|
||||||
this.compare = compare;
|
this.compare = compare;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,6 +143,8 @@ public class TileImporter extends TileMachine implements IInventory, ISidedInven
|
|||||||
|
|
||||||
public void setMode(int mode)
|
public void setMode(int mode)
|
||||||
{
|
{
|
||||||
|
markDirty();
|
||||||
|
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,6 +16,8 @@ public abstract class TileMachine extends TileBase implements INetworkTile, IRed
|
|||||||
|
|
||||||
public void onConnected(TileController controller)
|
public void onConnected(TileController controller)
|
||||||
{
|
{
|
||||||
|
markDirty();
|
||||||
|
|
||||||
connected = true;
|
connected = true;
|
||||||
|
|
||||||
controllerPos = controller.getPos();
|
controllerPos = controller.getPos();
|
||||||
@@ -25,6 +27,8 @@ public abstract class TileMachine extends TileBase implements INetworkTile, IRed
|
|||||||
|
|
||||||
public void onDisconnected()
|
public void onDisconnected()
|
||||||
{
|
{
|
||||||
|
markDirty();
|
||||||
|
|
||||||
connected = false;
|
connected = false;
|
||||||
|
|
||||||
if (!worldObj.isAirBlock(pos))
|
if (!worldObj.isAirBlock(pos))
|
||||||
@@ -60,6 +64,8 @@ public abstract class TileMachine extends TileBase implements INetworkTile, IRed
|
|||||||
{
|
{
|
||||||
if (redstoneControlled)
|
if (redstoneControlled)
|
||||||
{
|
{
|
||||||
|
markDirty();
|
||||||
|
|
||||||
this.redstoneMode = mode;
|
this.redstoneMode = mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -47,6 +47,8 @@ public class TileSolderer extends TileMachine implements IInventory, ISidedInven
|
|||||||
recipe = newRecipe;
|
recipe = newRecipe;
|
||||||
progress = 0;
|
progress = 0;
|
||||||
working = true;
|
working = true;
|
||||||
|
|
||||||
|
markDirty();
|
||||||
}
|
}
|
||||||
else if (working)
|
else if (working)
|
||||||
{
|
{
|
||||||
@@ -82,6 +84,8 @@ public class TileSolderer extends TileMachine implements IInventory, ISidedInven
|
|||||||
progress = 0;
|
progress = 0;
|
||||||
working = false;
|
working = false;
|
||||||
recipe = null;
|
recipe = null;
|
||||||
|
|
||||||
|
markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -47,6 +47,8 @@ public class TileWirelessTransmitter extends TileMachine implements IInventory
|
|||||||
|
|
||||||
progress = 0;
|
progress = 0;
|
||||||
working = true;
|
working = true;
|
||||||
|
|
||||||
|
markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inventory.getStackInSlot(1) != null)
|
if (inventory.getStackInSlot(1) != null)
|
||||||
@@ -68,6 +70,8 @@ public class TileWirelessTransmitter extends TileMachine implements IInventory
|
|||||||
{
|
{
|
||||||
progress = 0;
|
progress = 0;
|
||||||
working = false;
|
working = false;
|
||||||
|
|
||||||
|
markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -92,7 +96,6 @@ public class TileWirelessTransmitter extends TileMachine implements IInventory
|
|||||||
{
|
{
|
||||||
for (TileMachine machine : getController().getMachines())
|
for (TileMachine machine : getController().getMachines())
|
||||||
{
|
{
|
||||||
// @TODO: Is this still needed?
|
|
||||||
if (worldObj.getTileEntity(machine.getPos()) != null)
|
if (worldObj.getTileEntity(machine.getPos()) != null)
|
||||||
{
|
{
|
||||||
if (machine instanceof TileGrid)
|
if (machine instanceof TileGrid)
|
||||||
|
Reference in New Issue
Block a user