diff --git a/src/main/java/techreborn/client/hud/ChargeHud.java b/src/main/java/techreborn/client/hud/ChargeHud.java index 9005b911c..b07bf2daf 100644 --- a/src/main/java/techreborn/client/hud/ChargeHud.java +++ b/src/main/java/techreborn/client/hud/ChargeHud.java @@ -41,7 +41,7 @@ public class ChargeHud if (mc.inGameHasFocus || (mc.currentScreen != null && mc.gameSettings.showDebugInfo)) { - if (ConfigTechReborn.ShowChargeHud) + if (ConfigTechReborn.ShowChargeHud && ElectricItem.manager != null) drawChargeHud(event.resolution); } } diff --git a/src/main/java/techreborn/items/ItemCells.java b/src/main/java/techreborn/items/ItemCells.java index 6c3167bf9..cc5b1b579 100644 --- a/src/main/java/techreborn/items/ItemCells.java +++ b/src/main/java/techreborn/items/ItemCells.java @@ -21,16 +21,18 @@ public class ItemCells extends ItemTR { public static ItemStack getCellByName(String name, int count) { Fluid fluid = FluidRegistry.getFluid("fluid" + name.toLowerCase()); - if(fluid != null){ - ItemStack stack = IC2Items.getItem("FluidCell").copy(); - if(stack != null && stack.getItem() instanceof IFluidContainerItem){ - IFluidContainerItem containerItem = (IFluidContainerItem)stack.getItem(); - containerItem.fill(stack, new FluidStack(fluid.getID(), 2147483647), true); - stack.stackSize = count; - return stack; + if(IC2Items.getItem("FluidCell") != null){ + if(fluid != null){ + ItemStack stack = IC2Items.getItem("FluidCell").copy(); + if(stack != null && stack.getItem() instanceof IFluidContainerItem){ + IFluidContainerItem containerItem = (IFluidContainerItem)stack.getItem(); + containerItem.fill(stack, new FluidStack(fluid.getID(), 2147483647), true); + stack.stackSize = count; + return stack; + } + } else { + LogHelper.error("Could not find " + "fluid" + name + " in the fluid registry!"); } - } else { - LogHelper.error("Could not find " + "fluid" + name + " in the fluid registry!"); } int index = -1; for (int i = 0; i < types.length; i++) { diff --git a/src/main/java/techreborn/items/ItemLapotronicOrb.java b/src/main/java/techreborn/items/ItemLapotronicOrb.java index 1e609063d..2b506e783 100644 --- a/src/main/java/techreborn/items/ItemLapotronicOrb.java +++ b/src/main/java/techreborn/items/ItemLapotronicOrb.java @@ -38,7 +38,7 @@ public class ItemLapotronicOrb extends Item implements IElectricItem { @SideOnly(Side.CLIENT) public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){ ItemStack itemStack = new ItemStack(this, 1); - if (getChargedItem(itemStack) == this){ + if (getChargedItem(itemStack) == this && ElectricItem.manager != null){ ItemStack charged = new ItemStack(this, 1); ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); diff --git a/src/main/java/techreborn/items/armor/ItemLapotronPack.java b/src/main/java/techreborn/items/armor/ItemLapotronPack.java index 10a9a2301..1881a7cda 100644 --- a/src/main/java/techreborn/items/armor/ItemLapotronPack.java +++ b/src/main/java/techreborn/items/armor/ItemLapotronPack.java @@ -45,7 +45,7 @@ public class ItemLapotronPack extends ItemArmor implements IElectricItem { @SideOnly(Side.CLIENT) public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){ ItemStack itemStack = new ItemStack(this, 1); - if (getChargedItem(itemStack) == this){ + if (getChargedItem(itemStack) == this && ElectricItem.manager != null){ ItemStack charged = new ItemStack(this, 1); ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); itemList.add(charged); diff --git a/src/main/java/techreborn/items/armor/ItemLithiumBatpack.java b/src/main/java/techreborn/items/armor/ItemLithiumBatpack.java index b73341b9c..c522a36bd 100644 --- a/src/main/java/techreborn/items/armor/ItemLithiumBatpack.java +++ b/src/main/java/techreborn/items/armor/ItemLithiumBatpack.java @@ -45,7 +45,7 @@ public class ItemLithiumBatpack extends ItemArmor implements IElectricItem { @SideOnly(Side.CLIENT) public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){ ItemStack itemStack = new ItemStack(this, 1); - if (getChargedItem(itemStack) == this){ + if (getChargedItem(itemStack) == this && ElectricItem.manager != null){ ItemStack charged = new ItemStack(this, 1); ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); diff --git a/src/main/java/techreborn/items/tools/ItemAdvancedDrill.java b/src/main/java/techreborn/items/tools/ItemAdvancedDrill.java index a1e4c1b77..763f0df64 100644 --- a/src/main/java/techreborn/items/tools/ItemAdvancedDrill.java +++ b/src/main/java/techreborn/items/tools/ItemAdvancedDrill.java @@ -48,7 +48,7 @@ public class ItemAdvancedDrill extends ItemPickaxe implements IElectricItem { @SideOnly(Side.CLIENT) public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){ ItemStack itemStack = new ItemStack(this, 1); - if (getChargedItem(itemStack) == this){ + if (getChargedItem(itemStack) == this && ElectricItem.manager != null){ ItemStack charged = new ItemStack(this, 1); ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); itemList.add(charged); diff --git a/src/main/java/techreborn/items/tools/ItemOmniTool.java b/src/main/java/techreborn/items/tools/ItemOmniTool.java index cdfffe10f..65670ac3e 100644 --- a/src/main/java/techreborn/items/tools/ItemOmniTool.java +++ b/src/main/java/techreborn/items/tools/ItemOmniTool.java @@ -49,7 +49,7 @@ public class ItemOmniTool extends ItemPickaxe implements IElectricItem { public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){ ItemStack itemStack = new ItemStack(this, 1); - if (getChargedItem(itemStack) == this){ + if (getChargedItem(itemStack) == this && ElectricItem.manager != null){ ItemStack charged = new ItemStack(this, 1); ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); diff --git a/src/main/java/techreborn/items/tools/ItemRockCutter.java b/src/main/java/techreborn/items/tools/ItemRockCutter.java index a28ec321c..9d1a5d8f3 100644 --- a/src/main/java/techreborn/items/tools/ItemRockCutter.java +++ b/src/main/java/techreborn/items/tools/ItemRockCutter.java @@ -58,7 +58,7 @@ public class ItemRockCutter extends ItemPickaxe implements IElectricItem { @SideOnly(Side.CLIENT) public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){ ItemStack itemStack = new ItemStack(this, 1); - if (getChargedItem(itemStack) == this){ + if (getChargedItem(itemStack) == this && ElectricItem.manager != null){ ItemStack charged = new ItemStack(this, 1); ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false); diff --git a/src/main/java/techreborn/powerSystem/TilePowerAcceptor.java b/src/main/java/techreborn/powerSystem/TilePowerAcceptor.java index 928335002..09b8ce289 100644 --- a/src/main/java/techreborn/powerSystem/TilePowerAcceptor.java +++ b/src/main/java/techreborn/powerSystem/TilePowerAcceptor.java @@ -156,7 +156,7 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements return 0; } maxReceive *= ConfigTechReborn.euPerRF; - int energyReceived = Math.min(getMaxEnergyStored(ForgeDirection.UNKNOWN) - getEnergyStored(ForgeDirection.UNKNOWN), Math.min((int)this.getMaxInput(), maxReceive)); + int energyReceived = Math.min(getMaxEnergyStored(ForgeDirection.UNKNOWN) - getEnergyStored(ForgeDirection.UNKNOWN), Math.min((int)this.getMaxInput() * ConfigTechReborn.euPerRF, maxReceive)); if (!simulate) { energy += energyReceived;