From d6cd145baa1ca4aa7b0bdf79538d0e2834185c58 Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Sun, 5 Oct 2014 12:02:49 +0200 Subject: [PATCH] Fix Smeltery bottom-layers not really being part of the smeltery, therefore not causing updates to the smeltery. --- .../smeltery/blocks/SmelteryBlock.java | 2 ++ .../smeltery/logic/SmelteryLogic.java | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/main/java/tconstruct/smeltery/blocks/SmelteryBlock.java b/src/main/java/tconstruct/smeltery/blocks/SmelteryBlock.java index 71094fd4..20e016d0 100644 --- a/src/main/java/tconstruct/smeltery/blocks/SmelteryBlock.java +++ b/src/main/java/tconstruct/smeltery/blocks/SmelteryBlock.java @@ -302,6 +302,8 @@ public class SmelteryBlock extends InventoryBlock @Override public void breakBlock (World world, int x, int y, int z, Block blockID, int meta) { + // TE is not valid anymore at this point. :/ + TileEntity logic = world.getTileEntity(x, y, z); if (logic instanceof IServantLogic) { diff --git a/src/main/java/tconstruct/smeltery/logic/SmelteryLogic.java b/src/main/java/tconstruct/smeltery/logic/SmelteryLogic.java index 2a508e92..c660b9a1 100644 --- a/src/main/java/tconstruct/smeltery/logic/SmelteryLogic.java +++ b/src/main/java/tconstruct/smeltery/logic/SmelteryLogic.java @@ -983,12 +983,24 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci { for (int zPos = zMin; zPos <= zMax; zPos++) { - if (validBlockID(worldObj.getBlock(xPos, y, zPos)) && (worldObj.getBlockMetadata(xPos, y, zPos) >= 2)) - bottomBricks++; + if (validBlockID(worldObj.getBlock(xPos, y, zPos)) && (worldObj.getBlockMetadata(xPos, y, zPos) >= 2)) { + TileEntity te = worldObj.getTileEntity(xPos, y, zPos); + + if (te instanceof MultiServantLogic) { + MultiServantLogic servant = (MultiServantLogic) te; + if (servant.hasValidMaster()) { + if (servant.verifyMaster(this, worldObj, this.xCoord, this.yCoord, this.zCoord)) + bottomBricks++; + } else { + servant.overrideMaster(this.xCoord, this.yCoord, this.zCoord); + bottomBricks++; + } + } + } } } - int neededBricks = (xMax + 1 - xMin) * (zMax + 1 - zMin); // +1 because we want inclusive the upper border + int neededBricks = (xMax + 1 - xMin) * (zMax + 1 - zMin); // +1 because we want inclusive the upper bound if (bottomBricks == neededBricks) { @@ -1017,6 +1029,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci else if (te instanceof MultiServantLogic) { MultiServantLogic servant = (MultiServantLogic) te; + if (servant.hasValidMaster()) { if (servant.verifyMaster(this, worldObj, this.xCoord, this.yCoord, this.zCoord))