use of net.minecraft.text.ClickEvent in project fabric-name-history-lookup by Woolyenough.
the class ClientCommands method namemc.
private static int namemc(CommandContext<FabricClientCommandSource> context) {
CompletableFuture.runAsync(() -> {
String name = context.getInput().split(" ")[1];
String[] playerNameAndUUID = get_player_name_and_uuid(name);
String username = playerNameAndUUID[0];
if (Objects.equals(username, "None")) {
context.getSource().sendFeedback(new LiteralText("§7[Click] §eSearch " + name + " on NameMC §c§o(account does not exist)").styled(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://namemc.com/profile/" + name)).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText(name + "\n\n§7§oClick to open NameMC")))));
} else {
context.getSource().sendFeedback(new LiteralText("§7[Click] §eLook at " + username + "'s NameMC page").styled(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://namemc.com/profile/" + username)).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText(username + "\n\n§7§oClick to open NameMC")))));
}
});
return 0;
}
use of net.minecraft.text.ClickEvent in project meteor-rejects by AntiCope.
the class Seeds method sendInvalidVersionWarning.
private static void sendInvalidVersionWarning(String seed, String targetVer) {
BaseText msg = new LiteralText(String.format("Couldn't resolve minecraft version \"%s\". Using %s instead. If you wish to change the version run: ", targetVer, MCVersion.latest().name));
String cmd = String.format("%sseed %s ", Config.get().prefix, seed);
BaseText cmdText = new LiteralText(cmd + "<version>");
cmdText.setStyle(cmdText.getStyle().withUnderline(true).withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, cmd)).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText("run command"))));
msg.append(cmdText);
msg.setStyle(msg.getStyle().withColor(Formatting.YELLOW));
ChatUtils.sendMsg("Seed", msg);
}
use of net.minecraft.text.ClickEvent in project Client by MatHax.
the class NbtCommand method build.
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.then(literal("add").then(argument("nbt_data", CompoundNbtTagArgumentType.nbtTag()).executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (validBasic(stack)) {
NbtCompound tag = CompoundNbtTagArgumentType.getNbt(s, "nbt_data");
NbtCompound source = stack.getOrCreateNbt();
if (tag != null) {
source.copyFrom(tag);
setStack(stack);
} else {
error("Some of the NBT data could not be found, try using: " + Config.get().prefix + "nbt set {nbt}");
}
}
return SINGLE_SUCCESS;
})));
builder.then(literal("set").then(argument("nbt_data", CompoundNbtTagArgumentType.nbtTag()).executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (validBasic(stack)) {
NbtCompound tag = s.getArgument("nbt_data", NbtCompound.class);
stack.setNbt(tag);
setStack(stack);
}
return SINGLE_SUCCESS;
})));
builder.then(literal("remove").then(argument("nbt_path", NbtPathArgumentType.nbtPath()).executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (validBasic(stack)) {
NbtPathArgumentType.NbtPath path = s.getArgument("nbt_path", NbtPathArgumentType.NbtPath.class);
path.remove(stack.getNbt());
}
return SINGLE_SUCCESS;
})));
builder.then(literal("get").executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (stack == null) {
error("You must hold an item in your main hand.");
} else {
NbtCompound tag = stack.getNbt();
String nbt = tag == null ? "{}" : tag.asString();
BaseText copyButton = new LiteralText("NBT");
copyButton.setStyle(copyButton.getStyle().withFormatting(Formatting.UNDERLINE).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, this.toString("copy"))).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText("Copy the NBT data to your clipboard."))));
BaseText text = new LiteralText("");
text.append(copyButton);
text.append(new LiteralText(": " + nbt));
info(text);
}
return SINGLE_SUCCESS;
}));
builder.then(literal("copy").executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (stack == null) {
error("You must hold an item in your main hand.");
} else {
NbtCompound tag = stack.getOrCreateNbt();
mc.keyboard.setClipboard(tag.toString());
BaseText nbt = new LiteralText("NBT");
nbt.setStyle(nbt.getStyle().withFormatting(Formatting.UNDERLINE).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText(tag.toString()))));
BaseText text = new LiteralText("");
text.append(nbt);
text.append(new LiteralText(" data copied!"));
info(text);
}
return SINGLE_SUCCESS;
}));
builder.then(literal("count").then(argument("count", IntegerArgumentType.integer(-127, 127)).executes(context -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (validBasic(stack)) {
int count = IntegerArgumentType.getInteger(context, "count");
stack.setCount(count);
setStack(stack);
info("Set mainhand stack count to %s.", count);
}
return SINGLE_SUCCESS;
})));
}
use of net.minecraft.text.ClickEvent in project Hypnotic-Client by Hypnotic-Development.
the class NBT method build.
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.then(literal("add").then(argument("nbt_data", CompoundNbtTagArgumentType.nbtTag()).executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (validBasic(stack)) {
NbtCompound tag = CompoundNbtTagArgumentType.getTag(s, "nbt_data");
NbtCompound source = stack.getNbt();
if (tag != null && source != null) {
stack.getNbt().copyFrom(tag);
setStack(stack);
} else {
error("Some of the NBT data could not be found, try using: " + CommandManager.INSTANCE.getPrefix() + "nbt set {nbt}");
}
}
return SINGLE_SUCCESS;
})));
builder.then(literal("set").then(argument("nbt_data", CompoundNbtTagArgumentType.nbtTag()).executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (validBasic(stack)) {
NbtCompound tag = s.getArgument("nbt_data", NbtCompound.class);
stack.setNbt(tag);
setStack(stack);
}
return SINGLE_SUCCESS;
})));
builder.then(literal("remove").then(argument("nbt_path", NbtPathArgumentType.nbtPath()).executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (validBasic(stack)) {
NbtPathArgumentType.NbtPath path = s.getArgument("nbt_path", NbtPathArgumentType.NbtPath.class);
path.remove(stack.getNbt());
}
return SINGLE_SUCCESS;
})));
builder.then(literal("get").executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (stack == null) {
error("You must hold an item in your main hand.");
} else {
NbtCompound tag = stack.getNbt();
String nbt = tag == null ? "none" : tag.asString();
BaseText copyButton = new LiteralText("NBT");
copyButton.setStyle(copyButton.getStyle().withFormatting(Formatting.UNDERLINE).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, this.toString("copy"))).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText("Copy the NBT data to your clipboard."))));
BaseText text = new LiteralText("");
text.append(copyButton);
text.append(new LiteralText(": " + nbt));
info(text);
}
return SINGLE_SUCCESS;
}));
builder.then(literal("copy").executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (stack == null) {
error("You must hold an item in your main hand.");
} else {
NbtCompound tag = stack.getNbt();
if (tag == null)
error("No NBT data on this item.");
else {
mc.keyboard.setClipboard(tag.toString());
BaseText nbt = new LiteralText("NBT");
nbt.setStyle(nbt.getStyle().withFormatting(Formatting.UNDERLINE).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText(tag.toString()))));
BaseText text = new LiteralText("");
text.append(nbt);
text.append(new LiteralText(" data copied!"));
info(text);
}
}
return SINGLE_SUCCESS;
}));
builder.then(literal("count").then(argument("count", IntegerArgumentType.integer(-127, 127)).executes(context -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (validBasic(stack)) {
int count = IntegerArgumentType.getInteger(context, "count");
stack.setCount(count);
setStack(stack);
info("Set mainhand stack count to " + count);
}
return SINGLE_SUCCESS;
})));
}
use of net.minecraft.text.ClickEvent in project Hypnotic-Client by Hypnotic-Development.
the class About method build.
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.executes(context -> {
ChatUtils.tellPlayerRaw(ColorUtils.red + "\n\u00A7l\u00A7nHypnotic\n");
ChatUtils.tellPlayerRaw(ColorUtils.red + "Current build" + ColorUtils.gray + ": " + Hypnotic.version);
ChatUtils.tellPlayerRaw(ColorUtils.red + "Modules" + ColorUtils.gray + ": " + ModuleManager.INSTANCE.modules.size());
ChatUtils.tellPlayerRaw(ColorUtils.red + "Commands" + ColorUtils.gray + ": " + CommandManager.INSTANCE.getCommands().size());
ChatUtils.tellPlayerRaw(new LiteralText(ColorUtils.red + "Website" + ColorUtils.gray + ": ").append(ChatUtils.clickableText(ColorUtils.gray + "https://hypnotic.dev", new ClickEvent(Action.OPEN_URL, "https://hypnotic.dev"))));
ChatUtils.tellPlayerRaw("\n\n\u00A7c .,;;;,. \n" + " .xXNNN0: ..... \n" + " .lXMMMNd. ;OXXKd. \n" + " :KWMWNk' ,OWMM0: \n" + " 'kWMW0d; .dNMMNo. \n" + " .oNMMXl.. cXMMWx. \n" + " .cKMMWk,. .;OWMW0:. \n" + " ..;ldxkkxxOXWMMWKkkxkOXWMMWXOxxxxxxxdo\n" + ".:kXWWXOdc:oKMMMKo:;;;l0WMMNkc;;;;;;;;,.\n" + "ONMWKd,. .dXMMKc. ;0MMWO' \n" + "MMMXc. .dNMWO: 'OWMM0: \n" + "MMWXc...l0NNKo. ..cKNNKl. \n" + "OKNWKOkO0Od:. .','.. \n" + "..;:cc:,.. \n");
return SINGLE_SUCCESS;
});
}
Aggregations