public abstract class TileEntitySidedEnvironment extends net.minecraft.tileentity.TileEntity implements SidedEnvironment, net.minecraft.tileentity.ITickableTileEntity
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
.
Modifier and Type | Field and Description |
---|---|
protected boolean |
addedToNetwork |
protected Node[] |
nodes |
Modifier | Constructor and Description |
---|---|
protected |
TileEntitySidedEnvironment(net.minecraft.tileentity.TileEntityType<?> type,
Node... nodes)
This expects a node per face that is used to represent this tile entity.
|
Modifier and Type | Method and Description |
---|---|
void |
load(net.minecraft.block.BlockState state,
net.minecraft.nbt.CompoundNBT nbt) |
void |
onChunkUnloaded() |
net.minecraft.nbt.CompoundNBT |
save(net.minecraft.nbt.CompoundNBT nbt) |
void |
setRemoved() |
Node |
sidedNode(net.minecraft.util.Direction side)
The node this environment uses for the specified side.
|
void |
tick() |
clearCache, clearRemoved, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getTileData, getType, getUpdatePacket, getUpdateTag, getViewDistance, hasLevel, isRemoved, loadStatic, logInvalidState, mirror, onlyOpCanSetNbt, rotate, setChanged, setLevelAndPosition, setPosition, triggerEvent
areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, getCapability, invalidateCaps, reviveCaps, serializeCaps
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canConnect
protected Node[] nodes
protected boolean addedToNetwork
protected TileEntitySidedEnvironment(net.minecraft.tileentity.TileEntityType<?> type, Node... nodes)
Network.newNode(li.cil.oc.api.network.Environment, li.cil.oc.api.network.Visibility)
.
// 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.minecraft.util.Direction side)
SidedEnvironment
Environment.node()
method.
sidedNode
in interface SidedEnvironment
side
- the side to get the node for.Environment.node()
public void tick()
tick
in interface net.minecraft.tileentity.ITickableTileEntity
public void onChunkUnloaded()
onChunkUnloaded
in interface net.minecraftforge.common.extensions.IForgeTileEntity
onChunkUnloaded
in class net.minecraft.tileentity.TileEntity
public void setRemoved()
setRemoved
in class net.minecraft.tileentity.TileEntity
public void load(net.minecraft.block.BlockState state, net.minecraft.nbt.CompoundNBT nbt)
load
in class net.minecraft.tileentity.TileEntity
public net.minecraft.nbt.CompoundNBT save(net.minecraft.nbt.CompoundNBT nbt)
save
in class net.minecraft.tileentity.TileEntity