Fixed some tank null point exceptions

This commit is contained in:
Calclavia 2014-03-17 22:03:56 +08:00
parent 7bea838a12
commit 3069774a44
4 changed files with 5 additions and 4 deletions

View file

@ -3,6 +3,7 @@ package resonantinduction.archaic.fluid.tank;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.PriorityQueue; import java.util.PriorityQueue;
import java.util.Random;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;

View file

@ -31,7 +31,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PartPipe extends PartFramedNode<EnumPipeMaterial, FluidPressureNode, IPressureNodeProvider> implements IPressureNodeProvider, TSlottedPart, JNormalOcclusion, IHollowConnect public class PartPipe extends PartFramedNode<EnumPipeMaterial, FluidPressureNode, IPressureNodeProvider> implements IPressureNodeProvider, TSlottedPart, JNormalOcclusion, IHollowConnect
{ {
protected FluidTank tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME); protected final FluidTank tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME);
/** /**
* Computes the average fluid for client to render. * Computes the average fluid for client to render.
*/ */
@ -183,7 +183,7 @@ public class PartPipe extends PartFramedNode<EnumPipeMaterial, FluidPressureNode
{ {
if (packetID == 3) if (packetID == 3)
{ {
tank = new FluidTank(packet.readInt()); tank.setCapacity(packet.readInt());
tank.readFromNBT(packet.readNBTTagCompound()); tank.readFromNBT(packet.readNBTTagCompound());
} }
else else

View file

@ -149,7 +149,7 @@ public class TilePump extends TileMechanical implements IPressureNodeProvider, I
@Override @Override
public FluidTank getPressureTank() public FluidTank getPressureTank()
{ {
return null; return new FluidTank(0);
} }
@Override @Override

View file

@ -115,7 +115,7 @@ public abstract class TileFluidNode extends TileBase implements IPacketReceiverW
@Override @Override
public Packet getDescriptionPacket() public Packet getDescriptionPacket()
{ {
if (getInternalTank().getFluid() == null || getInternalTank().getFluid().getFluid().getName() != null) if (getInternalTank().getFluid() == null || (getInternalTank().getFluid() != null && getInternalTank().getFluid().getFluid().getName() != null))
return ResonantInduction.PACKET_TILE.getPacketWithID(PACKET_DESCRIPTION, this, this.colorID, this.renderSides, getInternalTank().getCapacity(), getInternalTank().writeToNBT(new NBTTagCompound())); return ResonantInduction.PACKET_TILE.getPacketWithID(PACKET_DESCRIPTION, this, this.colorID, this.renderSides, getInternalTank().getCapacity(), getInternalTank().writeToNBT(new NBTTagCompound()));
return null; return null;
} }