Package net.lenni0451.imnbt.ui
Class ContextMenu
java.lang.Object
net.lenni0451.imnbt.ui.ContextMenu
A builder for the context menu when right clicking on a tag.
-
Method Summary
Modifier and TypeMethodDescriptionallTypes(BiConsumer<String, net.lenni0451.mcstructs.nbt.INbtTag> newTagAction) Allow all types to be created.Allow the tag to be copied.
The tag is cloned before it is copied.Allow a tag to be deleted.<T extends net.lenni0451.mcstructs.nbt.INbtTag>
ContextMenuAllow editing the tag.paste(BiConsumer<String, net.lenni0451.mcstructs.nbt.INbtTag> pasteAction) Allow the clipboard to be pasted.voidrender()Render the context menu and handle the actions.singleType(net.lenni0451.mcstructs.nbt.NbtType newType, BiConsumer<String, net.lenni0451.mcstructs.nbt.INbtTag> newTagAction) Allow only a single type to be created.sNbtParser(Supplier<net.lenni0451.mcstructs.nbt.INbtTag> sNbtSerializerListener) Allow a tag to be serialized to SNbt.static ContextMenustart(ImNbtDrawer drawer) transform(Consumer<net.lenni0451.mcstructs.nbt.NbtType> typeConsumer, net.lenni0451.mcstructs.nbt.NbtType... possibleTypes) Allow transforming the tag into another type.
-
Method Details
-
start
-
allTypes
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 creatednewTagAction- The action to be executed when a new tag is created- Returns:
- The builder instance
-
copy
Allow the tag to be copied.
The tag is cloned before it is copied.- Parameters:
tag- The tag to be copied- Returns:
- The builder instance
-
paste
Allow the clipboard to be pasted.- Parameters:
pasteAction- The action to be executed when the tag is pasted- Returns:
- The builder instance
-
transform
public ContextMenu transform(Consumer<net.lenni0451.mcstructs.nbt.NbtType> typeConsumer, net.lenni0451.mcstructs.nbt.NbtType... possibleTypes) Allow transforming the tag into another type.- Parameters:
typeConsumer- The consumer to be executed when the tag is transformedpossibleTypes- The possible types the tag can be transformed into- 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 tagtag- The tag to be editednameEditConsumer- The consumer to be executed when the name is editedtagConsumer- The consumer to be executed when the tag is edited- Returns:
- The builder instance
-
delete
Allow a tag to be deleted.- Parameters:
deleteListener- The listener to be executed when the tag is deleted- Returns:
- The builder instance
-
sNbtParser
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.
-