public interface IGridNode
updateState, getGrid, destroy are required to implement a proper IGridHost.
Don't Implement; Acquire from IAppEngApi
.createGridNode
Modifier and Type | Method and Description |
---|---|
void |
beginVisit(IGridVisitor visitor)
lets you walk the grid stating at the current node using a IGridVisitor, generally not needed, please use only if
required.
|
void |
destroy()
By destroying your node, you destroy any connections, and its existence in the grid, use in invalidate, or
onChunkUnload
|
java.util.EnumSet<net.minecraftforge.common.util.ForgeDirection> |
getConnectedSides() |
IReadOnlyCollection<IGridConnection> |
getConnections()
lets you iterate a nodes connections
|
IGrid |
getGrid()
get the grid for the node, this can change at a moments notice.
|
IGridBlock |
getGridBlock() |
IGridHost |
getMachine()
get the machine represented by the node.
|
int |
getPlayerID() |
net.minecraft.world.World |
getWorld() |
boolean |
hasFlag(GridFlags flag)
see if this node has a certain flag
|
boolean |
isActive()
Reflects the networks status, returns true only if the network is powered, and the network is not booting, this
also takes into account channels.
|
void |
loadFromNBT(java.lang.String name,
net.minecraft.nbt.NBTTagCompound nodeData)
this should be called for each node you create, if you have a nodeData compound to load from, you can store all
your nods on a single compound using name.
|
boolean |
meetsChannelRequirements() |
void |
saveToNBT(java.lang.String name,
net.minecraft.nbt.NBTTagCompound nodeData)
this should be called for each node you maintain, you can save all your nodes to the same tag with different
names, if you fail to complete the load / save procedure, network state may be lost between game load/saves.
|
void |
setPlayerID(int playerID)
tell the node who was responsible for placing it, failure to do this may result in in-compatibility with the
security system.
|
void |
updateState()
inform the node that your IGridBlock has changed its internal state, and force the node to update.
|
void beginVisit(IGridVisitor visitor)
visitor
- visitorvoid updateState()
ALWAYS make sure that your tile entity is in the world, and has its node properly saved to be returned from the host before updating state,
If your entity is not in the world, or if you IGridHost returns a different node for the same side you will likely crash the game.
IGridHost getMachine()
IGrid getGrid()
void destroy()
net.minecraft.world.World getWorld()
java.util.EnumSet<net.minecraftforge.common.util.ForgeDirection> getConnectedSides()
IReadOnlyCollection<IGridConnection> getConnections()
IGridBlock getGridBlock()
boolean isActive()
void loadFromNBT(java.lang.String name, net.minecraft.nbt.NBTTagCompound nodeData)
Important: You must call this before updateState.
name
- nbt namenodeData
- to be loaded datavoid saveToNBT(java.lang.String name, net.minecraft.nbt.NBTTagCompound nodeData)
name
- nbt namenodeData
- to be saved databoolean meetsChannelRequirements()
boolean hasFlag(GridFlags flag)
flag
- flagsint getPlayerID()
void setPlayerID(int playerID)
playerID
- new player id