public abstract class TileEntityEnvironment extends net.minecraft.tileentity.TileEntity implements Environment, net.minecraft.server.gui.IUpdatePlayerListBox
Environment
interface to allow them to interact with the component network, by providing
a Node and connecting it to said network.
Nodes in such a network can communicate with each other, or just use the
network as an index structure to find other nodes connected to them.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
addedToNetwork |
protected Node |
node
This must be set in subclasses to the node that is used to represent
this tile entity.
|
| Constructor and Description |
|---|
TileEntityEnvironment() |
| Modifier and Type | Method and Description |
|---|---|
void |
invalidate() |
Node |
node()
The node this environment wraps.
|
void |
onChunkUnload() |
void |
onConnect(Node node)
This is called when a node is added to a network.
|
void |
onDisconnect(Node node)
This is called when a node is removed from the network.
|
void |
onMessage(Message message)
This is the generic message handler.
|
void |
readFromNBT(net.minecraft.nbt.NBTTagCompound nbt) |
void |
update() |
void |
writeToNBT(net.minecraft.nbt.NBTTagCompound nbt) |
addInfoToCrashReport, addMapping, canRenderBreaking, createAndLoadEntity, getBlockMetadata, getBlockType, getDescriptionPacket, getDistanceSq, getMaxRenderDistanceSquared, getPos, getRenderBoundingBox, getTileData, getWorld, hasWorldObj, isInvalid, markDirty, onDataPacket, receiveClientEvent, restrictNBTCopy, setPos, setWorldObj, shouldRefresh, shouldRenderInPass, updateContainingBlockInfo, validateprotected Node node
Network.newNode(Environment, Visibility).
For example:
// The first parameters to newNode is the host() of the node, which will // usually be this tile entity. The second one is it's reachability, // which determines how other nodes in the same network can query this // node. SeeNetwork.nodes(li.cil.oc.api.network.Node). node = Network.newNode(this, Visibility.Network) // This call allows the node to consume energy from the // component network it is in and act as a consumer, or to // inject energy into that network and act as a producer. // If you do not need energy remove this call. .withConnector() // This call marks the tile entity as a component. This means you // can mark methods in it using theCallback// annotation, making them callable from user code. The first // parameter is the name by which the component will be known in // the computer, in this case it could be accessed as // component.example. The second parameter is the // component's visibility. This is like the node's reachability, // but only applies to computers. For example, network cards can // only be seen by the computer they're installed in, but // can be reached by all other network cards in the same // network. If you do not need callbacks remove this call. .withComponent("example", Visibility.Neighbors) // Finalizes the construction of the node and returns it. .create();
protected boolean addedToNetwork
public Node node()
Environmentnode in interface Environmentpublic void onConnect(Node node)
EnvironmentonConnect in interface Environmentpublic void onDisconnect(Node node)
EnvironmentonDisconnect in interface Environmentpublic void onMessage(Message message)
EnvironmentNode receives a message
that was sent via one of the send methods in the Network
or the Node itself.onMessage in interface Environmentmessage - the message to handle.public void update()
update in interface net.minecraft.server.gui.IUpdatePlayerListBoxpublic void onChunkUnload()
onChunkUnload in class net.minecraft.tileentity.TileEntitypublic void invalidate()
invalidate in class net.minecraft.tileentity.TileEntitypublic void readFromNBT(net.minecraft.nbt.NBTTagCompound nbt)
readFromNBT in class net.minecraft.tileentity.TileEntitypublic void writeToNBT(net.minecraft.nbt.NBTTagCompound nbt)
writeToNBT in class net.minecraft.tileentity.TileEntity