Class ContextMenu

java.lang.Object
net.lenni0451.imnbt.ui.ContextMenu

public class ContextMenu extends Object
A builder for the context menu when right clicking on a tag.
  • Method Details

    • start

      public static ContextMenu start(ImNbtDrawer drawer)
    • allTypes

      public ContextMenu allTypes(BiConsumer<String,net.lenni0451.mcstructs.nbt.INbtTag> newTagAction)
      Allow all types to be created.
      Parameters:
      newTagAction - The action to be executed when a new tag is created
      Returns:
      The builder instance
    • singleType

      public ContextMenu singleType(net.lenni0451.mcstructs.nbt.NbtType newType, BiConsumer<String,net.lenni0451.mcstructs.nbt.INbtTag> newTagAction)
      Allow only a single type to be created.
      Parameters:
      newType - The type to be created
      newTagAction - The action to be executed when a new tag is created
      Returns:
      The builder instance
    • edit

      public <T extends net.lenni0451.mcstructs.nbt.INbtTag> ContextMenu edit(String name, T tag, Consumer<String> nameEditConsumer, Consumer<T> tagConsumer)
      Allow editing the tag.
      Type Parameters:
      T - The type of the tag
      Parameters:
      name - The name of the tag
      tag - The tag to be edited
      nameEditConsumer - The consumer to be executed when the name is edited
      tagConsumer - The consumer to be executed when the tag is edited
      Returns:
      The builder instance
    • delete

      public ContextMenu delete(Runnable deleteListener)
      Allow a tag to be deleted.
      Parameters:
      deleteListener - The listener to be executed when the tag is deleted
      Returns:
      The builder instance
    • sNbtParser

      public ContextMenu sNbtParser(Supplier<net.lenni0451.mcstructs.nbt.INbtTag> sNbtSerializerListener)
      Allow a tag to be serialized to SNbt.
      Parameters:
      sNbtSerializerListener - The listener to be executed when the tag is serialized
      Returns:
      The builder instance
    • render

      public void render()
      Render the context menu and handle the actions.