Skip to content
This repository has been archived by the owner on Dec 15, 2024. It is now read-only.

Commit

Permalink
add copy button for NBT tags
Browse files Browse the repository at this point in the history
Fixes #37
  • Loading branch information
BasiqueEvangelist committed Dec 29, 2023
1 parent ec5ddaf commit 4963bb6
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.wispforest.owo.ui.container.FlowLayout;
import io.wispforest.owo.ui.core.Insets;
import io.wispforest.owo.ui.core.Sizing;
import net.minecraft.client.MinecraftClient;
import net.minecraft.nbt.*;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
Expand Down Expand Up @@ -196,9 +197,17 @@ else if (number instanceof NbtDouble)
target.removeChild(full);
elements.entrySet().removeIf(entry -> entry.getKey().startsWith(path));
});
crossLabel.margins(Insets.right(5));
row.child(crossLabel);
}

var copyLabel = Components.label(Text.literal("C"));
copyLabel.tooltip(Text.translatable("chat.copy.click"));
GuiUtil.semiButton(copyLabel, () -> {
MinecraftClient.getInstance().keyboard.setClipboard(path.follow(data).asString());
});
row.child(copyLabel);

row
.margins(Insets.both(0, 2))
.allowOverflow(true);
Expand Down

0 comments on commit 4963bb6

Please sign in to comment.