public interface CasingProxy extends Casing
| Modifier and Type | Method and Description |
|---|---|
Casing |
getCasing() |
default net.minecraft.world.World |
getCasingWorld()
The world this casing resides in.
|
default Module |
getModule(Face face)
Get the module installed on the specified face of the casing.
|
default net.minecraft.util.math.BlockPos |
getPosition()
The position of the casing in the world it exists in.
|
default Pipe |
getReceivingPipe(Face face,
Port port)
Get the receiving pipe on the specified port of a module in this casing.
|
default Pipe |
getSendingPipe(Face face,
Port port)
Get the sending pipe on the specified port of a module in this casing.
|
default boolean |
isEnabled()
Get whether the casing is currently enabled, i.e.
|
default boolean |
isLocked()
Get whether the casing is locked.
|
default void |
markDirty()
Flag the casing as dirty so it is saved when the chunk containing it
saved next.
|
default void |
sendData(Face face,
io.netty.buffer.ByteBuf data)
Call this to send some data from a module to it's other representation.
|
default void |
sendData(Face face,
io.netty.buffer.ByteBuf data,
byte type)
Call this to send some data from a module to it's other representation.
|
default void |
sendData(Face face,
net.minecraft.nbt.NBTTagCompound data)
Call this to send some data from a module to it's other representation.
|
default void |
sendData(Face face,
net.minecraft.nbt.NBTTagCompound data,
byte type)
Call this to send some data from a module to it's other representation.
|
Casing getCasing()
default net.minecraft.world.World getCasingWorld()
CasinggetCasingWorld in interface Casingdefault net.minecraft.util.math.BlockPos getPosition()
CasinggetPosition in interface Casingdefault void markDirty()
Casingdefault boolean isEnabled()
CasingA controller is considered active when a positive non-zero redstone signal is applied to it. This in particular includes the paused state at a signal strength one.
This is useful for contextual behavior in modules while rendering or in
the activation callback Module.onActivate(EntityPlayer, EnumHand, ItemStack, float, float, float).
default boolean isLocked()
Casing
Casings can be locked, preventing players to remove modules from the
casing or add modules to the casing. Some modules may choose to also
ignore Module.onActivate(EntityPlayer, EnumHand, ItemStack, float, float, float)
calls while their casing is locks (such as the execution module to
prevent reprogramming).
@Nullable default Module getModule(Face face)
Casingdefault Pipe getReceivingPipe(Face face, Port port)
Casing
There are two Pipes between every pair of Modules
in a case. Specifically, each edge of a Casing has two
Pipes, going into opposite directions. This method is used
to to get a Pipe based on its sink.
getReceivingPipe in interface Casingface - the face to get the port for.port - the port for which to get the port.default Pipe getSendingPipe(Face face, Port port)
Casing
There are two Pipes between every pair of Modules
in a case. Specifically, each edge of a Casing has two
Pipes, going into opposite directions. This method is used
to to get a Pipe based on its source.
getSendingPipe in interface Casingface - the face to get the port for.port - the port for which to get the port.default void sendData(Face face, net.minecraft.nbt.NBTTagCompound data, byte type)
CasingThat is, when called from the client, it will send the data to the instance representing the module on the specified face on the server, when called on the server it will send the data to the client.
Data is collected each tick, and sent in one big packet. If more than one send request is performed in one tick with the same type, the data will replace the previously queued data. A negative value indicates that no specific type is set and data should not be replaced in the send queue.
Note that this is a convenience alternative for Casing.sendData(Face, ByteBuf, byte)
that is meant to be used for non-frequent data, i.e. data
that's only sent every so often. For data you expect may be sent
each tick, prefer using the more light-weight ByteBuf.
Important: the passed NBT tag is not copied, it is stored by reference. If you intend to modify the tag after passing it to this method, pass a copy of it instead.
default void sendData(Face face, net.minecraft.nbt.NBTTagCompound data)
Casing
This behaves like Casing.sendData(Face, ByteBuf, byte), except
with no specific type associated, so new data will never replace old
data. Where at all possible, providing a type is strongly recommended,
to reduce generated network traffic.
Note that this is a convenience alternative for Casing.sendData(Face, ByteBuf)
that is meant to be used for non-frequent data, i.e. data
that's only sent every so often. For data you expect may be sent
each tick, prefer using the more light-weight ByteBuf.
Important: the passed NBT tag is not copied, it is stored by reference. If you intend to modify the tag after passing it to this method, pass a copy of it instead.
default void sendData(Face face, io.netty.buffer.ByteBuf data, byte type)
CasingThat is, when called from the client, it will send the data to the instance representing the module on the specified face on the server, when called on the server it will send the data to the client.
Data is collected each tick, and sent in one big packet. If more than one send request is performed in one tick with the same type, the data will replace the previously queued data. A negative value indicates that no specific type is set and data should not be replaced in the send queue.
Important: the passed buffer is not copied, it is stored by reference. If you intend to modify the buffer after passing it to this method, pass a copy of it instead.
default void sendData(Face face, io.netty.buffer.ByteBuf data)
Casing
This behaves like Casing.sendData(Face, ByteBuf, byte), except
with no specific type associated, so new data will never replace old
data. Where at all possible, providing a type is strongly recommended,
to reduce generated network traffic.
Important: the passed buffer is not copied, it is stored by reference. If you intend to modify the buffer after passing it to this method, pass a copy of it instead.