Null check getTanks()
This commit is contained in:
parent
7b9994bd86
commit
234d17b700
1 changed files with 11 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue