Fix a few nutderps on block updates

Incorrect assumptions + adopting very early = mistakes were made
This commit is contained in:
Nick 2016-03-18 13:05:57 -07:00
parent 26f7c874ff
commit 1bcc4e47e0
7 changed files with 18 additions and 11 deletions

View file

@ -287,7 +287,7 @@ public class BloodAltar implements IFluidHandler
public void startCycle() public void startCycle()
{ {
if (tileAltar.getWorld() != null) if (tileAltar.getWorld() != null)
tileAltar.markDirty(); tileAltar.getWorld().notifyBlockUpdate(tileAltar.getPos(), tileAltar.getWorld().getBlockState(tileAltar.getPos()), tileAltar.getWorld().getBlockState(tileAltar.getPos()), 3);
checkTier(); checkTier();
@ -355,7 +355,7 @@ public class BloodAltar implements IFluidHandler
fluidOutputted = Math.min(this.fluid.amount, fluidOutputted); fluidOutputted = Math.min(this.fluid.amount, fluidOutputted);
this.fluidOutput.amount += fluidOutputted; this.fluidOutput.amount += fluidOutputted;
this.fluid.amount -= fluidOutputted; this.fluid.amount -= fluidOutputted;
tileAltar.markDirty(); tileAltar.getWorld().notifyBlockUpdate(tileAltar.getPos(), tileAltar.getWorld().getBlockState(tileAltar.getPos()), tileAltar.getWorld().getBlockState(tileAltar.getPos()), 3);
} }
if (internalCounter % this.getChargingFrequency() == 0 && !this.isActive) if (internalCounter % this.getChargingFrequency() == 0 && !this.isActive)
@ -364,7 +364,7 @@ public class BloodAltar implements IFluidHandler
chargeInputted = Math.min(chargeInputted, maxCharge - totalCharge); chargeInputted = Math.min(chargeInputted, maxCharge - totalCharge);
totalCharge += chargeInputted; totalCharge += chargeInputted;
this.fluid.amount -= chargeInputted; this.fluid.amount -= chargeInputted;
tileAltar.markDirty(); tileAltar.getWorld().notifyBlockUpdate(tileAltar.getPos(), tileAltar.getWorld().getBlockState(tileAltar.getPos()), tileAltar.getWorld().getBlockState(tileAltar.getPos()), 3);
} }
if (internalCounter % 100 == 0 && (this.isActive || this.cooldownAfterCrafting <= 0)) if (internalCounter % 100 == 0 && (this.isActive || this.cooldownAfterCrafting <= 0))
@ -491,7 +491,7 @@ public class BloodAltar implements IFluidHandler
} }
} }
tileAltar.markDirty(); tileAltar.getWorld().notifyBlockUpdate(tileAltar.getPos(), tileAltar.getWorld().getBlockState(tileAltar.getPos()), tileAltar.getWorld().getBlockState(tileAltar.getPos()), 3);
} }
public void checkTier() public void checkTier()
@ -546,7 +546,7 @@ public class BloodAltar implements IFluidHandler
if (this.totalCharge > this.maxCharge) if (this.totalCharge > this.maxCharge)
this.totalCharge = this.maxCharge; this.totalCharge = this.maxCharge;
tileAltar.markDirty(); tileAltar.getWorld().notifyBlockUpdate(tileAltar.getPos(), tileAltar.getWorld().getBlockState(tileAltar.getPos()), tileAltar.getWorld().getBlockState(tileAltar.getPos()), 3);
} }
public int fillMainTank(int amount) public int fillMainTank(int amount)

View file

@ -67,7 +67,7 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator, I
int filledAmount = altar.fillMainTank(amount); int filledAmount = altar.fillMainTank(amount);
amount -= filledAmount; amount -= filledAmount;
setStoredLP(stack, amount); setStoredLP(stack, amount);
world.setBlockState(position.getBlockPos(), world.getBlockState(position.getBlockPos())); world.notifyBlockUpdate(position.getBlockPos(), world.getBlockState(position.getBlockPos()), world.getBlockState(position.getBlockPos()), 3);
} }
} }
} }

View file

@ -75,7 +75,7 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
int filledAmount = altar.fillMainTank(amount); int filledAmount = altar.fillMainTank(amount);
amount -= filledAmount; amount -= filledAmount;
setStoredLP(stack, amount); setStoredLP(stack, amount);
world.setBlockState(position.getBlockPos(), world.getBlockState(position.getBlockPos())); world.notifyBlockUpdate(position.getBlockPos(), world.getBlockState(position.getBlockPos()), world.getBlockState(position.getBlockPos()), 3);
} }
} }
} }

View file

@ -79,6 +79,7 @@ public class DefaultItemFilter implements IItemFilter
TileEntity tile = (TileEntity) accessedInventory; TileEntity tile = (TileEntity) accessedInventory;
World world = tile.getWorld(); World world = tile.getWorld();
BlockPos pos = tile.getPos(); BlockPos pos = tile.getPos();
world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 3);
return testStack; return testStack;
} }
@ -135,6 +136,7 @@ public class DefaultItemFilter implements IItemFilter
TileEntity tile = (TileEntity) accessedInventory; TileEntity tile = (TileEntity) accessedInventory;
World world = tile.getWorld(); World world = tile.getWorld();
BlockPos pos = tile.getPos(); BlockPos pos = tile.getPos();
world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 3);
inputStack.stackSize -= changeAmount; inputStack.stackSize -= changeAmount;
maxTransfer -= changeAmount; maxTransfer -= changeAmount;

View file

@ -130,6 +130,9 @@ public class TileInventory extends TileEntity implements IInventory
{ {
if (inventory[index] != null) if (inventory[index] != null)
{ {
if (!getWorld().isRemote)
getWorld().notifyBlockUpdate(getPos(), getWorld().getBlockState(getPos()), getWorld().getBlockState(getPos()), 3);
if (inventory[index].stackSize <= count) if (inventory[index].stackSize <= count)
{ {
ItemStack itemStack = inventory[index]; ItemStack itemStack = inventory[index];
@ -168,6 +171,8 @@ public class TileInventory extends TileEntity implements IInventory
if (stack != null && stack.stackSize > getInventoryStackLimit()) if (stack != null && stack.stackSize > getInventoryStackLimit())
stack.stackSize = getInventoryStackLimit(); stack.stackSize = getInventoryStackLimit();
markDirty(); markDirty();
if (!getWorld().isRemote)
getWorld().notifyBlockUpdate(getPos(), getWorld().getBlockState(getPos()), getWorld().getBlockState(getPos()), 3);
} }
@Override @Override

View file

@ -75,7 +75,7 @@ public class TileSpectralBlock extends TileEntity implements ITickable
block = Block.getBlockFromName(containedBlockName); block = Block.getBlockFromName(containedBlockName);
if (block != null && worldObj.setBlockState(pos, block.getStateFromMeta(containedBlockMeta))) if (block != null && worldObj.setBlockState(pos, block.getStateFromMeta(containedBlockMeta)))
markDirty(); getWorld().notifyBlockUpdate(getPos(), getWorld().getBlockState(getPos()), getWorld().getBlockState(getPos()), 3);
} }
public static void createSpectralBlock(World world, BlockPos blockPos, int duration) public static void createSpectralBlock(World world, BlockPos blockPos, int duration)

View file

@ -80,7 +80,7 @@ public class TileRoutingNode extends TileInventory implements IRoutingNode, IIte
if (tile instanceof IRoutingNode) if (tile instanceof IRoutingNode)
{ {
((IRoutingNode) tile).removeConnection(pos); ((IRoutingNode) tile).removeConnection(pos);
markDirty(); getWorld().notifyBlockUpdate(getPos(), getWorld().getBlockState(getPos()), getWorld().getBlockState(getPos()), 3);
} }
} }
@ -156,7 +156,7 @@ public class TileRoutingNode extends TileInventory implements IRoutingNode, IIte
{ {
if (!connectionList.contains(pos1)) if (!connectionList.contains(pos1))
{ {
markDirty(); getWorld().notifyBlockUpdate(getPos(), getWorld().getBlockState(getPos()), getWorld().getBlockState(getPos()), 3);
connectionList.add(pos1); connectionList.add(pos1);
} }
} }
@ -167,7 +167,7 @@ public class TileRoutingNode extends TileInventory implements IRoutingNode, IIte
if (connectionList.contains(pos1)) if (connectionList.contains(pos1))
{ {
connectionList.remove(pos1); connectionList.remove(pos1);
markDirty(); getWorld().notifyBlockUpdate(getPos(), getWorld().getBlockState(getPos()), getWorld().getBlockState(getPos()), 3);
} }
} }