use of net.minecraft.text.BaseText in project meteor-client by MeteorDevelopment.
the class LocateCommand method build.
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.then(literal("buried_treasure").executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (stack.getItem() != Items.FILLED_MAP) {
error("You need to hold a treasure map first");
return SINGLE_SUCCESS;
}
NbtCompound tag = stack.getNbt();
NbtList nbt1 = (NbtList) tag.get("Decorations");
if (nbt1 == null) {
error("Couldn't locate the cross. Are you holding a (highlight)treasure map(default)?");
return SINGLE_SUCCESS;
}
NbtCompound iconNBT = nbt1.getCompound(0);
if (iconNBT == null) {
error("Couldn't locate the cross. Are you holding a (highlight)treasure map(default)?");
return SINGLE_SUCCESS;
}
Vec3d coords = new Vec3d(iconNBT.getDouble("x"), iconNBT.getDouble("y"), iconNBT.getDouble("z"));
BaseText text = new LiteralText("Buried Treasure located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
return SINGLE_SUCCESS;
}));
builder.then(literal("lodestone").executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (stack.getItem() != Items.COMPASS) {
error("You need to hold a lodestone compass");
return SINGLE_SUCCESS;
}
NbtCompound tag = stack.getNbt();
if (tag == null) {
error("Couldn't get the NBT data. Are you holding a (highlight)lodestone(default) compass?");
return SINGLE_SUCCESS;
}
NbtCompound nbt1 = tag.getCompound("LodestonePos");
if (nbt1 == null) {
error("Couldn't get the NBT data. Are you holding a (highlight)lodestone(default) compass?");
return SINGLE_SUCCESS;
}
Vec3d coords = new Vec3d(nbt1.getDouble("X"), nbt1.getDouble("Y"), nbt1.getDouble("Z"));
BaseText text = new LiteralText("Lodestone located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
return SINGLE_SUCCESS;
}));
builder.then(literal("mansion").executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (stack.getItem() != Items.FILLED_MAP) {
error("You need to hold a woodland explorer map first");
return SINGLE_SUCCESS;
}
NbtCompound tag = stack.getNbt();
NbtList nbt1 = (NbtList) tag.get("Decorations");
if (nbt1 == null) {
error("Couldn't locate the mansion. Are you holding a (highlight)woodland explorer map(default)?");
return SINGLE_SUCCESS;
}
NbtCompound iconNBT = nbt1.getCompound(0);
if (iconNBT == null) {
error("Couldn't locate the mansion. Are you holding a (highlight)woodland explorer map(default)?");
return SINGLE_SUCCESS;
}
Vec3d coords = new Vec3d(iconNBT.getDouble("x"), iconNBT.getDouble("y"), iconNBT.getDouble("z"));
BaseText text = new LiteralText("Mansion located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
return SINGLE_SUCCESS;
}));
builder.then(literal("stronghold").executes(s -> {
FindItemResult eye = InvUtils.findInHotbar(Items.ENDER_EYE);
if (eye.found()) {
BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute("follow entity minecraft:eye_of_ender");
firstStart = null;
firstEnd = null;
secondStart = null;
secondEnd = null;
MeteorClient.EVENT_BUS.subscribe(this);
info("Please throw the first Eye of Ender");
} else {
Vec3d coords = findByBlockList(strongholdBlocks);
if (coords == null) {
error("No stronghold found nearby. You can use (highlight)Ender Eyes(default) for more success.");
return SINGLE_SUCCESS;
}
BaseText text = new LiteralText("Stronghold located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
}
return SINGLE_SUCCESS;
}));
builder.then(literal("nether_fortress").executes(s -> {
Vec3d coords = findByBlockList(netherFortressBlocks);
if (coords == null) {
error("No nether fortress found.");
return SINGLE_SUCCESS;
}
BaseText text = new LiteralText("Fortress located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
return SINGLE_SUCCESS;
}));
builder.then(literal("monument").executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (stack.getItem() == Items.FILLED_MAP) {
NbtCompound tag = stack.getNbt();
if (tag != null) {
NbtList nbt1 = (NbtList) tag.get("Decorations");
if (nbt1 != null) {
NbtCompound iconNBT = nbt1.getCompound(0);
if (iconNBT != null) {
Vec3d coords = new Vec3d(iconNBT.getDouble("x"), iconNBT.getDouble("y"), iconNBT.getDouble("z"));
BaseText text = new LiteralText("Monument located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
return SINGLE_SUCCESS;
}
}
}
}
Vec3d coords = findByBlockList(monumentBlocks);
if (coords == null) {
error("No monument found. You can try using a (highlight)Ocean explorer map(default) for more success.");
return SINGLE_SUCCESS;
}
BaseText text = new LiteralText("Monument located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
return SINGLE_SUCCESS;
}));
builder.then(literal("cancel").executes(s -> {
cancel();
return SINGLE_SUCCESS;
}));
}
use of net.minecraft.text.BaseText in project meteor-client by MeteorDevelopment.
the class CommandsCommand method getCommandText.
private BaseText getCommandText(Command command) {
// Hover tooltip
BaseText tooltip = new LiteralText("");
tooltip.append(new LiteralText(Utils.nameToTitle(command.getName())).formatted(Formatting.BLUE, Formatting.BOLD)).append("\n");
BaseText aliases = new LiteralText(Config.get().prefix.get() + command.getName());
if (command.getAliases().size() > 0) {
aliases.append(", ");
for (String alias : command.getAliases()) {
if (alias.isEmpty())
continue;
aliases.append(Config.get().prefix.get() + alias);
if (!alias.equals(command.getAliases().get(command.getAliases().size() - 1)))
aliases.append(", ");
}
}
tooltip.append(aliases.formatted(Formatting.GRAY)).append("\n\n");
tooltip.append(new LiteralText(command.getDescription()).formatted(Formatting.WHITE));
// Text
BaseText text = new LiteralText(Utils.nameToTitle(command.getName()));
if (command != Commands.get().getAll().get(Commands.get().getAll().size() - 1))
text.append(new LiteralText(", ").formatted(Formatting.GRAY));
text.setStyle(text.getStyle().withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)).withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, Config.get().prefix.get() + command.getName())));
return text;
}
use of net.minecraft.text.BaseText 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.BaseText in project Client by MatHax.
the class LocateCommand method build.
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.then(literal("buried_treasure").executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (stack.getItem() != Items.FILLED_MAP) {
error("You need to hold a treasure map first");
return SINGLE_SUCCESS;
}
NbtCompound tag = stack.getNbt();
NbtList nbt1 = (NbtList) tag.get("Decorations");
if (nbt1 == null) {
error("Couldn't locate the cross. Are you holding a (highlight)treasure map(default)?");
return SINGLE_SUCCESS;
}
NbtCompound iconNBT = nbt1.getCompound(0);
if (iconNBT == null) {
error("Couldn't locate the cross. Are you holding a (highlight)treasure map(default)?");
return SINGLE_SUCCESS;
}
Vec3d coords = new Vec3d(iconNBT.getDouble("x"), iconNBT.getDouble("y"), iconNBT.getDouble("z"));
BaseText text = new LiteralText("Buried Treasure located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
return SINGLE_SUCCESS;
}));
builder.then(literal("lodestone").executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (stack.getItem() != Items.COMPASS) {
error("You need to hold a lodestone compass");
return SINGLE_SUCCESS;
}
NbtCompound tag = stack.getNbt();
if (tag == null) {
error("Couldn't get the NBT data. Are you holding a (highlight)lodestone(default) compass?");
return SINGLE_SUCCESS;
}
NbtCompound nbt1 = tag.getCompound("LodestonePos");
if (nbt1 == null) {
error("Couldn't get the NBT data. Are you holding a (highlight)lodestone(default) compass?");
return SINGLE_SUCCESS;
}
Vec3d coords = new Vec3d(nbt1.getDouble("X"), nbt1.getDouble("Y"), nbt1.getDouble("Z"));
BaseText text = new LiteralText("Lodestone located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
return SINGLE_SUCCESS;
}));
builder.then(literal("mansion").executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (stack.getItem() != Items.FILLED_MAP) {
error("You need to hold a woodland explorer map first");
return SINGLE_SUCCESS;
}
NbtCompound tag = stack.getNbt();
NbtList nbt1 = (NbtList) tag.get("Decorations");
if (nbt1 == null) {
error("Couldn't locate the mansion. Are you holding a (highlight)woodland explorer map(default)?");
return SINGLE_SUCCESS;
}
NbtCompound iconNBT = nbt1.getCompound(0);
if (iconNBT == null) {
error("Couldn't locate the mansion. Are you holding a (highlight)woodland explorer map(default)?");
return SINGLE_SUCCESS;
}
Vec3d coords = new Vec3d(iconNBT.getDouble("x"), iconNBT.getDouble("y"), iconNBT.getDouble("z"));
BaseText text = new LiteralText("Mansion located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
return SINGLE_SUCCESS;
}));
builder.then(literal("stronghold").executes(s -> {
FindItemResult eye = InvUtils.findInHotbar(Items.ENDER_EYE);
if (eye.found()) {
BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute("follow entity minecraft:eye_of_ender");
firstStart = null;
firstEnd = null;
secondStart = null;
secondEnd = null;
MatHax.EVENT_BUS.subscribe(this);
info("Please throw the first Eye of Ender");
} else {
Vec3d coords = findByBlockList(strongholdBlocks);
if (coords == null) {
error("No stronghold found nearby. You can use (highlight)Ender Eyes(default) for more success.");
return SINGLE_SUCCESS;
}
BaseText text = new LiteralText("Stronghold located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
}
return SINGLE_SUCCESS;
}));
builder.then(literal("nether_fortress").executes(s -> {
Vec3d coords = findByBlockList(netherFortressBlocks);
if (coords == null) {
error("No nether fortress found.");
return SINGLE_SUCCESS;
}
BaseText text = new LiteralText("Fortress located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
return SINGLE_SUCCESS;
}));
builder.then(literal("monument").executes(s -> {
ItemStack stack = mc.player.getInventory().getMainHandStack();
if (stack.getItem() == Items.FILLED_MAP) {
NbtCompound tag = stack.getNbt();
if (tag != null) {
NbtList nbt1 = (NbtList) tag.get("Decorations");
if (nbt1 != null) {
NbtCompound iconNBT = nbt1.getCompound(0);
if (iconNBT != null) {
Vec3d coords = new Vec3d(iconNBT.getDouble("x"), iconNBT.getDouble("y"), iconNBT.getDouble("z"));
BaseText text = new LiteralText("Monument located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
return SINGLE_SUCCESS;
}
}
}
}
Vec3d coords = findByBlockList(monumentBlocks);
if (coords == null) {
error("No monument found. You can try using a (highlight)Ocean explorer map(default) for more success.");
return SINGLE_SUCCESS;
}
BaseText text = new LiteralText("Monument located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
return SINGLE_SUCCESS;
}));
builder.then(literal("cancel").executes(s -> {
cancel();
return SINGLE_SUCCESS;
}));
}
use of net.minecraft.text.BaseText in project Client by MatHax.
the class ModulesCommand method build.
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.executes(context -> {
info("--- Modules ((highlight)%d(default)) ---", Modules.get().getCount());
Modules.loopCategories().forEach(category -> {
BaseText categoryMessage = new LiteralText("");
Modules.get().getGroup(category).forEach(module -> categoryMessage.append(getModuleText(module)));
ChatUtils.sendMsg(category.title, categoryMessage);
});
return SINGLE_SUCCESS;
});
}
Aggregations