public abstract class ManagedEnvironment extends java.lang.Object implements ManagedEnvironment
Constructor and Description |
---|
ManagedEnvironment() |
Modifier and Type | Method and Description |
---|---|
boolean |
canUpdate()
Like the method of the same name on tile entities, this is used to
decide whether to put a component in the list of components that need
updating, i.e.
|
void |
load(net.minecraft.nbt.NBTTagCompound nbt)
Restores a previous state of the object from the specified NBT tag.
|
Node |
node()
The node this environment wraps.
|
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 |
save(net.minecraft.nbt.NBTTagCompound nbt)
Saves the current state of the object into the specified NBT tag.
|
protected void |
setNode(Node value) |
void |
update()
This is called by the host of this managed environment once per tick.
|
public Node node()
Environment
node
in interface Environment
protected void setNode(Node value)
public boolean canUpdate()
ManagedEnvironment
ManagedEnvironment.update()
should be called each tick.
Return false here, if you do not need updates, to improve performance.canUpdate
in interface ManagedEnvironment
public void update()
ManagedEnvironment
update
in interface ManagedEnvironment
public void onConnect(Node node)
Environment
onConnect
in interface Environment
public void onDisconnect(Node node)
Environment
onDisconnect
in interface Environment
public void onMessage(Message message)
Environment
Node
receives a message
that was sent via one of the send methods in the Network
or the Node itself.onMessage
in interface Environment
message
- the message to handle.public void load(net.minecraft.nbt.NBTTagCompound nbt)
Persistable
load
in interface Persistable
nbt
- the tag to read the state from.public void save(net.minecraft.nbt.NBTTagCompound nbt)
Persistable
Persistable.load(net.minecraft.nbt.NBTTagCompound)
is called with that tag.save
in interface Persistable
nbt
- the tag to save the state to.