use of net.minecraft.text.LiteralText in project meteor-rejects by AntiCope.
the class KickCommand method build.
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.then(literal("disconnect").executes(ctx -> {
mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("Disconnected via .kick command")));
return SINGLE_SUCCESS;
}));
builder.then(literal("pos").executes(ctx -> {
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, !mc.player.isOnGround()));
return SINGLE_SUCCESS;
}));
builder.then(literal("hurt").executes(ctx -> {
mc.player.networkHandler.sendPacket(PlayerInteractEntityC2SPacket.attack(mc.player, mc.player.isSneaking()));
return SINGLE_SUCCESS;
}));
builder.then(literal("chat").executes(ctx -> {
mc.player.sendChatMessage("§0§1§");
return SINGLE_SUCCESS;
}));
builder.then(literal("shutdown").executes(ctx -> {
try {
shutdown();
} catch (Exception exception) {
error("Couldn't disconnect. IOException");
}
return SINGLE_SUCCESS;
}));
builder.then(literal("crash").executes(ctx -> {
GlfwUtil.makeJvmCrash();
return SINGLE_SUCCESS;
}));
}
use of net.minecraft.text.LiteralText in project meteor-rejects by AntiCope.
the class LocateCommand method findStronghold.
private void findStronghold() {
if (this.firstStart == null || this.firstEnd == null || this.secondStart == null || this.secondEnd == null) {
error("Missing position data");
cancel();
return;
}
final double[] start = new double[] { this.secondStart.x, this.secondStart.z, this.secondEnd.x, this.secondEnd.z };
final double[] end = new double[] { this.firstStart.x, this.firstStart.z, this.firstEnd.x, this.firstEnd.z };
final double[] intersection = calcIntersection(start, end);
if (Double.isNaN(intersection[0]) || Double.isNaN(intersection[1]) || Double.isInfinite(intersection[0]) || Double.isInfinite(intersection[1])) {
error("Lines are parallel");
cancel();
return;
}
BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute("stop");
MeteorClient.EVENT_BUS.unsubscribe(this);
Vec3d coords = new Vec3d(intersection[0], 0, intersection[1]);
BaseText text = new LiteralText("Stronghold roughly located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
}
use of net.minecraft.text.LiteralText in project meteor-rejects by AntiCope.
the class LocateCommand method build.
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.then(literal("lodestone").executes(ctx -> {
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(argument("feature", EnumArgumentType.enumArgument(WorldGenUtils.Feature.stronghold)).executes(ctx -> {
WorldGenUtils.Feature feature = EnumArgumentType.getEnum(ctx, "feature", WorldGenUtils.Feature.stronghold);
BlockPos pos = WorldGenUtils.locateFeature(feature, mc.player.getBlockPos());
if (pos != null) {
BaseText text = new LiteralText(String.format("%s located at ", Utils.nameToTitle(feature.toString().replaceAll("_", "-"))));
Vec3d coords = new Vec3d(pos.getX(), pos.getY(), pos.getZ());
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
return SINGLE_SUCCESS;
}
if (feature == WorldGenUtils.Feature.stronghold) {
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");
}
}
throw NOT_FOUND.create(feature);
}));
builder.then(literal("cancel").executes(s -> {
cancel();
return SINGLE_SUCCESS;
}));
}
use of net.minecraft.text.LiteralText in project meteor-rejects by AntiCope.
the class SeedCommand method build.
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.executes(ctx -> {
Seed seed = Seeds.get().getSeed();
if (seed == null)
throw NO_SEED.create();
info(seed.toText());
return SINGLE_SUCCESS;
});
builder.then(literal("list").executes(ctx -> {
Seeds.get().seeds.forEach((name, seed) -> {
BaseText text = new LiteralText(name + " ");
text.append(seed.toText());
info(text);
});
return SINGLE_SUCCESS;
}));
builder.then(literal("delete").executes(ctx -> {
Seed seed = Seeds.get().getSeed();
if (seed != null) {
BaseText text = new LiteralText("Deleted ");
text.append(seed.toText());
info(text);
}
Seeds.get().seeds.remove(Utils.getWorldName());
return SINGLE_SUCCESS;
}));
builder.then(argument("seed", StringArgumentType.string()).executes(ctx -> {
Seeds.get().setSeed(StringArgumentType.getString(ctx, "seed"));
return SINGLE_SUCCESS;
}));
builder.then(argument("seed", StringArgumentType.string()).then(argument("version", EnumArgumentType.enumArgument(MCVersion.latest())).executes(ctx -> {
Seeds.get().setSeed(StringArgumentType.getString(ctx, "seed"), EnumArgumentType.getEnum(ctx, "version", MCVersion.latest()));
return SINGLE_SUCCESS;
})));
}
use of net.minecraft.text.LiteralText in project dynmap by webbukkit.
the class FabricCommandSender method sendMessage.
@Override
public void sendMessage(String msg) {
if (sender != null) {
Text ichatcomponent = new LiteralText(msg);
sender.sendFeedback(ichatcomponent, false);
}
}
Aggregations