Null check getTanks()

This commit is contained in:
CovertJaguar 2013-05-02 19:18:19 -07:00
parent 7b9994bd86
commit 234d17b700

View file

@ -13,13 +13,15 @@ import buildcraft.api.gates.ITrigger;
import buildcraft.api.gates.ITriggerProvider;
import buildcraft.api.transport.IPipe;
import buildcraft.core.IMachine;
import net.minecraftforge.liquids.ILiquidTank;
public class DefaultTriggerProvider implements ITriggerProvider {
@Override
public LinkedList<ITrigger> getNeighborTriggers(Block block, TileEntity tile) {
if (tile instanceof IOverrideDefaultTriggers)
if (tile instanceof IOverrideDefaultTriggers) {
return ((IOverrideDefaultTriggers) tile).getTriggers();
}
LinkedList<ITrigger> res = new LinkedList<ITrigger>();
@ -30,11 +32,14 @@ public class DefaultTriggerProvider implements ITriggerProvider {
res.add(BuildCraftCore.triggerFullInventory);
}
if (tile instanceof ITankContainer && ((ITankContainer) tile).getTanks(ForgeDirection.UNKNOWN).length > 0) {
res.add(BuildCraftCore.triggerEmptyLiquid);
res.add(BuildCraftCore.triggerContainsLiquid);
res.add(BuildCraftCore.triggerSpaceLiquid);
res.add(BuildCraftCore.triggerFullLiquid);
if (tile instanceof ITankContainer) {
ILiquidTank[] tanks = ((ITankContainer) tile).getTanks(ForgeDirection.UNKNOWN);
if (tanks != null && tanks.length > 0) {
res.add(BuildCraftCore.triggerEmptyLiquid);
res.add(BuildCraftCore.triggerContainsLiquid);
res.add(BuildCraftCore.triggerSpaceLiquid);
res.add(BuildCraftCore.triggerFullLiquid);
}
}
if (tile instanceof IMachine) {
@ -54,5 +59,4 @@ public class DefaultTriggerProvider implements ITriggerProvider {
public LinkedList<ITrigger> getPipeTriggers(IPipe pipe) {
return null;
}
}