Cleaner CC support with a separate peripheral handler
This commit is contained in:
parent
728e497dd1
commit
c7fe1f86eb
18 changed files with 132 additions and 654 deletions
|
@ -1,10 +1,15 @@
|
||||||
package mekanism.common.block;
|
package mekanism.common.block;
|
||||||
|
|
||||||
import java.util.Random;
|
import cpw.mods.fml.common.Optional.Interface;
|
||||||
|
import cpw.mods.fml.common.Optional.Method;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||||
|
import dan200.computercraft.api.peripheral.IPeripheralProvider;
|
||||||
|
import mekanism.common.integration.CCPeripheral;
|
||||||
|
import mekanism.common.integration.IComputerIntegration;
|
||||||
import mekanism.common.tile.TileEntityAdvancedBoundingBlock;
|
import mekanism.common.tile.TileEntityAdvancedBoundingBlock;
|
||||||
import mekanism.common.tile.TileEntityBoundingBlock;
|
import mekanism.common.tile.TileEntityBoundingBlock;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
@ -14,13 +19,8 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import cpw.mods.fml.common.Optional.Interface;
|
|
||||||
import cpw.mods.fml.common.Optional.Method;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
import java.util.Random;
|
||||||
import dan200.computercraft.api.peripheral.IPeripheralProvider;
|
|
||||||
|
|
||||||
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheralProvider", modid = "ComputerCraft")
|
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheralProvider", modid = "ComputerCraft")
|
||||||
public class BlockBounding extends Block implements IPeripheralProvider
|
public class BlockBounding extends Block implements IPeripheralProvider
|
||||||
|
@ -139,9 +139,9 @@ public class BlockBounding extends Block implements IPeripheralProvider
|
||||||
{
|
{
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(te != null && te instanceof IPeripheral)
|
if(te != null && te instanceof IComputerIntegration)
|
||||||
{
|
{
|
||||||
return (IPeripheral)te;
|
return new CCPeripheral((IComputerIntegration)te);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
package mekanism.common.block;
|
package mekanism.common.block;
|
||||||
|
|
||||||
import java.util.List;
|
import buildcraft.api.tools.IToolWrench;
|
||||||
import java.util.Random;
|
import cpw.mods.fml.common.Optional.Interface;
|
||||||
|
import cpw.mods.fml.common.Optional.Method;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||||
|
import dan200.computercraft.api.peripheral.IPeripheralProvider;
|
||||||
import mekanism.api.energy.IEnergizedItem;
|
import mekanism.api.energy.IEnergizedItem;
|
||||||
import mekanism.common.ItemAttacher;
|
import mekanism.common.ItemAttacher;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.Mekanism;
|
||||||
|
@ -10,12 +14,12 @@ import mekanism.common.MekanismBlocks;
|
||||||
import mekanism.common.Tier.EnergyCubeTier;
|
import mekanism.common.Tier.EnergyCubeTier;
|
||||||
import mekanism.common.base.IEnergyCube;
|
import mekanism.common.base.IEnergyCube;
|
||||||
import mekanism.common.base.ISustainedInventory;
|
import mekanism.common.base.ISustainedInventory;
|
||||||
|
import mekanism.common.integration.CCPeripheral;
|
||||||
|
import mekanism.common.integration.IComputerIntegration;
|
||||||
import mekanism.common.item.ItemBlockEnergyCube;
|
import mekanism.common.item.ItemBlockEnergyCube;
|
||||||
import mekanism.common.tile.TileEntityBasicBlock;
|
import mekanism.common.tile.TileEntityBasicBlock;
|
||||||
import mekanism.common.tile.TileEntityElectricBlock;
|
|
||||||
import mekanism.common.tile.TileEntityEnergyCube;
|
import mekanism.common.tile.TileEntityEnergyCube;
|
||||||
import mekanism.common.util.MekanismUtils;
|
import mekanism.common.util.MekanismUtils;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -27,21 +31,14 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import cpw.mods.fml.common.ModAPIManager;
|
|
||||||
import cpw.mods.fml.common.Optional.Interface;
|
|
||||||
import cpw.mods.fml.common.Optional.Method;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
import buildcraft.api.tools.IToolWrench;
|
import java.util.List;
|
||||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
import java.util.Random;
|
||||||
import dan200.computercraft.api.peripheral.IPeripheralProvider;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block class for handling multiple energy cube block IDs.
|
* Block class for handling multiple energy cube block IDs.
|
||||||
|
@ -341,9 +338,9 @@ public class BlockEnergyCube extends BlockContainer implements IPeripheralProvid
|
||||||
{
|
{
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(te != null && te instanceof IPeripheral)
|
if(te != null && te instanceof IComputerIntegration)
|
||||||
{
|
{
|
||||||
return (IPeripheral)te;
|
return new CCPeripheral((IComputerIntegration)te);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -25,6 +25,8 @@ import mekanism.common.MekanismBlocks;
|
||||||
import mekanism.common.Tier.BaseTier;
|
import mekanism.common.Tier.BaseTier;
|
||||||
import mekanism.common.base.*;
|
import mekanism.common.base.*;
|
||||||
import mekanism.common.base.IFactory.RecipeType;
|
import mekanism.common.base.IFactory.RecipeType;
|
||||||
|
import mekanism.common.integration.CCPeripheral;
|
||||||
|
import mekanism.common.integration.IComputerIntegration;
|
||||||
import mekanism.common.item.ItemBlockMachine;
|
import mekanism.common.item.ItemBlockMachine;
|
||||||
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
|
import mekanism.common.network.PacketElectricChest.ElectricChestMessage;
|
||||||
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
|
import mekanism.common.network.PacketElectricChest.ElectricChestPacketType;
|
||||||
|
@ -1302,9 +1304,9 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
||||||
{
|
{
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(te != null && te instanceof IPeripheral)
|
if(te != null && te instanceof IComputerIntegration)
|
||||||
{
|
{
|
||||||
return (IPeripheral)te;
|
return new CCPeripheral((IComputerIntegration)te);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
62
src/main/java/mekanism/common/integration/CCPeripheral.java
Normal file
62
src/main/java/mekanism/common/integration/CCPeripheral.java
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
package mekanism.common.integration;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
|
import dan200.computercraft.api.lua.ILuaContext;
|
||||||
|
import dan200.computercraft.api.lua.LuaException;
|
||||||
|
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||||
|
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by aidancbrady on 7/20/15.
|
||||||
|
*/
|
||||||
|
public class CCPeripheral implements IPeripheral
|
||||||
|
{
|
||||||
|
public IComputerIntegration computerTile;
|
||||||
|
|
||||||
|
public CCPeripheral(IComputerIntegration tile)
|
||||||
|
{
|
||||||
|
computerTile = tile;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "ComputerCraft")
|
||||||
|
public String getType()
|
||||||
|
{
|
||||||
|
return computerTile.getInventoryName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "ComputerCraft")
|
||||||
|
public String[] getMethodNames()
|
||||||
|
{
|
||||||
|
return computerTile.getMethods();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "ComputerCraft")
|
||||||
|
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return computerTile.invoke(method, arguments);
|
||||||
|
} catch(NoSuchMethodException e) {
|
||||||
|
return new Object[] {"Unknown command."};
|
||||||
|
} finally {
|
||||||
|
return new Object[] {"Error."};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "ComputerCraft")
|
||||||
|
public void attach(IComputerAccess computer) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "ComputerCraft")
|
||||||
|
public void detach(IComputerAccess computer) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Optional.Method(modid = "ComputerCraft")
|
||||||
|
public boolean equals(IPeripheral other)
|
||||||
|
{
|
||||||
|
return this == other;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +1,11 @@
|
||||||
package mekanism.common.integration;
|
package mekanism.common.integration;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Optional;
|
|
||||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by aidancbrady on 7/20/15.
|
* Created by aidancbrady on 7/20/15.
|
||||||
*/
|
*/
|
||||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
public interface IComputerIntegration extends IInventory
|
||||||
public interface IComputerIntegration extends IInventory, IPeripheral
|
|
||||||
{
|
{
|
||||||
public String[] getMethods();
|
public String[] getMethods();
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,6 @@ import cofh.api.energy.IEnergyHandler;
|
||||||
import cpw.mods.fml.common.Optional.Interface;
|
import cpw.mods.fml.common.Optional.Interface;
|
||||||
import cpw.mods.fml.common.Optional.InterfaceList;
|
import cpw.mods.fml.common.Optional.InterfaceList;
|
||||||
import cpw.mods.fml.common.Optional.Method;
|
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 ic2.api.energy.tile.IEnergySink;
|
import ic2.api.energy.tile.IEnergySink;
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
import mekanism.api.IFilterAccess;
|
import mekanism.api.IFilterAccess;
|
||||||
|
@ -391,38 +387,6 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public String getType()
|
|
||||||
{
|
|
||||||
if(getInv() == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return getInv().getType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@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
|
@Override
|
||||||
public String[] getMethods()
|
public String[] getMethods()
|
||||||
{
|
{
|
||||||
|
@ -445,37 +409,6 @@ public class TileEntityAdvancedBoundingBlock extends TileEntityBoundingBlock imp
|
||||||
return getInv().invoke(method, arguments);
|
return getInv().invoke(method, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void attach(IComputerAccess computer)
|
|
||||||
{
|
|
||||||
if(getInv() == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
getInv().attach(computer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void detach(IComputerAccess computer)
|
|
||||||
{
|
|
||||||
if(getInv() == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
getInv().detach(computer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public boolean equals(IPeripheral other)
|
|
||||||
{
|
|
||||||
return this == other;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound getFilterData(NBTTagCompound nbtTags)
|
public NBTTagCompound getFilterData(NBTTagCompound nbtTags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package mekanism.common.tile;
|
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 io.netty.buffer.ByteBuf;
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
import mekanism.api.MekanismConfig.general;
|
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
|
@Override
|
||||||
public boolean canSetFacing(int facing)
|
public boolean canSetFacing(int facing)
|
||||||
{
|
{
|
||||||
return facing != 0 && facing != 1;
|
return facing != 0 && facing != 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void attach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void detach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] getAccessibleSlotsFromSide(int side)
|
public int[] getAccessibleSlotsFromSide(int side)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
package mekanism.common.tile;
|
package mekanism.common.tile;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Optional.Method;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
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 io.netty.buffer.ByteBuf;
|
||||||
import mekanism.api.Chunk3D;
|
import mekanism.api.Chunk3D;
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
|
@ -1229,33 +1224,6 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||||
numPowering--;
|
numPowering--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public String getType()
|
|
||||||
{
|
|
||||||
return getInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@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."};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] methods = {"setRadius", "setMin", "setMax", "addFilter", "removeFilter", "addOreFilter", "removeOreFilter", "reset", "start", "stop"};
|
public String[] methods = {"setRadius", "setMin", "setMax", "addFilter", "removeFilter", "addOreFilter", "removeOreFilter", "reset", "start", "stop"};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1378,21 +1346,6 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public boolean equals(IPeripheral other)
|
|
||||||
{
|
|
||||||
return this == other;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void attach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void detach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound getFilterData(NBTTagCompound nbtTags)
|
public NBTTagCompound getFilterData(NBTTagCompound nbtTags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package mekanism.common.tile;
|
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 io.netty.buffer.ByteBuf;
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
import mekanism.api.EnumColor;
|
import mekanism.api.EnumColor;
|
||||||
|
@ -512,33 +507,6 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
|
||||||
return new Object[] {fluidTank};
|
return new Object[] {fluidTank};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public String getType()
|
|
||||||
{
|
|
||||||
return getInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@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."};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final String[] methods = new String[] {"reset"};
|
private static final String[] methods = new String[] {"reset"};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -559,19 +527,4 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
|
||||||
throw new NoSuchMethodException();
|
throw new NoSuchMethodException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void attach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void detach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public boolean equals(IPeripheral other)
|
|
||||||
{
|
|
||||||
return this == other;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package mekanism.common.tile;
|
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 io.netty.buffer.ByteBuf;
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
import mekanism.api.Range4D;
|
import mekanism.api.Range4D;
|
||||||
|
@ -532,33 +527,6 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
||||||
nbtTags.setInteger("dumpRight", dumpRight.ordinal());
|
nbtTags.setInteger("dumpRight", dumpRight.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public String getType()
|
|
||||||
{
|
|
||||||
return getInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@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."};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final String[] methods = new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded", "getWater", "getWaterNeeded", "getHydrogen", "getHydrogenNeeded", "getOxygen", "getOxygenNeeded"};
|
private static final String[] methods = new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded", "getWater", "getWaterNeeded", "getHydrogen", "getHydrogenNeeded", "getOxygen", "getOxygenNeeded"};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -597,21 +565,6 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public boolean equals(IPeripheral other)
|
|
||||||
{
|
|
||||||
return this == other;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void attach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void detach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTubeConnect(ForgeDirection side)
|
public boolean canTubeConnect(ForgeDirection side)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package mekanism.common.tile;
|
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 io.netty.buffer.ByteBuf;
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
import mekanism.api.Range4D;
|
import mekanism.api.Range4D;
|
||||||
|
@ -150,33 +145,6 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements ICo
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public String getType()
|
|
||||||
{
|
|
||||||
return getInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@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."};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final String[] methods = new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded"};
|
private static final String[] methods = new String[] {"getStored", "getOutput", "getMaxEnergy", "getEnergyNeeded"};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -203,21 +171,6 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements ICo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public boolean equals(IPeripheral other)
|
|
||||||
{
|
|
||||||
return this == other;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void attach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void detach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handlePacketData(ByteBuf dataStream)
|
public void handlePacketData(ByteBuf dataStream)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
package mekanism.common.tile;
|
package mekanism.common.tile;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Optional.Method;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
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 io.netty.buffer.ByteBuf;
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
import mekanism.api.EnumColor;
|
import mekanism.api.EnumColor;
|
||||||
|
@ -782,33 +777,6 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
|
||||||
return tier.getBaseTier().getLocalizedName() + " " + recipeType.getLocalizedName() + " " + super.getInventoryName();
|
return tier.getBaseTier().getLocalizedName() + " " + recipeType.getLocalizedName() + " " + super.getInventoryName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public String getType()
|
|
||||||
{
|
|
||||||
return getInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@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."};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final String[] methods = new String[] {"getStored", "getProgress", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded"};
|
private static final String[] methods = new String[] {"getStored", "getProgress", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded"};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -869,21 +837,6 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void attach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void detach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public boolean equals(IPeripheral other)
|
|
||||||
{
|
|
||||||
return this == other;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setActive(boolean active)
|
public void setActive(boolean active)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package mekanism.common.tile;
|
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 io.netty.buffer.ByteBuf;
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
import mekanism.api.EnumColor;
|
import mekanism.api.EnumColor;
|
||||||
|
@ -503,33 +498,6 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public String getType()
|
|
||||||
{
|
|
||||||
return getInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@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."};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final String[] methods = new String[] {"reset"};
|
private static final String[] methods = new String[] {"reset"};
|
||||||
|
|
||||||
|
@ -541,32 +509,17 @@ public class TileEntityFluidicPlenisher extends TileEntityElectricBlock implemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] invoke(int method, Object[] arguments) throws Exception
|
public Object[] invoke(int method, Object[] arguments) throws Exception
|
||||||
{
|
{
|
||||||
switch(method)
|
switch(method)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
activeNodes.clear();
|
activeNodes.clear();
|
||||||
usedNodes.clear();
|
usedNodes.clear();
|
||||||
finishedCalc = false;
|
finishedCalc = false;
|
||||||
|
|
||||||
return new Object[] {"Plenisher calculation reset."};
|
|
||||||
default:
|
|
||||||
throw new NoSuchMethodException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
return new Object[]{"Plenisher calculation reset."};
|
||||||
@Method(modid = "ComputerCraft")
|
default:
|
||||||
public void attach(IComputerAccess computer) {}
|
throw new NoSuchMethodException();
|
||||||
|
}
|
||||||
@Override
|
}
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void detach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public boolean equals(IPeripheral other)
|
|
||||||
{
|
|
||||||
return this == other;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package mekanism.common.tile;
|
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 io.netty.buffer.ByteBuf;
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
import mekanism.api.MekanismConfig.general;
|
import mekanism.api.MekanismConfig.general;
|
||||||
|
@ -314,33 +309,6 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
||||||
{
|
{
|
||||||
return MAX_ENERGY;
|
return MAX_ENERGY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public String getType()
|
|
||||||
{
|
|
||||||
return getInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@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."};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final String[] methods = new String[] {"getStored", "getMaxEnergy"};
|
private static final String[] methods = new String[] {"getStored", "getMaxEnergy"};
|
||||||
|
|
||||||
|
@ -363,19 +331,4 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement
|
||||||
throw new NoSuchMethodException();
|
throw new NoSuchMethodException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void attach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void detach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public boolean equals(IPeripheral other)
|
|
||||||
{
|
|
||||||
return this == other;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package mekanism.common.tile;
|
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 io.netty.buffer.ByteBuf;
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
import mekanism.api.EnumColor;
|
import mekanism.api.EnumColor;
|
||||||
|
@ -364,33 +359,6 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public String getType()
|
|
||||||
{
|
|
||||||
return getInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@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."};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final String[] methods = new String[] {"getStored", "getProgress", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded", "getInfuse", "getInfuseNeeded"};
|
private static final String[] methods = new String[] {"getStored", "getProgress", "facing", "canOperate", "getMaxEnergy", "getEnergyNeeded", "getInfuse", "getInfuseNeeded"};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -425,21 +393,6 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public boolean equals(IPeripheral other)
|
|
||||||
{
|
|
||||||
return this == other;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void attach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void detach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] getAccessibleSlotsFromSide(int side)
|
public int[] getAccessibleSlotsFromSide(int side)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
package mekanism.common.tile;
|
package mekanism.common.tile;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import mekanism.api.Chunk3D;
|
import mekanism.api.Chunk3D;
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.Mekanism;
|
||||||
|
@ -17,6 +13,7 @@ import mekanism.common.block.BlockMachine.MachineType;
|
||||||
import mekanism.common.chunkloading.IChunkLoader;
|
import mekanism.common.chunkloading.IChunkLoader;
|
||||||
import mekanism.common.frequency.Frequency;
|
import mekanism.common.frequency.Frequency;
|
||||||
import mekanism.common.frequency.FrequencyManager;
|
import mekanism.common.frequency.FrequencyManager;
|
||||||
|
import mekanism.common.integration.IComputerIntegration;
|
||||||
import mekanism.common.network.PacketPortalFX.PortalFXMessage;
|
import mekanism.common.network.PacketPortalFX.PortalFXMessage;
|
||||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||||
import mekanism.common.util.ChargeUtils;
|
import mekanism.common.util.ChargeUtils;
|
||||||
|
@ -36,18 +33,10 @@ import net.minecraft.world.WorldServer;
|
||||||
import net.minecraftforge.common.ForgeChunkManager;
|
import net.minecraftforge.common.ForgeChunkManager;
|
||||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||||
import net.minecraftforge.common.ForgeChunkManager.Type;
|
import net.minecraftforge.common.ForgeChunkManager.Type;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.Optional.Interface;
|
|
||||||
import cpw.mods.fml.common.Optional.Method;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import dan200.computercraft.api.lua.ILuaContext;
|
|
||||||
import dan200.computercraft.api.lua.LuaException;
|
|
||||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
|
||||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
|
||||||
|
|
||||||
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
import java.util.*;
|
||||||
public class TileEntityTeleporter extends TileEntityElectricBlock implements IPeripheral, IChunkLoader
|
|
||||||
|
public class TileEntityTeleporter extends TileEntityElectricBlock implements IComputerIntegration, IChunkLoader
|
||||||
{
|
{
|
||||||
private MinecraftServer server = MinecraftServer.getServer();
|
private MinecraftServer server = MinecraftServer.getServer();
|
||||||
|
|
||||||
|
@ -655,23 +644,16 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements IPe
|
||||||
return ChargeUtils.canBeOutputted(itemstack, false);
|
return ChargeUtils.canBeOutputted(itemstack, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String[] methods = new String[] {"getStored", "canTeleport", "getMaxEnergy", "getEnergyNeeded", "teleport", "set"};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Method(modid = "ComputerCraft")
|
public String[] getMethods()
|
||||||
public String getType()
|
|
||||||
{
|
{
|
||||||
return getInventoryName();
|
return methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Method(modid = "ComputerCraft")
|
public Object[] invoke(int method, Object[] arguments) throws Exception
|
||||||
public String[] getMethodNames()
|
|
||||||
{
|
|
||||||
return new String[] {"getStored", "canTeleport", "getMaxEnergy", "getEnergyNeeded", "teleport", "set"};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException
|
|
||||||
{
|
{
|
||||||
switch(method)
|
switch(method)
|
||||||
{
|
{
|
||||||
|
@ -699,26 +681,10 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements IPe
|
||||||
|
|
||||||
return new Object[] {"Frequency set."};
|
return new Object[] {"Frequency set."};
|
||||||
default:
|
default:
|
||||||
Mekanism.logger.error("Attempted to call unknown method with computer ID " + computer.getID());
|
throw new NoSuchMethodException();
|
||||||
return new Object[] {"Unknown command."};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public boolean equals(IPeripheral other)
|
|
||||||
{
|
|
||||||
return this == other;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void attach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void detach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public AxisAlignedBB getRenderBoundingBox()
|
public AxisAlignedBB getRenderBoundingBox()
|
||||||
|
|
|
@ -1,30 +1,26 @@
|
||||||
package mekanism.generators.common.block;
|
package mekanism.generators.common.block;
|
||||||
|
|
||||||
import java.util.List;
|
import buildcraft.api.tools.IToolWrench;
|
||||||
import java.util.Random;
|
import cpw.mods.fml.common.Optional.Interface;
|
||||||
|
import cpw.mods.fml.common.Optional.Method;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||||
|
import dan200.computercraft.api.peripheral.IPeripheralProvider;
|
||||||
import mekanism.api.MekanismConfig.general;
|
import mekanism.api.MekanismConfig.general;
|
||||||
import mekanism.api.energy.IEnergizedItem;
|
import mekanism.api.energy.IEnergizedItem;
|
||||||
import mekanism.common.ItemAttacher;
|
import mekanism.common.ItemAttacher;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.Mekanism;
|
||||||
import mekanism.common.base.IActiveState;
|
import mekanism.common.base.*;
|
||||||
import mekanism.common.base.IBoundingBlock;
|
import mekanism.common.integration.CCPeripheral;
|
||||||
import mekanism.common.base.ISpecialBounds;
|
import mekanism.common.integration.IComputerIntegration;
|
||||||
import mekanism.common.base.ISustainedData;
|
|
||||||
import mekanism.common.base.ISustainedInventory;
|
|
||||||
import mekanism.common.base.ISustainedTank;
|
|
||||||
import mekanism.common.tile.TileEntityBasicBlock;
|
import mekanism.common.tile.TileEntityBasicBlock;
|
||||||
import mekanism.common.tile.TileEntityElectricBlock;
|
import mekanism.common.tile.TileEntityElectricBlock;
|
||||||
import mekanism.common.util.LangUtils;
|
import mekanism.common.util.LangUtils;
|
||||||
import mekanism.common.util.MekanismUtils;
|
import mekanism.common.util.MekanismUtils;
|
||||||
import mekanism.generators.common.GeneratorsBlocks;
|
import mekanism.generators.common.GeneratorsBlocks;
|
||||||
import mekanism.generators.common.MekanismGenerators;
|
import mekanism.generators.common.MekanismGenerators;
|
||||||
import mekanism.generators.common.tile.TileEntityAdvancedSolarGenerator;
|
import mekanism.generators.common.tile.*;
|
||||||
import mekanism.generators.common.tile.TileEntityBioGenerator;
|
|
||||||
import mekanism.generators.common.tile.TileEntityGasGenerator;
|
|
||||||
import mekanism.generators.common.tile.TileEntityHeatGenerator;
|
|
||||||
import mekanism.generators.common.tile.TileEntitySolarGenerator;
|
|
||||||
import mekanism.generators.common.tile.TileEntityWindTurbine;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -41,14 +37,9 @@ import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import buildcraft.api.tools.IToolWrench;
|
|
||||||
import cpw.mods.fml.common.ModAPIManager;
|
import java.util.List;
|
||||||
import cpw.mods.fml.common.Optional.Interface;
|
import java.util.Random;
|
||||||
import cpw.mods.fml.common.Optional.Method;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
|
||||||
import dan200.computercraft.api.peripheral.IPeripheralProvider;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -654,9 +645,9 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds, IP
|
||||||
{
|
{
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if(te != null && te instanceof IPeripheral)
|
if(te != null && te instanceof IComputerIntegration)
|
||||||
{
|
{
|
||||||
return (IPeripheral)te;
|
return new CCPeripheral((IComputerIntegration)te);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
package mekanism.generators.common.tile;
|
package mekanism.generators.common.tile;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Optional.Method;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
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 io.netty.buffer.ByteBuf;
|
||||||
import mekanism.api.Coord4D;
|
import mekanism.api.Coord4D;
|
||||||
import mekanism.api.MekanismConfig.general;
|
import mekanism.api.MekanismConfig.general;
|
||||||
|
@ -139,48 +134,6 @@ public abstract class TileEntityGenerator extends TileEntityNoisyElectricBlock i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public String getType()
|
|
||||||
{
|
|
||||||
return getInventoryName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@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
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void attach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public void detach(IComputerAccess computer) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Method(modid = "ComputerCraft")
|
|
||||||
public boolean equals(IPeripheral other)
|
|
||||||
{
|
|
||||||
return this == other;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSetFacing(int side)
|
public boolean canSetFacing(int side)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue