Fixed minor tank packet bug

This commit is contained in:
Calclavia 2014-01-19 19:30:00 +08:00
parent bd496c66bd
commit a0bbaee12b
3 changed files with 24 additions and 23 deletions

View file

@ -61,20 +61,6 @@ public abstract class TileFluidNetwork extends TileAdvanced implements IFluidCon
getNetwork().reconstruct();
}
@Override
public void onFluidChanged()
{
if (!worldObj.isRemote)
{
if (!FluidUtility.matchExact(prevStack, this.getInternalTank().getFluid()))
{
this.sendTankUpdate();
}
this.prevStack = this.tank.getFluid();
}
}
@Override
public void invalidate()
{
@ -264,10 +250,23 @@ public abstract class TileFluidNetwork extends TileAdvanced implements IFluidCon
public void sendTankUpdate()
{
System.out.println("Send Amount: " + this.getInternalTank().getFluidAmount());
PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacketWithID(PACKET_TANK, this, getInternalTank().getCapacity(), getInternalTank().writeToNBT(new NBTTagCompound())), this.worldObj, new Vector3(this), 60);
}
@Override
public void onFluidChanged()
{
if (!worldObj.isRemote)
{
if (!FluidUtility.matchExact(prevStack, this.getInternalTank().getFluid()))
{
sendTankUpdate();
}
prevStack = tank.getFluid();
}
}
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox()

View file

@ -67,7 +67,6 @@ public class BlockTank extends BlockFluidNetwork
if (!world.isRemote)
{
return FluidUtility.playerActivatedFluidItem(world, x, y, z, entityplayer, side);
}
return true;

View file

@ -17,7 +17,7 @@ public class TankNetwork extends FluidNetwork
{
@Override
public void distributeConnectors()
{
{
FluidStack fillStack = this.getTank().getFluid();
int lowestY = 255, highestY = 0;
@ -28,16 +28,19 @@ public class TankNetwork extends FluidNetwork
else if (this.getConnectors().size() > 0)
{
fillStack = fillStack.copy();
for (IFluidConnector part : this.getConnectors())
for (IFluidConnector connector : this.getConnectors())
{
part.getInternalTank().setFluid(null);
if (part instanceof TileEntity && ((TileEntity) part).yCoord < lowestY)
connector.getInternalTank().setFluid(null);
connector.onFluidChanged();
if (connector instanceof TileEntity && ((TileEntity) connector).yCoord < lowestY)
{
lowestY = ((TileEntity) part).yCoord;
lowestY = ((TileEntity) connector).yCoord;
}
if (part instanceof TileEntity && ((TileEntity) part).yCoord > highestY)
if (connector instanceof TileEntity && ((TileEntity) connector).yCoord > highestY)
{
highestY = ((TileEntity) part).yCoord;
highestY = ((TileEntity) connector).yCoord;
}
}