Package appeng.api.networking
Interface IGridServiceProvider
public interface IGridServiceProvider
Allows you to create a grid-wide service. AE2 uses these for providing item, spatial, and tunnel services.
Any class that implements this needs to be registered with GridServices
.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Informs the grid service about a node that was added to the grid.default void
debugDump
(com.google.gson.stream.JsonWriter writer, net.minecraft.core.HolderLookup.Provider registries) Write debug information about this service to the given writer.default void
onLevelEndTick
(net.minecraft.world.level.Level level) Called each tick for the network, allows you to have active network wide behaviors.default void
onLevelStartTick
(net.minecraft.world.level.Level level) Called each tick for the network, allows you to have active network wide behaviors.default void
Called each tick for the network, allows you to have active network wide behaviors.default void
Called each tick for the network, allows you to have active network wide behaviors.default void
removeNode
(IGridNode gridNode) Informs the grid service, that a node was removed from the grid.default void
saveNodeData
(IGridNode gridNode, net.minecraft.nbt.CompoundTag savedData) Save provider-specific data for the given node to the given tag.
-
Method Details
-
onServerStartTick
default void onServerStartTick()Called each tick for the network, allows you to have active network wide behaviors.Called at the beginning of a server tick.
-
onLevelStartTick
default void onLevelStartTick(net.minecraft.world.level.Level level) Called each tick for the network, allows you to have active network wide behaviors.Called at the beginning of a level tick. Will happen for each
Level
separately. -
onLevelEndTick
default void onLevelEndTick(net.minecraft.world.level.Level level) Called each tick for the network, allows you to have active network wide behaviors.Called at the end of a level tick. Will happen for each
Level
separately. -
onServerEndTick
default void onServerEndTick()Called each tick for the network, allows you to have active network wide behaviors.Called at the end of a server tick.
-
removeNode
Informs the grid service, that a node was removed from the grid.Important: Do not trust the grids state in this method, interact only with the node you are passed, if you need to manage other grid information, do it on the next updateTick.
- Parameters:
gridNode
- removed from that grid
-
addNode
default void addNode(IGridNode gridNode, @Nullable @Nullable net.minecraft.nbt.CompoundTag savedData) Informs the grid service about a node that was added to the grid.Important: Do not trust the grids state in this method, interact only with the node you are passed, if you need to manage other grid information, do it on the next updateTick.
- Parameters:
gridNode
- added to grid nodesavedData
- The grid-related saved data for the node joining the grid. May be null. Contains data written bysaveNodeData(appeng.api.networking.IGridNode, net.minecraft.nbt.CompoundTag)
.
-
saveNodeData
Save provider-specific data for the given node to the given tag. Note that the tag is shared between all providers, so take care to use unique names for your properties! -
debugDump
default void debugDump(com.google.gson.stream.JsonWriter writer, net.minecraft.core.HolderLookup.Provider registries) throws IOException Write debug information about this service to the given writer.- Throws:
IOException
-