More ComputerCraft cleanup

This commit is contained in:
LemADEC 2014-10-05 23:25:13 +02:00
parent 1b1a57a790
commit 9453c88e21
4 changed files with 29 additions and 10 deletions

View file

@ -54,7 +54,20 @@ import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
@Mod(modid = "WarpDrive", name = "WarpDrive", version = "1.2.7.0",
dependencies = "required-after:IC2; after:ComputerCraft; after:OpenComputer; after:CCTurtle; after:gregtech_addon; required-after:AppliedEnergistics; after:AdvancedSolarPanel; after:AtomicScience; after:ICBM|Explosion; after:MFFS; after:GraviSuite; after:UndergroundBiomes; after:NetherOres")
dependencies = "required-after:IC2;"
+ " required-after:CoFHCore;"
+ " after:ComputerCraft;"
+ " after:OpenComputer;"
+ " after:CCTurtle;"
+ " after:gregtech_addon;"
+ " required-after:AppliedEnergistics;"
+ " after:AdvancedSolarPanel;"
+ " after:AtomicScience;"
+ " after:ICBM|Explosion;"
+ " after:MFFS;"
+ " after:GraviSuite;"
+ " after:UndergroundBiomes;"
+ " after:NetherOres")
@NetworkMod(clientSideRequired = true, serverSideRequired = true, channels = {
"WarpDriveBeam",
"WarpDriveFreq",
@ -117,7 +130,7 @@ public class WarpDrive implements LoadingCallback {
public int overlayType = 0;
public String debugMessage = "";
public static WarpDrivePeripheralHandler peripheralHandler = new WarpDrivePeripheralHandler();
public static WarpDrivePeripheralHandler peripheralHandler = null;
public static String defHelpStr = "help(\"functionName\"): returns help for the function specified";
public static String defEnergyStr = "getEnergyLevel(): returns currently contained energy, max contained energy";
@ -290,7 +303,10 @@ public class WarpDrive implements LoadingCallback {
MinecraftForge.EVENT_BUS.register(new CameraOverlay(Minecraft.getMinecraft()));
}
ComputerCraftAPI.registerPeripheralProvider(peripheralHandler);
if (WarpDriveConfig.isCCLoaded) {
peripheralHandler = new WarpDrivePeripheralHandler();
ComputerCraftAPI.registerPeripheralProvider(peripheralHandler);
}
}
@EventHandler
@ -444,7 +460,7 @@ public class WarpDrive implements LoadingCallback {
// top = advancedCircuit, floppy, advancedCircuit
// middle = advancedCircuit, advancedMachine, advancedCircuit
// bottom = advancedCircuit, flux crystal, advancedCircuit
// bottom = advancedCircuit, fluix crystal, advancedCircuit
GameRegistry.addRecipe(new ItemStack(protocolBlock), "coc", "cmc", "cfc",
'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'c', WarpDriveConfig.getIC2Item("advancedCircuit"),

View file

@ -220,22 +220,22 @@ public class TileEntityLift extends WarpEnergyTE {
// ComputerCraft IPeripheral methods implementation
@Override
@Optional.Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] args) throws Exception {
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
String methodName = methodsArray[method];
if (methodName.equals("getEnergyLevel")) {
return getEnergyLevel();
} else if (methodName.equals("mode")) {
return mode(args);
return mode(arguments);
} else if (methodName.equals("active")) {
if (args.length == 1) {
computerEnabled = toBool(args[0]);
if (arguments.length == 1) {
computerEnabled = toBool(arguments);
}
return new Object[] { computerEnabled ? false : isEnabled };
} else if (methodName.equals("help")) {
return new Object[] { helpStr(args) };
return new Object[] { helpStr(arguments) };
}
return null;
}

View file

@ -745,6 +745,7 @@ public class TileEntityMiningLaser extends WarpInterfacedTE implements IGridMach
// ComputerCraft IPeripheral methods implementation
@Override
@Optional.Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {
super.attach(computer);
if (WarpDriveConfig.G_LUA_SCRIPTS != WarpDriveConfig.LUA_SCRIPTS_NONE) {

View file

@ -145,6 +145,7 @@ public class TileEntityRadar extends WarpEnergyTE {
// ComputerCraft IPeripheral methods implementation
@Override
@Optional.Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {
super.attach(computer);
if (WarpDriveConfig.G_LUA_SCRIPTS != WarpDriveConfig.LUA_SCRIPTS_NONE) {
@ -161,6 +162,7 @@ public class TileEntityRadar extends WarpEnergyTE {
}
@Override
@Optional.Method(modid = "ComputerCraft")
public void detach(IComputerAccess computer) {
super.detach(computer);
// worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 1 + 2);