Cleaner CC support with a separate peripheral handler

This commit is contained in:
aidancbrady committed 2015-07-20 12:28:18 -07:00
1 parent 728e497dd1
commit c7fe1f86eb
18 files changed
+132 -654

No files matched your search

@@ -1,10 +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 dan200.computercraft.api.peripheral.IPeripheral;
import io.netty.buffer.ByteBuf;
import mekanism.api.Coord4D;
import mekanism.api.MekanismConfig.general;
@@ -226,54 +221,12 @@ public abstract class TileEntityBasicMachine<INPUT extends MachineInput<INPUT>,
}
}
@Override
@Method(modid = "ComputerCraft")
public String getType()
{
return getInventoryName();
}
@Override
@Method(modid = "ComputerCraft")
public boolean equals(IPeripheral other)
{
return this == other;
}
@Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames()
{
return getMethods();
}
@Override
@Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException
{
try {
return invoke(method, arguments);
} catch(NoSuchMethodException e) {
return new Object[] {"Unknown command."};
} finally {
return new Object[] {"Error."};
}
}
@Override
public boolean canSetFacing(int facing)
{
return facing != 0 && facing != 1;
}
@Override
@Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {}
@Override
@Method(modid = "ComputerCraft")
public void detach(IComputerAccess computer) {}
@Override
public int[] getAccessibleSlotsFromSide(int side)
{