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,19 +1,9 @@
package mekanism.common.tile;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.Map;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.MekanismConfig.usage;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasRegistry;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
import mekanism.api.gas.IGasHandler;
import mekanism.api.gas.ITubeConnection;
import mekanism.api.gas.*;
import mekanism.api.transmitters.TransmissionType;
import mekanism.common.SideData;
import mekanism.common.Upgrade;
@@ -34,19 +24,12 @@ import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
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 net.minecraftforge.fluids.*;
import java.util.ArrayList;
import java.util.Map;
public class TileEntityPRC extends TileEntityBasicMachine<PressurizedInput, PressurizedOutput, PressurizedRecipe> implements IFluidHandler, IGasHandler, ITubeConnection, ISustainedData, ITankManager
{
@@ -310,18 +293,40 @@ public class TileEntityPRC extends TileEntityBasicMachine<PressurizedInput, Pres
return null;
}
private static final String[] methods = new String[] {"getStored", "getProgress", "isActive", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded", "getFluidStored", "getGasStored"};
@Override
@Method(modid = "ComputerCraft")
public String[] getMethodNames()
public String[] getMethods()
{
return null;
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
{
return null;
switch(method)
{
case 0:
return new Object[] {getEnergy()};
case 1:
return new Object[] {operatingTicks};
case 2:
return new Object[] {isActive};
case 3:
return new Object[] {facing};
case 4:
return new Object[] {canOperate(getRecipe())};
case 5:
return new Object[] {getMaxEnergy()};
case 6:
return new Object[] {getMaxEnergy()-getEnergy()};
case 7:
return new Object[] {inputFluidTank.getFluidAmount()};
case 8:
return new Object[] {inputGasTank.getStored()};
default:
throw new NoSuchMethodException();
}
}
@Override