Implement new computer framework in primary machines

This commit is contained in:
aidancbrady committed 2015-07-20 11:09:44 -07:00
1 parent a062ea5e9e
commit a94c13edc7
7 files changed
+110 -90

No files matched your search

@@ -1,9 +1,5 @@
package mekanism.common.tile;
import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.lua.LuaException;
import dan200.computercraft.api.peripheral.IComputerAccess;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.Range4D;
@@ -226,16 +222,16 @@ public abstract class TileEntityElectricMachine<RECIPE extends BasicMachineRecip
return false;
}
private static final String[] methods = new String[] {"getStored", "getProgress", "isActive", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded"};
@Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames()
public String[] getMethods()
{
return new String[] {"getStored", "getProgress", "isActive", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded"};
return methods;
}
@Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException
public Object[] invoke(int method, Object[] arguments) throws Exception
{
switch(method)
{
@@ -254,7 +250,7 @@ public abstract class TileEntityElectricMachine<RECIPE extends BasicMachineRecip
case 6:
return new Object[] {getMaxEnergy()-getEnergy()};
default:
return new Object[] {"Unknown command."};
throw new NoSuchMethodException();
}
}
}