add null checks for obsidian pipes, fix #2111

This commit is contained in:
asiekierka 2014-10-28 20:19:01 +01:00
parent 9c31b0123b
commit 239edfa78a
2 changed files with 22 additions and 0 deletions

View file

@ -0,0 +1,12 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|tiles")
package buildcraft.api.tiles;
import cpw.mods.fml.common.API;

View file

@ -216,6 +216,10 @@ public class PipeItemsObsidian extends Pipe<PipeTransportItems> implements IEner
EntityItem item = (EntityItem) entity;
ItemStack contained = item.getEntityItem();
if (contained == null) {
return;
}
CoreProxy.proxy.obsidianPipePickup(container.getWorldObj(), item, this.container);
int energyUsed = Math.min(10 * contained.stackSize * distance, battery.getEnergyStored());
@ -236,8 +240,14 @@ public class PipeItemsObsidian extends Pipe<PipeTransportItems> implements IEner
} else if (entity instanceof EntityArrow && battery.useEnergy(distance * 10, distance * 10, false) > 0) {
stack = new ItemStack(Items.arrow, 1);
CoreProxy.proxy.removeEntity(entity);
} else {
return;
}
if (stack == null) {
return;
}
TravelingItem item = TravelingItem.make(container.xCoord + 0.5, container.yCoord + TransportUtils.getPipeFloorOf(stack), container.zCoord + 0.5, stack);
item.setSpeed((float) speed);