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 (mc.inGameHasFocus || (mc.currentScreen != null && mc.gameSettings.showDebugInfo))
|
||||||
{
|
{
|
||||||
if (ConfigTechReborn.ShowChargeHud)
|
if (ConfigTechReborn.ShowChargeHud && ElectricItem.manager != null)
|
||||||
drawChargeHud(event.resolution);
|
drawChargeHud(event.resolution);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ public class ItemCells extends ItemTR {
|
||||||
public static ItemStack getCellByName(String name, int count)
|
public static ItemStack getCellByName(String name, int count)
|
||||||
{
|
{
|
||||||
Fluid fluid = FluidRegistry.getFluid("fluid" + name.toLowerCase());
|
Fluid fluid = FluidRegistry.getFluid("fluid" + name.toLowerCase());
|
||||||
|
if(IC2Items.getItem("FluidCell") != null){
|
||||||
if(fluid != null){
|
if(fluid != null){
|
||||||
ItemStack stack = IC2Items.getItem("FluidCell").copy();
|
ItemStack stack = IC2Items.getItem("FluidCell").copy();
|
||||||
if(stack != null && stack.getItem() instanceof IFluidContainerItem){
|
if(stack != null && stack.getItem() instanceof IFluidContainerItem){
|
||||||
|
@ -32,6 +33,7 @@ public class ItemCells extends ItemTR {
|
||||||
} else {
|
} else {
|
||||||
LogHelper.error("Could not find " + "fluid" + name + " in the fluid registry!");
|
LogHelper.error("Could not find " + "fluid" + name + " in the fluid registry!");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
int index = -1;
|
int index = -1;
|
||||||
for (int i = 0; i < types.length; i++) {
|
for (int i = 0; i < types.length; i++) {
|
||||||
if (types[i].equals(name)) {
|
if (types[i].equals(name)) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class ItemLapotronicOrb extends Item implements IElectricItem {
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
|
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
|
||||||
ItemStack itemStack = new ItemStack(this, 1);
|
ItemStack itemStack = new ItemStack(this, 1);
|
||||||
if (getChargedItem(itemStack) == this){
|
if (getChargedItem(itemStack) == this && ElectricItem.manager != null){
|
||||||
ItemStack charged = new ItemStack(this, 1);
|
ItemStack charged = new ItemStack(this, 1);
|
||||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
|
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
|
||||||
false);
|
false);
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class ItemLapotronPack extends ItemArmor implements IElectricItem {
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
|
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
|
||||||
ItemStack itemStack = new ItemStack(this, 1);
|
ItemStack itemStack = new ItemStack(this, 1);
|
||||||
if (getChargedItem(itemStack) == this){
|
if (getChargedItem(itemStack) == this && ElectricItem.manager != null){
|
||||||
ItemStack charged = new ItemStack(this, 1);
|
ItemStack charged = new ItemStack(this, 1);
|
||||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
|
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
|
||||||
itemList.add(charged);
|
itemList.add(charged);
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class ItemLithiumBatpack extends ItemArmor implements IElectricItem {
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
|
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
|
||||||
ItemStack itemStack = new ItemStack(this, 1);
|
ItemStack itemStack = new ItemStack(this, 1);
|
||||||
if (getChargedItem(itemStack) == this){
|
if (getChargedItem(itemStack) == this && ElectricItem.manager != null){
|
||||||
ItemStack charged = new ItemStack(this, 1);
|
ItemStack charged = new ItemStack(this, 1);
|
||||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
|
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
|
||||||
false);
|
false);
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class ItemAdvancedDrill extends ItemPickaxe implements IElectricItem {
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
|
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
|
||||||
ItemStack itemStack = new ItemStack(this, 1);
|
ItemStack itemStack = new ItemStack(this, 1);
|
||||||
if (getChargedItem(itemStack) == this){
|
if (getChargedItem(itemStack) == this && ElectricItem.manager != null){
|
||||||
ItemStack charged = new ItemStack(this, 1);
|
ItemStack charged = new ItemStack(this, 1);
|
||||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
|
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
|
||||||
itemList.add(charged);
|
itemList.add(charged);
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class ItemOmniTool extends ItemPickaxe implements IElectricItem {
|
||||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
|
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
|
||||||
ItemStack itemStack = new ItemStack(this, 1);
|
ItemStack itemStack = new ItemStack(this, 1);
|
||||||
|
|
||||||
if (getChargedItem(itemStack) == this){
|
if (getChargedItem(itemStack) == this && ElectricItem.manager != null){
|
||||||
ItemStack charged = new ItemStack(this, 1);
|
ItemStack charged = new ItemStack(this, 1);
|
||||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
|
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
|
||||||
false);
|
false);
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class ItemRockCutter extends ItemPickaxe implements IElectricItem {
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
|
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList){
|
||||||
ItemStack itemStack = new ItemStack(this, 1);
|
ItemStack itemStack = new ItemStack(this, 1);
|
||||||
if (getChargedItem(itemStack) == this){
|
if (getChargedItem(itemStack) == this && ElectricItem.manager != null){
|
||||||
ItemStack charged = new ItemStack(this, 1);
|
ItemStack charged = new ItemStack(this, 1);
|
||||||
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
|
ElectricItem.manager.charge(charged, 2147483647, 2147483647, true,
|
||||||
false);
|
false);
|
||||||
|
|
|
@ -156,7 +156,7 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
maxReceive *= ConfigTechReborn.euPerRF;
|
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) {
|
if (!simulate) {
|
||||||
energy += energyReceived;
|
energy += energyReceived;
|
||||||
|
|
Loading…
Reference in a new issue