Fix the no-update issues

This commit is contained in:
Aidan C. Brady 2014-08-08 22:09:14 -04:00
parent 40659dcdac
commit d4039d7f4b
5 changed files with 47 additions and 18 deletions

View file

@ -40,6 +40,7 @@ import codechicken.lib.render.CCModel;
import codechicken.lib.vec.Cuboid6;
import codechicken.lib.vec.Vector3;
import codechicken.microblock.ISidedHollowConnect;
import codechicken.multipart.INeighborTileChange;
import codechicken.multipart.IconHitEffects;
import codechicken.multipart.JIconHitEffects;
import codechicken.multipart.JNormalOcclusion;
@ -51,7 +52,7 @@ import cpw.mods.fml.common.ModAPIManager;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart, JNormalOcclusion, ISidedHollowConnect, JIconHitEffects, ITileNetwork, IBlockableConnection, IConfigurable, ITransmitter
public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart, JNormalOcclusion, ISidedHollowConnect, JIconHitEffects, ITileNetwork, IBlockableConnection, IConfigurable, ITransmitter, INeighborTileChange
{
public static IndexedCuboid6[] smallSides = new IndexedCuboid6[7];
public static IndexedCuboid6[] largeSides = new IndexedCuboid6[7];
@ -512,11 +513,10 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
super.onChunkLoad();
refreshConnections();
}
@Override
public void onNeighborChanged()
public void onNeighborTileChanged(int side, boolean weak)
{
super.onNeighborChanged();
refreshConnections();
}
@ -673,4 +673,10 @@ public abstract class PartSidedPipe extends TMultiPart implements TSlottedPart,
return values()[ordinal()+1];
}
}
@Override
public boolean weakTileChanges()
{
return false;
}
}

View file

@ -195,9 +195,9 @@ public abstract class PartTransmitter<N extends DynamicNetwork<?, N>> extends Pa
}
@Override
public void onNeighborChanged()
public void onNeighborTileChanged(int side, boolean weak)
{
super.onNeighborChanged();
super.onNeighborTileChanged(side, weak);
if(!world().isRemote)
{

View file

@ -161,9 +161,9 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock implements I
{
Coord4D obj = Coord4D.get(this).getFromSide(side);
if(!(obj.getTileEntity(worldObj) instanceof TileEntityDynamicTank))
if(!obj.isAirBlock(worldObj) && !(obj.getTileEntity(worldObj) instanceof TileEntityDynamicTank))
{
worldObj.notifyBlockOfNeighborChange(obj.xCoord, obj.yCoord, obj.zCoord, getBlockType());
obj.getBlock(worldObj).onNeighborChange(worldObj, obj.xCoord, obj.yCoord, obj.zCoord, xCoord, yCoord, zCoord);
}
}

View file

@ -162,6 +162,9 @@ public class TileEntitySalinationController extends TileEntitySalinationBlock
temperature = Math.min(getMaxTemperature(), getTemperature());
}
else {
clearStructure();
}
}
}
}
@ -381,15 +384,7 @@ public class TileEntitySalinationController extends TileEntitySalinationBlock
structured = scanTopLayer(startPoint);
height = structured ? height : 0;
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType());
for(TileEntitySalinationBlock tank : tankParts)
{
if(tank != this && tank instanceof TileEntitySalinationValve)
{
worldObj.notifyBlocksOfNeighborChange(tank.xCoord, tank.yCoord, tank.zCoord, tank.getBlockType());
}
}
markDirty();
return structured;
}

View file

@ -1,5 +1,8 @@
package mekanism.common.tile;
import mekanism.api.Coord4D;
import mekanism.common.Mekanism;
import mekanism.common.util.PipeUtils;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
@ -9,6 +12,31 @@ import net.minecraftforge.fluids.IFluidHandler;
public class TileEntitySalinationValve extends TileEntitySalinationBlock implements IFluidHandler
{
public boolean prevMaster = false;
@Override
public void onUpdate()
{
super.onUpdate();
if(!worldObj.isRemote)
{
if((master != null) != prevMaster)
{
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
Coord4D obj = Coord4D.get(this).getFromSide(side);
if(!obj.isAirBlock(worldObj) && !(obj.getTileEntity(worldObj) instanceof TileEntitySalinationBlock))
{
obj.getBlock(worldObj).onNeighborChange(worldObj, obj.xCoord, obj.yCoord, obj.zCoord, xCoord, yCoord, zCoord);
}
}
}
prevMaster = (master != null);
}
}
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{
@ -54,7 +82,7 @@ public class TileEntitySalinationValve extends TileEntitySalinationBlock impleme
{
if(master == null)
{
return new FluidTankInfo[0];
return PipeUtils.EMPTY;
}
return new FluidTankInfo[] {new FluidTankInfo(master.waterTank), new FluidTankInfo(master.brineTank)};