Refactored reactor core in WarpInterfacedTE
Also fixing a CC dependency at boot
This commit is contained in:
parent
e64fe092fa
commit
9438fe5905
1 changed files with 13 additions and 26 deletions
|
@ -1,5 +1,9 @@
|
|||
package cr0s.warpdrive.machines;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Arrays;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
@ -11,7 +15,7 @@ import dan200.computercraft.api.lua.ILuaContext;
|
|||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
|
||||
public class TileEntityPowerLaser extends TileEntityAbstractLaser implements IPeripheral, IBlockUpdateDetector {
|
||||
public class TileEntityPowerLaser extends TileEntityAbstractLaser implements IBlockUpdateDetector {
|
||||
Vector3 myVec;
|
||||
Vector3 reactorVec;
|
||||
ForgeDirection side = ForgeDirection.UNKNOWN;
|
||||
|
@ -21,7 +25,10 @@ public class TileEntityPowerLaser extends TileEntityAbstractLaser implements IPe
|
|||
boolean useLaser = false;
|
||||
boolean doOnce = false;
|
||||
|
||||
String[] methodArray = { "energy", "hasReactor", "side", "sendLaser", "help" };
|
||||
public TileEntityPowerLaser() {
|
||||
methodsArray = new String[] { "energy", "hasReactor", "side", "sendLaser", "help" };
|
||||
peripheralName = "warpdriveReactorLaser";
|
||||
}
|
||||
|
||||
public TileEntityPowerReactor scanForReactor() {
|
||||
reactor = null;
|
||||
|
@ -144,16 +151,6 @@ public class TileEntityPowerLaser extends TileEntityAbstractLaser implements IPe
|
|||
super.readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "warpdriveReactorLaser";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
return methodArray;
|
||||
}
|
||||
|
||||
private static String helpStr(Object[] args) {
|
||||
if (args.length > 0) {
|
||||
String arg = args[0].toString().toLowerCase();
|
||||
|
@ -170,9 +167,11 @@ public class TileEntityPowerLaser extends TileEntityAbstractLaser implements IPe
|
|||
return WarpDrive.defHelpStr;
|
||||
}
|
||||
|
||||
// ComputerCraft methods
|
||||
@Override
|
||||
@Optional.Method(modid = "ComputerCraft")
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) {
|
||||
String methodName = methodArray[method];
|
||||
String methodName = methodsArray[method];
|
||||
if (methodName.equals("energy")) {
|
||||
scanForBooster();
|
||||
if (booster == null) {
|
||||
|
@ -194,19 +193,7 @@ public class TileEntityPowerLaser extends TileEntityAbstractLaser implements IPe
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attach(IComputerAccess computer) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach(IComputerAccess computer) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(IPeripheral other) {
|
||||
return other == this;
|
||||
}
|
||||
|
||||
// IC2 methods
|
||||
@Override
|
||||
public int getSinkTier() {
|
||||
// TODO Auto-generated method stub
|
||||
|
|
Loading…
Reference in a new issue