public abstract class TileEntitySidedEnvironment extends net.minecraft.tileentity.TileEntity implements SidedEnvironment
SidedEnvironment
interface to allow them to interact with the component network, by providing
a separate Node
for each block face, and
connecting it to said network. This allows more control over connectivity
than the simple Environment
.
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[] |
nodes |
Modifier | Constructor and Description |
---|---|
protected |
TileEntitySidedEnvironment(Node... nodes)
This expects a node per face that is used to represent this tile entity.
|
Modifier and Type | Method and Description |
---|---|
void |
invalidate() |
void |
onChunkUnload() |
void |
readFromNBT(net.minecraft.nbt.NBTTagCompound nbt) |
Node |
sidedNode(net.minecraftforge.common.util.ForgeDirection side)
The node this environment uses for the specified side.
|
void |
updateEntity() |
void |
writeToNBT(net.minecraft.nbt.NBTTagCompound nbt) |
addMapping, canUpdate, createAndLoadEntity, func_145828_a, getBlockMetadata, getBlockType, getDescriptionPacket, getDistanceFrom, getMaxRenderDistanceSquared, getRenderBoundingBox, getWorldObj, hasWorldObj, isInvalid, markDirty, onDataPacket, receiveClientEvent, setWorldObj, shouldRefresh, shouldRenderInPass, updateContainingBlockInfo, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canConnect
protected Node[] nodes
protected boolean addedToNetwork
protected TileEntitySidedEnvironment(Node... nodes)
Network.newNode(li.cil.oc.api.network.Environment, li.cil.oc.api.network.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)
. super(Network.newNode(???, 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(), ...);
public Node sidedNode(net.minecraftforge.common.util.ForgeDirection side)
SidedEnvironment
Environment.node()
method.
The provided side is relative to the environment, i.e. when the tile
entity hosting the environment sits at (0, 0, 0) and is asked for its
southern node (positive Z axis) it has to return the node for the face
between it and the block at (0, 0, 1).sidedNode
in interface SidedEnvironment
side
- the side to get the node for.Environment.node()
public void updateEntity()
updateEntity
in class net.minecraft.tileentity.TileEntity
public void onChunkUnload()
onChunkUnload
in class net.minecraft.tileentity.TileEntity
public void invalidate()
invalidate
in class net.minecraft.tileentity.TileEntity
public void readFromNBT(net.minecraft.nbt.NBTTagCompound nbt)
readFromNBT
in class net.minecraft.tileentity.TileEntity
public void writeToNBT(net.minecraft.nbt.NBTTagCompound nbt)
writeToNBT
in class net.minecraft.tileentity.TileEntity