SomeSourceCode / SomeGuiApi

A Paper API to create interactable GUIs using Minecraft Inventories, ...
MIT License
1 stars 0 forks source link

Node ids #2

Closed SomeSourceCode closed 3 months ago

SomeSourceCode commented 3 months ago

Description

Every node should have an id. That id can be used to search for a specific node in the scene graph.

It could also be used in the future for features like loading guis from xml files.

Expected Code

Node node = new ...;
node.setId("custom-id");
// Add the node to the scene graph.
// Then it can be found, e.g. in another node's click event:
otherNode.setOnClick(context -> {
    context.getScene().findNode("custom-id");
    // Or maybe even:
    context.findNode("custom-id");
});