Fixed internal multi blocks of Thermoelectric Boiler not updating

This commit is contained in:
aidancbrady 2016-04-17 23:12:33 -04:00
parent a891ed02ac
commit aeecb57978
3 changed files with 46 additions and 2 deletions

View file

@ -34,6 +34,7 @@ import mekanism.common.tile.TileEntityInductionCasing;
import mekanism.common.tile.TileEntityInductionCell; import mekanism.common.tile.TileEntityInductionCell;
import mekanism.common.tile.TileEntityInductionPort; import mekanism.common.tile.TileEntityInductionPort;
import mekanism.common.tile.TileEntityInductionProvider; import mekanism.common.tile.TileEntityInductionProvider;
import mekanism.common.tile.TileEntityMultiblock;
import mekanism.common.tile.TileEntityPressureDisperser; import mekanism.common.tile.TileEntityPressureDisperser;
import mekanism.common.tile.TileEntitySecurityDesk; import mekanism.common.tile.TileEntitySecurityDesk;
import mekanism.common.tile.TileEntityStructuralGlass; import mekanism.common.tile.TileEntityStructuralGlass;
@ -223,6 +224,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
ctms[4][2] = new CTMData("ctm/InductionProviderElite", this, Arrays.asList(3, 4)).registerIcons(register).setRenderConvexConnections(); ctms[4][2] = new CTMData("ctm/InductionProviderElite", this, Arrays.asList(3, 4)).registerIcons(register).setRenderConvexConnections();
ctms[4][3] = new CTMData("ctm/InductionProviderUltimate", this, Arrays.asList(3, 4)).registerIcons(register).setRenderConvexConnections(); ctms[4][3] = new CTMData("ctm/InductionProviderUltimate", this, Arrays.asList(3, 4)).registerIcons(register).setRenderConvexConnections();
ctms[5][0] = new CTMData("ctm/SuperheatingElement", this, Arrays.asList(5)).registerIcons(register).setRenderConvexConnections(); ctms[5][0] = new CTMData("ctm/SuperheatingElement", this, Arrays.asList(5)).registerIcons(register).setRenderConvexConnections();
ctms[5][1] = new CTMData("ctm/SuperheatingElementOn", this, Arrays.asList(5)).registerIcons(register).setRenderConvexConnections();
ctms[7][0] = new CTMData("ctm/BoilerCasing", this, Arrays.asList(7, 8)).registerIcons(register); ctms[7][0] = new CTMData("ctm/BoilerCasing", this, Arrays.asList(7, 8)).registerIcons(register);
ctms[8][0] = new CTMData("ctm/BoilerValve", this, Arrays.asList(7, 8)).registerIcons(register); ctms[8][0] = new CTMData("ctm/BoilerValve", this, Arrays.asList(7, 8)).registerIcons(register);
@ -241,6 +243,7 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
icons[4][2] = ctms[4][2].mainTextureData.icon; icons[4][2] = ctms[4][2].mainTextureData.icon;
icons[4][3] = ctms[4][3].mainTextureData.icon; icons[4][3] = ctms[4][3].mainTextureData.icon;
icons[5][0] = ctms[5][0].mainTextureData.icon; icons[5][0] = ctms[5][0].mainTextureData.icon;
icons[5][1] = ctms[5][1].mainTextureData.icon;
icons[7][0] = ctms[7][0].mainTextureData.icon; icons[7][0] = ctms[7][0].mainTextureData.icon;
icons[8][0] = ctms[8][0].mainTextureData.icon; icons[8][0] = ctms[8][0].mainTextureData.icon;
@ -291,6 +294,15 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
case 4: case 4:
TileEntityInductionProvider tileEntity2 = (TileEntityInductionProvider)world.getTileEntity(x, y, z); TileEntityInductionProvider tileEntity2 = (TileEntityInductionProvider)world.getTileEntity(x, y, z);
return icons[meta][tileEntity2.tier.ordinal()]; return icons[meta][tileEntity2.tier.ordinal()];
case 5:
TileEntitySuperheatingElement element = (TileEntitySuperheatingElement)world.getTileEntity(x, y, z);
if(element.multiblockUUID != null && SynchronizedBoilerData.clientHotMap.get(element.multiblockUUID) != null)
{
return icons[meta][SynchronizedBoilerData.clientHotMap.get(element.multiblockUUID) ? 1 : 0];
}
return icons[meta][0];
default: default:
return getIcon(side, meta); return getIcon(side, meta);
} }
@ -373,8 +385,9 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
case BASIC_BLOCK_1: case BASIC_BLOCK_1:
switch(meta) switch(meta)
{ {
case 9:
case 10: case 10:
return false;
case 9:
case 11: case 11:
TileEntityDynamicTank tileEntity = (TileEntityDynamicTank)world.getTileEntity(x, y, z); TileEntityDynamicTank tileEntity = (TileEntityDynamicTank)world.getTileEntity(x, y, z);
@ -402,7 +415,9 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
{ {
case 1: case 1:
case 2: case 2:
TileEntityInductionCasing tileEntity = (TileEntityInductionCasing)world.getTileEntity(x, y, z); case 7:
case 8:
TileEntityMultiblock tileEntity = (TileEntityMultiblock)world.getTileEntity(x, y, z);
if(tileEntity != null) if(tileEntity != null)
{ {
@ -1040,6 +1055,17 @@ public class BlockBasic extends Block implements IBlockCTM, ICustomBlockIcon
TileEntityInductionProvider tileEntity = (TileEntityInductionProvider)world.getTileEntity(x, y, z); TileEntityInductionProvider tileEntity = (TileEntityInductionProvider)world.getTileEntity(x, y, z);
return ctms[meta][tileEntity.tier.ordinal()]; return ctms[meta][tileEntity.tier.ordinal()];
} }
else if(type == BasicType.SUPERHEATING_ELEMENT)
{
TileEntitySuperheatingElement element = (TileEntitySuperheatingElement)world.getTileEntity(x, y, z);
if(element.multiblockUUID != null && SynchronizedBoilerData.clientHotMap.get(element.multiblockUUID) != null)
{
return ctms[meta][SynchronizedBoilerData.clientHotMap.get(element.multiblockUUID) ? 1 : 0];
}
return ctms[meta][0];
}
return ctms[meta][0]; return ctms[meta][0];
} }

View file

@ -1,7 +1,13 @@
package mekanism.common.tile; package mekanism.common.tile;
import java.util.ArrayList;
import mekanism.api.Coord4D;
import mekanism.api.Range4D;
import mekanism.common.Mekanism;
import mekanism.common.content.boiler.SynchronizedBoilerData; import mekanism.common.content.boiler.SynchronizedBoilerData;
import mekanism.common.multiblock.TileEntityInternalMultiblock; import mekanism.common.multiblock.TileEntityInternalMultiblock;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
public class TileEntitySuperheatingElement extends TileEntityInternalMultiblock public class TileEntitySuperheatingElement extends TileEntityInternalMultiblock
@ -11,12 +17,24 @@ public class TileEntitySuperheatingElement extends TileEntityInternalMultiblock
@Override @Override
public void setMultiblock(String id) public void setMultiblock(String id)
{ {
boolean packet = false;
if(id == null && multiblockUUID != null) if(id == null && multiblockUUID != null)
{ {
SynchronizedBoilerData.clientHotMap.remove(multiblockUUID); SynchronizedBoilerData.clientHotMap.remove(multiblockUUID);
packet = true;
}
else if(id != null && multiblockUUID == null)
{
packet = true;
} }
super.setMultiblock(id); super.setMultiblock(id);
if(packet && !worldObj.isRemote)
{
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this)));
}
} }
@Override @Override