Update to 1.19

This commit is contained in:
MonkeySaint
2022-06-10 15:37:58 -04:00
committed by Cloudburst
parent f0b189634f
commit f8dd3787d1
35 changed files with 170 additions and 164 deletions

View File

@@ -10,7 +10,6 @@ import net.minecraft.nbt.*;
import anticope.rejects.utils.GiveUtils;
import meteordevelopment.meteorclient.systems.commands.Command;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.registry.Registry;
@@ -73,7 +72,7 @@ public class GiveCommand extends Command {
tag.putBoolean("Interpret", true);
tag.putBoolean("NoGravity", true);
tag.putBoolean("CustomNameVisible", true);
tag.putString("CustomName", Text.Serializer.toJson(new LiteralText(message)));
tag.putString("CustomName", Text.Serializer.toJson(Text.literal(message)));
tag.put("Pos", NbtList);
stack.setSubNbt("EntityTag", tag);
GiveUtils.giveItem(stack);
@@ -84,7 +83,7 @@ public class GiveCommand extends Command {
String message = ctx.getArgument("message", String.class).replace("&", "\247");
ItemStack stack = new ItemStack(Items.BAT_SPAWN_EGG);
NbtCompound tag = new NbtCompound();
tag.putString("CustomName", Text.Serializer.toJson(new LiteralText(message)));
tag.putString("CustomName", Text.Serializer.toJson(Text.literal(message)));
tag.putBoolean("NoAI", true);
tag.putBoolean("Silent", true);
tag.putBoolean("PersistenceRequired", true);

View File

@@ -7,7 +7,7 @@ import net.minecraft.command.CommandSource;
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.network.packet.s2c.play.DisconnectS2CPacket;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import org.apache.commons.lang3.SystemUtils;
import meteordevelopment.meteorclient.systems.commands.Command;
@@ -23,7 +23,7 @@ public class KickCommand extends Command {
@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")));
mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(Text.literal("Disconnected via .kick command")));
return SINGLE_SUCCESS;
}));
builder.then(literal("pos").executes(ctx -> {

View File

@@ -21,8 +21,8 @@ import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket;
import net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.BaseText;
import net.minecraft.text.LiteralText;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@@ -32,12 +32,12 @@ public class LocateCommand extends Command {
private final static DynamicCommandExceptionType NOT_FOUND = new DynamicCommandExceptionType(o -> {
if (o instanceof WorldGenUtils.Feature) {
return new LiteralText(String.format(
return Text.literal(String.format(
"%s not found.",
Utils.nameToTitle(o.toString().replaceAll("_", "-")))
);
}
return new LiteralText("Not found.");
return Text.literal("Not found.");
});
private Vec3d firstStart;
@@ -69,7 +69,7 @@ public class LocateCommand extends Command {
}
Vec3d coords = new Vec3d(nbt1.getDouble("X"),nbt1.getDouble("Y"),nbt1.getDouble("Z"));
BaseText text = new LiteralText("Lodestone located at ");
MutableText text = Text.literal("Lodestone located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);
@@ -80,7 +80,7 @@ public class LocateCommand extends Command {
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(
MutableText text = Text.literal(String.format(
"%s located at ",
Utils.nameToTitle(feature.toString().replaceAll("_", "-"))
));
@@ -172,7 +172,7 @@ public class LocateCommand extends Command {
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 ");
MutableText text = Text.literal("Stronghold roughly located at ");
text.append(ChatUtils.formatCoords(coords));
text.append(".");
info(text);

View File

@@ -9,7 +9,7 @@ import meteordevelopment.meteorclient.systems.commands.arguments.PlayerArgumentT
import meteordevelopment.meteorclient.utils.network.Http;
import net.minecraft.command.CommandSource;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import org.apache.commons.codec.binary.Base64;
import org.lwjgl.BufferUtils;
import org.lwjgl.PointerBuffer;
@@ -25,7 +25,7 @@ import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
public class SaveSkinCommand extends Command {
private final static SimpleCommandExceptionType IO_EXCEPTION = new SimpleCommandExceptionType(new LiteralText("An IOException occurred"));
private final static SimpleCommandExceptionType IO_EXCEPTION = new SimpleCommandExceptionType(Text.literal("An IOException occurred"));
private final PointerBuffer filters;
private final Gson GSON = new Gson();

View File

@@ -6,19 +6,19 @@ import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import net.minecraft.command.CommandSource;
import net.minecraft.text.BaseText;
import net.minecraft.text.LiteralText;
import com.seedfinding.mccore.version.MCVersion;
import meteordevelopment.meteorclient.systems.commands.Command;
import anticope.rejects.utils.seeds.Seed;
import anticope.rejects.utils.seeds.Seeds;
import meteordevelopment.meteorclient.utils.Utils;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
public class SeedCommand extends Command {
private final static SimpleCommandExceptionType NO_SEED = new SimpleCommandExceptionType(new LiteralText("No seed for current world saved."));
private final static SimpleCommandExceptionType NO_SEED = new SimpleCommandExceptionType(Text.literal("No seed for current world saved."));
public SeedCommand() {
super("seed", "Get or set seed for the current world.");
@@ -35,7 +35,7 @@ public class SeedCommand extends Command {
builder.then(literal("list").executes(ctx -> {
Seeds.get().seeds.forEach((name, seed) -> {
BaseText text = new LiteralText(name + " ");
MutableText text = Text.literal(name + " ");
text.append(seed.toText());
info(text);
});
@@ -45,7 +45,7 @@ public class SeedCommand extends Command {
builder.then(literal("delete").executes(ctx -> {
Seed seed = Seeds.get().getSeed();
if (seed != null) {
BaseText text = new LiteralText("Deleted ");
MutableText text = Text.literal("Deleted ");
text.append(seed.toText());
info(text);
}

View File

@@ -6,11 +6,11 @@ import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import net.minecraft.client.network.ServerInfo;
import net.minecraft.command.CommandSource;
import net.minecraft.text.BaseText;
import net.minecraft.text.ClickEvent;
import net.minecraft.text.HoverEvent;
import net.minecraft.text.LiteralText;
import net.minecraft.text.ClickEvent.Action;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import anticope.rejects.utils.portscanner.PScanRunner;
@@ -34,8 +34,8 @@ import com.mojang.brigadier.arguments.IntegerArgumentType;
*/
public class ServerCommand extends Command {
private final static SimpleCommandExceptionType ADDRESS_ERROR = new SimpleCommandExceptionType(new LiteralText("Couldn't obtain server address"));
private final static SimpleCommandExceptionType INVALID_RANGE = new SimpleCommandExceptionType(new LiteralText("Invalid range"));
private final static SimpleCommandExceptionType ADDRESS_ERROR = new SimpleCommandExceptionType(Text.literal("Couldn't obtain server address"));
private final static SimpleCommandExceptionType INVALID_RANGE = new SimpleCommandExceptionType(Text.literal("Invalid range"));
private final static HashMap<Integer, String> ports = new HashMap<Integer, String>();
@@ -119,8 +119,8 @@ public class ServerCommand extends Command {
scanPorts(address, port_list);
}
private BaseText formatPort(int port, InetAddress address) {
BaseText text = new LiteralText(String.format("- %s%d%s ", Formatting.GREEN, port, Formatting.GRAY));
private MutableText formatPort(int port, InetAddress address) {
MutableText text = Text.literal(String.format("- %s%d%s ", Formatting.GREEN, port, Formatting.GRAY));
if (ports.containsKey(port)) {
text.append(ports.get(port));
if (ports.get(port).startsWith("HTTP") || ports.get(port).startsWith("FTP")) {
@@ -131,7 +131,7 @@ public class ServerCommand extends Command {
))
.withHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new LiteralText("Open in browser")
Text.literal("Open in browser")
))
);
} else if (ports.get(port) == "DynMap") {
@@ -142,7 +142,7 @@ public class ServerCommand extends Command {
))
.withHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new LiteralText("Open in browser")
Text.literal("Open in browser")
))
);
} else {
@@ -153,7 +153,7 @@ public class ServerCommand extends Command {
))
.withHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new LiteralText("Copy")
Text.literal("Copy")
))
);
}
@@ -165,7 +165,7 @@ public class ServerCommand extends Command {
))
.withHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new LiteralText("Copy")
Text.literal("Copy")
))
);
}

View File

@@ -3,6 +3,7 @@ package anticope.rejects.commands;
import anticope.rejects.arguments.ClientPosArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import meteordevelopment.meteorclient.systems.commands.Command;
import meteordevelopment.meteorclient.systems.commands.Commands;
import net.minecraft.block.BlockState;
import net.minecraft.command.CommandSource;
import net.minecraft.command.argument.BlockStateArgument;
@@ -19,7 +20,7 @@ public class SetBlockCommand extends Command {
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.then(argument("pos", ClientPosArgumentType.pos()).then(argument("block", BlockStateArgumentType.blockState()).executes(ctx -> {
builder.then(argument("pos", ClientPosArgumentType.pos()).then(argument("block", BlockStateArgumentType.blockState(Commands.REGISTRY_ACCESS)).executes(ctx -> {
Vec3d pos = ClientPosArgumentType.getPos(ctx, "pos");
BlockState blockState = ctx.getArgument("block", BlockStateArgument.class).getBlockState();
mc.world.setBlockState(new BlockPos((int)pos.getX(), (int)pos.getY(), (int)pos.getZ()), blockState);

View File

@@ -6,7 +6,7 @@ import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import meteordevelopment.meteorclient.systems.commands.Command;
import net.minecraft.command.CommandSource;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.math.BlockPos;
import org.lwjgl.BufferUtils;
@@ -24,7 +24,7 @@ public class TerrainExport extends Command {
private final PointerBuffer filters;
private final static SimpleCommandExceptionType IO_EXCEPTION = new SimpleCommandExceptionType(new LiteralText("An IOException occurred"));
private final static SimpleCommandExceptionType IO_EXCEPTION = new SimpleCommandExceptionType(Text.literal("An IOException occurred"));
public TerrainExport() {
super("terrain-export", "Export an area to the c++ terrain finder format (very popbob command).");