New Modules and update to 1.19.3 (#186)
This commit is contained in:
@@ -35,9 +35,12 @@ public class MeteorRejectsAddon extends MeteorAddon {
|
||||
modules.add(new AntiBot());
|
||||
modules.add(new AntiSpawnpoint());
|
||||
modules.add(new AntiVanish());
|
||||
modules.add(new ArrowDmg());
|
||||
modules.add(new AutoBedTrap());
|
||||
modules.add(new AutoCraft());
|
||||
modules.add(new AutoExtinguish());
|
||||
modules.add(new AutoGrind());
|
||||
modules.add(new AutoLogin());
|
||||
modules.add(new AutoPot());
|
||||
modules.add(new AutoSoup());
|
||||
modules.add(new AutoTNT());
|
||||
@@ -84,7 +87,7 @@ public class MeteorRejectsAddon extends MeteorAddon {
|
||||
commands.add(new GiveCommand());
|
||||
commands.add(new HeadsCommand());
|
||||
commands.add(new KickCommand());
|
||||
// commands.add(new LocateCommand()); I wish it was that simple -_-
|
||||
commands.add(new LocateCommand());
|
||||
commands.add(new PanicCommand());
|
||||
commands.add(new ReconnectCommand());
|
||||
commands.add(new ServerCommand());
|
||||
|
||||
@@ -10,8 +10,8 @@ import net.minecraft.nbt.*;
|
||||
|
||||
import anticope.rejects.utils.GiveUtils;
|
||||
import meteordevelopment.meteorclient.systems.commands.Command;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class GiveCommand extends Command {
|
||||
ct.putInt("Time",1);
|
||||
ct.putString("id", "minecraft:falling_block");
|
||||
ct.put("BlockState", new NbtCompound());
|
||||
ct.getCompound("BlockState").putString("Name", Registry.ITEM.getId(inHand.getItem()).toString());
|
||||
ct.getCompound("BlockState").putString("Name", Registries.ITEM.getId(inHand.getItem()).toString());
|
||||
if (inHand.hasNbt() && inHand.getNbt().contains("BlockEntityTag")) {
|
||||
ct.put("TileEntityData", inHand.getNbt().getCompound("BlockEntityTag"));
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class GiveCommand extends Command {
|
||||
} else {
|
||||
ct.putString("id", "minecraft:item");
|
||||
NbtCompound it = new NbtCompound();
|
||||
it.putString("id", Registry.ITEM.getId(inHand.getItem()).toString());
|
||||
it.putString("id", Registries.ITEM.getId(inHand.getItem()).toString());
|
||||
it.putInt("Count",inHand.getCount());
|
||||
if (inHand.hasNbt()) {
|
||||
it.put("tag", inHand.getNbt());
|
||||
|
||||
@@ -1,26 +1,13 @@
|
||||
package anticope.rejects.commands;
|
||||
|
||||
import anticope.rejects.arguments.EnumArgumentType;
|
||||
import baritone.api.BaritoneAPI;
|
||||
import anticope.rejects.utils.WorldGenUtils;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
|
||||
import meteordevelopment.meteorclient.MeteorClient;
|
||||
import meteordevelopment.meteorclient.events.packets.PacketEvent;
|
||||
import meteordevelopment.meteorclient.systems.commands.Command;
|
||||
import meteordevelopment.meteorclient.utils.Utils;
|
||||
import meteordevelopment.meteorclient.utils.player.ChatUtils;
|
||||
import meteordevelopment.meteorclient.utils.player.FindItemResult;
|
||||
import meteordevelopment.meteorclient.utils.player.InvUtils;
|
||||
import anticope.rejects.utils.WorldGenUtils;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
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.MutableText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -31,58 +18,28 @@ import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||
public class LocateCommand extends Command {
|
||||
|
||||
private final static DynamicCommandExceptionType NOT_FOUND = new DynamicCommandExceptionType(o -> {
|
||||
if (o instanceof WorldGenUtils.Feature) {
|
||||
return Text.literal(String.format(
|
||||
"%s not found.",
|
||||
Utils.nameToTitle(o.toString().replaceAll("_", "-")))
|
||||
);
|
||||
}
|
||||
return Text.literal("Not found.");
|
||||
if (o instanceof WorldGenUtils.Feature) {
|
||||
return Text.literal(String.format(
|
||||
"%s not found.",
|
||||
Utils.nameToTitle(o.toString().replaceAll("_", "-")))
|
||||
);
|
||||
}
|
||||
return Text.literal("Not found.");
|
||||
});
|
||||
|
||||
private Vec3d firstStart;
|
||||
private Vec3d firstEnd;
|
||||
private Vec3d secondStart;
|
||||
private Vec3d secondEnd;
|
||||
|
||||
public LocateCommand() {
|
||||
super("locate", "Locates structures", "loc");
|
||||
super("locate", "Locates structures.", "loc");
|
||||
}
|
||||
|
||||
@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"));
|
||||
MutableText text = Text.literal("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 -> {
|
||||
builder.then(literal("feature").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) {
|
||||
MutableText text = Text.literal(String.format(
|
||||
"%s located at ",
|
||||
Utils.nameToTitle(feature.toString().replaceAll("_", "-"))
|
||||
"%s located at ",
|
||||
Utils.nameToTitle(feature.toString().replaceAll("_", "-"))
|
||||
));
|
||||
Vec3d coords = new Vec3d(pos.getX(), pos.getY(), pos.getZ());
|
||||
text.append(ChatUtils.formatCoords(coords));
|
||||
@@ -90,105 +47,7 @@ public class LocateCommand extends Command {
|
||||
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;
|
||||
}));
|
||||
}
|
||||
|
||||
private void cancel() {
|
||||
warning("Locate canceled");
|
||||
MeteorClient.EVENT_BUS.unsubscribe(this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onReadPacket(PacketEvent.Receive event) {
|
||||
if (event.packet instanceof EntitySpawnS2CPacket) {
|
||||
EntitySpawnS2CPacket packet = (EntitySpawnS2CPacket) event.packet;
|
||||
if (packet.getEntityTypeId() == EntityType.EYE_OF_ENDER) {
|
||||
firstPosition(packet.getX(),packet.getY(),packet.getZ());
|
||||
}
|
||||
}
|
||||
if (event.packet instanceof PlaySoundS2CPacket) {
|
||||
PlaySoundS2CPacket packet = (PlaySoundS2CPacket) event.packet;
|
||||
if (packet.getSound() == SoundEvents.ENTITY_ENDER_EYE_DEATH) {
|
||||
lastPosition(packet.getX(), packet.getY(), packet.getZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void firstPosition(double x, double y, double z) {
|
||||
Vec3d pos = new Vec3d(x, y, z);
|
||||
if (this.firstStart == null) {
|
||||
this.firstStart = pos;
|
||||
}
|
||||
else {
|
||||
this.secondStart = pos;
|
||||
}
|
||||
}
|
||||
|
||||
private void lastPosition(double x, double y, double z) {
|
||||
info("%s Eye of Ender's trajectory saved.", (this.firstEnd == null) ? "First" : "Second");
|
||||
Vec3d pos = new Vec3d(x, y, z);
|
||||
if (this.firstEnd == null) {
|
||||
this.firstEnd = pos;
|
||||
info("Please throw the second Eye Of Ender from a different location.");
|
||||
}
|
||||
else {
|
||||
this.secondEnd = pos;
|
||||
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]);
|
||||
MutableText text = Text.literal("Stronghold roughly located at ");
|
||||
text.append(ChatUtils.formatCoords(coords));
|
||||
text.append(".");
|
||||
info(text);
|
||||
}
|
||||
|
||||
private double[] calcIntersection(double[] line, double[] line2) {
|
||||
final double a1 = line[3] - line[1];
|
||||
final double b1 = line[0] - line[2];
|
||||
final double c1 = a1 * line[0] + b1 * line[1];
|
||||
|
||||
final double a2 = line2[3] - line2[1];
|
||||
final double b2 = line2[0] - line2[2];
|
||||
final double c2 = a2 * line2[0] + b2 * line2[1];
|
||||
|
||||
final double delta = a1 * b2 - a2 * b1;
|
||||
|
||||
return new double[]{(b2 * c1 - b1 * c2) / delta, (a1 * c2 - a2 * c1) / delta};
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package anticope.rejects.events;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class StopUsingItemEvent {
|
||||
private static final StopUsingItemEvent INSTANCE = new StopUsingItemEvent();
|
||||
|
||||
public ItemStack itemStack;
|
||||
|
||||
public static StopUsingItemEvent get(ItemStack itemStack) {
|
||||
INSTANCE.itemStack = itemStack;
|
||||
return INSTANCE;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package anticope.rejects.gui.hud;
|
||||
import java.util.Iterator;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.meteorclient.systems.hud.Hud;
|
||||
import meteordevelopment.meteorclient.systems.hud.HudElementInfo;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
@@ -23,7 +22,6 @@ import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.ESP;
|
||||
import meteordevelopment.meteorclient.systems.waypoints.Waypoint;
|
||||
import meteordevelopment.meteorclient.systems.waypoints.Waypoints;
|
||||
import meteordevelopment.meteorclient.utils.misc.Vec3;
|
||||
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
|
||||
|
||||
import static meteordevelopment.meteorclient.MeteorClient.mc;
|
||||
@@ -118,8 +116,7 @@ public class RadarHud extends HudElement {
|
||||
while (waypoints.hasNext()) {
|
||||
Waypoint waypoint = waypoints.next();
|
||||
BlockPos blockPos = waypoint.getPos();
|
||||
Vec3 c = new Vec3(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5);
|
||||
Vec3d coords = new Vec3d(c.x, c.y, c.z);
|
||||
Vec3d coords = new Vec3d(blockPos.getX() + 0.5, blockPos.getY(), blockPos.getZ() + 0.5);
|
||||
double xPos = ((coords.getX() - mc.player.getX()) * scale.get() * zoom.get() + width/2);
|
||||
double yPos = ((coords.getZ() - mc.player.getZ()) * scale.get() * zoom.get() + height/2);
|
||||
if (xPos < 0 || yPos < 0 || xPos > width - scale.get() || yPos > height - scale.get()) continue;
|
||||
|
||||
@@ -10,10 +10,8 @@ import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import meteordevelopment.meteorclient.utils.misc.MeteorStarscript;
|
||||
import meteordevelopment.meteorclient.utils.render.PeekScreen;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.starscript.Script;
|
||||
import meteordevelopment.starscript.compiler.Compiler;
|
||||
import meteordevelopment.starscript.compiler.Parser;
|
||||
import meteordevelopment.starscript.compiler.Parser.Result;
|
||||
import meteordevelopment.starscript.utils.Error;
|
||||
import meteordevelopment.starscript.utils.StarscriptError;
|
||||
|
||||
@@ -42,6 +40,7 @@ import org.lwjgl.glfw.GLFW;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/*
|
||||
@@ -55,8 +54,8 @@ public class InteractionScreen extends Screen {
|
||||
private String focusedString = null;
|
||||
private int crosshairX, crosshairY, focusedDot = -1;
|
||||
private float yaw, pitch;
|
||||
private final HashMap<String, Consumer<Entity>> functions;
|
||||
private final HashMap<String, String> msgs;
|
||||
private final Map<String, Consumer<Entity>> functions;
|
||||
private final Map<String, String> msgs;
|
||||
|
||||
private final StaticListener shiftListener = new StaticListener();
|
||||
|
||||
@@ -146,7 +145,7 @@ public class InteractionScreen extends Screen {
|
||||
closeScreen();
|
||||
});
|
||||
}
|
||||
msgs = Modules.get().get(InteractionMenu.class).messages;
|
||||
msgs = Modules.get().get(InteractionMenu.class).messages.get();
|
||||
msgs.keySet().forEach((key) -> {
|
||||
functions.put(key, (Entity e) -> {
|
||||
closeScreen();
|
||||
@@ -242,7 +241,7 @@ public class InteractionScreen extends Screen {
|
||||
public void render(MatrixStack matrix, int mouseX, int mouseY, float delta) {
|
||||
// Fake crosshair stuff
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
||||
RenderSystem.setShaderTexture(0, GUI_ICONS_TEXTURE);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.ONE_MINUS_DST_COLOR,
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package anticope.rejects.mixin;
|
||||
|
||||
import anticope.rejects.events.StopUsingItemEvent;
|
||||
import meteordevelopment.meteorclient.MeteorClient;
|
||||
import net.minecraft.client.network.ClientPlayerInteractionManager;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ClientPlayerInteractionManager.class)
|
||||
public class ClientPlayerInteractionManagerMixin {
|
||||
@Inject(at = @At("HEAD"), method = "stopUsingItem")
|
||||
public void onStopUsingItem(PlayerEntity player, CallbackInfo ci) {
|
||||
MeteorClient.EVENT_BUS.post(StopUsingItemEvent.get(player.getInventory().getMainHandStack()));
|
||||
}
|
||||
}
|
||||
@@ -3,26 +3,26 @@ package anticope.rejects.mixin;
|
||||
import anticope.rejects.modules.Rendering;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
|
||||
import net.minecraft.client.gl.PostEffectProcessor;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.*;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gl.ShaderEffect;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(GameRenderer.class)
|
||||
public class GameRendererMixin {
|
||||
@Shadow @Final private MinecraftClient client;
|
||||
@Shadow @Final MinecraftClient client;
|
||||
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;drawEntityOutlinesFramebuffer()V", ordinal = 0))
|
||||
private void renderShader(float tickDelta, long startTime, boolean tick, CallbackInfo ci) {
|
||||
Rendering renderingModule = Modules.get().get(Rendering.class);
|
||||
if (renderingModule == null) return;
|
||||
ShaderEffect shader = renderingModule.getShaderEffect();
|
||||
PostEffectProcessor shader = renderingModule.getShaderEffect();
|
||||
|
||||
if (shader != null) {
|
||||
shader.setupDimensions(client.getWindow().getFramebufferWidth(), client.getWindow().getFramebufferHeight());
|
||||
|
||||
@@ -6,9 +6,9 @@ import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.entity.LivingEntityRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@@ -24,7 +24,7 @@ public class LivingEntityRendererMixin {
|
||||
if (renderingModule == null) return;
|
||||
if ((!(entity instanceof PlayerEntity)) && renderingModule.dinnerboneEnabled()) {
|
||||
matrices.translate(0.0D, entity.getHeight() + 0.1F, 0.0D);
|
||||
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(180.0F));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(180.0F));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,9 @@ public abstract class MultiplayerScreenMixin extends Screen {
|
||||
|
||||
@Inject(method = "init", at = @At("TAIL"))
|
||||
private void onInit(CallbackInfo info) {
|
||||
addDrawableChild(new ButtonWidget(this.width - 75 - 3 - 75 - 2 - 75 - 2, 3, 75, 20, Text.literal("Servers"), button -> {
|
||||
client.setScreen(new ServerManagerScreen(GuiThemes.get(), (MultiplayerScreen) (Object) this));
|
||||
}));
|
||||
addDrawableChild(new ButtonWidget.Builder(Text.literal("Servers"), button -> client.setScreen(new ServerManagerScreen(GuiThemes.get(), (MultiplayerScreen) (Object) this)))
|
||||
.size(75, 20)
|
||||
.position(this.width - 75 - 3 - 75 - 2 - 75 - 2, 3)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package anticope.rejects.mixin.meteor;
|
||||
|
||||
import anticope.rejects.commands.LocateCommand;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
||||
import meteordevelopment.meteorclient.systems.commands.Command;
|
||||
import meteordevelopment.meteorclient.systems.commands.Commands;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import net.minecraft.command.CommandSource;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Mixin(Commands.class)
|
||||
public class CommandsMixin {
|
||||
@Shadow(remap = false)
|
||||
@Final
|
||||
private List<Command> commands;
|
||||
|
||||
@Shadow(remap = false)
|
||||
@Final
|
||||
private Map<Class<? extends Command>, Command> commandInstances;
|
||||
|
||||
|
||||
@Shadow(remap = false)
|
||||
@Final
|
||||
private CommandDispatcher<CommandSource> DISPATCHER;
|
||||
|
||||
@Inject(method = "add", at=@At("HEAD"), remap = false, cancellable = true)
|
||||
private void onAdd(Command cmd, CallbackInfo ci) {
|
||||
if (cmd instanceof meteordevelopment.meteorclient.systems.commands.commands.LocateCommand) {
|
||||
Command command = new LocateCommand();
|
||||
commands.removeIf(command1 -> command1.getName().equals(command.getName()));
|
||||
commandInstances.values().removeIf(command1 -> command1.getName().equals(command.getName()));
|
||||
|
||||
command.registerTo(DISPATCHER);
|
||||
commands.add(command);
|
||||
commandInstances.put(command.getClass(), command);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package anticope.rejects.mixin.meteor;
|
||||
|
||||
import anticope.rejects.settings.RejectsSettings;
|
||||
import meteordevelopment.meteorclient.gui.DefaultSettingsWidgetFactory;
|
||||
import meteordevelopment.meteorclient.gui.GuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.utils.SettingsWidgetFactory;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(DefaultSettingsWidgetFactory.class)
|
||||
public abstract class DefaultSettingsWidgetFactoryMixin extends SettingsWidgetFactory {
|
||||
public DefaultSettingsWidgetFactoryMixin(GuiTheme theme) {
|
||||
super(theme);
|
||||
}
|
||||
|
||||
@Inject(method = "<init>", at = @At("TAIL"), remap = false)
|
||||
private void onInit(GuiTheme theme, CallbackInfo ci) {
|
||||
new RejectsSettings(factories, this.theme).addSettings();
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(Module.class)
|
||||
public class ModuleMixin {
|
||||
@Mutable @Shadow public String name;
|
||||
@Mutable @Shadow(remap = false) public String name;
|
||||
|
||||
@Mutable @Shadow public String title;
|
||||
@Mutable @Shadow(remap = false) public String title;
|
||||
|
||||
@Inject(method = "<init>", at = @At("TAIL"), remap = false)
|
||||
private void onInit(Category category, String name, String description, CallbackInfo info) {
|
||||
|
||||
@@ -37,14 +37,13 @@ public class AntiVanish extends Module {
|
||||
|
||||
@EventHandler
|
||||
public void onPacket(PacketEvent.Receive event) {
|
||||
if (event.packet instanceof PlayerListS2CPacket) {
|
||||
PlayerListS2CPacket packet = (PlayerListS2CPacket) event.packet;
|
||||
if (packet.getAction() == PlayerListS2CPacket.Action.UPDATE_LATENCY) {
|
||||
if (event.packet instanceof PlayerListS2CPacket packet) {
|
||||
if (packet.getActions().contains(PlayerListS2CPacket.Action.UPDATE_LATENCY)) {
|
||||
try {
|
||||
for (PlayerListS2CPacket.Entry entry : packet.getEntries()) {
|
||||
if (mc.getNetworkHandler().getPlayerListEntry(entry.getProfile().getId()) != null)
|
||||
if (mc.getNetworkHandler().getPlayerListEntry(entry.profileId()) != null)
|
||||
continue;
|
||||
toLookup.add(entry.getProfile().getId());
|
||||
toLookup.add(entry.profileId());
|
||||
}
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
|
||||
66
src/main/java/anticope/rejects/modules/ArrowDmg.java
Normal file
66
src/main/java/anticope/rejects/modules/ArrowDmg.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import anticope.rejects.events.StopUsingItemEvent;
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.IntSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
||||
|
||||
public class ArrowDmg extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
public final Setting<Integer> packets = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("packets")
|
||||
.description("Amount of packets to send. More packets = higher damage.")
|
||||
.defaultValue(200)
|
||||
.min(2)
|
||||
.sliderMax(2000)
|
||||
.build()
|
||||
);
|
||||
|
||||
public final Setting<Boolean> tridents = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("tridents")
|
||||
.description("When enabled, tridents fly much further. Doesn't seem to affect damage or Riptide. WARNING: You can easily lose your trident by enabling this option!")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
public ArrowDmg() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "arrow-damage", "Massively increases arrow damage, but also consumes a lot of hunger and reduces accuracy. Does not work with crossbows and seems to be patched on Paper servers.");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onStopUsingItem(StopUsingItemEvent event) {
|
||||
if (!isValidItem(event.itemStack.getItem()))
|
||||
return;
|
||||
|
||||
ClientPlayerEntity p = mc.player;
|
||||
|
||||
p.networkHandler.sendPacket(
|
||||
new ClientCommandC2SPacket(p, ClientCommandC2SPacket.Mode.START_SPRINTING));
|
||||
|
||||
double x = p.getX();
|
||||
double y = p.getY();
|
||||
double z = p.getZ();
|
||||
|
||||
for (int i = 0; i < packets.get() / 2; i++) {
|
||||
p.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x,
|
||||
y - 1e-10, z, true));
|
||||
p.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x,
|
||||
y + 1e-10, z, false));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isValidItem(Item item) {
|
||||
return tridents.get() && item == Items.TRIDENT || item == Items.BOW;
|
||||
}
|
||||
}
|
||||
@@ -17,11 +17,11 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class AutoExtinguish extends Module {
|
||||
private BlockPos blockPos = null;
|
||||
private boolean doesWaterBucketWork = true;
|
||||
|
||||
private static final StatusEffect FIRE_RESISTANCE = Registry.STATUS_EFFECT.get(new Identifier("fire_resistance"));
|
||||
private static final StatusEffect FIRE_RESISTANCE = Registries.STATUS_EFFECT.get(new Identifier("fire_resistance"));
|
||||
|
||||
public AutoExtinguish() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "auto-extinguish", "Automatically extinguishes fire around you");
|
||||
|
||||
94
src/main/java/anticope/rejects/modules/AutoGrind.java
Normal file
94
src/main/java/anticope/rejects/modules/AutoGrind.java
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
|
||||
* Copyright (c) Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.meteorclient.events.game.OpenScreenEvent;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.network.MeteorExecutor;
|
||||
import meteordevelopment.meteorclient.utils.player.InvUtils;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.GrindstoneScreenHandler;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class AutoGrind extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Integer> delay = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("delay")
|
||||
.description("The tick delay between grinding items.")
|
||||
.defaultValue(50)
|
||||
.sliderMax(500)
|
||||
.min(0)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<List<Item>> itemBlacklist = sgGeneral.add(new ItemListSetting.Builder()
|
||||
.name("item-blacklist")
|
||||
.description("Items that should be ignored.")
|
||||
.defaultValue()
|
||||
.filter(Item::isDamageable)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<List<Enchantment>> enchantmentBlacklist = sgGeneral.add(new EnchantmentListSetting.Builder()
|
||||
.name("enchantment-blacklist")
|
||||
.description("Enchantments that should be ignored.")
|
||||
.defaultValue()
|
||||
.build()
|
||||
);
|
||||
|
||||
public AutoGrind() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "auto-grind", "Automatically disenchants items.");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onOpenScreen(OpenScreenEvent event) {
|
||||
if (!(mc.player.currentScreenHandler instanceof GrindstoneScreenHandler))
|
||||
return;
|
||||
|
||||
MeteorExecutor.execute(() -> {
|
||||
for (int i = 0; i <= mc.player.getInventory().size(); i++) {
|
||||
if (canGrind(mc.player.getInventory().getStack(i))) {
|
||||
try {
|
||||
Thread.sleep(delay.get());
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (mc.currentScreen == null) break;
|
||||
|
||||
InvUtils.quickMove().slot(i);
|
||||
InvUtils.move().fromId(2).to(i);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean canGrind(ItemStack stack) {
|
||||
if (itemBlacklist.get().contains(stack.getItem())) return false;
|
||||
|
||||
Map<Enchantment, Integer> enchantments = EnchantmentHelper.get(stack);
|
||||
int availEnchs = 0;
|
||||
|
||||
for (Enchantment enchantment : enchantments.keySet()) {
|
||||
availEnchs++;
|
||||
if (enchantment.isCursed())
|
||||
availEnchs--;
|
||||
if (enchantmentBlacklist.get().contains(enchantment))
|
||||
return false;
|
||||
}
|
||||
|
||||
return enchantments.size() > 0 && availEnchs > 0;
|
||||
}
|
||||
}
|
||||
110
src/main/java/anticope/rejects/modules/AutoLogin.java
Normal file
110
src/main/java/anticope/rejects/modules/AutoLogin.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
|
||||
* Copyright (c) Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import anticope.rejects.settings.StringMapSetting;
|
||||
import anticope.rejects.utils.RejectsUtils;
|
||||
import meteordevelopment.meteorclient.MeteorClient;
|
||||
import meteordevelopment.meteorclient.events.game.GameJoinedEvent;
|
||||
import meteordevelopment.meteorclient.events.packets.PacketEvent;
|
||||
import meteordevelopment.meteorclient.gui.GuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WHorizontalList;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WButton;
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.IntSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.Utils;
|
||||
import meteordevelopment.meteorclient.utils.player.ChatUtils;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.network.packet.c2s.play.CommandExecutionC2SPacket;
|
||||
import net.minecraft.text.ClickEvent;
|
||||
import net.minecraft.text.MutableText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class AutoLogin extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Integer> delay = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("delay")
|
||||
.description("Delay in ms before executing the command.")
|
||||
.defaultValue(1000)
|
||||
.min(0)
|
||||
.sliderMax(10000)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> smart = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("smart")
|
||||
.description("Auto add the entries.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Map<String, String>> commands = sgGeneral.add(new StringMapSetting.Builder()
|
||||
.name("commands")
|
||||
.description("Server and commands. (* for universal)")
|
||||
.defaultValue(new LinkedHashMap<>() {{
|
||||
put("localhost", "/login 123456");
|
||||
}})
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Timer timer = new Timer();
|
||||
|
||||
public AutoLogin() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "auto-login", "Runs command when joining specified server.");
|
||||
MeteorClient.EVENT_BUS.subscribe(new Listener());
|
||||
}
|
||||
|
||||
@Override
|
||||
public WWidget getWidget(GuiTheme theme) {
|
||||
WHorizontalList l = theme.horizontalList();
|
||||
WButton btn = l.add(theme.button("Random generate password")).widget();
|
||||
btn.action = () -> {
|
||||
String password = RejectsUtils.getRandomPassword(16);
|
||||
MutableText text = Text.literal(Formatting.BOLD + "Click here to register securely.");
|
||||
text.setStyle(text.getStyle().withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.format("/register %s %s", password, password))));
|
||||
info(text);
|
||||
};
|
||||
return l;
|
||||
}
|
||||
|
||||
private class Listener {
|
||||
@EventHandler
|
||||
private void onGameJoined(GameJoinedEvent event) {
|
||||
String command = commands.get().getOrDefault("*", commands.get().get(Utils.getWorldName()));
|
||||
if (command != null) {
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mc.player != null) ChatUtils.sendPlayerMsg(command);
|
||||
}
|
||||
}, delay.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onPacketSent(PacketEvent.Send event) {
|
||||
if (!smart.get()) return;
|
||||
|
||||
if (event.packet instanceof CommandExecutionC2SPacket packet) {
|
||||
String command = packet.command();
|
||||
List<String> hint = Arrays.asList("reg", "register", "l", "login", "log");
|
||||
String[] cmds = command.split(" ");
|
||||
if (cmds.length >= 2 && hint.contains(cmds[0])) {
|
||||
commands.get().put(Utils.getWorldName(), "/login " + cmds[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +1,34 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.meteorclient.gui.utils.StarscriptTextBoxRenderer;
|
||||
import meteordevelopment.meteorclient.utils.player.ChatUtils;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtString;
|
||||
import net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket;
|
||||
|
||||
import anticope.rejects.settings.StringMapSetting;
|
||||
import meteordevelopment.meteorclient.events.game.ReceiveMessageEvent;
|
||||
import meteordevelopment.meteorclient.gui.GuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WTable;
|
||||
import meteordevelopment.meteorclient.gui.widgets.input.WTextBox;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WMinus;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WPlus;
|
||||
import meteordevelopment.meteorclient.gui.utils.StarscriptTextBoxRenderer;
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.settings.StringSetting;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.misc.MeteorStarscript;
|
||||
import meteordevelopment.meteorclient.utils.player.ChatUtils;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.starscript.Script;
|
||||
import meteordevelopment.starscript.compiler.Compiler;
|
||||
import meteordevelopment.starscript.compiler.Parser;
|
||||
import meteordevelopment.starscript.utils.StarscriptError;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ChatBot extends Module {
|
||||
|
||||
public final HashMap<String, String> commands = new HashMap<>() {{
|
||||
put("ping", "Pong!");
|
||||
put("tps", "Current TPS: {server.tps}");
|
||||
put("time", "It's currently {server.time}");
|
||||
put("pos", "I am @ {player.pos}");
|
||||
}};
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<String> prefix = sgGeneral.add(new StringSetting.Builder()
|
||||
.name("prefix")
|
||||
.description("Command prefix for the bot.")
|
||||
.defaultValue("!")
|
||||
.build()
|
||||
.name("prefix")
|
||||
.description("Command prefix for the bot.")
|
||||
.defaultValue("!")
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> help = sgGeneral.add(new BoolSetting.Builder()
|
||||
@@ -54,23 +38,33 @@ public class ChatBot extends Module {
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Map<String, String>> commands = sgGeneral.add(new StringMapSetting.Builder()
|
||||
.name("commands")
|
||||
.description("Commands.")
|
||||
.renderer(StarscriptTextBoxRenderer.class)
|
||||
.defaultValue(new LinkedHashMap<>() {{
|
||||
put("ping", "Pong!");
|
||||
put("tps", "Current TPS: {server.tps}");
|
||||
put("time", "It's currently {server.time}");
|
||||
put("pos", "I am @ {player.pos}");
|
||||
}})
|
||||
.build()
|
||||
);
|
||||
|
||||
public ChatBot() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "chat-bot", "Bot which automatically responds to chat messages.");
|
||||
}
|
||||
|
||||
private String currMsgK = "", currMsgV = "";
|
||||
|
||||
@EventHandler
|
||||
private void onMessageRecieve(ReceiveMessageEvent event) {
|
||||
String msg = event.getMessage().getString();
|
||||
if (help.get() && msg.endsWith(prefix.get()+"help")) {
|
||||
mc.player.sendMessage(Text.of("Avaliable commands: " + String.join(", ", commands.keySet())), false);
|
||||
// mc.getNetworkHandler().sendPacket(new ChatMessageC2SPacket("Avaliable commands: " + String.join(", ", commands.keySet())), );
|
||||
if (help.get() && msg.endsWith(prefix.get() + "help")) {
|
||||
ChatUtils.sendPlayerMsg("Available commands: " + String.join(", ", commands.get().keySet()));
|
||||
return;
|
||||
}
|
||||
for (String cmd : commands.keySet()) {
|
||||
if (msg.endsWith(prefix.get()+cmd)) {
|
||||
Script script = compile(commands.get(cmd));
|
||||
for (String cmd : commands.get().keySet()) {
|
||||
if (msg.endsWith(prefix.get() + cmd)) {
|
||||
Script script = compile(commands.get().get(cmd));
|
||||
if (script == null) ChatUtils.sendPlayerMsg("An error occurred");
|
||||
try {
|
||||
var section = MeteorStarscript.ss.run(script);
|
||||
@@ -84,71 +78,6 @@ public class ChatBot extends Module {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WWidget getWidget(GuiTheme theme) {
|
||||
WTable table = theme.table();
|
||||
fillTable(theme, table);
|
||||
return table;
|
||||
}
|
||||
|
||||
private void fillTable(GuiTheme theme, WTable table) {
|
||||
table.clear();
|
||||
commands.keySet().forEach((key) -> {
|
||||
table.add(theme.label(key)).expandCellX();
|
||||
table.add(theme.label(commands.get(key))).expandCellX();
|
||||
WMinus delete = table.add(theme.minus()).widget();
|
||||
delete.action = () -> {
|
||||
commands.remove(key);
|
||||
fillTable(theme,table);
|
||||
};
|
||||
table.row();
|
||||
});
|
||||
WTextBox textBoxK = table.add(theme.textBox(currMsgK)).minWidth(100).expandX().widget();
|
||||
textBoxK.action = () -> {
|
||||
currMsgK = textBoxK.get();
|
||||
};
|
||||
WTextBox textBoxV = table.add(theme.textBox(currMsgV, (text1, c) -> true, StarscriptTextBoxRenderer.class)).minWidth(100).expandX().widget();
|
||||
textBoxV.action = () -> {
|
||||
currMsgV = textBoxV.get();
|
||||
};
|
||||
WPlus add = table.add(theme.plus()).widget();
|
||||
add.action = () -> {
|
||||
if (currMsgK != "" && currMsgV != "") {
|
||||
commands.put(currMsgK, currMsgV);
|
||||
currMsgK = ""; currMsgV = "";
|
||||
fillTable(theme,table);
|
||||
}
|
||||
};
|
||||
table.row();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NbtCompound toTag() {
|
||||
NbtCompound tag = super.toTag();
|
||||
|
||||
NbtCompound messTag = new NbtCompound();
|
||||
commands.keySet().forEach((key) -> {
|
||||
messTag.put(key, NbtString.of(commands.get(key)));
|
||||
});
|
||||
|
||||
tag.put("commands", messTag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Module fromTag(NbtCompound tag) {
|
||||
|
||||
commands.clear();
|
||||
if (tag.contains("commands")) {
|
||||
NbtCompound msgs = tag.getCompound("commands");
|
||||
msgs.getKeys().forEach((key) -> {
|
||||
commands.put(key, msgs.getString(key));
|
||||
});
|
||||
}
|
||||
|
||||
return super.fromTag(tag);
|
||||
}
|
||||
|
||||
private static Script compile(String script) {
|
||||
if (script == null) return null;
|
||||
Parser.Result result = Parser.parse(script);
|
||||
|
||||
@@ -2,14 +2,9 @@ package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import anticope.rejects.gui.screens.InteractionScreen;
|
||||
import anticope.rejects.settings.StringMapSetting;
|
||||
import it.unimi.dsi.fastutil.objects.Object2BooleanMap;
|
||||
import meteordevelopment.meteorclient.gui.GuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.utils.StarscriptTextBoxRenderer;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WTable;
|
||||
import meteordevelopment.meteorclient.gui.widgets.input.WTextBox;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WMinus;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WPlus;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.Utils;
|
||||
@@ -22,10 +17,8 @@ import net.minecraft.client.render.debug.DebugRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtString;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class InteractionMenu extends Module {
|
||||
@@ -85,8 +78,12 @@ public class InteractionMenu extends Module {
|
||||
.build()
|
||||
);
|
||||
|
||||
public final HashMap<String, String> messages = new HashMap<>();
|
||||
private String currMsgK = "", currMsgV = "";
|
||||
public final Setting<Map<String, String>> messages = sgGeneral.add(new StringMapSetting.Builder()
|
||||
.name("messages")
|
||||
.description("Messages.")
|
||||
.renderer(StarscriptTextBoxRenderer.class)
|
||||
.build()
|
||||
);
|
||||
|
||||
public InteractionMenu() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "interaction-menu", "An interaction screen when looking at an entity.");
|
||||
@@ -111,64 +108,6 @@ public class InteractionMenu extends Module {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WWidget getWidget(GuiTheme theme) {
|
||||
WTable table = theme.table();
|
||||
fillTable(theme, table);
|
||||
return table;
|
||||
}
|
||||
|
||||
private void fillTable(GuiTheme theme, WTable table) {
|
||||
table.clear();
|
||||
messages.keySet().forEach((key) -> {
|
||||
table.add(theme.label(key)).expandCellX();
|
||||
table.add(theme.label(messages.get(key))).expandCellX();
|
||||
WMinus delete = table.add(theme.minus()).widget();
|
||||
delete.action = () -> {
|
||||
messages.remove(key);
|
||||
fillTable(theme, table);
|
||||
};
|
||||
table.row();
|
||||
});
|
||||
WTextBox textBoxK = table.add(theme.textBox(currMsgK)).minWidth(100).expandX().widget();
|
||||
textBoxK.action = () -> currMsgK = textBoxK.get();
|
||||
WTextBox textBoxV = table.add(theme.textBox(currMsgV, (text1, c) -> true, StarscriptTextBoxRenderer.class)).minWidth(100).expandX().widget();
|
||||
textBoxV.action = () -> currMsgV = textBoxV.get();
|
||||
WPlus add = table.add(theme.plus()).widget();
|
||||
add.action = () -> {
|
||||
if (!currMsgK.equals("") && !currMsgV.equals("")) {
|
||||
messages.put(currMsgK, currMsgV);
|
||||
currMsgK = "";
|
||||
currMsgV = "";
|
||||
fillTable(theme, table);
|
||||
}
|
||||
};
|
||||
table.row();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NbtCompound toTag() {
|
||||
NbtCompound tag = super.toTag();
|
||||
|
||||
NbtCompound messTag = new NbtCompound();
|
||||
messages.keySet().forEach((key) -> messTag.put(key, NbtString.of(messages.get(key))));
|
||||
|
||||
tag.put("messages", messTag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Module fromTag(NbtCompound tag) {
|
||||
|
||||
messages.clear();
|
||||
if (tag.contains("messages")) {
|
||||
NbtCompound msgs = tag.getCompound("messages");
|
||||
msgs.getKeys().forEach((key) -> messages.put(key, msgs.getString(key)));
|
||||
}
|
||||
|
||||
return super.fromTag(tag);
|
||||
}
|
||||
|
||||
private static Value wrap(Entity entity) {
|
||||
if (entity == null) {
|
||||
return Value.map(new ValueMap()
|
||||
|
||||
@@ -11,9 +11,9 @@ import meteordevelopment.meteorclient.utils.player.InvUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryEntry;
|
||||
|
||||
public class ItemGenerator extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
@@ -56,7 +56,7 @@ public class ItemGenerator extends Module {
|
||||
int stacks = speed.get();
|
||||
int size = stackSize.get();
|
||||
for(int i = 9; i < 9 + stacks; i++) {
|
||||
mc.player.networkHandler.sendPacket(new CreativeInventoryActionC2SPacket(i, new ItemStack(Registry.ITEM.getRandom(random).map(RegistryEntry::value).orElse(Items.DIRT), size)));
|
||||
mc.player.networkHandler.sendPacket(new CreativeInventoryActionC2SPacket(i, new ItemStack(Registries.ITEM.getRandom(random).map(RegistryEntry::value).orElse(Items.DIRT), size)));
|
||||
}
|
||||
|
||||
for(int i = 9; i < 9 + stacks; i++) {
|
||||
|
||||
@@ -18,6 +18,7 @@ import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
@@ -25,11 +26,8 @@ import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.random.ChunkRandom;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
//import net.minecraft.world.chunk.world.random.ChunkRandom;
|
||||
import com.seedfinding.mccore.version.MCVersion;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -37,7 +35,6 @@ import java.util.BitSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class OreSim extends Module {
|
||||
|
||||
@@ -282,7 +279,7 @@ public class OreSim extends Module {
|
||||
long populationSeed = random.setPopulationSeed(worldSeed.seed, chunkX, chunkZ);
|
||||
|
||||
var optional = world.getBiomeAccess().getBiomeForNoiseGen(new BlockPos(chunkX, 0, chunkZ)).getKeyOrValue();
|
||||
Identifier id = (optional.right().isPresent()) ? world.getRegistryManager().get(Registry.BIOME_KEY).getId(optional.right().get()) : optional.left().get().getValue();
|
||||
Identifier id = (optional.right().isPresent()) ? world.getRegistryManager().get(RegistryKeys.BIOME).getId(optional.right().get()) : optional.left().get().getValue();
|
||||
if (id == null) {
|
||||
error("Something went wrong, you may have some mods that mess with world generation");
|
||||
toggle();
|
||||
|
||||
@@ -3,7 +3,7 @@ package anticope.rejects.modules;
|
||||
import java.io.IOException;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import net.minecraft.client.gl.ShaderEffect;
|
||||
import net.minecraft.client.gl.PostEffectProcessor;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import meteordevelopment.meteorclient.settings.EnumSetting;
|
||||
@@ -86,7 +86,7 @@ public class Rendering extends Module {
|
||||
.build()
|
||||
);
|
||||
|
||||
private ShaderEffect shader = null;
|
||||
private PostEffectProcessor shader = null;
|
||||
|
||||
public Rendering() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "rendering", "Various Render Tweaks");
|
||||
@@ -109,7 +109,7 @@ public class Rendering extends Module {
|
||||
else name = s.toString().toLowerCase();
|
||||
Identifier shaderID = new Identifier(String.format("shaders/post/%s.json", name));
|
||||
try {
|
||||
ShaderEffect shader = new ShaderEffect(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), shaderID);
|
||||
PostEffectProcessor shader = new PostEffectProcessor(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), shaderID);
|
||||
this.shader = shader;
|
||||
} catch (IOException e) {
|
||||
this.shader = null;
|
||||
@@ -120,7 +120,7 @@ public class Rendering extends Module {
|
||||
return this.isActive() && structureVoid.get();
|
||||
}
|
||||
|
||||
public ShaderEffect getShaderEffect() {
|
||||
public PostEffectProcessor getShaderEffect() {
|
||||
if (!this.isActive()) return null;
|
||||
return shader;
|
||||
}
|
||||
|
||||
@@ -26,23 +26,27 @@ import net.minecraft.client.render.entity.model.PlayerEntityModel;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Quaternionf;
|
||||
|
||||
public class SkeletonESP extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<SettingColor> skeletonColorSetting = sgGeneral.add(new ColorSetting.Builder()
|
||||
.name("players-color")
|
||||
.description("The other player's color.")
|
||||
.defaultValue(new SettingColor(255, 255, 255))
|
||||
.build()
|
||||
.name("players-color")
|
||||
.description("The other player's color.")
|
||||
.defaultValue(new SettingColor(255, 255, 255))
|
||||
.build()
|
||||
);
|
||||
|
||||
public final Setting<Boolean> distance = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("distance-colors")
|
||||
.description("Changes the color of skeletons depending on distance.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
.name("distance-colors")
|
||||
.description("Changes the color of skeletons depending on distance.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Freecam freecam;
|
||||
@@ -57,7 +61,7 @@ public class SkeletonESP extends Module {
|
||||
MatrixStack matrixStack = event.matrices;
|
||||
float g = event.tickDelta;
|
||||
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
@@ -67,7 +71,8 @@ public class SkeletonESP extends Module {
|
||||
|
||||
mc.world.getEntities().forEach(entity -> {
|
||||
if (!(entity instanceof PlayerEntity)) return;
|
||||
if (mc.options.getPerspective() == Perspective.FIRST_PERSON && !freecam.isActive() && mc.player == entity) return;
|
||||
if (mc.options.getPerspective() == Perspective.FIRST_PERSON && !freecam.isActive() && mc.player == entity)
|
||||
return;
|
||||
int rotationHoldTicks = Config.get().rotationHoldTicks.get();
|
||||
|
||||
Color skeletonColor = PlayerUtils.getPlayerColor((PlayerEntity) entity, skeletonColorSetting.get());
|
||||
@@ -75,8 +80,8 @@ public class SkeletonESP extends Module {
|
||||
PlayerEntity playerEntity = (PlayerEntity) entity;
|
||||
|
||||
Vec3d footPos = getEntityRenderPosition(playerEntity, g);
|
||||
PlayerEntityRenderer livingEntityRenderer = (PlayerEntityRenderer)(LivingEntityRenderer<?, ?>) mc.getEntityRenderDispatcher().getRenderer(playerEntity);
|
||||
PlayerEntityModel<PlayerEntity> playerEntityModel = (PlayerEntityModel)livingEntityRenderer.getModel();
|
||||
PlayerEntityRenderer livingEntityRenderer = (PlayerEntityRenderer) (LivingEntityRenderer<?, ?>) mc.getEntityRenderDispatcher().getRenderer(playerEntity);
|
||||
PlayerEntityModel<PlayerEntity> playerEntityModel = (PlayerEntityModel) livingEntityRenderer.getModel();
|
||||
|
||||
float h = MathHelper.lerpAngleDegrees(g, playerEntity.prevBodyYaw, playerEntity.bodyYaw);
|
||||
if (mc.player == entity && Rotations.rotationTimer < rotationHoldTicks) h = Rotations.serverYaw;
|
||||
@@ -106,8 +111,9 @@ public class SkeletonESP extends Module {
|
||||
matrixStack.translate(footPos.x, footPos.y, footPos.z);
|
||||
if (swimming) matrixStack.translate(0, 0.35f, 0);
|
||||
|
||||
matrixStack.multiply(new Quaternion(new Vec3f(0, -1, 0), h + 180, true));
|
||||
if (swimming || flying) matrixStack.multiply(new Quaternion(new Vec3f(-1, 0, 0), 90 + m, true));
|
||||
matrixStack.multiply(new Quaternionf().setAngleAxis((h + 180) * Math.PI / 180F, 0, -1, 0));
|
||||
if (swimming || flying)
|
||||
matrixStack.multiply(new Quaternionf().setAngleAxis((90 + m) * Math.PI / 180F, -1, 0, 0));
|
||||
if (swimming) matrixStack.translate(0, -0.95f, 0);
|
||||
|
||||
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
|
||||
@@ -169,13 +175,14 @@ public class SkeletonESP extends Module {
|
||||
matrixStack.pop();
|
||||
|
||||
bufferBuilder.clear();
|
||||
BufferRenderer.drawWithShader(bufferBuilder.end());
|
||||
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
||||
|
||||
if (swimming) matrixStack.translate(0, 0.95f, 0);
|
||||
if (swimming || flying) matrixStack.multiply(new Quaternion(new Vec3f(1, 0, 0), 90 + m, true));
|
||||
if (swimming || flying)
|
||||
matrixStack.multiply(new Quaternionf().setAngleAxis((90 + m) * Math.PI / 180F, 1, 0, 0));
|
||||
if (swimming) matrixStack.translate(0, -0.35f, 0);
|
||||
|
||||
matrixStack.multiply(new Quaternion(new Vec3f(0, 1, 0), h + 180, true));
|
||||
matrixStack.multiply(new Quaternionf().setAngleAxis((h + 180) * Math.PI / 180F, 0, 1, 0));
|
||||
matrixStack.translate(-footPos.x, -footPos.y, -footPos.z);
|
||||
});
|
||||
|
||||
@@ -184,20 +191,20 @@ public class SkeletonESP extends Module {
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.enableDepthTest();
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
||||
}
|
||||
|
||||
private void rotate(MatrixStack matrix, ModelPart modelPart) {
|
||||
if (modelPart.roll != 0.0F) {
|
||||
matrix.multiply(Vec3f.POSITIVE_Z.getRadialQuaternion(modelPart.roll));
|
||||
matrix.multiply(RotationAxis.POSITIVE_Z.rotation(modelPart.roll));
|
||||
}
|
||||
|
||||
if (modelPart.yaw != 0.0F) {
|
||||
matrix.multiply(Vec3f.NEGATIVE_Y.getRadialQuaternion(modelPart.yaw));
|
||||
matrix.multiply(RotationAxis.NEGATIVE_Y.rotation(modelPart.yaw));
|
||||
}
|
||||
|
||||
if (modelPart.pitch != 0.0F) {
|
||||
matrix.multiply(Vec3f.NEGATIVE_X.getRadialQuaternion(modelPart.pitch));
|
||||
matrix.multiply(RotationAxis.NEGATIVE_X.rotation(modelPart.pitch));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,8 +229,7 @@ public class SkeletonESP extends Module {
|
||||
if (percent < 0.5) {
|
||||
r = 255;
|
||||
g = (int) (255 * percent / 0.5);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
g = 255;
|
||||
r = 255 - (int) (255 * (percent - 0.5) / 0.5);
|
||||
}
|
||||
|
||||
@@ -48,10 +48,8 @@ public class SoundLocator extends Module {
|
||||
private void printSound(SoundInstance sound) {
|
||||
WeightedSoundSet soundSet = mc.getSoundManager().get(sound.getId());
|
||||
MutableText text;
|
||||
if (soundSet == null) {
|
||||
if (soundSet == null || soundSet.getSubtitle() == null) {
|
||||
text = Text.literal(sound.getId().toString());
|
||||
} else if (soundSet.getSubtitle() == null) {
|
||||
text = Text.literal(soundSet.getId().toString());
|
||||
} else {
|
||||
text = soundSet.getSubtitle().copy();
|
||||
}
|
||||
|
||||
27
src/main/java/anticope/rejects/settings/RejectsSettings.java
Normal file
27
src/main/java/anticope/rejects/settings/RejectsSettings.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package anticope.rejects.settings;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.GuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.utils.SettingsWidgetFactory;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WTable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class RejectsSettings {
|
||||
private final Map<Class<?>, SettingsWidgetFactory.Factory> factories;
|
||||
|
||||
private final GuiTheme theme;
|
||||
|
||||
public RejectsSettings(Map<Class<?>, SettingsWidgetFactory.Factory> factories, GuiTheme theme) {
|
||||
this.factories = factories;
|
||||
this.theme = theme;
|
||||
}
|
||||
|
||||
public void addSettings() {
|
||||
factories.put(StringMapSetting.class, (table, setting) -> stringMapW(table, (StringMapSetting) setting));
|
||||
}
|
||||
|
||||
private void stringMapW(WTable table, StringMapSetting setting) {
|
||||
WTable wtable = table.add(theme.table()).expandX().widget();
|
||||
StringMapSetting.fillTable(theme, wtable, setting);
|
||||
}
|
||||
}
|
||||
162
src/main/java/anticope/rejects/settings/StringMapSetting.java
Normal file
162
src/main/java/anticope/rejects/settings/StringMapSetting.java
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
|
||||
* Copyright (c) Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.settings;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.GuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WTable;
|
||||
import meteordevelopment.meteorclient.gui.widgets.input.WTextBox;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WButton;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WMinus;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WPlus;
|
||||
import meteordevelopment.meteorclient.settings.IVisible;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtString;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class StringMapSetting extends Setting<Map<String, String>> {
|
||||
public final Class<? extends WTextBox.Renderer> renderer;
|
||||
|
||||
public StringMapSetting(String name, String description, Map<String, String> defaultValue, Consumer<Map<String, String>> onChanged, Consumer<Setting<Map<String, String>>> onModuleActivated, IVisible visible, Class<? extends WTextBox.Renderer> renderer) {
|
||||
super(name, description, defaultValue, onChanged, onModuleActivated, visible);
|
||||
|
||||
this.renderer = renderer;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> parseImpl(String str) {
|
||||
String[] values = str.split(",");
|
||||
|
||||
Map<String, String> map = new LinkedHashMap<>(values.length / 2);
|
||||
|
||||
try {
|
||||
String left = null;
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
if (i % 2 == 0) {
|
||||
left = values[i];
|
||||
} else {
|
||||
map.put(left, values[i]);
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValueValid(Map<String, String> value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void resetImpl() {
|
||||
value = new LinkedHashMap<>(defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NbtCompound save(NbtCompound tag) {
|
||||
NbtCompound valueTag = new NbtCompound();
|
||||
for (String key : get().keySet()) {
|
||||
valueTag.put(key, NbtString.of(get().get(key)));
|
||||
}
|
||||
tag.put("map", valueTag);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> load(NbtCompound tag) {
|
||||
get().clear();
|
||||
|
||||
NbtCompound valueTag = tag.getCompound("map");
|
||||
for (String key : valueTag.getKeys()) {
|
||||
get().put(key, valueTag.getString(key));
|
||||
}
|
||||
|
||||
return get();
|
||||
}
|
||||
|
||||
public static void fillTable(GuiTheme theme, WTable table, StringMapSetting setting) {
|
||||
table.clear();
|
||||
|
||||
Map<String, String> map = setting.get();
|
||||
|
||||
for (String key : map.keySet()) {
|
||||
AtomicReference<String> key2 = new AtomicReference<>(key);
|
||||
|
||||
WTextBox textBoxK = table.add(theme.textBox(key2.get())).minWidth(150).expandX().widget();
|
||||
textBoxK.actionOnUnfocused = () -> {
|
||||
String text = textBoxK.get();
|
||||
if (map.containsKey(text)) {
|
||||
textBoxK.set(key2.get());
|
||||
return;
|
||||
}
|
||||
String value = map.remove(key2.get());
|
||||
key2.set(text);
|
||||
map.put(text, value);
|
||||
};
|
||||
|
||||
WTextBox textBoxV = table.add(theme.textBox(map.get(key2.get()), (text1, c) -> true, setting.renderer)).minWidth(150).expandX().widget();
|
||||
textBoxV.actionOnUnfocused = () -> map.replace(key2.get(), textBoxV.get());
|
||||
|
||||
WMinus delete = table.add(theme.minus()).widget();
|
||||
delete.action = () -> {
|
||||
map.remove(key2.get());
|
||||
fillTable(theme, table, setting);
|
||||
};
|
||||
|
||||
table.row();
|
||||
}
|
||||
|
||||
if (!map.isEmpty()) {
|
||||
table.add(theme.horizontalSeparator()).expandX();
|
||||
table.row();
|
||||
}
|
||||
|
||||
WButton reset = table.add(theme.button(GuiRenderer.RESET)).widget();
|
||||
reset.action = () -> {
|
||||
setting.reset();
|
||||
fillTable(theme, table, setting);
|
||||
};
|
||||
|
||||
WPlus add = table.add(theme.plus()).widget();
|
||||
add.action = () -> {
|
||||
map.put("", "");
|
||||
fillTable(theme, table, setting);
|
||||
};
|
||||
|
||||
table.row();
|
||||
}
|
||||
|
||||
public static class Builder extends SettingBuilder<Builder, Map<String, String>, StringMapSetting> {
|
||||
private Class<? extends WTextBox.Renderer> renderer;
|
||||
|
||||
public Builder() {
|
||||
super(new LinkedHashMap<>(0));
|
||||
}
|
||||
|
||||
public Builder defaultValue(Map<String, String> map) {
|
||||
this.defaultValue = map;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder renderer(Class<? extends WTextBox.Renderer> renderer) {
|
||||
this.renderer = renderer;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringMapSetting build() {
|
||||
return new StringMapSetting(name, description, defaultValue, onChanged, onModuleActivated, visible, renderer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,9 @@ import meteordevelopment.meteorclient.MeteorClient;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import meteordevelopment.meteorclient.utils.PostInit;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class RejectsUtils {
|
||||
|
||||
@PostInit
|
||||
@@ -26,4 +29,15 @@ public class RejectsUtils {
|
||||
}
|
||||
return dupe == 0 ? name : getModuleName(name + "*".repeat(dupe));
|
||||
}
|
||||
|
||||
public static String getRandomPassword(int num) {
|
||||
String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
|
||||
Random random = new Random();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < num; i++) {
|
||||
int number = random.nextInt(63);
|
||||
sb.append(str.charAt(number));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user