public class PneumaticTilePeripheral extends java.lang.Object implements dan200.computercraft.api.peripheral.IDynamicPeripheral, ComputerEventManager.IComputerEventSender
| Modifier and Type | Field and Description |
|---|---|
static net.minecraftforge.common.capabilities.Capability<dan200.computercraft.api.peripheral.IPeripheral> |
PERIPHERAL_CAPABILITY |
| Modifier and Type | Method and Description |
|---|---|
void |
attach(dan200.computercraft.api.peripheral.IComputerAccess computer)
Is called when when a computer is attaching to the peripheral.
|
dan200.computercraft.api.lua.MethodResult |
callMethod(dan200.computercraft.api.peripheral.IComputerAccess computer,
dan200.computercraft.api.lua.ILuaContext ctx,
int method,
dan200.computercraft.api.lua.IArguments args)
This is called when a lua program on an attached computer calls
peripheral.call() with
one of the methods exposed by IDynamicPeripheral.getMethodNames(). |
void |
detach(dan200.computercraft.api.peripheral.IComputerAccess computer)
Called when a computer is detaching from the peripheral.
|
boolean |
equals(dan200.computercraft.api.peripheral.IPeripheral other)
Determine whether this peripheral is equivalent to another one.
|
java.lang.String[] |
getMethodNames()
Should return an array of strings that identify the methods that this peripheral exposes to Lua.
|
java.lang.String |
getType()
Should return a string that uniquely identifies this type of peripheral.
|
void |
sendEvent(net.minecraft.tileentity.TileEntity te,
java.lang.String name,
java.lang.Object... params) |
public static final net.minecraftforge.common.capabilities.Capability<dan200.computercraft.api.peripheral.IPeripheral> PERIPHERAL_CAPABILITY
@Nonnull public java.lang.String[] getMethodNames()
dan200.computercraft.api.peripheral.IDynamicPeripheralgetMethodNames in interface dan200.computercraft.api.peripheral.IDynamicPeripheralIDynamicPeripheral.callMethod(dan200.computercraft.api.peripheral.IComputerAccess, dan200.computercraft.api.lua.ILuaContext, int, dan200.computercraft.api.lua.IArguments)@Nonnull
public dan200.computercraft.api.lua.MethodResult callMethod(@Nonnull
dan200.computercraft.api.peripheral.IComputerAccess computer,
@Nonnull
dan200.computercraft.api.lua.ILuaContext ctx,
int method,
@Nonnull
dan200.computercraft.api.lua.IArguments args)
throws dan200.computercraft.api.lua.LuaException
dan200.computercraft.api.peripheral.IDynamicPeripheralperipheral.call() with
one of the methods exposed by IDynamicPeripheral.getMethodNames().
Be aware that this will be called from the ComputerCraft Lua thread, and must be thread-safe when interacting
with Minecraft objects.callMethod in interface dan200.computercraft.api.peripheral.IDynamicPeripheralcomputer - The interface to the computer that is making the call. Remember that multiple
computers can be attached to a peripheral at once.ctx - The context of the currently running lua thread. This can be used to wait for events
or otherwise yield.method - An integer identifying which of the methods from getMethodNames() the computercraft
wishes to call. The integer indicates the index into the getMethodNames() table
that corresponds to the string passed into peripheral.call()args - The arguments for this method.MethodResult containing the values to return or the action to perform.dan200.computercraft.api.lua.LuaException - If you throw any exception from this function, a lua error will be raised with the
same message as your exception. Use this to throw appropriate errors if the wrong
arguments are supplied to your method.IDynamicPeripheral.getMethodNames()@Nonnull public java.lang.String getType()
dan200.computercraft.api.peripheral.IPeripheralperipheral.getType()getType in interface dan200.computercraft.api.peripheral.IPeripheralpublic boolean equals(@Nullable
dan200.computercraft.api.peripheral.IPeripheral other)
dan200.computercraft.api.peripheral.IPeripheralequals in interface dan200.computercraft.api.peripheral.IPeripheralother - The peripheral to compare against. This may be null.public void attach(@Nonnull
dan200.computercraft.api.peripheral.IComputerAccess computer)
dan200.computercraft.api.peripheral.IPeripheralIPeripheral.detach(dan200.computercraft.api.peripheral.IComputerAccess), the attached computer can make method calls on the peripheral using
peripheral.call(). This method can be used to keep track of which computers are attached to the
peripheral, or to take action when attachment occurs.
Be aware that will be called from both the server thread and ComputerCraft Lua thread, and so must be thread-safe
and reentrant.attach in interface dan200.computercraft.api.peripheral.IPeripheralcomputer - The interface to the computer that is being attached. Remember that multiple computers can be
attached to a peripheral at once.IPeripheral.detach(dan200.computercraft.api.peripheral.IComputerAccess)public void detach(@Nonnull
dan200.computercraft.api.peripheral.IComputerAccess computer)
dan200.computercraft.api.peripheral.IPeripheraldetach in interface dan200.computercraft.api.peripheral.IPeripheralcomputer - The interface to the computer that is being detached. Remember that multiple computers can be
attached to a peripheral at once.IPeripheral.attach(dan200.computercraft.api.peripheral.IComputerAccess)public void sendEvent(net.minecraft.tileentity.TileEntity te,
java.lang.String name,
java.lang.Object... params)
sendEvent in interface ComputerEventManager.IComputerEventSender