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

@ -3,6 +3,7 @@ package techreborn.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerDigitalChest;
@ -38,10 +39,10 @@ public class GuiDigitalChest extends GuiContainer {
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Amount", 10, 20, 16448255);
if (tile.storedItem != null && tile.getStackInSlot(1) != null)
if (tile.storedItem != ItemStack.EMPTY && tile.getStackInSlot(1) != null)
this.fontRendererObj.drawString(tile.storedItem.getCount() + tile.getStackInSlot(1).getCount() + "", 10, 30,
16448255);
if (tile.storedItem == null && tile.getStackInSlot(1) != null)
if (tile.storedItem == ItemStack.EMPTY && tile.getStackInSlot(1) != null)
this.fontRendererObj.drawString(tile.getStackInSlot(1).getCount() + "", 10, 30, 16448255);
}
}

View file

@ -3,6 +3,7 @@ package techreborn.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import techreborn.client.container.ContainerQuantumChest;
@ -38,10 +39,10 @@ public class GuiQuantumChest extends GuiContainer {
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Amount", 10, 20, 16448255);
if (tile.storedItem != null && tile.getStackInSlot(1) != null)
if (tile.storedItem != ItemStack.EMPTY && tile.getStackInSlot(1) != null)
this.fontRendererObj.drawString(tile.storedItem.getCount() + tile.getStackInSlot(1).getCount() + "", 10, 30,
16448255);
if (tile.storedItem == null && tile.getStackInSlot(1) != null)
if (tile.storedItem == ItemStack.EMPTY && tile.getStackInSlot(1) != null)
this.fontRendererObj.drawString(tile.getStackInSlot(1).getCount() + "", 10, 30, 16448255);
}
}

View file

@ -50,7 +50,7 @@ public class ChargeHud {
int y = 5;
if (armorstack != null && ConfigTechReborn.ShowChargeHud
if (armorstack != ItemStack.EMPTY && ConfigTechReborn.ShowChargeHud
&& armorstack.getItem() instanceof IEnergyInterfaceItem) {
double MaxCharge = ((IEnergyInterfaceItem) armorstack.getItem()).getMaxPower(armorstack);
double CurrentCharge = ((IEnergyInterfaceItem) armorstack.getItem()).getEnergy(armorstack);
@ -76,7 +76,7 @@ public class ChargeHud {
}
if (showHud) {
if (offHandstack != null && offHandstack.getItem() instanceof IEnergyInterfaceItem) {
if (offHandstack != ItemStack.EMPTY && offHandstack.getItem() instanceof IEnergyInterfaceItem) {
double MaxCharge = ((IEnergyInterfaceItem) offHandstack.getItem()).getMaxPower(offHandstack);
double CurrentCharge = ((IEnergyInterfaceItem) offHandstack.getItem()).getEnergy(offHandstack);
if (MaxCharge != 0) {
@ -99,7 +99,7 @@ public class ChargeHud {
y += 20;
}
}
if (stack != null && stack.getItem() instanceof IEnergyInterfaceItem) {
if (stack != ItemStack.EMPTY && stack.getItem() instanceof IEnergyInterfaceItem) {
double MaxCharge = ((IEnergyInterfaceItem) stack.getItem()).getMaxPower(stack);
double CurrentCharge = ((IEnergyInterfaceItem) stack.getItem()).getEnergy(stack);
Color color = Color.GREEN;