Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pl.asie.computronics.integration.enderio;
- import dan200.computercraft.api.lua.ILuaContext;
- import dan200.computercraft.api.lua.LuaException;
- import dan200.computercraft.api.peripheral.IComputerAccess;
- import li.cil.oc.api.machine.Arguments;
- import li.cil.oc.api.machine.Callback;
- import li.cil.oc.api.machine.Context;
- import li.cil.oc.api.network.ManagedEnvironment;
- import li.cil.oc.api.prefab.DriverTileEntity;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.world.World;
- import pl.asie.computronics.integration.CCMultiPeripheral;
- import pl.asie.computronics.integration.ManagedEnvironmentOCTile;
- /**
- * @author Vexatos
- */
- public class DriverTest {
- public static class OCDriver extends DriverTileEntity {
- public class InternalManagedEnvironment extends ManagedEnvironmentOCTile<TileChatBox> {
- public InternalManagedEnvironment(TileChatBox tile) {
- super(tile, "chat_box");
- }
- @Override
- public int priority() {
- return 1;
- }
- @Callback(doc = "")
- public Object[] say(Context c, Arguments a) {
- return new Object[] {};
- }
- @Callback(doc = "")
- public Object[] setDistance(Context c, Arguments a) {
- return new Object[] {};
- }
- @Callback(doc = "")
- public Object[] getDistance(Context c, Arguments a) {
- return new Object[] {};
- }
- }
- @Override
- public Class<?> getTileEntityClass() {
- return TileChatBox.class;
- }
- @Override
- public ManagedEnvironment createEnvironment(World world, int x, int y, int z) {
- return new InternalManagedEnvironment(((TileChatBox) world.getTileEntity(x, y, z)));
- }
- }
- public static class CCDriver extends CCMultiPeripheral<TileChatBox> {
- public CCDriver() {
- }
- public CCDriver(TileChatBox tile, World world, int x, int y, int z) {
- super(tile, "chat_box", world, x, y, z);
- }
- @Override
- public int peripheralPriority() {
- return 1;
- }
- @Override
- public CCMultiPeripheral getPeripheral(World world, int x, int y, int z, int side) {
- TileEntity te = world.getTileEntity(x, y, z);
- if(te != null && te instanceof TileChatBox) {
- return new CCDriver((TileChatBox) te, world, x, y, z);
- }
- return null;
- }
- @Override
- public String[] getMethodNames() {
- return new String[] { "say", "setDistance", "getDistance" };
- }
- @Override
- public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException {
- switch(method) {
- case 0: {
- return new Object[] {};
- }
- case 1: {
- return new Object[] {};
- }
- case 2: {
- return new Object[] {};
- }
- }
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement