mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Fixed a minor bug in the coordinate OC compat for launch pads, also removed a feature because it keeps throwing a NullPointerException and I have no clue how to fix it
This commit is contained in:
parent
5e1f3b3134
commit
39e37f0676
@ -4,6 +4,8 @@ import com.hbm.blocks.ModBlocks;
|
|||||||
import com.hbm.blocks.bomb.LaunchPad;
|
import com.hbm.blocks.bomb.LaunchPad;
|
||||||
import com.hbm.inventory.container.ContainerLaunchPadTier1;
|
import com.hbm.inventory.container.ContainerLaunchPadTier1;
|
||||||
import com.hbm.inventory.gui.GUILaunchPadTier1;
|
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.lib.Library;
|
||||||
import com.hbm.packet.AuxElectricityPacket;
|
import com.hbm.packet.AuxElectricityPacket;
|
||||||
import com.hbm.packet.PacketDispatcher;
|
import com.hbm.packet.PacketDispatcher;
|
||||||
@ -298,8 +300,13 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI
|
|||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] getCoords(Context context, Arguments args) {
|
public Object[] getCoords(Context context, Arguments args) {
|
||||||
if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
|
if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
|
||||||
int xCoord2 = slots[1].stackTagCompound.getInteger("xCoord");
|
int xCoord2;
|
||||||
int zCoord2 = slots[1].stackTagCompound.getInteger("zCoord");
|
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
|
// Not sure if i should have this
|
||||||
/*
|
/*
|
||||||
@ -307,7 +314,7 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI
|
|||||||
xCoord2 += 1;
|
xCoord2 += 1;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return new Object[] {xCoord2, zCoord2};
|
return new Object[] {xCoord2, zCoord2};
|
||||||
}
|
}
|
||||||
return new Object[] {false, "Designator not found"};
|
return new Object[] {false, "Designator not found"};
|
||||||
@ -316,9 +323,10 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI
|
|||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] setCoords(Context context, Arguments args) {
|
public Object[] setCoords(Context context, Arguments args) {
|
||||||
if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
|
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("xCoord", args.checkInteger(0));
|
||||||
slots[1].stackTagCompound.setInteger("zCoord", args.checkInteger(1));
|
slots[1].stackTagCompound.setInteger("zCoord", args.checkInteger(1));
|
||||||
|
|
||||||
return new Object[] {true};
|
return new Object[] {true};
|
||||||
}
|
}
|
||||||
return new Object[] {false, "Designator not found"};
|
return new Object[] {false, "Designator not found"};
|
||||||
|
|||||||
@ -645,10 +645,15 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide
|
|||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] getCoords(Context context, Arguments args) {
|
public Object[] getCoords(Context context, Arguments args) {
|
||||||
if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
|
if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
|
||||||
int xCoord2 = slots[1].stackTagCompound.getInteger("xCoord");
|
int xCoord2;
|
||||||
int zCoord2 = slots[1].stackTagCompound.getInteger("zCoord");
|
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) {
|
if(xCoord2 == xCoord && zCoord2 == zCoord) {
|
||||||
xCoord2 += 1;
|
xCoord2 += 1;
|
||||||
@ -663,6 +668,7 @@ public class TileEntityLaunchTable extends TileEntityLoadedBase implements ISide
|
|||||||
@Optional.Method(modid = "OpenComputers")
|
@Optional.Method(modid = "OpenComputers")
|
||||||
public Object[] setCoords(Context context, Arguments args) {
|
public Object[] setCoords(Context context, Arguments args) {
|
||||||
if (slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
|
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("xCoord", args.checkInteger(0));
|
||||||
slots[1].stackTagCompound.setInteger("zCoord", args.checkInteger(1));
|
slots[1].stackTagCompound.setInteger("zCoord", args.checkInteger(1));
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.hbm.tileentity.machine.storage;
|
|||||||
|
|
||||||
import api.hbm.energy.*;
|
import api.hbm.energy.*;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
|
import com.hbm.blocks.bomb.LaunchPad;
|
||||||
import com.hbm.blocks.machine.MachineBattery;
|
import com.hbm.blocks.machine.MachineBattery;
|
||||||
import com.hbm.inventory.container.ContainerMachineBattery;
|
import com.hbm.inventory.container.ContainerMachineBattery;
|
||||||
import com.hbm.inventory.gui.GUIMachineBattery;
|
import com.hbm.inventory.gui.GUIMachineBattery;
|
||||||
@ -394,17 +395,7 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
|
|||||||
// do some opencomputer stuff
|
// do some opencomputer stuff
|
||||||
@Override
|
@Override
|
||||||
public String getComponentName() {
|
public String getComponentName() {
|
||||||
Block block = worldObj.getBlock(xCoord, yCoord, zCoord);
|
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)
|
||||||
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";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(direct = true, limit = 8)
|
@Callback(direct = true, limit = 8)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user