Package appeng.api.networking
Interface IGridNode
public interface IGridNode
Gives you a view into a Nodes connections and information.
updateState, getGrid, destroy are required to implement a proper IGridHost.
Don't Implement; Acquire from GridHelper
via IManagedGridNode
.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
fillCrashReportCategory
(net.minecraft.CrashReportCategory category) Fills in details about this node in the given crash report category.Set
<net.minecraft.core.Direction> lets you iterate all of a nodes connections that have been made either internally within the grid host, or to other grid hosts, including connections made through the hosts sides and indirectly (QNB, tunnels).getGrid()
get the grid for the node, this can change at a moments notice.Colors can be used to prevent adjacent grid nodes from connecting.double
Map
<net.minecraft.core.Direction, IGridConnection> lets you iterate a nodes connections that have been made via the grid host's exposed sides to other adjacent grid nodes.net.minecraft.server.level.ServerLevel
getLevel()
int
getOwner()
Gets the host of the grid node, which does not necessarily have a representation in the game level.int
@Nullable UUID
<T extends IGridNodeService>
TgetService
(Class<T> serviceClass) Tries to get a service that was attached to this grid node when it was created.int
@Nullable AEItemKey
boolean
see if this node has a certain flagboolean
default boolean
isActive()
Reflects the networks status, returns true only if the network is powered, and the network has fully booted, and this node has the channels it needs (if any).default boolean
isOnline()
Return true only if the network is powered and the node has the channels it needs (if any).boolean
boolean
-
Method Details
-
getService
Tries to get a service that was attached to this grid node when it was created. Used by overlay grids such as theICraftingService
. -
getOwner
Object getOwner()Gets the host of the grid node, which does not necessarily have a representation in the game level. In most cases, this will be the game object that has created the node, for example aBlockEntity
orIPart
, but may also represent something entirely different. -
beginVisit
lets you walk the grid stating at the current node using a IGridVisitor, generally not needed, please use only if required.- Parameters:
visitor
- visitor
-
getGrid
IGrid getGrid()get the grid for the node, this can change at a moments notice.- Returns:
- The grid this node is a part of.
- Throws:
IllegalStateException
- If the node is being used after being destroyed or before it's initialized.
-
getLevel
net.minecraft.server.level.ServerLevel getLevel()- Returns:
- the level the node is located in
-
getConnectedSides
Set<net.minecraft.core.Direction> getConnectedSides()- Returns:
- The externally accessible sides of the host that this grid node has formed a connection through.
-
getInWorldConnections
Map<net.minecraft.core.Direction,IGridConnection> getInWorldConnections()lets you iterate a nodes connections that have been made via the grid host's exposed sides to other adjacent grid nodes. -
getConnections
List<IGridConnection> getConnections()lets you iterate all of a nodes connections that have been made either internally within the grid host, or to other grid hosts, including connections made through the hosts sides and indirectly (QNB, tunnels). Includes connections fromgetInWorldConnections()
. -
isActive
default boolean isActive()Reflects the networks status, returns true only if the network is powered, and the network has fully booted, and this node has the channels it needs (if any).This should be used for active behavior such as network I/O, but
isOnline()
should be used instead for visual state display to avoid the device looking disabled while the grid is booting. -
isOnline
default boolean isOnline()Return true only if the network is powered and the node has the channels it needs (if any).This ignores whether the network is booting, so it should be used for "enabled" visuals or other "passive" behavior, but should not perform active actions (such as network I/O) without checking that booting is finished, as the channels might still be outdated.
-
hasGridBooted
boolean hasGridBooted()- Returns:
- True if the grid is connected to a network, and that network has fully booted.
- See Also:
-
isPowered
boolean isPowered()- Returns:
- True if the node has power from it's connected grid. Can be used to show a machine being powered, even if the machine doesn't have it's required channel or the network is still booting.
- See Also:
-
meetsChannelRequirements
boolean meetsChannelRequirements()- Returns:
- if the node's channel requirements are currently met, use this for display purposes, use isActive for status.
-
hasFlag
see if this node has a certain flag- Parameters:
flag
- flags- Returns:
- true if has flag
-
getOwningPlayerId
int getOwningPlayerId()- Returns:
- the ownerID this represents the person who placed the node.
- See Also:
-
getOwningPlayerProfileId
- Returns:
- the UUID of the owners game profile. null if not known.
- See Also:
-
getIdlePowerUsage
double getIdlePowerUsage()- Returns:
- The power in AE/t that will be drained by this node. Non-negative.
-
getVisualRepresentation
- Returns:
- An item that will only be used to represent this grid node in user interfaces. Can return an
null
to indicate the node should not be shown in the UI.
-
getGridColor
AEColor getGridColor()Colors can be used to prevent adjacent grid nodes from connecting.AEColor.TRANSPARENT
indicates that the node will connect to nodes of any color. -
fillCrashReportCategory
void fillCrashReportCategory(net.minecraft.CrashReportCategory category) Fills in details about this node in the given crash report category. -
getMaxChannels
int getMaxChannels() -
getUsedChannels
int getUsedChannels()
-