Fixed crashing when ic2 is not installed
This commit is contained in:
parent
d8e8f45993
commit
f433aa706a
9 changed files with 19 additions and 17 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ public class ItemCells extends ItemTR {
|
|||
public static ItemStack getCellByName(String name, int count)
|
||||
{
|
||||
Fluid fluid = FluidRegistry.getFluid("fluid" + name.toLowerCase());
|
||||
if(IC2Items.getItem("FluidCell") != null){
|
||||
if(fluid != null){
|
||||
ItemStack stack = IC2Items.getItem("FluidCell").copy();
|
||||
if(stack != null && stack.getItem() instanceof IFluidContainerItem){
|
||||
|
@ -32,6 +33,7 @@ public class ItemCells extends ItemTR {
|
|||
} else {
|
||||
LogHelper.error("Could not find " + "fluid" + name + " in the fluid registry!");
|
||||
}
|
||||
}
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue