A bunch more null check \o/

This commit is contained in:
modmuss50 2016-12-06 18:22:18 +00:00
parent 97e5fcc032
commit 5dff31d937
19 changed files with 33 additions and 29 deletions

View file

@ -29,7 +29,7 @@ public class ItemBlockAesu extends ItemBlock {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
if (stack != null && stack.hasTagCompound()) {
if (stack != ItemStack.EMPTY && stack.hasTagCompound()) {
if (stack.getTagCompound().getCompoundTag("tileEntity") != null)
list.add(PowerSystem
.getLocaliszedPower(stack.getTagCompound().getCompoundTag("tileEntity").getInteger("energy")));
@ -47,7 +47,7 @@ public class ItemBlockAesu extends ItemBlock {
// world.getBlockState(pos).getBlock().onPostBlockPlaced(world, x,
// y, z, metadata);
}
if (stack != null && stack.hasTagCompound()) {
if (stack != ItemStack.EMPTY && stack.hasTagCompound()) {
((TileAesu) world.getTileEntity(pos))
.readFromNBTWithoutCoords(stack.getTagCompound().getCompoundTag("tileEntity"));
}

View file

@ -24,7 +24,7 @@ public class ItemBlockDigitalChest extends ItemBlock {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
if (stack != null && stack.hasTagCompound()) {
if (stack != ItemStack.EMPTY && stack.hasTagCompound()) {
if (stack.getTagCompound().getCompoundTag("tileEntity") != null)
list.add(stack.getTagCompound().getCompoundTag("tileEntity").getInteger("storedQuantity") + " items");
}
@ -41,7 +41,7 @@ public class ItemBlockDigitalChest extends ItemBlock {
// world.getBlockState(pos).getBlock().onPostBlockPlaced(world, x,
// y, z, metadata);
}
if (stack != null && stack.hasTagCompound()) {
if (stack != ItemStack.EMPTY && stack.hasTagCompound()) {
((TileDigitalChest) world.getTileEntity(pos))
.readFromNBTWithoutCoords(stack.getTagCompound().getCompoundTag("tileEntity"));
}

View file

@ -24,7 +24,7 @@ public class ItemBlockQuantumChest extends ItemBlock {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
if (stack != null && stack.hasTagCompound()) {
if (stack != ItemStack.EMPTY && stack.hasTagCompound()) {
if (stack.getTagCompound().getCompoundTag("tileEntity") != null)
list.add(stack.getTagCompound().getCompoundTag("tileEntity").getInteger("storedQuantity") + " items");
}
@ -41,7 +41,7 @@ public class ItemBlockQuantumChest extends ItemBlock {
// world.getBlockState(pos).getBlock().onPostBlockPlaced(world, x,
// y, z, metadata);
}
if (stack != null && stack.hasTagCompound()) {
if (stack != ItemStack.EMPTY && stack.hasTagCompound()) {
((TileQuantumChest) world.getTileEntity(pos))
.readFromNBTWithoutCoords(stack.getTagCompound().getCompoundTag("tileEntity"));
}

View file

@ -27,7 +27,7 @@ public class ItemBlockQuantumTank extends ItemBlock {
// world.getBlockState(pos).getBlock().onPostBlockPlaced(world, x,
// y, z, metadata);
}
if (stack != null && stack.hasTagCompound()) {
if (stack != ItemStack.EMPTY && stack.hasTagCompound()) {
((TileQuantumTank) world.getTileEntity(pos))
.readFromNBTWithoutCoords(stack.getTagCompound().getCompoundTag("tileEntity"));
}