Class NodeRegistry
java.lang.Object
com.soulfiremc.server.script.nodes.NodeRegistry
Registry of all available script node types.
Metadata is stored separately from node instances — nodes are pure executors.
-
Method Summary
Modifier and TypeMethodDescriptioncomputeDefaultInputs(NodeMetadata metadata) Computes default input values from node metadata port definitions.static ScriptNodeGets a cached instance of a node by its type.static List<NodeCategory> Gets all categories sorted by sort order.static List<NodeMetadata> Gets metadata for all registered node types.static List<NodeMetadata> getFilteredMetadata(String categoryId, boolean includeDeprecated) Gets metadata for all registered node types, optionally filtered.static NodeMetadatagetMetadata(String type) Gets the metadata for a registered node type.static intGets the number of registered node types.Gets all registered node types.static booleanisRegistered(String type) Checks if a node type is registered.static voidregister(NodeMetadata metadata, Supplier<ScriptNode> factory) Registers a node type with its metadata and factory.
-
Method Details
-
register
Registers a node type with its metadata and factory. Metadata is stored separately — no node instance is created during registration.- Parameters:
metadata- the node metadata (provides type identifier, ports, etc.)factory- the factory to create node instances on demand
-
create
Gets a cached instance of a node by its type. Node instances are stateless, so the same instance can be safely reused.- Parameters:
type- the node type identifier- Returns:
- the cached node instance
- Throws:
IllegalArgumentException- if the type is not registered
-
getMetadata
Gets the metadata for a registered node type.- Parameters:
type- the node type identifier- Returns:
- the node metadata
- Throws:
IllegalArgumentException- if the type is not registered
-
computeDefaultInputs
Computes default input values from node metadata port definitions.- Parameters:
metadata- the node metadata- Returns:
- a map of input names to their default values
-
isRegistered
Checks if a node type is registered.- Parameters:
type- the node type identifier- Returns:
- true if the type is registered
-
getRegisteredTypes
-
getRegisteredCount
public static int getRegisteredCount()Gets the number of registered node types.- Returns:
- the count of registered types
-
getAllMetadata
Gets metadata for all registered node types.- Returns:
- list of all node metadata
-
getFilteredMetadata
Gets metadata for all registered node types, optionally filtered.- Parameters:
categoryId- optional category ID filter (null for all)includeDeprecated- whether to include deprecated nodes- Returns:
- list of matching node metadata
-
getAllCategories
Gets all categories sorted by sort order.- Returns:
- sorted list of all NodeCategory values
-