Inventories now don't NPE when broken
This commit is contained in:
parent
6a5f5356ce
commit
ddcc1237e8
3 changed files with 8 additions and 10 deletions
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.tile;
|
|||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
@ -57,10 +58,7 @@ public class TileInventory extends TileEntity implements IInventory {
|
|||
}
|
||||
|
||||
public void dropItems() {
|
||||
if (inventory != null) {
|
||||
for (ItemStack stack : inventory)
|
||||
getWorld().spawnEntityInWorld(new EntityItem(getWorld(), getPos().getX(), pos.getY(), pos.getZ(), stack));
|
||||
}
|
||||
InventoryHelper.dropInventoryItems(getWorld(), getPos(), this);
|
||||
}
|
||||
|
||||
// IInventory
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue