Last active
September 12, 2015 11:21
-
-
Save boq/390f7967b672945f076b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java.lang.RuntimeException: You are not attached to this Computer | |
at dan200.computercraft.core.apis.PeripheralAPI$PeripheralWrapper.getAttachmentName(PeripheralAPI.java:230) | |
at testmod.TestPeripheral.callMethod(TestPeripheral.java:23) | |
at dan200.computercraft.core.apis.PeripheralAPI$PeripheralWrapper.call(PeripheralAPI.java:110) | |
at dan200.computercraft.core.apis.PeripheralAPI.callMethod(PeripheralAPI.java:477) | |
at dan200.computercraft.core.lua.LuaJLuaMachine$2.invoke(LuaJLuaMachine.java:332) | |
at org.luaj.vm2.lib.VarArgFunction.onInvoke(Unknown Source) | |
at org.luaj.vm2.TailcallVarargs.eval(Unknown Source) | |
at org.luaj.vm2.TailcallVarargs.arg1(Unknown Source) | |
at org.luaj.vm2.LuaClosure.call(Unknown Source) | |
at org.luaj.vm2.LuaClosure.execute(Unknown Source) | |
at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source) | |
at org.luaj.vm2.LuaClosure.invoke(Unknown Source) | |
at org.luaj.vm2.LuaClosure.execute(Unknown Source) | |
at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source) | |
at org.luaj.vm2.LuaClosure.invoke(Unknown Source) | |
at org.luaj.vm2.lib.BaseLib.pcall(Unknown Source) | |
at org.luaj.vm2.lib.BaseLib$BaseLibV.invoke(Unknown Source) | |
at org.luaj.vm2.LuaClosure.execute(Unknown Source) | |
at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source) | |
at org.luaj.vm2.LuaClosure.invoke(Unknown Source) | |
at org.luaj.vm2.LuaClosure.execute(Unknown Source) | |
at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source) | |
at org.luaj.vm2.TailcallVarargs.eval(Unknown Source) | |
at org.luaj.vm2.TailcallVarargs.arg1(Unknown Source) | |
at org.luaj.vm2.LuaClosure.call(Unknown Source) | |
at org.luaj.vm2.LuaClosure.execute(Unknown Source) | |
at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source) | |
at org.luaj.vm2.LuaClosure.invoke(Unknown Source) | |
at org.luaj.vm2.LuaClosure.execute(Unknown Source) | |
at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source) | |
at org.luaj.vm2.LuaClosure.invoke(Unknown Source) | |
at org.luaj.vm2.lib.BaseLib.pcall(Unknown Source) | |
at org.luaj.vm2.lib.BaseLib$BaseLibV.invoke(Unknown Source) | |
at org.luaj.vm2.LuaClosure.execute(Unknown Source) | |
at org.luaj.vm2.LuaClosure.call(Unknown Source) | |
at org.luaj.vm2.LuaClosure.execute(Unknown Source) | |
at org.luaj.vm2.LuaClosure.onInvoke(Unknown Source) | |
at org.luaj.vm2.LuaClosure.invoke(Unknown Source) | |
at org.luaj.vm2.LuaThread$State.run(Unknown Source) | |
at java.lang.Thread.run(Thread.java:744) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true do peripheral.call("left", "testAttached") sleep(0) end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package testmod; | |
import dan200.computercraft.api.lua.ILuaContext; | |
import dan200.computercraft.api.lua.LuaException; | |
import dan200.computercraft.api.peripheral.IComputerAccess; | |
import dan200.computercraft.api.peripheral.IPeripheral; | |
public class TestPeripheral implements IPeripheral { | |
@Override | |
public String getType() { | |
return "faulty_peripheral"; | |
} | |
@Override | |
public String[] getMethodNames() { | |
return new String[] { "testAttached" }; | |
} | |
@Override | |
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException { | |
try { | |
return new Object[] { computer.getAttachmentName() }; | |
} catch (Exception e) { | |
e.printStackTrace(); | |
throw new LuaException("fail"); | |
} | |
} | |
@Override | |
public void attach(IComputerAccess computer) {} | |
@Override | |
public void detach(IComputerAccess computer) {} | |
@Override | |
public boolean equals(IPeripheral other) { | |
return other == this; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package testmod; | |
import net.minecraft.block.Block; | |
import net.minecraft.init.Blocks; | |
import net.minecraft.world.World; | |
import dan200.computercraft.api.peripheral.IPeripheral; | |
import dan200.computercraft.api.peripheral.IPeripheralProvider; | |
public class TestProvider implements IPeripheralProvider { | |
@Override | |
public IPeripheral getPeripheral(World world, int x, int y, int z, int side) { | |
Block block = world.getBlock(x, y, z); | |
return (block == Blocks.gold_block) ? new TestPeripheral() : null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment