diff --git a/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPad.java b/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPad.java index d6a31650e..e69f71203 100644 --- a/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPad.java +++ b/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchPad.java @@ -4,6 +4,8 @@ import com.hbm.blocks.ModBlocks; import com.hbm.blocks.bomb.LaunchPad; import com.hbm.inventory.container.ContainerLaunchPadTier1; import com.hbm.inventory.gui.GUILaunchPadTier1; +import com.hbm.items.ModItems; +import com.hbm.items.tool.ItemDesingator; import com.hbm.lib.Library; import com.hbm.packet.AuxElectricityPacket; import com.hbm.packet.PacketDispatcher; @@ -298,8 +300,13 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI @Optional.Method(modid = "OpenComputers") public Object[] getCoords(Context context, Arguments args) { if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) { - int xCoord2 = slots[1].stackTagCompound.getInteger("xCoord"); - int zCoord2 = slots[1].stackTagCompound.getInteger("zCoord"); + int xCoord2; + int zCoord2; + if (slots[1].stackTagCompound != null) { + xCoord2 = slots[1].stackTagCompound.getInteger("xCoord"); + zCoord2 = slots[1].stackTagCompound.getInteger("zCoord"); + } else + return new Object[] {false}; // Not sure if i should have this /* @@ -307,7 +314,7 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI xCoord2 += 1; } */ - + return new Object[] {xCoord2, zCoord2}; } return new Object[] {false, "Designator not found"}; @@ -316,9 +323,10 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI @Optional.Method(modid = "OpenComputers") public Object[] setCoords(Context context, Arguments args) { if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) { + slots[1].stackTagCompound = new NBTTagCompound(); slots[1].stackTagCompound.setInteger("xCoord", args.checkInteger(0)); slots[1].stackTagCompound.setInteger("zCoord", args.checkInteger(1)); - + return new Object[] {true}; } return new Object[] {false, "Designator not found"}; diff --git a/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchTable.java b/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchTable.java index 748d63c6c..fa1018dc7 100644 --- a/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchTable.java +++ b/src/main/java/com/hbm/tileentity/bomb/TileEntityLaunchTable.java @@ -645,10 +645,15 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide @Optional.Method(modid = "OpenComputers") public Object[] getCoords(Context context, Arguments args) { if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) { - int xCoord2 = slots[1].stackTagCompound.getInteger("xCoord"); - int zCoord2 = slots[1].stackTagCompound.getInteger("zCoord"); + int xCoord2; + int zCoord2; + if (slots[1].stackTagCompound != null) { + xCoord2 = slots[1].stackTagCompound.getInteger("xCoord"); + zCoord2 = slots[1].stackTagCompound.getInteger("zCoord"); + } else + return new Object[] {false}; - //unsure if this is needed, leaving here in case it is + // Not sure if i should have this /* if(xCoord2 == xCoord && zCoord2 == zCoord) { xCoord2 += 1; @@ -663,6 +668,7 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide @Optional.Method(modid = "OpenComputers") public Object[] setCoords(Context context, Arguments args) { if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) { + slots[1].stackTagCompound = new NBTTagCompound(); slots[1].stackTagCompound.setInteger("xCoord", args.checkInteger(0)); slots[1].stackTagCompound.setInteger("zCoord", args.checkInteger(1)); diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineBattery.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineBattery.java index 15e321eec..2d05bbf25 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineBattery.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineBattery.java @@ -2,6 +2,7 @@ package com.hbm.tileentity.machine.storage; import api.hbm.energy.*; import com.hbm.blocks.ModBlocks; +import com.hbm.blocks.bomb.LaunchPad; import com.hbm.blocks.machine.MachineBattery; import com.hbm.inventory.container.ContainerMachineBattery; import com.hbm.inventory.gui.GUIMachineBattery; @@ -394,17 +395,7 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I // do some opencomputer stuff @Override public String getComponentName() { - Block block = worldObj.getBlock(xCoord, yCoord, zCoord); - if (block.equals(ModBlocks.machine_battery_potato)) { - return "ntm_energy_storage_potato"; - } else if (block.equals(ModBlocks.machine_lithium_battery)) { - return "ntm_energy_storage_lithium"; - } else if (block.equals(ModBlocks.machine_schrabidium_battery)) { - return "ntm_energy_storage_schrabidum"; - } else if (block.equals(ModBlocks.machine_dineutronium_battery)) { - return "ntm_energy_storage_dineutronium"; - } else - return "ntm_energy_storage"; + return "ntm_energy_storage"; //ok if someone else can figure out how to do this that'd be nice (change the component name based on the type of storage block) } @Callback(direct = true, limit = 8)