Renamed directory to anticope
This commit is contained in:
104
src/main/java/anticope/rejects/MeteorRejectsAddon.java
Normal file
104
src/main/java/anticope/rejects/MeteorRejectsAddon.java
Normal file
@@ -0,0 +1,104 @@
|
||||
package anticope.rejects;
|
||||
|
||||
import anticope.rejects.commands.*;
|
||||
import anticope.rejects.gui.hud.*;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.modules.*;
|
||||
import anticope.rejects.modules.modifier.NoRenderModifier;
|
||||
import anticope.rejects.utils.GiveUtils;
|
||||
import anticope.rejects.utils.RejectsUtils;
|
||||
import meteordevelopment.meteorclient.MeteorAddon;
|
||||
import meteordevelopment.meteorclient.MeteorClient;
|
||||
import meteordevelopment.meteorclient.gui.GuiThemes;
|
||||
import meteordevelopment.meteorclient.systems.commands.Commands;
|
||||
import meteordevelopment.meteorclient.systems.modules.Category;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HUD;
|
||||
import net.minecraft.item.Items;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
|
||||
public class MeteorRejectsAddon extends MeteorAddon {
|
||||
public static final Logger LOG = LogManager.getLogger();
|
||||
public static final Category CATEGORY = new Category("Rejects", Items.BARRIER.getDefaultStack());
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
LOG.info("Initializing Meteor Rejects Addon");
|
||||
|
||||
MeteorClient.EVENT_BUS.registerLambdaFactory("cloudburst.rejects", (lookupInMethod, klass) -> (MethodHandles.Lookup) lookupInMethod.invoke(null, klass, MethodHandles.lookup()));
|
||||
|
||||
RejectsUtils.init();
|
||||
GiveUtils.init();
|
||||
|
||||
// Modules
|
||||
Modules modules = Modules.get();
|
||||
modules.add(new AntiBot());
|
||||
modules.add(new AntiSpawnpoint());
|
||||
modules.add(new AntiVanish());
|
||||
modules.add(new Auto32K());
|
||||
modules.add(new AutoBedTrap());
|
||||
modules.add(new AutoCraft());
|
||||
modules.add(new AutoExtinguish());
|
||||
modules.add(new AutoEz());
|
||||
modules.add(new AutoPot());
|
||||
modules.add(new AutoTNT());
|
||||
modules.add(new AutoWither());
|
||||
modules.add(new BedrockWalk());
|
||||
modules.add(new BoatGlitch());
|
||||
modules.add(new BlockIn());
|
||||
modules.add(new BoatPhase());
|
||||
modules.add(new Boost());
|
||||
modules.add(new ChatBot());
|
||||
modules.add(new ColorSigns());
|
||||
modules.add(new Confuse());
|
||||
modules.add(new CoordLogger());
|
||||
modules.add(new CustomPackets());
|
||||
modules.add(new InteractionMenu());
|
||||
modules.add(new Lavacast());
|
||||
modules.add(new NewChunks());
|
||||
modules.add(new ObsidianFarm());
|
||||
modules.add(new PacketFly());
|
||||
modules.add(new Painter());
|
||||
modules.add(new Phase());
|
||||
modules.add(new Prone());
|
||||
modules.add(new Rendering());
|
||||
modules.add(new SkeletonESP());
|
||||
modules.add(new SoundLocator());
|
||||
|
||||
// Module modifications
|
||||
NoRenderModifier.init();
|
||||
|
||||
// Commands
|
||||
Commands commands = Commands.get();
|
||||
commands.add(new GhostCommand());
|
||||
commands.add(new GiveCommand());
|
||||
commands.add(new SaveSkinCommand());
|
||||
commands.add(new SeedCommand());
|
||||
commands.add(new HeadsCommand());
|
||||
commands.add(new KickCommand());
|
||||
// commands.add(new LocateCommand()); I wish it was that simple -_-
|
||||
commands.add(new ServerCommand());
|
||||
commands.add(new SetBlockCommand());
|
||||
commands.add(new TeleportCommand());
|
||||
commands.add(new TerrainExport());
|
||||
|
||||
// HUD
|
||||
HUD hud = modules.get(HUD.class);
|
||||
hud.elements.add(new AppleHud(hud));
|
||||
hud.elements.add(new BaritoneHud(hud));
|
||||
hud.elements.add(new CrystalHud(hud));
|
||||
hud.elements.add(new ExpHud(hud));
|
||||
hud.elements.add(new CpsHud(hud));
|
||||
|
||||
// Themes
|
||||
GuiThemes.add(new MeteorRoundedGuiTheme());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRegisterCategories() {
|
||||
Modules.registerCategory(CATEGORY);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package anticope.rejects.arguments;
|
||||
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.arguments.ArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.suggestion.Suggestions;
|
||||
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.command.argument.*;
|
||||
import net.minecraft.server.command.CommandManager;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class ClientPosArgumentType implements ArgumentType<Vec3d> {
|
||||
private static final Collection<String> EXAMPLES = Arrays.asList("0 0 0", "~ ~ ~", "~0.5 ~1 ~-5");
|
||||
private static final MinecraftClient mc = MinecraftClient.getInstance();
|
||||
|
||||
public ClientPosArgumentType() {
|
||||
}
|
||||
|
||||
public static ClientPosArgumentType pos() {
|
||||
return new ClientPosArgumentType();
|
||||
}
|
||||
|
||||
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
|
||||
if (!(context.getSource() instanceof CommandSource)) {
|
||||
return Suggestions.empty();
|
||||
} else {
|
||||
String string = builder.getRemaining();
|
||||
Object collection2 = ((CommandSource)context.getSource()).getBlockPositionSuggestions();
|
||||
|
||||
return CommandSource.suggestPositions(string, (Collection)collection2, builder, CommandManager.getCommandValidator(this::parse));
|
||||
}
|
||||
}
|
||||
|
||||
public static Vec3d getPos(final CommandContext<?> context, final String name) {
|
||||
return context.getArgument(name, Vec3d.class);
|
||||
}
|
||||
|
||||
|
||||
public Vec3d parse(StringReader reader) throws CommandSyntaxException {
|
||||
int i = reader.getCursor();
|
||||
double x,y,z;
|
||||
CoordinateArgument coordinateArgument = CoordinateArgument.parse(reader);
|
||||
CoordinateArgument coordinateArgument2;
|
||||
CoordinateArgument coordinateArgument3;
|
||||
if (reader.canRead() && reader.peek() == ' ') {
|
||||
reader.skip();
|
||||
coordinateArgument2 = CoordinateArgument.parse(reader);
|
||||
if (reader.canRead() && reader.peek() == ' ') {
|
||||
reader.skip();
|
||||
coordinateArgument3 = CoordinateArgument.parse(reader);
|
||||
} else {
|
||||
reader.setCursor(i);
|
||||
throw Vec3ArgumentType.INCOMPLETE_EXCEPTION.createWithContext(reader);
|
||||
}
|
||||
} else {
|
||||
reader.setCursor(i);
|
||||
throw Vec3ArgumentType.INCOMPLETE_EXCEPTION.createWithContext(reader);
|
||||
}
|
||||
|
||||
x = coordinateArgument.toAbsoluteCoordinate(mc.player.getX());
|
||||
y = coordinateArgument2.toAbsoluteCoordinate(mc.player.getY());
|
||||
z = coordinateArgument3.toAbsoluteCoordinate(mc.player.getZ());
|
||||
|
||||
return new Vec3d(x,y,z);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package anticope.rejects.arguments;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.arguments.ArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
|
||||
import com.mojang.brigadier.suggestion.Suggestions;
|
||||
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.text.LiteralText;
|
||||
|
||||
public class EnumArgumentType<T extends Enum<?>> implements ArgumentType<T> {
|
||||
private static final DynamicCommandExceptionType NO_SUCH_TYPE = new DynamicCommandExceptionType(o ->
|
||||
new LiteralText(o + " is not a valid argument."));
|
||||
|
||||
private T[] values;
|
||||
|
||||
public EnumArgumentType(T defaultValue) {
|
||||
super();
|
||||
|
||||
try {
|
||||
values = (T[]) defaultValue.getClass().getMethod("values").invoke(null);
|
||||
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static <T extends Enum<?>> EnumArgumentType<T> enumArgument(T defaultValue) {
|
||||
return new EnumArgumentType<T>(defaultValue);
|
||||
}
|
||||
|
||||
public static <T extends Enum<?>> T getEnum(CommandContext<?> context, String name, T defaultValue) {
|
||||
return (T) context.getArgument(name, defaultValue.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public T parse(StringReader reader) throws CommandSyntaxException {
|
||||
String argument = reader.readString();
|
||||
for (T t : values) {
|
||||
if (t.toString().equals(argument)) return t;
|
||||
}
|
||||
throw NO_SUCH_TYPE.create(argument);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
|
||||
return CommandSource.suggestMatching(Arrays.stream(values).map(T::toString), builder);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package anticope.rejects.arguments;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.arguments.ArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
|
||||
import com.mojang.brigadier.suggestion.Suggestions;
|
||||
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.text.LiteralText;
|
||||
|
||||
public class EnumStringArgumentType implements ArgumentType<String> {
|
||||
|
||||
private Collection<String> EXAMPLES;
|
||||
private static final DynamicCommandExceptionType INVALID_OPTION = new DynamicCommandExceptionType(name ->
|
||||
new LiteralText(name+" is not a valid option."));
|
||||
public EnumStringArgumentType(Collection<String> examples) {
|
||||
this.EXAMPLES = examples;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String parse(StringReader reader) throws CommandSyntaxException {
|
||||
String arg = reader.readUnquotedString();
|
||||
if (!EXAMPLES.contains(arg)) throw INVALID_OPTION.create(arg);
|
||||
return arg;
|
||||
}
|
||||
|
||||
public static String getString(final CommandContext<?> context, final String name) {
|
||||
return context.getArgument(name, String.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getExamples() {
|
||||
return EXAMPLES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "string()";
|
||||
}
|
||||
|
||||
@Override
|
||||
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
|
||||
return CommandSource.suggestMatching(EXAMPLES, builder);
|
||||
}
|
||||
|
||||
}
|
||||
48
src/main/java/anticope/rejects/commands/GhostCommand.java
Normal file
48
src/main/java/anticope/rejects/commands/GhostCommand.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package anticope.rejects.commands;
|
||||
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import meteordevelopment.meteorclient.systems.commands.Command;
|
||||
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||
|
||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||
|
||||
public class GhostCommand extends Command {
|
||||
public GhostCommand() {
|
||||
super("ghost", "Remove ghost blocks & bypass AntiXray", "aax", "anti-anti-xray");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||
builder.executes(ctx -> {
|
||||
execute(4);
|
||||
return SINGLE_SUCCESS;
|
||||
});
|
||||
builder.then(argument("radius", IntegerArgumentType.integer(1)).executes(ctx -> {
|
||||
int radius = IntegerArgumentType.getInteger(ctx, "radius");
|
||||
execute(radius);
|
||||
return SINGLE_SUCCESS;
|
||||
}));
|
||||
}
|
||||
|
||||
private void execute(int radius) {
|
||||
ClientPlayNetworkHandler conn = mc.getNetworkHandler();
|
||||
if (conn == null)
|
||||
return;
|
||||
BlockPos pos = mc.player.getBlockPos();
|
||||
for (int dx = -radius; dx <= radius; dx++)
|
||||
for (int dy = -radius; dy <= radius; dy++)
|
||||
for (int dz = -radius; dz <= radius; dz++) {
|
||||
PlayerActionC2SPacket packet = new PlayerActionC2SPacket(
|
||||
PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK,
|
||||
new BlockPos(pos.getX() + dx, pos.getY() + dy, pos.getZ() + dz), Direction.UP);
|
||||
conn.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
100
src/main/java/anticope/rejects/commands/GiveCommand.java
Normal file
100
src/main/java/anticope/rejects/commands/GiveCommand.java
Normal file
@@ -0,0 +1,100 @@
|
||||
package anticope.rejects.commands;
|
||||
|
||||
import anticope.rejects.arguments.EnumStringArgumentType;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.item.*;
|
||||
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;
|
||||
|
||||
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class GiveCommand extends Command {
|
||||
|
||||
public GiveCommand() {
|
||||
super("give", "Gives items in creative", "item", "kit");
|
||||
}
|
||||
private final Collection<String> PRESETS = GiveUtils.PRESETS.keySet();
|
||||
|
||||
@Override
|
||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||
builder.then(literal("egg").executes(ctx -> {
|
||||
ItemStack inHand = mc.player.getMainHandStack();
|
||||
ItemStack item = new ItemStack(Items.STRIDER_SPAWN_EGG);
|
||||
NbtCompound ct = new NbtCompound();
|
||||
if (inHand.getItem() instanceof BlockItem) {
|
||||
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());
|
||||
if (inHand.hasNbt() && inHand.getNbt().contains("BlockEntityTag")) {
|
||||
ct.put("TileEntityData", inHand.getNbt().getCompound("BlockEntityTag"));
|
||||
}
|
||||
NbtCompound t = new NbtCompound();
|
||||
t.put("EntityTag", ct);
|
||||
item.setNbt(t);
|
||||
} else {
|
||||
ct.putString("id", "minecraft:item");
|
||||
NbtCompound it = new NbtCompound();
|
||||
it.putString("id", Registry.ITEM.getId(inHand.getItem()).toString());
|
||||
it.putInt("Count",inHand.getCount());
|
||||
if (inHand.hasNbt()) {
|
||||
it.put("tag", inHand.getNbt());
|
||||
}
|
||||
ct.put("Item",it);
|
||||
}
|
||||
NbtCompound t = new NbtCompound();
|
||||
t.put("EntityTag", ct);
|
||||
item.setNbt(t);
|
||||
item.setCustomName(inHand.getName());
|
||||
GiveUtils.giveItem(item);
|
||||
return SINGLE_SUCCESS;
|
||||
}));
|
||||
|
||||
builder.then(literal("holo").then(argument("message", StringArgumentType.greedyString()).executes(ctx -> {
|
||||
String message = ctx.getArgument("message", String.class);
|
||||
message = message.replace("&", "\247");
|
||||
ItemStack stack = new ItemStack(Items.ARMOR_STAND);
|
||||
NbtCompound tag = new NbtCompound();
|
||||
NbtList NbtList = new NbtList();
|
||||
NbtList.add(NbtDouble.of(mc.player.getX()));
|
||||
NbtList.add(NbtDouble.of(mc.player.getY()));
|
||||
NbtList.add(NbtDouble.of(mc.player.getZ()));
|
||||
tag.putBoolean("Invisible", true);
|
||||
tag.putBoolean("Invulnerable", true);
|
||||
tag.putBoolean("Interpret", true);
|
||||
tag.putBoolean("NoGravity", true);
|
||||
tag.putBoolean("CustomNameVisible", true);
|
||||
tag.putString("CustomName", Text.Serializer.toJson(new LiteralText(message)));
|
||||
tag.put("Pos", NbtList);
|
||||
stack.setSubNbt("EntityTag", tag);
|
||||
GiveUtils.giveItem(stack);
|
||||
return SINGLE_SUCCESS;
|
||||
})));
|
||||
|
||||
builder.then(literal("head").then(argument("owner",StringArgumentType.greedyString()).executes(ctx -> {
|
||||
String playerName = ctx.getArgument("owner",String.class);
|
||||
ItemStack itemStack = new ItemStack(Items.PLAYER_HEAD);
|
||||
NbtCompound tag = new NbtCompound();
|
||||
tag.putString("SkullOwner", playerName);
|
||||
itemStack.setNbt(tag);
|
||||
GiveUtils.giveItem(itemStack);
|
||||
return SINGLE_SUCCESS;
|
||||
})));
|
||||
|
||||
builder.then(literal("preset").then(argument("name", new EnumStringArgumentType(PRESETS)).executes(context -> {
|
||||
String name = context.getArgument("name", String.class);
|
||||
GiveUtils.giveItem(GiveUtils.getPreset(name));
|
||||
return SINGLE_SUCCESS;
|
||||
})));
|
||||
}
|
||||
}
|
||||
30
src/main/java/anticope/rejects/commands/HeadsCommand.java
Normal file
30
src/main/java/anticope/rejects/commands/HeadsCommand.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package anticope.rejects.commands;
|
||||
|
||||
import anticope.rejects.gui.screens.HeadScreen;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
|
||||
import net.minecraft.command.CommandSource;
|
||||
|
||||
import meteordevelopment.meteorclient.MeteorClient;
|
||||
import meteordevelopment.meteorclient.gui.GuiThemes;
|
||||
import meteordevelopment.meteorclient.systems.commands.Command;
|
||||
|
||||
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||
|
||||
public class HeadsCommand extends Command {
|
||||
|
||||
public HeadsCommand() {
|
||||
super("heads", "Display heads gui");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||
builder.executes(ctx -> {
|
||||
MeteorClient.screenToOpen = new HeadScreen(GuiThemes.get());
|
||||
return SINGLE_SUCCESS;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
40
src/main/java/anticope/rejects/commands/KickCommand.java
Normal file
40
src/main/java/anticope/rejects/commands/KickCommand.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package anticope.rejects.commands;
|
||||
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
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 meteordevelopment.meteorclient.systems.commands.Command;
|
||||
|
||||
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||
|
||||
public class KickCommand extends Command {
|
||||
|
||||
public KickCommand() {
|
||||
super("kick", "Kick or disconnect yourself from the server", "disconnect", "quit");
|
||||
}
|
||||
|
||||
@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;
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
194
src/main/java/anticope/rejects/commands/LocateCommand.java
Normal file
194
src/main/java/anticope/rejects/commands/LocateCommand.java
Normal file
@@ -0,0 +1,194 @@
|
||||
package anticope.rejects.commands;
|
||||
|
||||
import anticope.rejects.arguments.EnumArgumentType;
|
||||
import baritone.api.BaritoneAPI;
|
||||
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.BaseText;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
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 new LiteralText(String.format(
|
||||
"%s not found.",
|
||||
Utils.nameToTitle(o.toString().replaceAll("_", "-")))
|
||||
);
|
||||
}
|
||||
return new LiteralText("Not found.");
|
||||
});
|
||||
|
||||
private Vec3d firstStart;
|
||||
private Vec3d firstEnd;
|
||||
private Vec3d secondStart;
|
||||
private Vec3d secondEnd;
|
||||
|
||||
public LocateCommand() {
|
||||
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"));
|
||||
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;
|
||||
}));
|
||||
}
|
||||
|
||||
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]);
|
||||
BaseText text = new LiteralText("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};
|
||||
}
|
||||
}
|
||||
94
src/main/java/anticope/rejects/commands/SaveSkinCommand.java
Normal file
94
src/main/java/anticope/rejects/commands/SaveSkinCommand.java
Normal file
@@ -0,0 +1,94 @@
|
||||
package anticope.rejects.commands;
|
||||
|
||||
import com.google.gson.*;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
||||
import meteordevelopment.meteorclient.systems.commands.Command;
|
||||
import meteordevelopment.meteorclient.systems.commands.arguments.PlayerArgumentType;
|
||||
import meteordevelopment.meteorclient.utils.network.Http;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
import org.lwjgl.util.tinyfd.TinyFileDialogs;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
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 PointerBuffer filters;
|
||||
private final Gson GSON = new Gson();
|
||||
|
||||
public SaveSkinCommand() {
|
||||
super("save-skin","Download a player's skin by name.", "skin","skinsteal");
|
||||
|
||||
filters = BufferUtils.createPointerBuffer(1);
|
||||
|
||||
ByteBuffer pngFilter = MemoryUtil.memASCII("*.png");
|
||||
|
||||
filters.put(pngFilter);
|
||||
filters.rewind();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||
builder.then(argument("player", PlayerArgumentType.player()).executes(ctx -> {
|
||||
PlayerEntity playerEntity = ctx.getArgument("player", PlayerEntity.class);
|
||||
String path = TinyFileDialogs.tinyfd_saveFileDialog("Save image", null, filters, null);
|
||||
if (path == null) IO_EXCEPTION.create();
|
||||
if (!path.endsWith(".png")) path += ".png";
|
||||
saveSkin(playerEntity.getUuidAsString(),path);
|
||||
return SINGLE_SUCCESS;
|
||||
}));
|
||||
}
|
||||
|
||||
private void saveSkin(String uuid, String path) throws CommandSyntaxException {
|
||||
try {
|
||||
//going to explain what happens so I don't forget
|
||||
//request their minecraft profile, all so we can get a base64 encoded string that contains ANOTHER json that then has the skin URL
|
||||
String PROFILE_REQUEST_URL = "https://sessionserver.mojang.com/session/minecraft/profile/%s";
|
||||
|
||||
JsonObject object = Http.get(String.format(PROFILE_REQUEST_URL, uuid)).sendJson(JsonObject.class);
|
||||
//Get the properties array which has what we need
|
||||
JsonArray array = object.getAsJsonArray("properties");
|
||||
JsonObject property = array.get(0).getAsJsonObject();
|
||||
//value is what we grab but it's encoded so we have to decode it
|
||||
String base64String = property.get("value").getAsString();
|
||||
byte[] bs = Base64.decodeBase64(base64String);
|
||||
//Convert the response to json and pull the skin url from there
|
||||
String secondResponse = new String(bs, StandardCharsets.UTF_8);
|
||||
JsonObject finalResponseObject = GSON.fromJson(secondResponse, JsonObject.class);
|
||||
JsonObject texturesObject = finalResponseObject.getAsJsonObject("textures");
|
||||
JsonObject skinObj = texturesObject.getAsJsonObject("SKIN");
|
||||
String skinURL = skinObj.get("url").getAsString();
|
||||
|
||||
InputStream in = new BufferedInputStream(new URL(skinURL).openStream());
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
byte[] buf = new byte[1024];
|
||||
int n = 0;
|
||||
while (-1 != (n = in.read(buf))) {
|
||||
out.write(buf, 0, n);
|
||||
}
|
||||
out.close();
|
||||
in.close();
|
||||
byte[] response = out.toByteArray();
|
||||
File file = new File(path);
|
||||
FileOutputStream fos = new FileOutputStream(file.getPath());
|
||||
fos.write(response);
|
||||
fos.close();
|
||||
} catch (IOException e) {
|
||||
throw IO_EXCEPTION.create();
|
||||
}
|
||||
}
|
||||
}
|
||||
67
src/main/java/anticope/rejects/commands/SeedCommand.java
Normal file
67
src/main/java/anticope/rejects/commands/SeedCommand.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package anticope.rejects.commands;
|
||||
|
||||
import anticope.rejects.arguments.EnumArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
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 kaptainwutax.mcutils.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 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."));
|
||||
|
||||
public SeedCommand() {
|
||||
super("seed", "Get or set seed for the current world.");
|
||||
}
|
||||
|
||||
@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;
|
||||
})));
|
||||
}
|
||||
|
||||
}
|
||||
153
src/main/java/anticope/rejects/commands/ServerCommand.java
Normal file
153
src/main/java/anticope/rejects/commands/ServerCommand.java
Normal file
@@ -0,0 +1,153 @@
|
||||
package anticope.rejects.commands;
|
||||
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
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.util.Formatting;
|
||||
|
||||
import anticope.rejects.utils.portscanner.PScanRunner;
|
||||
import anticope.rejects.utils.portscanner.PortScannerManager;
|
||||
import meteordevelopment.meteorclient.systems.commands.Command;
|
||||
|
||||
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||
|
||||
/*
|
||||
Ported from Cornos
|
||||
https://github.com/cornos/Cornos/blob/master/src/main/java/me/zeroX150/cornos/features/command/impl/Scan.java
|
||||
*/
|
||||
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 HashMap<Integer, String> ports = new HashMap<Integer, String>();
|
||||
|
||||
public ServerCommand() {
|
||||
super("server", "Prints server information");
|
||||
|
||||
ports.put(20, "FTP");
|
||||
ports.put(22, "SSH");
|
||||
ports.put(80, "HTTP");
|
||||
ports.put(443, "HTTPS");
|
||||
ports.put(25565, "Java Server");
|
||||
ports.put(25575, "Java Server RCON");
|
||||
ports.put(19132, "Bedrock Server");
|
||||
ports.put(19133, "Bedrock Server IPv6");
|
||||
ports.put(8123, "DynMap");
|
||||
ports.put(25566, "Minequery");
|
||||
ports.put(3306, "MySQL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||
builder.then(literal("ports").executes(ctx -> {
|
||||
scanKnownPorts(getAddress());
|
||||
return SINGLE_SUCCESS;
|
||||
}));
|
||||
builder.then(literal("ports").then(literal("known").executes(ctx -> {
|
||||
scanKnownPorts(getAddress());
|
||||
return SINGLE_SUCCESS;
|
||||
})));
|
||||
builder.then(literal("ports").then(argument("from", IntegerArgumentType.integer(0)).then(argument("to", IntegerArgumentType.integer(1)).executes(ctx -> {
|
||||
scanRange(getAddress(), IntegerArgumentType.getInteger(ctx, "from"),
|
||||
IntegerArgumentType.getInteger(ctx, "to"));
|
||||
return SINGLE_SUCCESS;
|
||||
}))));
|
||||
}
|
||||
|
||||
private InetAddress getAddress() throws CommandSyntaxException {
|
||||
if (mc.isIntegratedServerRunning()) {
|
||||
try {
|
||||
return InetAddress.getLocalHost();
|
||||
} catch (UnknownHostException e) {
|
||||
throw ADDRESS_ERROR.create();
|
||||
}
|
||||
}
|
||||
else {
|
||||
ServerInfo server = mc.getCurrentServerEntry();
|
||||
if (server == null) throw ADDRESS_ERROR.create();
|
||||
try {
|
||||
return InetAddress.getByName(server.address);
|
||||
} catch (UnknownHostException e) {
|
||||
throw ADDRESS_ERROR.create();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void scanPorts(InetAddress address, Collection<Integer> port_list){
|
||||
info("Started scanning %d ports", port_list.size());
|
||||
PScanRunner pScanRunner = new PScanRunner(address, 5, 3, 200, port_list, scanResults -> {
|
||||
int open_ports = 0;
|
||||
info("Open ports:");
|
||||
for (PortScannerManager.ScanResult result : scanResults) {
|
||||
if (result.isOpen()) {
|
||||
info(formatPort(result.getPort(), address));
|
||||
open_ports++;
|
||||
}
|
||||
}
|
||||
info("Open count: %d/%d", open_ports, scanResults.size());
|
||||
});
|
||||
PortScannerManager.scans.add(pScanRunner);
|
||||
}
|
||||
|
||||
private void scanKnownPorts(InetAddress address) {
|
||||
scanPorts(address, ports.keySet());
|
||||
}
|
||||
|
||||
private void scanRange(InetAddress address, int min, int max) throws CommandSyntaxException {
|
||||
if (max<min) throw INVALID_RANGE.create();
|
||||
List<Integer> port_list = new LinkedList<>();
|
||||
for (int i = min; i <= max; i++) port_list.add(i);
|
||||
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));
|
||||
if (ports.containsKey(port)) {
|
||||
text.append(ports.get(port));
|
||||
if (ports.get(port).startsWith("HTTP")) {
|
||||
text.setStyle(text.getStyle()
|
||||
.withClickEvent(new ClickEvent(
|
||||
Action.OPEN_URL,
|
||||
String.format("%s://%s:%d", ports.get(port).toLowerCase(), address.getHostAddress(), port)
|
||||
))
|
||||
.withHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new LiteralText("Open in browser")
|
||||
))
|
||||
);
|
||||
}
|
||||
else if (ports.get(port) == "DynMap") {
|
||||
text.setStyle(text.getStyle()
|
||||
.withClickEvent(new ClickEvent(
|
||||
ClickEvent.Action.OPEN_URL,
|
||||
String.format("http://%s:%d", address.getHostAddress(), port)
|
||||
))
|
||||
.withHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new LiteralText("Open in browser")
|
||||
))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
}
|
||||
30
src/main/java/anticope/rejects/commands/SetBlockCommand.java
Normal file
30
src/main/java/anticope/rejects/commands/SetBlockCommand.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package anticope.rejects.commands;
|
||||
|
||||
import anticope.rejects.arguments.ClientPosArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import meteordevelopment.meteorclient.systems.commands.Command;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.command.argument.BlockStateArgument;
|
||||
import net.minecraft.command.argument.BlockStateArgumentType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||
|
||||
public class SetBlockCommand extends Command {
|
||||
public SetBlockCommand() {
|
||||
super("setblock", "Sets client side blocks", "sblk");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||
builder.then(argument("pos", ClientPosArgumentType.pos()).then(argument("block", BlockStateArgumentType.blockState()).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);
|
||||
|
||||
return SINGLE_SUCCESS;
|
||||
})));
|
||||
}
|
||||
}
|
||||
35
src/main/java/anticope/rejects/commands/TeleportCommand.java
Normal file
35
src/main/java/anticope/rejects/commands/TeleportCommand.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package anticope.rejects.commands;
|
||||
|
||||
import anticope.rejects.arguments.ClientPosArgumentType;
|
||||
import com.mojang.brigadier.arguments.FloatArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import meteordevelopment.meteorclient.systems.commands.Command;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||
|
||||
public class TeleportCommand extends Command {
|
||||
|
||||
|
||||
public TeleportCommand() {
|
||||
super("teleport","Sends a packet to the server with new position. Allows to teleport small distances.", "tp");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||
builder.then(argument("pos", ClientPosArgumentType.pos()).executes(ctx -> {
|
||||
Vec3d pos = ClientPosArgumentType.getPos(ctx, "pos");
|
||||
mc.player.updatePosition(pos.getX(), pos.getY(), pos.getZ());
|
||||
return SINGLE_SUCCESS;
|
||||
}));
|
||||
|
||||
builder.then(argument("pos", ClientPosArgumentType.pos()).then(argument("yaw", FloatArgumentType.floatArg()).then(argument("pitch",FloatArgumentType.floatArg()).executes(ctx -> {
|
||||
Vec3d pos = ClientPosArgumentType.getPos(ctx, "pos");
|
||||
float yaw = FloatArgumentType.getFloat(ctx, "yaw");
|
||||
float pitch = FloatArgumentType.getFloat(ctx, "pitch");
|
||||
mc.player.updatePositionAndAngles(pos.getX(), pos.getY(), pos.getZ(), yaw, pitch);
|
||||
return SINGLE_SUCCESS;
|
||||
}))));
|
||||
}
|
||||
}
|
||||
72
src/main/java/anticope/rejects/commands/TerrainExport.java
Normal file
72
src/main/java/anticope/rejects/commands/TerrainExport.java
Normal file
@@ -0,0 +1,72 @@
|
||||
package anticope.rejects.commands;
|
||||
|
||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
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.util.math.BlockPos;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
import org.lwjgl.util.tinyfd.TinyFileDialogs;
|
||||
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||
|
||||
public class TerrainExport extends Command {
|
||||
|
||||
private final PointerBuffer filters;
|
||||
|
||||
private final static SimpleCommandExceptionType IO_EXCEPTION = new SimpleCommandExceptionType(new LiteralText("An IOException occurred"));
|
||||
|
||||
public TerrainExport() {
|
||||
super("terrain-export", "Export an area to the c++ terrain finder format (very popbob command).");
|
||||
|
||||
filters = BufferUtils.createPointerBuffer(1);
|
||||
|
||||
ByteBuffer txtFilter = MemoryUtil.memASCII("*.txt");
|
||||
|
||||
filters.put(txtFilter);
|
||||
filters.rewind();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||
builder.then(argument("distance", IntegerArgumentType.integer(1)).executes(context -> {
|
||||
int distance = IntegerArgumentType.getInteger(context, "distance");
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int x = -distance; x <= distance; x++) {
|
||||
for (int z = -distance; z <= distance; z++) {
|
||||
for (int y = distance; y >= -distance; y--) {
|
||||
BlockPos pos = mc.player.getBlockPos().add(x, y, z);
|
||||
if (mc.world.getBlockState(pos).isFullCube(mc.world, pos)) {
|
||||
stringBuilder.append(String.format("%d, %d, %d\n", x + distance, y + distance, z + distance));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String path = TinyFileDialogs.tinyfd_saveFileDialog("Save data", null, filters, null);
|
||||
if (path == null) throw IO_EXCEPTION.create();
|
||||
if (!path.endsWith(".txt"))
|
||||
path += ".txt";
|
||||
try {
|
||||
FileWriter file = new FileWriter(path);
|
||||
file.write(stringBuilder.toString().trim());
|
||||
file.close();
|
||||
} catch (IOException e) {
|
||||
throw IO_EXCEPTION.create();
|
||||
}
|
||||
|
||||
return SINGLE_SUCCESS;
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package anticope.rejects.events;
|
||||
|
||||
import meteordevelopment.meteorclient.events.packets.PacketEvent;
|
||||
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
|
||||
|
||||
public class CustomPayloadEvent extends PacketEvent {
|
||||
public CustomPayloadS2CPacket packet;
|
||||
|
||||
private static final CustomPayloadEvent INSTANCE = new CustomPayloadEvent();
|
||||
|
||||
public static CustomPayloadEvent get(CustomPayloadS2CPacket packet) {
|
||||
INSTANCE.setCancelled(false);
|
||||
INSTANCE.packet = packet;
|
||||
return INSTANCE;
|
||||
}
|
||||
}
|
||||
50
src/main/java/anticope/rejects/gui/hud/AppleHud.java
Normal file
50
src/main/java/anticope/rejects/gui/hud/AppleHud.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package anticope.rejects.gui.hud;
|
||||
|
||||
import meteordevelopment.meteorclient.settings.DoubleSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HUD;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HudRenderer;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.modules.HudElement;
|
||||
import meteordevelopment.meteorclient.utils.player.InvUtils;
|
||||
import meteordevelopment.meteorclient.utils.render.RenderUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
|
||||
public class AppleHud extends HudElement {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Double> scale = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("scale")
|
||||
.description("Scale of golden apple counter.")
|
||||
.defaultValue(3)
|
||||
.min(1)
|
||||
.sliderMin(1)
|
||||
.sliderMax(4)
|
||||
.build()
|
||||
);
|
||||
|
||||
public AppleHud(HUD hud) {
|
||||
super(hud, "apples", "Displays the amount of golden apples in your inventory.", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(HudRenderer renderer) {
|
||||
box.setSize(16 * scale.get(), 16 * scale.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(HudRenderer renderer) {
|
||||
double x = box.getX();
|
||||
double y = box.getY();
|
||||
|
||||
if (isInEditor()) {
|
||||
RenderUtils.drawItem(Items.GOLDEN_APPLE.getDefaultStack(), (int) x, (int) y, scale.get(), true);
|
||||
} else {
|
||||
int count = InvUtils.find(Items.GOLDEN_APPLE).getCount();
|
||||
count += InvUtils.find(Items.ENCHANTED_GOLDEN_APPLE).getCount();
|
||||
if (count > 0)
|
||||
RenderUtils.drawItem(new ItemStack(Items.GOLDEN_APPLE, count), (int) x, (int) y, scale.get(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
23
src/main/java/anticope/rejects/gui/hud/BaritoneHud.java
Normal file
23
src/main/java/anticope/rejects/gui/hud/BaritoneHud.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package anticope.rejects.gui.hud;
|
||||
|
||||
import baritone.api.BaritoneAPI;
|
||||
import baritone.api.process.IBaritoneProcess;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HUD;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.modules.DoubleTextHudElement;
|
||||
|
||||
public class BaritoneHud extends DoubleTextHudElement {
|
||||
public BaritoneHud(HUD hud) {
|
||||
super(hud, "Baritone", "Displays what baritone is doing.", "Baritone: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRight() {
|
||||
IBaritoneProcess process = BaritoneAPI.getProvider().getPrimaryBaritone().getPathingControlManager().mostRecentInControl().orElse(null);
|
||||
|
||||
if (process == null) return "-";
|
||||
|
||||
return process.displayName();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
16
src/main/java/anticope/rejects/gui/hud/CpsHud.java
Normal file
16
src/main/java/anticope/rejects/gui/hud/CpsHud.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package anticope.rejects.gui.hud;
|
||||
|
||||
import anticope.rejects.utils.RejectsUtils;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HUD;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.modules.DoubleTextHudElement;
|
||||
|
||||
public class CpsHud extends DoubleTextHudElement {
|
||||
public CpsHud(HUD hud) {
|
||||
super(hud, "cps", "Displays your CPS.", "CPS: ", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRight() {
|
||||
return Integer.toString(RejectsUtils.CPS);
|
||||
}
|
||||
}
|
||||
49
src/main/java/anticope/rejects/gui/hud/CrystalHud.java
Normal file
49
src/main/java/anticope/rejects/gui/hud/CrystalHud.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package anticope.rejects.gui.hud;
|
||||
|
||||
import meteordevelopment.meteorclient.settings.DoubleSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HUD;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HudRenderer;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.modules.HudElement;
|
||||
import meteordevelopment.meteorclient.utils.player.InvUtils;
|
||||
import meteordevelopment.meteorclient.utils.render.RenderUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
|
||||
//SonyTV was here :)
|
||||
|
||||
public class CrystalHud extends HudElement {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Double> scale = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("scale")
|
||||
.description("Scale of crystal counter.")
|
||||
.defaultValue(3)
|
||||
.min(1)
|
||||
.sliderMin(1)
|
||||
.sliderMax(4)
|
||||
.build()
|
||||
);
|
||||
|
||||
public CrystalHud(HUD hud) {
|
||||
super(hud, "crytals", "Displays the amount of crystals in your inventory.", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(HudRenderer renderer) {
|
||||
box.setSize(16 * scale.get(), 16 * scale.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(HudRenderer renderer) {
|
||||
double x = box.getX();
|
||||
double y = box.getY();
|
||||
|
||||
if (isInEditor()) {
|
||||
RenderUtils.drawItem(Items.END_CRYSTAL.getDefaultStack(), (int) x, (int) y, scale.get(), true);
|
||||
} else if (InvUtils.find(Items.END_CRYSTAL).getCount() > 0) {
|
||||
RenderUtils.drawItem(new ItemStack(Items.END_CRYSTAL, InvUtils.find(Items.END_CRYSTAL).getCount()), (int) x, (int) y, scale.get(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
47
src/main/java/anticope/rejects/gui/hud/ExpHud.java
Normal file
47
src/main/java/anticope/rejects/gui/hud/ExpHud.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package anticope.rejects.gui.hud;
|
||||
|
||||
import meteordevelopment.meteorclient.settings.DoubleSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HUD;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.HudRenderer;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.hud.modules.HudElement;
|
||||
import meteordevelopment.meteorclient.utils.player.InvUtils;
|
||||
import meteordevelopment.meteorclient.utils.render.RenderUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
|
||||
public class ExpHud extends HudElement {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Double> scale = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("scale")
|
||||
.description("Scale of exp bottle counter.")
|
||||
.defaultValue(3)
|
||||
.min(1)
|
||||
.sliderMin(1)
|
||||
.sliderMax(4)
|
||||
.build()
|
||||
);
|
||||
|
||||
public ExpHud(HUD hud) {
|
||||
super(hud, "exp", "Displays the amount of exp bottles in your inventory.", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(HudRenderer renderer) {
|
||||
box.setSize(16 * scale.get(), 16 * scale.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(HudRenderer renderer) {
|
||||
double x = box.getX();
|
||||
double y = box.getY();
|
||||
|
||||
if (isInEditor()) {
|
||||
RenderUtils.drawItem(Items.EXPERIENCE_BOTTLE.getDefaultStack(), (int) x, (int) y, scale.get(), true);
|
||||
} else if (InvUtils.find(Items.EXPERIENCE_BOTTLE).getCount() > 0) {
|
||||
RenderUtils.drawItem(new ItemStack(Items.EXPERIENCE_BOTTLE, InvUtils.find(Items.EXPERIENCE_BOTTLE).getCount()), (int) x, (int) y, scale.get(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
128
src/main/java/anticope/rejects/gui/screens/HeadScreen.java
Normal file
128
src/main/java/anticope/rejects/gui/screens/HeadScreen.java
Normal file
@@ -0,0 +1,128 @@
|
||||
package anticope.rejects.gui.screens;
|
||||
|
||||
import anticope.rejects.utils.GiveUtils;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import meteordevelopment.meteorclient.gui.GuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.WindowScreen;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WTable;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WButton;
|
||||
import meteordevelopment.meteorclient.settings.EnumSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.settings.Settings;
|
||||
import meteordevelopment.meteorclient.utils.network.Http;
|
||||
import meteordevelopment.meteorclient.utils.network.MeteorExecutor;
|
||||
import meteordevelopment.meteorclient.utils.player.ChatUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtList;
|
||||
import net.minecraft.text.LiteralText;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static meteordevelopment.meteorclient.utils.Utils.mc;
|
||||
|
||||
public class HeadScreen extends WindowScreen {
|
||||
|
||||
public enum Categories {
|
||||
Alphabet,
|
||||
Animals,
|
||||
Blocks,
|
||||
Decoration,
|
||||
Food_Drinks,
|
||||
Humanoid,
|
||||
Miscellaneous,
|
||||
Monsters,
|
||||
Plants
|
||||
}
|
||||
|
||||
private static final Type gsonType = new TypeToken<List<Map<String, String>>>() {}.getType();
|
||||
|
||||
private final Settings settings = new Settings();
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
private static Categories category = Categories.Decoration;
|
||||
private final Setting<Categories> categorySetting = sgGeneral.add(new EnumSetting.Builder<Categories>()
|
||||
.name("Category")
|
||||
.defaultValue(category)
|
||||
.description("Category")
|
||||
.onChanged((v) -> this.loadHeads())
|
||||
.build()
|
||||
);
|
||||
|
||||
public HeadScreen(GuiTheme theme) {
|
||||
super(theme, "Heads");
|
||||
loadHeads();
|
||||
}
|
||||
|
||||
private void set() {
|
||||
clear();
|
||||
add(theme.settings(settings)).expandX();
|
||||
add(theme.horizontalSeparator()).expandX();
|
||||
}
|
||||
|
||||
private String getCat() {
|
||||
category = categorySetting.get();
|
||||
return category.toString().replace("_", "-");
|
||||
}
|
||||
|
||||
private void loadHeads() {
|
||||
MeteorExecutor.execute(() -> {
|
||||
List<Map<String, String>> res = Http.get("https://minecraft-heads.com/scripts/api.php?cat="+getCat()).sendJson(gsonType);
|
||||
List<ItemStack> heads = new ArrayList<>();
|
||||
res.forEach(a -> {
|
||||
try {
|
||||
heads.add(createHeadStack(a.get("uuid"), a.get("value"), a.get("name")));
|
||||
} catch (Exception e) { }
|
||||
});
|
||||
|
||||
WTable t = theme.table();
|
||||
for (ItemStack head : heads) {
|
||||
t.add(theme.item(head));
|
||||
t.add(theme.label(head.getName().asString()));
|
||||
WButton give = t.add(theme.button("Give")).widget();
|
||||
give.action = () -> {
|
||||
try {
|
||||
GiveUtils.giveItem(head);
|
||||
} catch (CommandSyntaxException e) {
|
||||
ChatUtils.error("Heads", e.getMessage());
|
||||
}
|
||||
};
|
||||
WButton equip = t.add(theme.button("Equip")).widget();
|
||||
equip.tooltip = "Equip client-side.";
|
||||
equip.action = () -> {
|
||||
mc.player.getInventory().armor.set(3, head);
|
||||
};
|
||||
t.row();
|
||||
}
|
||||
set();
|
||||
add(t).expandX().minWidth(400).widget();
|
||||
});
|
||||
}
|
||||
|
||||
private ItemStack createHeadStack(String uuid, String value, String name) {
|
||||
ItemStack head = Items.PLAYER_HEAD.getDefaultStack();
|
||||
NbtCompound tag = new NbtCompound();
|
||||
NbtCompound skullOwner = new NbtCompound();
|
||||
skullOwner.putUuid("Id", UUID.fromString(uuid));
|
||||
NbtCompound properties = new NbtCompound();
|
||||
NbtList textures = new NbtList();
|
||||
NbtCompound Value = new NbtCompound();
|
||||
Value.putString("Value", value);
|
||||
textures.add(Value);
|
||||
properties.put("textures", textures);
|
||||
skullOwner.put("Properties", properties);
|
||||
tag.put("SkullOwner", skullOwner);
|
||||
head.setNbt(tag);
|
||||
head.setCustomName(new LiteralText(name));
|
||||
return head;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initWidgets() {}
|
||||
}
|
||||
@@ -0,0 +1,395 @@
|
||||
package anticope.rejects.gui.screens;
|
||||
|
||||
import anticope.rejects.modules.InteractionMenu;
|
||||
import anticope.rejects.mixin.EntityAccessor;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import meteordevelopment.meteorclient.MeteorClient;
|
||||
import meteordevelopment.meteorclient.events.meteor.KeyEvent;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import meteordevelopment.meteorclient.utils.render.PeekScreen;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.mob.EndermanEntity;
|
||||
import net.minecraft.entity.passive.HorseBaseEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.vehicle.StorageMinecartEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerInputC2SPacket;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/*
|
||||
Ported from: https://github.com/BleachDrinker420/BleachHack/pull/211
|
||||
*/
|
||||
public class InteractionScreen extends Screen {
|
||||
|
||||
private final Entity entity;
|
||||
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 StaticListener shiftListener = new StaticListener();
|
||||
|
||||
// Style
|
||||
private final int selectedDotColor;
|
||||
private final int dotColor;
|
||||
private final int backgroundColor;
|
||||
private final int borderColor;
|
||||
private final int textColor;
|
||||
|
||||
public InteractionScreen(Entity e) {
|
||||
this(e, Modules.get().get(InteractionMenu.class));
|
||||
}
|
||||
|
||||
public InteractionScreen(Entity entity, InteractionMenu module) {
|
||||
super(new LiteralText("Menu Screen"));
|
||||
|
||||
selectedDotColor = module.selectedDotColor.get().getPacked();
|
||||
dotColor = module.dotColor.get().getPacked();
|
||||
backgroundColor = module.backgroundColor.get().getPacked();
|
||||
borderColor = module.borderColor.get().getPacked();
|
||||
textColor = module.textColor.get().getPacked();
|
||||
|
||||
this.entity = entity;
|
||||
functions = new HashMap<>();
|
||||
functions.put("Stats", (Entity e) -> {
|
||||
closeScreen();
|
||||
client.setScreen(new StatsScreen(e));
|
||||
});
|
||||
if (entity instanceof PlayerEntity) {
|
||||
functions.put("Open Inventory", (Entity e) -> {
|
||||
closeScreen();
|
||||
client.setScreen(new InventoryScreen((PlayerEntity) e));
|
||||
});
|
||||
}
|
||||
|
||||
else if (entity instanceof HorseBaseEntity) {
|
||||
functions.put("Open Inventory", (Entity e) -> {
|
||||
closeScreen();
|
||||
if (client.player.isRiding()) {
|
||||
client.player.networkHandler.sendPacket(new PlayerInputC2SPacket(0, 0, false, true));
|
||||
}
|
||||
client.player.networkHandler.sendPacket(PlayerInteractEntityC2SPacket.interact(entity, true, Hand.MAIN_HAND));
|
||||
client.player.setSneaking(false);
|
||||
});
|
||||
}
|
||||
else if (entity instanceof StorageMinecartEntity) {
|
||||
functions.put("Open Inventory", (Entity e) -> {
|
||||
closeScreen();
|
||||
client.player.networkHandler.sendPacket(PlayerInteractEntityC2SPacket.interact(entity, true, Hand.MAIN_HAND));
|
||||
});
|
||||
}
|
||||
else {
|
||||
functions.put("Open Inventory", (Entity e) -> {
|
||||
closeScreen();
|
||||
ItemStack container = new ItemStack(Items.CHEST);
|
||||
container.setCustomName(e.getName());
|
||||
client.setScreen(new PeekScreen(container, getInventory(e)));
|
||||
});
|
||||
}
|
||||
|
||||
functions.put("Spectate", (Entity e) -> {
|
||||
MinecraftClient.getInstance().setCameraEntity(e);
|
||||
client.player.sendMessage(new LiteralText("Sneak to un-spectate."), true);
|
||||
MeteorClient.EVENT_BUS.subscribe(shiftListener);
|
||||
closeScreen();
|
||||
});
|
||||
|
||||
if (entity.isGlowing()) {
|
||||
functions.put("Remove glow", (Entity e) -> {
|
||||
e.setGlowing(false);
|
||||
((EntityAccessor)e).invokeSetFlag(6, false);
|
||||
closeScreen();
|
||||
});
|
||||
} else {
|
||||
functions.put("Glow", (Entity e) -> {
|
||||
e.setGlowing(true);
|
||||
((EntityAccessor)e).invokeSetFlag(6, true);
|
||||
closeScreen();
|
||||
});
|
||||
}
|
||||
if (entity.noClip) {
|
||||
functions.put("Disable NoClip", (Entity e) -> {
|
||||
entity.noClip = false;
|
||||
closeScreen();
|
||||
});
|
||||
} else {
|
||||
functions.put("NoClip", (Entity e) -> {
|
||||
entity.noClip = true;
|
||||
closeScreen();
|
||||
});
|
||||
}
|
||||
msgs = Modules.get().get(InteractionMenu.class).messages;
|
||||
msgs.keySet().forEach((key) -> {
|
||||
if (msgs.get(key).contains("{username}") && !(entity instanceof PlayerEntity)) return;
|
||||
if (msgs.get(key).contains("{health}") && !(entity instanceof LivingEntity)) return;
|
||||
|
||||
functions.put(key, (Entity e) -> {
|
||||
closeScreen();
|
||||
client.setScreen(new ChatScreen(replacePlaceholders(msgs.get(key), e)));
|
||||
});
|
||||
|
||||
});
|
||||
functions.put("Cancel", (Entity e) -> {closeScreen();});
|
||||
}
|
||||
|
||||
private ItemStack[] getInventory(Entity e) {
|
||||
ItemStack[] stack = new ItemStack[27];
|
||||
final int[] index = {0};
|
||||
if (e instanceof EndermanEntity) {
|
||||
try {
|
||||
stack[index[0]] = ((EndermanEntity)e).getCarriedBlock().getBlock().asItem().getDefaultStack();
|
||||
index[0]++;
|
||||
}
|
||||
catch (NullPointerException ex) {}
|
||||
}
|
||||
if (Saddleable.class.isInstance(e)) {
|
||||
if (((Saddleable)e).isSaddled()){
|
||||
stack[index[0]] = Items.SADDLE.getDefaultStack();
|
||||
index[0]++;
|
||||
}
|
||||
}
|
||||
e.getItemsHand().forEach(itemStack -> {
|
||||
if (itemStack!=null) {
|
||||
stack[index[0]] = itemStack;
|
||||
index[0]++;
|
||||
}
|
||||
});
|
||||
e.getArmorItems().forEach(itemStack -> {
|
||||
if (itemStack!=null) {
|
||||
stack[index[0]] = itemStack;
|
||||
index[0]++;
|
||||
}
|
||||
});
|
||||
for (int i = index[0]; i < 27; i++) stack[i] = Items.AIR.getDefaultStack();
|
||||
return stack;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
super.init();
|
||||
this.cursorMode(GLFW.GLFW_CURSOR_HIDDEN);
|
||||
yaw = client.player.getYaw();
|
||||
pitch = client.player.getPitch();
|
||||
}
|
||||
|
||||
private void cursorMode(int mode) {
|
||||
KeyBinding.unpressAll();
|
||||
double x = (double)(this.client.getWindow().getWidth() / 2);
|
||||
double y = (double)(this.client.getWindow().getHeight() / 2);
|
||||
InputUtil.setCursorParameters(this.client.getWindow().getHandle(), mode, x, y);
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
if (Modules.get().get(InteractionMenu.class).keybind.get().isPressed())
|
||||
onClose();
|
||||
}
|
||||
|
||||
private void closeScreen() {
|
||||
client.setScreen((Screen) null);
|
||||
}
|
||||
|
||||
public void onClose() {
|
||||
cursorMode(GLFW.GLFW_CURSOR_NORMAL);
|
||||
// This makes the magic
|
||||
if (focusedString != null) {
|
||||
functions.get(focusedString).accept(this.entity);
|
||||
} else
|
||||
client.setScreen((Screen) null);
|
||||
}
|
||||
|
||||
public boolean isPauseScreen() {
|
||||
return false;
|
||||
}
|
||||
|
||||
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.setShaderTexture(0, GUI_ICONS_TEXTURE);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.ONE_MINUS_DST_COLOR,
|
||||
GlStateManager.DstFactor.ONE_MINUS_SRC_COLOR, GlStateManager.SrcFactor.ONE,
|
||||
GlStateManager.DstFactor.ZERO);
|
||||
drawTexture(matrix, crosshairX - 8, crosshairY - 8, 0, 0, 15, 15);
|
||||
|
||||
drawDots(matrix, (int) (Math.min(height, width) / 2 * 0.75), mouseX, mouseY);
|
||||
matrix.scale (2f, 2f, 1f);
|
||||
drawCenteredText(matrix, textRenderer, entity.getName(), width / 4, 6, 0xFFFFFFFF);
|
||||
|
||||
int scale = client.options.guiScale;
|
||||
Vector2 mouse = new Vector2(mouseX, mouseY);
|
||||
Vector2 center = new Vector2(width / 2, height / 2);
|
||||
mouse.subtract(center);
|
||||
mouse.normalize();
|
||||
Vector2 cross = mouse;
|
||||
|
||||
if (scale == 0)
|
||||
scale = 4;
|
||||
|
||||
// Move crossHair based on distance between mouse and center. But with limit
|
||||
if (Math.hypot(width / 2 - mouseX, height / 2 - mouseY) < 1f / scale * 200f)
|
||||
mouse.multiply((float) Math.hypot(width / 2 - mouseX, height / 2 - mouseY));
|
||||
else
|
||||
mouse.multiply(1f / scale * 200f);
|
||||
|
||||
this.crosshairX = (int) mouse.x + width / 2;
|
||||
this.crosshairY = (int) mouse.y + height / 2;
|
||||
|
||||
client.player.setYaw( yaw + cross.x / 3);
|
||||
client.player.setPitch(MathHelper.clamp(pitch + cross.y / 3, -90f, 90f));
|
||||
super.render(matrix, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void drawDots(MatrixStack matrix, int radius, int mouseX, int mouseY) {
|
||||
ArrayList<Point> pointList = new ArrayList<Point>();
|
||||
String cache[] = new String[functions.size()];
|
||||
double lowestDistance = Double.MAX_VALUE;
|
||||
int i = 0;
|
||||
|
||||
for (String string: functions.keySet()) {
|
||||
// Just some fancy calculations to get the positions of the dots
|
||||
double s = (double) i / functions.size() * 2 * Math.PI;
|
||||
int x = (int) Math.round(radius * Math.cos(s) + width / 2);
|
||||
int y = (int) Math.round(radius * Math.sin(s) + height / 2);
|
||||
drawTextField(matrix, x, y, string);
|
||||
|
||||
// Calculate lowest distance between mouse and dot
|
||||
if (Math.hypot(x - mouseX, y - mouseY) < lowestDistance) {
|
||||
lowestDistance = Math.hypot(x - mouseX, y - mouseY);
|
||||
focusedDot = i;
|
||||
}
|
||||
|
||||
cache[i] = string;
|
||||
pointList.add(new Point(x, y));
|
||||
i++;
|
||||
}
|
||||
|
||||
// Go through all point and if it is focused -> drawing different color, changing closest string value
|
||||
for (int j = 0; j < functions.size(); j++) {
|
||||
Point point = pointList.get(j);
|
||||
if (pointList.get(focusedDot) == point) {
|
||||
drawDot(matrix, point.x - 4, point.y - 4, selectedDotColor);
|
||||
this.focusedString = cache[focusedDot];
|
||||
}
|
||||
else
|
||||
drawDot(matrix, point.x - 4, point.y - 4, dotColor);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawRect(MatrixStack matrix, int startX, int startY, int width, int height, int colorInner,int colorOuter) {
|
||||
drawHorizontalLine(matrix, startX, startX + width, startY, colorOuter);
|
||||
drawHorizontalLine(matrix, startX, startX + width, startY + height, colorOuter);
|
||||
drawVerticalLine(matrix, startX, startY, startY + height, colorOuter);
|
||||
drawVerticalLine(matrix, startX + width, startY, startY + height, colorOuter);
|
||||
fill(matrix, startX + 1, startY + 1, startX + width, startY + height, colorInner);
|
||||
}
|
||||
|
||||
private void drawTextField(MatrixStack matrix, int x, int y, String key) {
|
||||
if (x >= width / 2) {
|
||||
drawRect(matrix, x + 10, y - 8, textRenderer.getWidth(key) + 3, 15, backgroundColor, borderColor);
|
||||
drawStringWithShadow(matrix, textRenderer, key, x + 12, y - 4, textColor);
|
||||
} else {
|
||||
drawRect(matrix, x - 14 - textRenderer.getWidth(key), y - 8, textRenderer.getWidth(key) + 3, 15, backgroundColor, borderColor);
|
||||
drawStringWithShadow(matrix, textRenderer, key, x - 12 - textRenderer.getWidth(key), y - 4, textColor);
|
||||
}
|
||||
}
|
||||
|
||||
// Literally drawing it in code
|
||||
private void drawDot(MatrixStack matrix, int startX, int startY, int colorInner) {
|
||||
// Draw dot itself
|
||||
drawHorizontalLine(matrix, startX + 2, startX + 5, startY, borderColor);
|
||||
drawHorizontalLine(matrix, startX + 1, startX + 6, startY + 1, borderColor);
|
||||
drawHorizontalLine(matrix, startX + 2, startX + 5, startY + 1, colorInner);
|
||||
fill(matrix, startX, startY + 2, startX + 8, startY + 6, borderColor);
|
||||
fill(matrix, startX + 1, startY + 2, startX + 7, startY + 6, colorInner);
|
||||
drawHorizontalLine(matrix, startX + 1, startX + 6, startY + 6, borderColor);
|
||||
drawHorizontalLine(matrix, startX + 2, startX + 5, startY + 6, colorInner);
|
||||
drawHorizontalLine(matrix, startX + 2, startX + 5, startY + 7, borderColor);
|
||||
|
||||
// Draw light overlay
|
||||
drawHorizontalLine(matrix, startX + 2, startX + 3, startY + 1, 0x80FFFFFF);
|
||||
drawHorizontalLine(matrix, startX + 1, startX + 1, startY + 2, 0x80FFFFFF);
|
||||
}
|
||||
|
||||
private String replacePlaceholders(String in, Entity e) {
|
||||
in = in.replace("{uuid}", e.getUuidAsString());
|
||||
in = in.replace("{name}", e.getName().getString());
|
||||
in = in.replace("{pos}", String.format("%.2f %.2f %.2f", e.getX(), e.getY(), e.getZ()));
|
||||
if (e instanceof PlayerEntity) {
|
||||
in = in.replace("{username}", ((PlayerEntity)e).getGameProfile().getName());
|
||||
}
|
||||
if (e instanceof LivingEntity) {
|
||||
in = in.replace("{health}", String.format("%.2f", ((LivingEntity)e).getHealth()));
|
||||
}
|
||||
return in;
|
||||
}
|
||||
|
||||
private class StaticListener {
|
||||
@EventHandler
|
||||
private void onKey(KeyEvent event) {
|
||||
if (client.options.keySneak.matchesKey(event.key, 0) || client.options.keySneak.matchesMouse(event.key)) {
|
||||
client.setCameraEntity(client.player);
|
||||
event.cancel();
|
||||
MeteorClient.EVENT_BUS.unsubscribe(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Creating my own Vector class beacause I couldn´t find a good one in minecrafts code
|
||||
class Vector2 {
|
||||
float x, y;
|
||||
|
||||
Vector2 (float x, float y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
void normalize() {
|
||||
float mag = getMag();
|
||||
if (mag != 0 && mag != 1)
|
||||
divide(mag);
|
||||
}
|
||||
|
||||
void subtract (Vector2 vec) {
|
||||
this.x -= vec.x;
|
||||
this.y -= vec.y;
|
||||
}
|
||||
|
||||
void divide(float n) {
|
||||
x /= n;
|
||||
y /= n;
|
||||
}
|
||||
|
||||
void multiply(float n) {
|
||||
x *= n;
|
||||
y *= n;
|
||||
}
|
||||
|
||||
private float getMag() {
|
||||
return (float) Math.sqrt(x * x + y * y);
|
||||
}
|
||||
}
|
||||
95
src/main/java/anticope/rejects/gui/screens/StatsScreen.java
Normal file
95
src/main/java/anticope/rejects/gui/screens/StatsScreen.java
Normal file
@@ -0,0 +1,95 @@
|
||||
package anticope.rejects.gui.screens;
|
||||
|
||||
import net.minecraft.client.resource.language.TranslationStorage;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.effect.StatusEffectUtil;
|
||||
import net.minecraft.util.Language;
|
||||
import net.minecraft.util.math.Box;
|
||||
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.MeteorClient;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.gui.GuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.GuiThemes;
|
||||
import meteordevelopment.meteorclient.gui.WindowScreen;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WSection;
|
||||
|
||||
public class StatsScreen extends WindowScreen {
|
||||
public final Entity entity;
|
||||
private boolean effectListExpanded = true;
|
||||
private boolean attribListExpanded = true;
|
||||
private boolean dimensionExpanded = false;
|
||||
public StatsScreen(Entity e) {
|
||||
super(GuiThemes.get(),e.getName().getString());
|
||||
this.entity = e;
|
||||
updateData();
|
||||
MeteorClient.EVENT_BUS.subscribe(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onClosed() {
|
||||
MeteorClient.EVENT_BUS.unsubscribe(this);
|
||||
super.onClosed();
|
||||
}
|
||||
|
||||
private void updateData() {
|
||||
clear();
|
||||
GuiTheme theme = GuiThemes.get();
|
||||
Language lang = TranslationStorage.getInstance();
|
||||
add(theme.label(String.format("Type: %s", lang.get(entity.getType().getTranslationKey()))));
|
||||
add(theme.label(String.format("Age: %d", entity.age)));
|
||||
add(theme.label(String.format("UUID: %s", entity.getUuidAsString())));
|
||||
if (entity instanceof LivingEntity) {
|
||||
LivingEntity liv = (LivingEntity) entity;
|
||||
add(theme.label(String.format("Health: %.2f/%.2f", liv.getHealth(), liv.getMaxHealth())));
|
||||
add(theme.label(String.format("Armor: %d/20", liv.getArmor())));
|
||||
|
||||
WSection effectList = add(theme.section("Status Effects", effectListExpanded)).expandX().widget();
|
||||
effectList.action = () -> {
|
||||
effectListExpanded = effectList.isExpanded();
|
||||
};
|
||||
liv.getActiveStatusEffects().forEach((effect, instance) -> {
|
||||
String status = lang.get(effect.getTranslationKey());
|
||||
if (instance.getAmplifier() != 0) {
|
||||
status += (String.format(" %d (%s)", instance.getAmplifier()+1, StatusEffectUtil.durationToString(instance, 1)));
|
||||
} else {
|
||||
status += (String.format(" (%s)", StatusEffectUtil.durationToString(instance, 1)));
|
||||
}
|
||||
effectList.add(theme.label(status)).expandX();
|
||||
});
|
||||
if (liv.getActiveStatusEffects().isEmpty()) {
|
||||
effectList.add(theme.label("No effects")).expandX();
|
||||
}
|
||||
|
||||
WSection attribList = add(theme.section("Attributes", attribListExpanded)).expandX().widget();
|
||||
attribList.action = () -> {
|
||||
attribListExpanded = attribList.isExpanded();
|
||||
};
|
||||
liv.getAttributes().getTracked().forEach((attrib) -> {
|
||||
attribList.add(theme.label(String.format("%s: %.2f",
|
||||
lang.get(attrib.getAttribute().getTranslationKey()),
|
||||
attrib.getValue()
|
||||
))).expandX();
|
||||
});
|
||||
}
|
||||
WSection dimension = add(theme.section("Dimensions", dimensionExpanded)).expandX().widget();
|
||||
dimension.action = () -> {
|
||||
dimensionExpanded = dimension.isExpanded();
|
||||
};
|
||||
dimension.add(theme.label(String.format("Position: %.2f, %.2f, %.2f", entity.getX(), entity.getY(), entity.getZ()))).expandX();
|
||||
dimension.add(theme.label(String.format("Yaw: %.2f, Pitch: %.2f", entity.getYaw(), entity.getPitch()))).expandX();
|
||||
Box box = entity.getBoundingBox();
|
||||
dimension.add(theme.label(String.format("Bounding Box: %.2f, %.2f, %.2f",
|
||||
box.maxX-box.minX, box.maxY-box.minY, box.maxZ-box.minZ
|
||||
))).expandX();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Post event) {
|
||||
updateData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initWidgets() {}
|
||||
}
|
||||
@@ -0,0 +1,333 @@
|
||||
package anticope.rejects.gui.themes.rounded;
|
||||
|
||||
import anticope.rejects.gui.themes.rounded.widgets.*;
|
||||
import anticope.rejects.gui.themes.rounded.widgets.input.WMeteorDropdown;
|
||||
import anticope.rejects.gui.themes.rounded.widgets.input.WMeteorSlider;
|
||||
import anticope.rejects.gui.themes.rounded.widgets.input.WMeteorTextBox;
|
||||
import anticope.rejects.gui.themes.rounded.widgets.pressable.*;
|
||||
import meteordevelopment.meteorclient.gui.DefaultSettingsWidgetFactory;
|
||||
import meteordevelopment.meteorclient.gui.GuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.WidgetScreen;
|
||||
import meteordevelopment.meteorclient.gui.renderer.packer.GuiTexture;
|
||||
import meteordevelopment.meteorclient.gui.utils.AlignmentX;
|
||||
import meteordevelopment.meteorclient.gui.utils.CharFilter;
|
||||
import meteordevelopment.meteorclient.gui.widgets.*;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WSection;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WView;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WWindow;
|
||||
import meteordevelopment.meteorclient.gui.widgets.input.WDropdown;
|
||||
import meteordevelopment.meteorclient.gui.widgets.input.WSlider;
|
||||
import meteordevelopment.meteorclient.gui.widgets.input.WTextBox;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.*;
|
||||
import meteordevelopment.meteorclient.renderer.text.TextRenderer;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.accounts.Account;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
|
||||
|
||||
import static meteordevelopment.meteorclient.utils.Utils.mc;
|
||||
|
||||
public class MeteorRoundedGuiTheme extends GuiTheme {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
private final SettingGroup sgColors = settings.createGroup("Colors");
|
||||
private final SettingGroup sgTextColors = settings.createGroup("Text");
|
||||
private final SettingGroup sgBackgroundColors = settings.createGroup("Background");
|
||||
private final SettingGroup sgOutline = settings.createGroup("Outline");
|
||||
private final SettingGroup sgSeparator = settings.createGroup("Separator");
|
||||
private final SettingGroup sgScrollbar = settings.createGroup("Scrollbar");
|
||||
private final SettingGroup sgSlider = settings.createGroup("Slider");
|
||||
|
||||
// General
|
||||
|
||||
public final Setting<Double> scale = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("scale")
|
||||
.description("Scale of the GUI.")
|
||||
.defaultValue(1)
|
||||
.min(0.75)
|
||||
.sliderMin(0.75)
|
||||
.sliderMax(4)
|
||||
.onSliderRelease()
|
||||
.onChanged(aDouble -> {
|
||||
if (mc.currentScreen instanceof WidgetScreen) ((WidgetScreen) mc.currentScreen).invalidate();
|
||||
})
|
||||
.build()
|
||||
);
|
||||
|
||||
public final Setting<AlignmentX> moduleAlignment = sgGeneral.add(new EnumSetting.Builder<AlignmentX>()
|
||||
.name("module-alignment")
|
||||
.description("How module titles are aligned.")
|
||||
.defaultValue(AlignmentX.Center)
|
||||
.build()
|
||||
);
|
||||
|
||||
public final Setting<Boolean> categoryIcons = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("category-icons")
|
||||
.description("Adds item icons to module categories.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
public final Setting<Boolean> hideHUD = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("hide-HUD")
|
||||
.description("Hide HUD when in GUI.")
|
||||
.defaultValue(false)
|
||||
.onChanged(v -> {
|
||||
if (mc.currentScreen instanceof WidgetScreen) mc.options.hudHidden = v;
|
||||
})
|
||||
.build()
|
||||
);
|
||||
|
||||
public final Setting<Integer> round = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("round")
|
||||
.description("How much windows should be rounded")
|
||||
.defaultValue(0)
|
||||
.min(0)
|
||||
.max(20)
|
||||
.sliderMin(0)
|
||||
.sliderMax(15)
|
||||
.build()
|
||||
);
|
||||
|
||||
// Colors
|
||||
|
||||
public final Setting<SettingColor> accentColor = color("accent", "Main color of the GUI.", new SettingColor(135, 0, 255));
|
||||
public final Setting<SettingColor> checkboxColor = color("checkbox", "Color of checkbox.", new SettingColor(135, 0, 255));
|
||||
public final Setting<SettingColor> plusColor = color("plus", "Color of plus button.", new SettingColor(255, 255, 255));
|
||||
public final Setting<SettingColor> minusColor = color("minus", "Color of minus button.", new SettingColor(255, 255, 255));
|
||||
|
||||
// Text
|
||||
|
||||
public final Setting<SettingColor> textColor = color(sgTextColors, "text", "Color of text.", new SettingColor(255, 255, 255));
|
||||
public final Setting<SettingColor> textSecondaryColor = color(sgTextColors, "text-secondary-text", "Color of secondary text.", new SettingColor(150, 150, 150));
|
||||
public final Setting<SettingColor> textHighlightColor = color(sgTextColors, "text-highlight", "Color of text highlighting.", new SettingColor(45, 125, 245, 100));
|
||||
public final Setting<SettingColor> titleTextColor = color(sgTextColors, "title-text", "Color of title text.", new SettingColor(255, 255, 255));
|
||||
public final Setting<SettingColor> loggedInColor = color(sgTextColors, "logged-in-text", "Color of logged in account name.", new SettingColor(45, 225, 45));
|
||||
|
||||
// Background
|
||||
|
||||
public final ThreeStateColorSetting backgroundColor = new ThreeStateColorSetting(
|
||||
sgBackgroundColors,
|
||||
"background",
|
||||
new SettingColor(20, 20, 20, 200),
|
||||
new SettingColor(30, 30, 30, 200),
|
||||
new SettingColor(40, 40, 40, 200)
|
||||
);
|
||||
|
||||
public final Setting<SettingColor> moduleBackground = color(sgBackgroundColors, "module-background", "Color of module background when active.", new SettingColor(50, 50, 50));
|
||||
|
||||
// Outline
|
||||
|
||||
public final ThreeStateColorSetting outlineColor = new ThreeStateColorSetting(
|
||||
sgOutline,
|
||||
"outline",
|
||||
new SettingColor(0, 0, 0),
|
||||
new SettingColor(10, 10, 10),
|
||||
new SettingColor(20, 20, 20)
|
||||
);
|
||||
|
||||
// Separator
|
||||
|
||||
public final Setting<SettingColor> separatorText = color(sgSeparator, "separator-text", "Color of separator text", new SettingColor(255, 255, 255));
|
||||
public final Setting<SettingColor> separatorCenter = color(sgSeparator, "separator-center", "Center color of separators.", new SettingColor(255, 255, 255));
|
||||
public final Setting<SettingColor> separatorEdges = color(sgSeparator, "separator-edges", "Color of separator edges.", new SettingColor(225, 225, 225, 150));
|
||||
|
||||
// Scrollbar
|
||||
|
||||
public final ThreeStateColorSetting scrollbarColor = new ThreeStateColorSetting(
|
||||
sgScrollbar,
|
||||
"Scrollbar",
|
||||
new SettingColor(30, 30, 30, 200),
|
||||
new SettingColor(40, 40, 40, 200),
|
||||
new SettingColor(50, 50, 50, 200)
|
||||
);
|
||||
|
||||
// Slider
|
||||
|
||||
public final ThreeStateColorSetting sliderHandle = new ThreeStateColorSetting(
|
||||
sgSlider,
|
||||
"slider-handle",
|
||||
new SettingColor(0, 255, 180),
|
||||
new SettingColor(0, 240, 165),
|
||||
new SettingColor(0, 225, 150)
|
||||
);
|
||||
|
||||
public final Setting<SettingColor> sliderLeft = color(sgSlider, "slider-left", "Color of slider left part.", new SettingColor(0, 150, 80));
|
||||
public final Setting<SettingColor> sliderRight = color(sgSlider, "slider-right", "Color of slider right part.", new SettingColor(50, 50, 50));
|
||||
|
||||
public MeteorRoundedGuiTheme() {
|
||||
super("Meteor Rounded");
|
||||
|
||||
settingsFactory = new DefaultSettingsWidgetFactory(this);
|
||||
}
|
||||
|
||||
private Setting<SettingColor> color(SettingGroup group, String name, String description, SettingColor color) {
|
||||
return group.add(new ColorSetting.Builder()
|
||||
.name(name + "-color")
|
||||
.description(description)
|
||||
.defaultValue(color)
|
||||
.build());
|
||||
}
|
||||
private Setting<SettingColor> color(String name, String description, SettingColor color) {
|
||||
return color(sgColors, name, description, color);
|
||||
}
|
||||
|
||||
// Widgets
|
||||
|
||||
@Override
|
||||
public WWindow window(String title) {
|
||||
return w(new WMeteorWindow(title));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WLabel label(String text, boolean title, double maxWidth) {
|
||||
if (maxWidth == 0) return w(new WMeteorLabel(text, title));
|
||||
return w(new WMeteorMultiLabel(text, title, maxWidth));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WHorizontalSeparator horizontalSeparator(String text) {
|
||||
return w(new WMeteorHorizontalSeparator(text));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WVerticalSeparator verticalSeparator() {
|
||||
return w(new WMeteorVerticalSeparator());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WButton button(String text, GuiTexture texture) {
|
||||
return w(new WMeteorButton(text, texture));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WMinus minus() {
|
||||
return w(new WMeteorMinus());
|
||||
}
|
||||
|
||||
@Override
|
||||
public WPlus plus() {
|
||||
return w(new WMeteorPlus());
|
||||
}
|
||||
|
||||
@Override
|
||||
public WCheckbox checkbox(boolean checked) {
|
||||
return w(new WMeteorCheckbox(checked));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WSlider slider(double value, double min, double max) {
|
||||
return w(new WMeteorSlider(value, min, max));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WTextBox textBox(String text, CharFilter filter) {
|
||||
return w(new WMeteorTextBox(text, filter));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> WDropdown<T> dropdown(T[] values, T value) {
|
||||
return w(new WMeteorDropdown<>(values, value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WTriangle triangle() {
|
||||
return w(new WMeteorTriangle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public WTooltip tooltip(String text) {
|
||||
return w(new WMeteorTooltip(text));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WView view() {
|
||||
return w(new WMeteorView());
|
||||
}
|
||||
|
||||
@Override
|
||||
public WSection section(String title, boolean expanded, WWidget headerWidget) {
|
||||
return w(new WMeteorSection(title, expanded, headerWidget));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WAccount account(WidgetScreen screen, Account<?> account) {
|
||||
return w(new WMeteorAccount(screen, account));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WWidget module(Module module) {
|
||||
return w(new WMeteorModule(module));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WQuad quad(Color color) {
|
||||
return w(new WMeteorQuad(color));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WTopBar topBar() {
|
||||
return w(new WMeteorTopBar());
|
||||
}
|
||||
|
||||
// Colors
|
||||
|
||||
@Override
|
||||
public Color textColor() {
|
||||
return textColor.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color textSecondaryColor() {
|
||||
return textSecondaryColor.get();
|
||||
}
|
||||
|
||||
// Other
|
||||
|
||||
@Override
|
||||
public TextRenderer textRenderer() {
|
||||
return TextRenderer.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double scale(double value) {
|
||||
return value * scale.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean categoryIcons() {
|
||||
return categoryIcons.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hideHUD() {
|
||||
return hideHUD.get();
|
||||
}
|
||||
|
||||
public int roundAmount() {
|
||||
return round.get();
|
||||
}
|
||||
|
||||
public class ThreeStateColorSetting {
|
||||
private final Setting<SettingColor> normal, hovered, pressed;
|
||||
|
||||
public ThreeStateColorSetting(SettingGroup group, String name, SettingColor c1, SettingColor c2, SettingColor c3) {
|
||||
normal = color(group, name, "Color of " + name + ".", c1);
|
||||
hovered = color(group, "hovered-" + name, "Color of " + name + " when hovered.", c2);
|
||||
pressed = color(group, "pressed-" + name, "Color of " + name + " when pressed.", c3);
|
||||
}
|
||||
|
||||
public SettingColor get() {
|
||||
return normal.get();
|
||||
}
|
||||
|
||||
public SettingColor get(boolean pressed, boolean hovered, boolean bypassDisableHoverColor) {
|
||||
if (pressed) return this.pressed.get();
|
||||
return (hovered && (bypassDisableHoverColor || !disableHoverColor)) ? this.hovered.get() : this.normal.get();
|
||||
}
|
||||
|
||||
public SettingColor get(boolean pressed, boolean hovered) {
|
||||
return get(pressed, hovered, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded;
|
||||
|
||||
import anticope.rejects.utils.gui.GuiUtils;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import meteordevelopment.meteorclient.gui.utils.BaseWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WWidget;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
|
||||
public interface MeteorWidget extends BaseWidget {
|
||||
default MeteorRoundedGuiTheme theme() {
|
||||
return (MeteorRoundedGuiTheme) getTheme();
|
||||
}
|
||||
|
||||
default void renderBackground(GuiRenderer renderer, WWidget widget, boolean pressed, boolean mouseOver) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
int r = theme.roundAmount();
|
||||
double s = theme.scale(2);
|
||||
Color outlineColor = theme.outlineColor.get(pressed, mouseOver);
|
||||
GuiUtils.quadRounded(renderer, widget.x + s, widget.y + s, widget.width - s * 2, widget.height - s * 2, theme.backgroundColor.get(pressed, mouseOver), r - s);
|
||||
GuiUtils.quadOutlineRounded(renderer, widget, outlineColor, r, s);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.WidgetScreen;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WAccount;
|
||||
import meteordevelopment.meteorclient.systems.accounts.Account;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
|
||||
public class WMeteorAccount extends WAccount implements MeteorWidget {
|
||||
public WMeteorAccount(WidgetScreen screen, Account<?> account) {
|
||||
super(screen, account);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color loggedInColor() {
|
||||
return theme().loggedInColor.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color accountTypeColor() {
|
||||
return theme().textSecondaryColor.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WHorizontalSeparator;
|
||||
|
||||
public class WMeteorHorizontalSeparator extends WHorizontalSeparator implements MeteorWidget {
|
||||
public WMeteorHorizontalSeparator(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
if (text == null) renderWithoutText(renderer);
|
||||
else renderWithText(renderer);
|
||||
}
|
||||
|
||||
private void renderWithoutText(GuiRenderer renderer) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double s = theme.scale(1);
|
||||
double w = width / 2;
|
||||
|
||||
renderer.quad(x, y + s, w, s, theme.separatorEdges.get(), theme.separatorCenter.get());
|
||||
renderer.quad(x + w, y + s, w, s, theme.separatorCenter.get(), theme.separatorEdges.get());
|
||||
}
|
||||
|
||||
private void renderWithText(GuiRenderer renderer) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double s = theme.scale(2);
|
||||
double h = theme.scale(1);
|
||||
|
||||
double textStart = Math.round(width / 2.0 - textWidth / 2.0 - s);
|
||||
double textEnd = s + textStart + textWidth + s;
|
||||
|
||||
double offsetY = Math.round(height / 2.0);
|
||||
|
||||
renderer.quad(x, y + offsetY, textStart, h, theme.separatorEdges.get(), theme.separatorCenter.get());
|
||||
renderer.text(text, x + textStart + s, y, theme.separatorText.get(), false);
|
||||
renderer.quad(x + textEnd, y + offsetY, width - textEnd, h, theme.separatorCenter.get(), theme.separatorEdges.get());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WLabel;
|
||||
|
||||
public class WMeteorLabel extends WLabel implements MeteorWidget {
|
||||
public WMeteorLabel(String text, boolean title) {
|
||||
super(text, title);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
if (!text.isEmpty()) {
|
||||
renderer.text(text, x, y, color != null ? color : (title ? theme().titleTextColor.get() : theme().textColor.get()), title);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.utils.AlignmentX;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WPressable;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.Utils;
|
||||
|
||||
import static meteordevelopment.meteorclient.utils.Utils.mc;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_LEFT;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_RIGHT;
|
||||
|
||||
public class WMeteorModule extends WPressable implements MeteorWidget {
|
||||
private final Module module;
|
||||
|
||||
private double titleWidth;
|
||||
|
||||
private double animationProgress1;
|
||||
|
||||
private double animationProgress2;
|
||||
|
||||
public WMeteorModule(Module module) {
|
||||
this.module = module;
|
||||
|
||||
if (module.isActive()) {
|
||||
animationProgress1 = 1;
|
||||
animationProgress2 = 1;
|
||||
} else {
|
||||
animationProgress1 = 0;
|
||||
animationProgress2 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double pad() {
|
||||
return theme.scale(4);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCalculateSize() {
|
||||
double pad = pad();
|
||||
|
||||
if (titleWidth == 0) titleWidth = theme.textWidth(module.title);
|
||||
|
||||
width = pad + titleWidth + pad;
|
||||
height = pad + theme.textHeight() + pad;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPressed(int button) {
|
||||
if (button == GLFW_MOUSE_BUTTON_LEFT) module.toggle();
|
||||
else if (button == GLFW_MOUSE_BUTTON_RIGHT) mc.setScreen(theme.moduleScreen(module));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double pad = pad();
|
||||
|
||||
animationProgress1 += delta * 4 * ((module.isActive() || mouseOver) ? 1 : -1);
|
||||
animationProgress1 = Utils.clamp(animationProgress1, 0, 1);
|
||||
|
||||
animationProgress2 += delta * 6 * (module.isActive() ? 1 : -1);
|
||||
animationProgress2 = Utils.clamp(animationProgress2, 0, 1);
|
||||
|
||||
if (animationProgress1 > 0) {
|
||||
renderer.quad(x, y, width * animationProgress1, height, theme.moduleBackground.get());
|
||||
}
|
||||
if (animationProgress2 > 0) {
|
||||
renderer.quad(x, y + height * (1 - animationProgress2), theme.scale(2), height * animationProgress2, theme.accentColor.get());
|
||||
}
|
||||
|
||||
double x = this.x + pad;
|
||||
double w = width - pad * 2;
|
||||
|
||||
if (theme.moduleAlignment.get() == AlignmentX.Center) {
|
||||
x += w / 2 - titleWidth / 2;
|
||||
}
|
||||
else if (theme.moduleAlignment.get() == AlignmentX.Right) {
|
||||
x += w - titleWidth;
|
||||
}
|
||||
|
||||
renderer.text(module.title, x, y + pad, theme.textColor.get(), false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WMultiLabel;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
|
||||
public class WMeteorMultiLabel extends WMultiLabel implements MeteorWidget {
|
||||
public WMeteorMultiLabel(String text, boolean title, double maxWidth) {
|
||||
super(text, title, maxWidth);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
double h = theme.textHeight(title);
|
||||
Color color = theme().textColor.get();
|
||||
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
renderer.text(lines.get(i), x, y + h * i, color, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import anticope.rejects.utils.gui.GuiUtils;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WQuad;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
|
||||
public class WMeteorQuad extends WQuad {
|
||||
public WMeteorQuad(Color color) {
|
||||
super(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
GuiUtils.quadRounded(renderer, x, y, width, height, color, ((MeteorRoundedGuiTheme)theme).roundAmount());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WSection;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WTriangle;
|
||||
|
||||
public class WMeteorSection extends WSection {
|
||||
public WMeteorSection(String title, boolean expanded, WWidget headerWidget) {
|
||||
super(title, expanded, headerWidget);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WHeader createHeader() {
|
||||
return new WMeteorHeader(title);
|
||||
}
|
||||
|
||||
protected class WMeteorHeader extends WHeader {
|
||||
private WTriangle triangle;
|
||||
|
||||
public WMeteorHeader(String title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
add(theme.horizontalSeparator(title)).expandX();
|
||||
|
||||
if (headerWidget != null) add(headerWidget);
|
||||
|
||||
triangle = new WHeaderTriangle();
|
||||
triangle.theme = theme;
|
||||
triangle.action = this::onClick;
|
||||
|
||||
add(triangle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
triangle.rotation = (1 - animProgress) * -90;
|
||||
}
|
||||
}
|
||||
|
||||
protected static class WHeaderTriangle extends WTriangle implements MeteorWidget {
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
renderer.rotatedQuad(x, y, width, height, rotation, GuiRenderer.TRIANGLE, theme().textColor.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WTooltip;
|
||||
|
||||
public class WMeteorTooltip extends WTooltip implements MeteorWidget {
|
||||
public WMeteorTooltip(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
renderer.quad(this, theme().backgroundColor.get());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import anticope.rejects.utils.gui.GuiUtils;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import meteordevelopment.meteorclient.gui.tabs.Tab;
|
||||
import meteordevelopment.meteorclient.gui.tabs.TabScreen;
|
||||
import meteordevelopment.meteorclient.gui.tabs.Tabs;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WTopBar;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WPressable;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
|
||||
import static meteordevelopment.meteorclient.utils.Utils.mc;
|
||||
import static org.lwjgl.glfw.GLFW.glfwSetCursorPos;
|
||||
|
||||
public class WMeteorTopBar extends WTopBar implements MeteorWidget {
|
||||
@Override
|
||||
protected Color getButtonColor(boolean pressed, boolean hovered) {
|
||||
return theme().backgroundColor.get(pressed, hovered);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getNameColor() {
|
||||
return theme().textColor.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
for (Tab tab : Tabs.get()) {
|
||||
add(new WTopBarButton(tab));
|
||||
}
|
||||
}
|
||||
|
||||
protected int getState(WTopBarButton btn) {
|
||||
int a = 0;
|
||||
if (btn.equals(cells.get(0).widget()))
|
||||
a |= 1;
|
||||
if (btn.equals(cells.get(cells.size() - 1).widget()))
|
||||
a |= 2;
|
||||
return a;
|
||||
}
|
||||
|
||||
protected class WTopBarButton extends WPressable {
|
||||
private final Tab tab;
|
||||
|
||||
public WTopBarButton(Tab tab) {
|
||||
this.tab = tab;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCalculateSize() {
|
||||
double pad = pad();
|
||||
|
||||
width = pad + theme.textWidth(tab.name) + pad;
|
||||
height = pad + theme.textHeight() + pad;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPressed(int button) {
|
||||
Screen screen = mc.currentScreen;
|
||||
|
||||
if (!(screen instanceof TabScreen) || ((TabScreen) screen).tab != tab) {
|
||||
double mouseX = mc.mouse.getX();
|
||||
double mouseY = mc.mouse.getY();
|
||||
|
||||
tab.openScreen(theme);
|
||||
glfwSetCursorPos(mc.getWindow().getHandle(), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
double pad = pad();
|
||||
Color color = getButtonColor(pressed || (mc.currentScreen instanceof TabScreen && ((TabScreen) mc.currentScreen).tab == tab), mouseOver);
|
||||
|
||||
//renderer.quad(x, y, width, height, color);
|
||||
switch (getState(this)) {
|
||||
case 1:
|
||||
GuiUtils.quadRoundedSide(renderer, this, color, ((MeteorRoundedGuiTheme)theme).roundAmount(), false);
|
||||
break;
|
||||
case 2:
|
||||
GuiUtils.quadRoundedSide(renderer, this, color, ((MeteorRoundedGuiTheme)theme).roundAmount(), true);
|
||||
break;
|
||||
case 3:
|
||||
GuiUtils.quadRounded(renderer, this, color, ((MeteorRoundedGuiTheme)theme).roundAmount());
|
||||
break;
|
||||
default:
|
||||
renderer.quad(this, color);
|
||||
break;
|
||||
}
|
||||
renderer.text(tab.name, x + pad, y + pad, getNameColor(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.widgets.WVerticalSeparator;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
|
||||
public class WMeteorVerticalSeparator extends WVerticalSeparator implements MeteorWidget {
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
Color colorEdges = theme.separatorEdges.get();
|
||||
Color colorCenter = theme.separatorCenter.get();
|
||||
|
||||
double s = theme.scale(1);
|
||||
double offsetX = Math.round(width / 2.0);
|
||||
|
||||
renderer.quad(x + offsetX, y, s, height / 2, colorEdges, colorEdges, colorCenter, colorCenter);
|
||||
renderer.quad(x + offsetX, y + height / 2, s, height / 2, colorCenter, colorCenter, colorEdges, colorEdges);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WView;
|
||||
|
||||
public class WMeteorView extends WView implements MeteorWidget {
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
if (canScroll && hasScrollBar) {
|
||||
renderer.quad(handleX(), handleY(), handleWidth(), handleHeight(), theme().scrollbarColor.get(handlePressed, handleMouseOver));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets;
|
||||
|
||||
import anticope.rejects.utils.gui.GuiUtils;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.containers.WWindow;
|
||||
|
||||
public class WMeteorWindow extends WWindow implements MeteorWidget {
|
||||
public WMeteorWindow(String title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WHeader header() {
|
||||
return new WMeteorHeader();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
if (expanded || animProgress > 0) {
|
||||
GuiUtils.quadRounded(renderer,x , y + header.height / 2, width, height - header.height / 2, theme().backgroundColor.get(), ((MeteorRoundedGuiTheme)theme).roundAmount(), false);
|
||||
}
|
||||
}
|
||||
|
||||
private class WMeteorHeader extends WHeader {
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
GuiUtils.quadRounded(renderer, this, theme().accentColor.get(), ((MeteorRoundedGuiTheme)theme).roundAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets.input;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.input.WDropdown;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
|
||||
public class WMeteorDropdown<T> extends WDropdown<T> implements MeteorWidget {
|
||||
public WMeteorDropdown(T[] values, T value) {
|
||||
super(values, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WDropdownRoot createRootWidget() {
|
||||
return new WRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WDropdownValue createValueWidget() {
|
||||
return new WValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double pad = pad();
|
||||
double s = theme.textHeight();
|
||||
|
||||
renderBackground(renderer, this, pressed, mouseOver);
|
||||
|
||||
String text = get().toString();
|
||||
double w = theme.textWidth(text);
|
||||
renderer.text(text, x + pad + maxValueWidth / 2 - w / 2, y + pad, theme.textColor.get(), false);
|
||||
|
||||
renderer.rotatedQuad(x + pad + maxValueWidth + pad, y + pad, s, s, 0, GuiRenderer.TRIANGLE, theme.textColor.get());
|
||||
}
|
||||
|
||||
private static class WRoot extends WDropdownRoot implements MeteorWidget {
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double s = theme.scale(2);
|
||||
Color c = theme.outlineColor.get();
|
||||
|
||||
renderer.quad(x, y + height - s, width, s, c);
|
||||
renderer.quad(x, y, s, height - s, c);
|
||||
renderer.quad(x + width - s, y, s, height - s, c);
|
||||
}
|
||||
}
|
||||
|
||||
private class WValue extends WDropdownValue implements MeteorWidget {
|
||||
@Override
|
||||
protected void onCalculateSize() {
|
||||
double pad = pad();
|
||||
|
||||
width = pad + theme.textWidth(value.toString()) + pad;
|
||||
height = pad + theme.textHeight() + pad;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
|
||||
Color color = theme.backgroundColor.get(pressed, mouseOver, true);
|
||||
int preA = color.a;
|
||||
color.a += color.a / 2;
|
||||
color.validate();
|
||||
|
||||
renderer.quad(this, color);
|
||||
|
||||
color.a = preA;
|
||||
|
||||
String text = value.toString();
|
||||
renderer.text(text, x + width / 2 - theme.textWidth(text) / 2, y + pad(), theme.textColor.get(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets.input;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.input.WSlider;
|
||||
|
||||
public class WMeteorSlider extends WSlider implements MeteorWidget {
|
||||
public WMeteorSlider(double value, double min, double max) {
|
||||
super(value, min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
double valueWidth = valueWidth();
|
||||
|
||||
renderBar(renderer, valueWidth);
|
||||
renderHandle(renderer, valueWidth);
|
||||
}
|
||||
|
||||
private void renderBar(GuiRenderer renderer, double valueWidth) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
|
||||
double s = theme.scale(3);
|
||||
double handleSize = handleSize();
|
||||
|
||||
double x = this.x + handleSize / 2;
|
||||
double y = this.y + height / 2 - s / 2;
|
||||
|
||||
renderer.quad(x, y, valueWidth, s, theme.sliderLeft.get());
|
||||
renderer.quad(x + valueWidth, y, width - valueWidth - handleSize, s, theme.sliderRight.get());
|
||||
}
|
||||
|
||||
private void renderHandle(GuiRenderer renderer, double valueWidth) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double s = handleSize();
|
||||
|
||||
renderer.quad(x + valueWidth, y, s, s, GuiRenderer.CIRCLE, theme.sliderHandle.get(dragging, handleMouseOver));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets.input;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.utils.CharFilter;
|
||||
import meteordevelopment.meteorclient.gui.widgets.input.WTextBox;
|
||||
import meteordevelopment.meteorclient.utils.Utils;
|
||||
|
||||
public class WMeteorTextBox extends WTextBox implements MeteorWidget {
|
||||
private boolean cursorVisible;
|
||||
private double cursorTimer;
|
||||
|
||||
private double animProgress;
|
||||
|
||||
public WMeteorTextBox(String text, CharFilter filter) {
|
||||
super(text, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCursorChanged() {
|
||||
cursorVisible = true;
|
||||
cursorTimer = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
if (cursorTimer >= 1) {
|
||||
cursorVisible = !cursorVisible;
|
||||
cursorTimer = 0;
|
||||
}
|
||||
else {
|
||||
cursorTimer += delta * 1.75;
|
||||
}
|
||||
|
||||
renderBackground(renderer, this, false, false);
|
||||
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double pad = pad();
|
||||
double overflowWidth = getOverflowWidthForRender();
|
||||
|
||||
renderer.scissorStart(x + pad, y + pad, width - pad * 2, height - pad * 2);
|
||||
|
||||
// Text content
|
||||
if (!text.isEmpty()) {
|
||||
renderer.text(text, x + pad - overflowWidth, y + pad, theme.textColor.get(), false);
|
||||
}
|
||||
|
||||
// Text highlighting
|
||||
if (focused && (cursor != selectionStart || cursor != selectionEnd)) {
|
||||
double selStart = x + pad + getTextWidth(selectionStart) - overflowWidth;
|
||||
double selEnd = x + pad + getTextWidth(selectionEnd) - overflowWidth;
|
||||
|
||||
renderer.quad(selStart, y + pad, selEnd - selStart, theme.textHeight(), theme.textHighlightColor.get());
|
||||
}
|
||||
|
||||
// Cursor
|
||||
animProgress += delta * 10 * (focused && cursorVisible ? 1 : -1);
|
||||
animProgress = Utils.clamp(animProgress, 0, 1);
|
||||
|
||||
if ((focused && cursorVisible) || animProgress > 0) {
|
||||
renderer.setAlpha(animProgress);
|
||||
renderer.quad(x + pad + getTextWidth(cursor) - overflowWidth, y + pad, theme.scale(1), theme.textHeight(), theme.textColor.get());
|
||||
renderer.setAlpha(1);
|
||||
}
|
||||
|
||||
renderer.scissorEnd();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets.pressable;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import meteordevelopment.meteorclient.gui.renderer.packer.GuiTexture;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WButton;
|
||||
|
||||
public class WMeteorButton extends WButton implements MeteorWidget {
|
||||
public WMeteorButton(String text, GuiTexture texture) {
|
||||
super(text, texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double pad = pad();
|
||||
|
||||
renderBackground(renderer, this, pressed, mouseOver);
|
||||
|
||||
if (text != null) {
|
||||
renderer.text(text, x + width / 2 - textWidth / 2, y + pad, theme.textColor.get(), false);
|
||||
}
|
||||
else {
|
||||
double ts = theme.textHeight();
|
||||
renderer.quad(x + width / 2 - ts / 2, y + pad, ts, ts, texture, theme.textColor.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets.pressable;
|
||||
|
||||
import anticope.rejects.utils.gui.GuiUtils;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WCheckbox;
|
||||
import meteordevelopment.meteorclient.utils.Utils;
|
||||
|
||||
public class WMeteorCheckbox extends WCheckbox implements MeteorWidget {
|
||||
private double animProgress;
|
||||
|
||||
public WMeteorCheckbox(boolean checked) {
|
||||
super(checked);
|
||||
animProgress = checked ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
|
||||
animProgress += (checked ? 1 : -1) * delta * 14;
|
||||
animProgress = Utils.clamp(animProgress, 0, 1);
|
||||
|
||||
renderBackground(renderer, this, pressed, mouseOver);
|
||||
|
||||
if (animProgress > 0) {
|
||||
double cs = (width - theme.scale(2)) / 1.75 * animProgress;
|
||||
GuiUtils.quadRounded(renderer, x + (width - cs) / 2, y + (height - cs) / 2, cs, cs, theme.checkboxColor.get(), ((MeteorRoundedGuiTheme)theme).roundAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets.pressable;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WMinus;
|
||||
|
||||
public class WMeteorMinus extends WMinus implements MeteorWidget {
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
double pad = pad();
|
||||
double s = theme.scale(3);
|
||||
|
||||
renderBackground(renderer, this, pressed, mouseOver);
|
||||
renderer.quad(x + pad, y + height / 2 - s / 2, width - pad * 2, s, theme().minusColor.get());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets.pressable;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WPlus;
|
||||
|
||||
public class WMeteorPlus extends WPlus implements MeteorWidget {
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
MeteorRoundedGuiTheme theme = theme();
|
||||
double pad = pad();
|
||||
double s = theme.scale(3);
|
||||
|
||||
renderBackground(renderer, this, pressed, mouseOver);
|
||||
renderer.quad(x + pad, y + height / 2 - s / 2, width - pad * 2, s, theme.plusColor.get());
|
||||
renderer.quad(x + width / 2 - s / 2, y + pad, s, height - pad * 2, theme.plusColor.get());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.gui.themes.rounded.widgets.pressable;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WTriangle;
|
||||
|
||||
public class WMeteorTriangle extends WTriangle implements MeteorWidget {
|
||||
@Override
|
||||
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
|
||||
renderer.rotatedQuad(x, y, width, height, rotation, GuiRenderer.TRIANGLE, theme().backgroundColor.get(pressed, mouseOver));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package anticope.rejects.mixin;
|
||||
|
||||
import anticope.rejects.modules.modifier.NoRenderModifier;
|
||||
import net.minecraft.client.gui.screen.CommandSuggestor;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
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(CommandSuggestor.class)
|
||||
public class CommandSuggestorMixin {
|
||||
@Inject(method = "render", at = @At(value = "HEAD"), cancellable = true)
|
||||
public void onRenderCommandSuggestion(MatrixStack matrices, int mouseX, int mouseY, CallbackInfo info) {
|
||||
if (NoRenderModifier.noCommandSuggestions()) info.cancel();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package anticope.rejects.mixin;
|
||||
|
||||
import anticope.rejects.events.CustomPayloadEvent;
|
||||
import meteordevelopment.meteorclient.MeteorClient;
|
||||
import net.minecraft.network.listener.ClientPlayPacketListener;
|
||||
import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(CustomPayloadS2CPacket.class)
|
||||
public class CustomPayloadS2CPacketMixin {
|
||||
@Shadow
|
||||
private Identifier channel;
|
||||
|
||||
@Inject(method = "apply(Lnet/minecraft/network/listener/ClientPlayPacketListener;)V",
|
||||
at = @At(value = "HEAD"), cancellable = true)
|
||||
private void onApply(ClientPlayPacketListener clientPlayPacketListener, CallbackInfo info) {
|
||||
CustomPayloadS2CPacket packet = (CustomPayloadS2CPacket) (Object) this;
|
||||
CustomPayloadEvent event = MeteorClient.EVENT_BUS.post(CustomPayloadEvent.get(packet));
|
||||
if (event.isCancelled()) {
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package anticope.rejects.mixin;
|
||||
|
||||
import anticope.rejects.modules.Rendering;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import net.minecraft.client.render.entity.feature.Deadmau5FeatureRenderer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(Deadmau5FeatureRenderer.class)
|
||||
public class Deadmau5FeatureRendererMixin {
|
||||
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Ljava/lang/String;equals(Ljava/lang/Object;)Z"))
|
||||
private boolean redirectAllow(String s, Object name){
|
||||
if (Modules.get().get(Rendering.class).deadmau5EarsEnabled()) {
|
||||
return true; //Allow it always
|
||||
}
|
||||
return name.equals(s);
|
||||
}
|
||||
}
|
||||
12
src/main/java/anticope/rejects/mixin/EntityAccessor.java
Normal file
12
src/main/java/anticope/rejects/mixin/EntityAccessor.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package anticope.rejects.mixin;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
|
||||
@Mixin(Entity.class)
|
||||
public interface EntityAccessor {
|
||||
@Invoker("setFlag")
|
||||
void invokeSetFlag(int index, boolean value);
|
||||
}
|
||||
30
src/main/java/anticope/rejects/mixin/GameRendererMixin.java
Normal file
30
src/main/java/anticope/rejects/mixin/GameRendererMixin.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package anticope.rejects.mixin;
|
||||
|
||||
import anticope.rejects.modules.Rendering;
|
||||
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 meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
|
||||
@Mixin(GameRenderer.class)
|
||||
public class GameRendererMixin {
|
||||
@Shadow @Final private MinecraftClient client;
|
||||
|
||||
@Redirect(method = "render", at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/GameRenderer;shader:Lnet/minecraft/client/gl/ShaderEffect;", ordinal = 0))
|
||||
private ShaderEffect renderShader(GameRenderer renderer, float tickDelta) {
|
||||
ShaderEffect shader = Modules.get().get(Rendering.class).getShaderEffect();
|
||||
|
||||
if (shader != null) {
|
||||
shader.setupDimensions(client.getWindow().getFramebufferWidth(), client.getWindow().getFramebufferHeight());
|
||||
shader.render(tickDelta);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package anticope.rejects.mixin;
|
||||
|
||||
import anticope.rejects.modules.Rendering;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
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 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;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Mixin(LivingEntityRenderer.class)
|
||||
public class LivingEntityRendererMixin {
|
||||
|
||||
@Inject(method = "setupTransforms", at = @At(value = "TAIL"))
|
||||
private void dinnerboneEntities(LivingEntity entity, MatrixStack matrices, float _animationProgress, float _bodyYaw, float _tickDelta, CallbackInfo _info) {
|
||||
if ((!(entity instanceof PlayerEntity)) && Modules.get().get(Rendering.class).dinnerboneEnabled()) {
|
||||
matrices.translate(0.0D, entity.getHeight() + 0.1F, 0.0D);
|
||||
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(180.0F));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package anticope.rejects.mixin;
|
||||
|
||||
import anticope.rejects.utils.RejectsUtils;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Injects the CPS counter.
|
||||
*/
|
||||
@Mixin(MinecraftClient.class)
|
||||
public class MinecraftClientMixin
|
||||
{
|
||||
@Inject(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;doAttack()V"))
|
||||
private void onAttack(CallbackInfo ci)
|
||||
{
|
||||
RejectsUtils.CPS++;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package anticope.rejects.mixin;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.StructureVoidBlock;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import anticope.rejects.modules.Rendering;
|
||||
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(StructureVoidBlock.class)
|
||||
public abstract class StructureVoidBlockMixin extends Block {
|
||||
|
||||
public StructureVoidBlockMixin(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "getRenderType", cancellable = true)
|
||||
public void getRenderType(BlockState state, CallbackInfoReturnable<BlockRenderType> info) {
|
||||
info.setReturnValue(BlockRenderType.MODEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideInvisible(BlockState state, BlockState neighbor, Direction facing) {
|
||||
return !(Modules.get().get(Rendering.class).renderStructureVoid());
|
||||
}
|
||||
|
||||
}
|
||||
20
src/main/java/anticope/rejects/mixin/ToastManagerMixin.java
Normal file
20
src/main/java/anticope/rejects/mixin/ToastManagerMixin.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package anticope.rejects.mixin;
|
||||
|
||||
import anticope.rejects.modules.Rendering;
|
||||
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;
|
||||
|
||||
import net.minecraft.client.toast.Toast;
|
||||
import net.minecraft.client.toast.ToastManager;
|
||||
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
|
||||
@Mixin(ToastManager.class)
|
||||
public class ToastManagerMixin {
|
||||
@Inject(method="add", at = @At("HEAD"), cancellable = true)
|
||||
public void preventAdd(Toast toast, CallbackInfo ci) {
|
||||
if (Modules.get().get(Rendering.class).disableToasts()) ci.cancel();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
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
|
||||
@Final
|
||||
private List<Command> commands;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private Map<Class<? extends Command>, Command> commandInstances;
|
||||
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private CommandDispatcher<CommandSource> DISPATCHER = new CommandDispatcher<>();
|
||||
|
||||
@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,46 @@
|
||||
package anticope.rejects.mixin.meteor;
|
||||
|
||||
import anticope.rejects.utils.RejectsConfig;
|
||||
import meteordevelopment.meteorclient.gui.tabs.builtin.ConfigTab;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.spongepowered.asm.mixin.*;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(ConfigTab.class)
|
||||
public class ConfigTabMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
private static Settings settings;
|
||||
|
||||
private static final SettingGroup sgRejects = settings.createGroup("Rejects");
|
||||
|
||||
private static final Setting<RejectsConfig.HttpAllowed> httpAllowed = sgRejects.add(new EnumSetting.Builder<RejectsConfig.HttpAllowed>()
|
||||
.name("http-allowed")
|
||||
.description("Changes what api endpoints can be reached.")
|
||||
.defaultValue(RejectsConfig.get().httpAllowed)
|
||||
.onChanged(v -> RejectsConfig.get().httpAllowed = v)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<List<Module>> hiddenModules = sgRejects.add(new ModuleListSetting.Builder()
|
||||
.name("hidden-modules")
|
||||
.description("Which modules to hide.")
|
||||
.defaultValue(Arrays.asList())
|
||||
.defaultValue(RejectsConfig.get().getHiddenModules())
|
||||
.onChanged(v -> RejectsConfig.get().setHiddenModules(v))
|
||||
.build()
|
||||
);
|
||||
|
||||
// No idea why CallbackInfoReturnable, but fabric crashes otherwise lol
|
||||
@Inject(method = "createScreen", at=@At("HEAD"), remap = false)
|
||||
private void onCreateScreen(CallbackInfoReturnable<?> cir) {
|
||||
hiddenModules.set(RejectsConfig.get().getHiddenModules());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package anticope.rejects.mixin.meteor;
|
||||
|
||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||
import meteordevelopment.meteorclient.renderer.Renderer2D;
|
||||
import org.spongepowered.asm.mixin.*;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(GuiRenderer.class)
|
||||
public interface GuiRendererAccessor {
|
||||
@Accessor("r")
|
||||
Renderer2D getRenderer2D();
|
||||
}
|
||||
27
src/main/java/anticope/rejects/mixin/meteor/HttpMixin.java
Normal file
27
src/main/java/anticope/rejects/mixin/meteor/HttpMixin.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package anticope.rejects.mixin.meteor;
|
||||
|
||||
import anticope.rejects.utils.RejectsConfig;
|
||||
import meteordevelopment.meteorclient.utils.network.Http;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.*;
|
||||
|
||||
|
||||
@Mixin(Http.class)
|
||||
public class HttpMixin {
|
||||
|
||||
@ModifyArg(method="get", at= @At(value = "INVOKE", target = "Lmeteordevelopment/meteorclient/utils/network/Http$Request;<init>(Lmeteordevelopment/meteorclient/utils/network/Http$Method;Ljava/lang/String;)V"), remap = false)
|
||||
private static String onGet(String url) {
|
||||
if (RejectsConfig.get().httpAllowed == RejectsConfig.HttpAllowed.Nothing) return "http://0.0.0.0";
|
||||
else if (RejectsConfig.get().httpAllowed == RejectsConfig.HttpAllowed.NotMeteorApi && url.startsWith("https://meteorclient.com/api")) return "http://0.0.0.0";
|
||||
else if (RejectsConfig.get().httpAllowed == RejectsConfig.HttpAllowed.NotMeteorPing && url.startsWith("https://meteorclient.com/api/online")) return "http://0.0.0.0";
|
||||
return url;
|
||||
}
|
||||
|
||||
@ModifyArg(method="post", at= @At(value = "INVOKE", target = "Lmeteordevelopment/meteorclient/utils/network/Http$Request;<init>(Lmeteordevelopment/meteorclient/utils/network/Http$Method;Ljava/lang/String;)V"), remap = false)
|
||||
private static String onPost(String url) {
|
||||
if (RejectsConfig.get().httpAllowed == RejectsConfig.HttpAllowed.Nothing) return "http://0.0.0.0";
|
||||
else if (RejectsConfig.get().httpAllowed == RejectsConfig.HttpAllowed.NotMeteorApi && url.startsWith("https://meteorclient.com/api")) return "http://0.0.0.0";
|
||||
else if (RejectsConfig.get().httpAllowed == RejectsConfig.HttpAllowed.NotMeteorPing && url.startsWith("https://meteorclient.com/api/online")) return "http://0.0.0.0";
|
||||
return url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package anticope.rejects.mixin.meteor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import anticope.rejects.utils.RejectsConfig;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import meteordevelopment.meteorclient.systems.modules.Category;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
|
||||
@Mixin(Modules.class)
|
||||
public class ModulesMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
private Map<Category, List<Module>> groups;
|
||||
|
||||
@Inject(method = "getGroup", at=@At("HEAD"), cancellable = true, remap = false)
|
||||
private void onGetGroup(Category category, CallbackInfoReturnable<List<Module>> cir) {
|
||||
Set<String> hiddenModules = RejectsConfig.get().hiddenModules;
|
||||
if (hiddenModules.isEmpty()) return;
|
||||
|
||||
List<Module> foundModules = groups.computeIfAbsent(category, category1 -> new ArrayList<>());
|
||||
foundModules.removeIf(m -> hiddenModules.contains(m.name));
|
||||
|
||||
cir.setReturnValue(foundModules);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package anticope.rejects.mixin.meteor.modules;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.movement.Flight;
|
||||
|
||||
import static meteordevelopment.meteorclient.utils.Utils.mc;
|
||||
|
||||
@Mixin(Flight.class)
|
||||
public class FlightMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
private SettingGroup sgGeneral;
|
||||
|
||||
private Setting<Boolean> stopMomentum = null;
|
||||
|
||||
@Inject(method = "<init>", at=@At("TAIL"), remap = false)
|
||||
private void onInit(CallbackInfo ci) {
|
||||
stopMomentum = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("stop-momentum")
|
||||
.description("Stops momentum on flight disable")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
@Inject(method = "onDeactivate", at=@At("TAIL"), remap = false)
|
||||
private void onDeactivate(CallbackInfo ci) {
|
||||
if (mc.player == null || stopMomentum == null || !stopMomentum.get()) return;
|
||||
|
||||
mc.options.keyForward.setPressed(false);
|
||||
mc.options.keyLeft.setPressed(false);
|
||||
mc.options.keyBack.setPressed(false);
|
||||
mc.options.keyRight.setPressed(false);
|
||||
|
||||
mc.player.setVelocity(Vec3d.ZERO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package anticope.rejects.mixin.meteor.modules;
|
||||
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.NoRender;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(NoRender.class)
|
||||
public interface NoRenderAccessor {
|
||||
@Accessor("sgOverlay")
|
||||
SettingGroup getSgOverlay();
|
||||
}
|
||||
95
src/main/java/anticope/rejects/modules/AntiBot.java
Normal file
95
src/main/java/anticope/rejects/modules/AntiBot.java
Normal file
@@ -0,0 +1,95 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.entity.EntityUtils;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
|
||||
public class AntiBot extends Module {
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
private final SettingGroup sgFilters = settings.createGroup("Filters");
|
||||
|
||||
private final Setting<Boolean> removeInvisible = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("remove-invisible")
|
||||
.description("Removes bot only if they are invisible.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> gameMode = sgFilters.add(new BoolSetting.Builder()
|
||||
.name("null-gamemode")
|
||||
.description("Removes players without a gamemode")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> api = sgFilters.add(new BoolSetting.Builder()
|
||||
.name("null-entry")
|
||||
.description("Removes players without a player entry")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> profile = sgFilters.add(new BoolSetting.Builder()
|
||||
.name("null-profile")
|
||||
.description("Removes players without a game profile")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> latency = sgFilters.add(new BoolSetting.Builder()
|
||||
.name("ping-check")
|
||||
.description("Removes players using ping check")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> nullException = sgFilters.add(new BoolSetting.Builder()
|
||||
.name("null-exception")
|
||||
.description("Removes players if a NullPointerException occurred")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
public AntiBot() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "anti-bot", "Detects and removes bots.");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTick(TickEvent.Post tickEvent) {
|
||||
for (Entity entity : mc.world.getEntities())
|
||||
{
|
||||
if (removeInvisible.get() && !entity.isInvisible()) continue;
|
||||
|
||||
if (isBot(entity)) entity.remove(Entity.RemovalReason.DISCARDED);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isBot(Entity entity) {
|
||||
if (entity == null) return false;
|
||||
if (!(entity instanceof PlayerEntity)) return false;
|
||||
|
||||
PlayerEntity player = (PlayerEntity)entity;
|
||||
try {
|
||||
if (gameMode.get() && EntityUtils.getGameMode(player) == null) return true;
|
||||
if (api.get() &&
|
||||
mc.getNetworkHandler().getPlayerListEntry(player.getUuid()) == null) return true;
|
||||
if (profile.get() &&
|
||||
mc.getNetworkHandler().getPlayerListEntry(player.getUuid()).getProfile() == null) return true;
|
||||
if (latency.get() &&
|
||||
mc.getNetworkHandler().getPlayerListEntry(player.getUuid()).getLatency() > 1) return true;
|
||||
} catch (NullPointerException e) {
|
||||
if (nullException.get()) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
57
src/main/java/anticope/rejects/modules/AntiSpawnpoint.java
Normal file
57
src/main/java/anticope/rejects/modules/AntiSpawnpoint.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.packets.PacketEvent;
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import net.minecraft.block.BedBlock;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public class AntiSpawnpoint extends Module {
|
||||
|
||||
private SettingGroup sgDefault = settings.getDefaultGroup();
|
||||
|
||||
private Setting<Boolean> fakeUse = sgDefault.add(new BoolSetting.Builder()
|
||||
.name("fake-use")
|
||||
.description("Fake using the bed or anchor.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
public AntiSpawnpoint() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "anti-spawnpoint", "Protects the player from losing the respawn point.");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onSendPacket(PacketEvent.Send event) {
|
||||
if (mc.world == null) return;
|
||||
if(!(event.packet instanceof PlayerInteractBlockC2SPacket)) return;
|
||||
|
||||
|
||||
BlockPos blockPos = ((PlayerInteractBlockC2SPacket) event.packet).getBlockHitResult().getBlockPos();
|
||||
boolean IsOverWorld = mc.world.getDimension().isBedWorking();
|
||||
boolean IsNetherWorld = mc.world.getDimension().isRespawnAnchorWorking();
|
||||
boolean BlockIsBed = mc.world.getBlockState(blockPos).getBlock() instanceof BedBlock;
|
||||
boolean BlockIsAnchor = mc.world.getBlockState(blockPos).getBlock().equals(Blocks.RESPAWN_ANCHOR);
|
||||
|
||||
if (fakeUse.get()) {
|
||||
if (BlockIsBed && IsOverWorld) {
|
||||
mc.player.swingHand(Hand.MAIN_HAND);
|
||||
mc.player.updatePosition(blockPos.getX(),blockPos.up().getY(),blockPos.getZ());
|
||||
}
|
||||
else if (BlockIsAnchor && IsNetherWorld) {
|
||||
mc.player.swingHand(Hand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
|
||||
if((BlockIsBed && IsOverWorld)||(BlockIsAnchor && IsNetherWorld)) {
|
||||
event.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
137
src/main/java/anticope/rejects/modules/AntiVanish.java
Normal file
137
src/main/java/anticope/rejects/modules/AntiVanish.java
Normal file
@@ -0,0 +1,137 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.game.GameLeftEvent;
|
||||
import meteordevelopment.meteorclient.events.packets.PacketEvent;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.packet.s2c.play.PlayerListS2CPacket;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Queue;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
public class AntiVanish extends Module {
|
||||
|
||||
private final Queue<UUID> toLookup = new ConcurrentLinkedQueue<UUID>();
|
||||
private long lastTick = 0;
|
||||
|
||||
public AntiVanish() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "anti-vanish", "Notifies user when a admin uses /vanish");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivate() {
|
||||
toLookup.clear();
|
||||
}
|
||||
@EventHandler
|
||||
public void onLeave(GameLeftEvent event) {
|
||||
toLookup.clear();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPacket(PacketEvent.Receive event) {
|
||||
if (event.packet instanceof PlayerListS2CPacket) {
|
||||
PlayerListS2CPacket packet = (PlayerListS2CPacket) event.packet;
|
||||
if (packet.getAction() == PlayerListS2CPacket.Action.UPDATE_LATENCY) {
|
||||
try {
|
||||
for (PlayerListS2CPacket.Entry entry : packet.getEntries()) {
|
||||
if (mc.getNetworkHandler().getPlayerListEntry(entry.getProfile().getId()) != null)
|
||||
continue;
|
||||
toLookup.add(entry.getProfile().getId());
|
||||
}
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTick(TickEvent.Post event) {
|
||||
long time = mc.world.getTime();
|
||||
UUID lookup;
|
||||
|
||||
if (Math.abs(lastTick - time) > 100 && (lookup = toLookup.poll()) != null) {
|
||||
try {
|
||||
String name = getPlayerNameFromUUID(lookup);
|
||||
if (name != null) {
|
||||
warning(name + " has gone into vanish.");
|
||||
}
|
||||
} catch (Exception ignore) {}
|
||||
lastTick = time;
|
||||
}
|
||||
}
|
||||
|
||||
public String getPlayerNameFromUUID(UUID id) {
|
||||
try {
|
||||
final NameLookup process = new NameLookup(id, mc);
|
||||
final Thread thread = new Thread(process);
|
||||
thread.start();
|
||||
thread.join();
|
||||
return process.getName();
|
||||
} catch (Exception ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class NameLookup implements Runnable {
|
||||
private final String uuidstr;
|
||||
private final UUID uuid;
|
||||
private final MinecraftClient mc;
|
||||
private volatile String name;
|
||||
|
||||
public NameLookup(final String input, MinecraftClient mc) {
|
||||
this.uuidstr = input;
|
||||
this.uuid = UUID.fromString(input);
|
||||
this.mc = mc;
|
||||
}
|
||||
|
||||
public NameLookup(final UUID input, MinecraftClient mc) {
|
||||
this.uuid = input;
|
||||
this.uuidstr = input.toString();
|
||||
this.mc = mc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
this.name = this.lookUpName();
|
||||
}
|
||||
|
||||
public String lookUpName() {
|
||||
PlayerEntity player = null;
|
||||
if (mc.world != null) {
|
||||
player = mc.world.getPlayerByUuid(uuid);
|
||||
}
|
||||
if (player == null) {
|
||||
final String url = "https://api.mojang.com/user/profiles/" + this.uuidstr.replace("-", "") + "/names";
|
||||
try {
|
||||
final JsonParser parser = new JsonParser();
|
||||
final String nameJson = IOUtils.toString(new URL(url), StandardCharsets.UTF_8);
|
||||
final JsonElement nameElement = parser.parse(nameJson);
|
||||
final JsonArray nameArray = nameElement.getAsJsonArray();
|
||||
final String playerSlot = nameArray.get(nameArray.size() - 1).toString();
|
||||
final JsonObject nameObject = parser.parse(playerSlot).getAsJsonObject();
|
||||
return nameObject.get("name").toString();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return player.getName().asString();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
314
src/main/java/anticope/rejects/modules/Auto32K.java
Normal file
314
src/main/java/anticope/rejects/modules/Auto32K.java
Normal file
@@ -0,0 +1,314 @@
|
||||
/*
|
||||
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client/).
|
||||
* Copyright (c) 2021 Meteor Development.
|
||||
*/
|
||||
|
||||
package anticope.rejects.modules;
|
||||
|
||||
//Created by squidoodly 13/07/2020
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.player.*;
|
||||
import meteordevelopment.meteorclient.utils.world.BlockUtils;
|
||||
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.client.gui.screen.ingame.Generic3x3ContainerScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.HopperScreen;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class Auto32K extends Module {
|
||||
public enum Mode{
|
||||
Hopper,
|
||||
Dispenser
|
||||
}
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Mode> mode = sgGeneral.add(new EnumSetting.Builder<Mode>()
|
||||
.name("mode")
|
||||
.description("The bypass mode used.")
|
||||
.defaultValue(Mode.Dispenser)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Double> placeRange = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("place-range")
|
||||
.description("The distance in a single direction the shulker is placed.")
|
||||
.defaultValue(3)
|
||||
.min(0)
|
||||
.sliderMax(5)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> fillHopper = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("fill-hopper")
|
||||
.description("Fills all slots of the hopper except one for the 32k.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<List<Block>> throwawayItems = sgGeneral.add(new BlockListSetting.Builder()
|
||||
.name("throwaway-blocks")
|
||||
.description("Whitelisted blocks to use to fill the hopper.")
|
||||
.defaultValue(setDefaultBlocks())
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> autoMove = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("auto-move")
|
||||
.description("Moves the 32K into your inventory automatically.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private int x;
|
||||
private int z;
|
||||
private int phase = 0;
|
||||
private BlockPos bestBlock;
|
||||
|
||||
public Auto32K(){
|
||||
super(MeteorRejectsAddon.CATEGORY, "auto-32k", "Automatically attacks other players with a 32k weapon.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivate() {
|
||||
phase = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
bestBlock = findValidBlocksDispenser();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Post event) {
|
||||
if (phase <= 7) {
|
||||
if (mode.get() == Mode.Hopper) {
|
||||
FindItemResult findShulker = InvUtils.findInHotbar(this::isShulkerBox);
|
||||
FindItemResult findHopper = InvUtils.findInHotbar(Items.HOPPER);
|
||||
if (isValidSlot(findShulker) || isValidSlot(findHopper)) return;
|
||||
List<BlockPos> sortedBlocks = findValidBlocksHopper();
|
||||
sortedBlocks.sort(Comparator.comparingDouble(value -> mc.player.squaredDistanceTo(value.getX(), value.getY(), value.getZ())));
|
||||
Iterator<BlockPos> sortedIterator = sortedBlocks.iterator();
|
||||
BlockPos bestBlock = null;
|
||||
if(sortedIterator.hasNext()) bestBlock = sortedIterator.next();
|
||||
|
||||
if (bestBlock != null) {
|
||||
while (!BlockUtils.place(bestBlock, findHopper,true,100,false)) {
|
||||
if(sortedIterator.hasNext()) {
|
||||
bestBlock = sortedIterator.next().up();
|
||||
}else break;
|
||||
}
|
||||
mc.player.setSneaking(true);
|
||||
if (!BlockUtils.place(bestBlock.up(), findShulker,true,100,false)) {
|
||||
error("Failed to place.");
|
||||
this.toggle();
|
||||
return;
|
||||
}
|
||||
mc.player.setSneaking(false);
|
||||
mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(mc.player.getPos(), mc.player.getHorizontalFacing(), bestBlock.up(), false));
|
||||
phase = 8;
|
||||
}
|
||||
} else if (mode.get() == Mode.Dispenser) {
|
||||
FindItemResult shulkerSlot = InvUtils.find(this::isShulkerBox);
|
||||
FindItemResult hopperSlot = InvUtils.find(Items.HOPPER);
|
||||
FindItemResult dispenserSlot = InvUtils.find(Items.DISPENSER);
|
||||
FindItemResult redstoneSlot = InvUtils.find(Items.REDSTONE_BLOCK);
|
||||
if ((isValidSlot(shulkerSlot) && mode.get() == Mode.Hopper) || isValidSlot(hopperSlot) || isValidSlot(dispenserSlot) || isValidSlot(redstoneSlot))
|
||||
return;
|
||||
if (phase == 0) {
|
||||
bestBlock = findValidBlocksDispenser();
|
||||
if(bestBlock == null) return;
|
||||
if (!BlockUtils.place(bestBlock.add(x, 0, z), hopperSlot, true, 100, false)) {
|
||||
error("Failed to place.");
|
||||
this.toggle();
|
||||
return;
|
||||
}
|
||||
phase += 1;
|
||||
} else if (phase == 1) {
|
||||
mc.player.getInventory().selectedSlot = dispenserSlot.getSlot();
|
||||
if (x == -1) {
|
||||
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(-90f, mc.player.getPitch(), mc.player.isOnGround()));
|
||||
} else if (x == 1) {
|
||||
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(90f, mc.player.getPitch(), mc.player.isOnGround()));
|
||||
} else if (z == -1) {
|
||||
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(1f, mc.player.getPitch(), mc.player.isOnGround()));
|
||||
} else if (z == 1) {
|
||||
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(179f, mc.player.getPitch(), mc.player.isOnGround()));
|
||||
}
|
||||
phase += 1;
|
||||
} else if (phase == 2) {
|
||||
mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(mc.player.getPos(), Direction.UP, bestBlock, false));
|
||||
phase += 1;
|
||||
} else if (phase == 3) {
|
||||
mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(mc.player.getPos(), mc.player.getHorizontalFacing().getOpposite(), bestBlock.up(), false));
|
||||
phase += 1;
|
||||
}else if (phase == 4 && mc.currentScreen instanceof Generic3x3ContainerScreen) {
|
||||
mc.player.getSpeed();
|
||||
InvUtils.move().from(shulkerSlot.getSlot()).toId(4);
|
||||
phase += 1;
|
||||
}else if (phase == 5 && mc.currentScreen instanceof Generic3x3ContainerScreen) {
|
||||
mc.player.closeHandledScreen();
|
||||
phase += 1;
|
||||
}else if (phase == 6) {
|
||||
mc.player.getInventory().selectedSlot = redstoneSlot.getSlot();
|
||||
mc.player.setSneaking(true);
|
||||
mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(mc.player.getPos(), mc.player.getHorizontalFacing().getOpposite(), bestBlock.up(2), false));
|
||||
mc.player.setSneaking(false);
|
||||
phase += 1;
|
||||
}else if (phase == 7){
|
||||
mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(mc.player.getPos(), mc.player.getHorizontalFacing().getOpposite(), bestBlock.add(x, 0, z), false));
|
||||
phase += 1;
|
||||
}
|
||||
}
|
||||
}else if(phase == 8) {
|
||||
if (mc.currentScreen instanceof HopperScreen) {
|
||||
if (fillHopper.get() && !throwawayItems.get().isEmpty()) {
|
||||
int slot = -1;
|
||||
int count = 0;
|
||||
Iterator<Block> blocks = throwawayItems.get().iterator();
|
||||
for (Item item = blocks.next().asItem(); blocks.hasNext(); item = blocks.next().asItem()) {
|
||||
for (int i = 5; i <= 40; i++) {
|
||||
ItemStack stack = mc.player.getInventory().getStack(i);
|
||||
if (stack.getItem() == item && stack.getCount() >= 4) {
|
||||
slot = i;
|
||||
count = stack.getCount();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (count >= 4) break;
|
||||
}
|
||||
for (int i = 1; i < 5; i++) {
|
||||
if (mc.player.currentScreenHandler.getSlot(i).getStack().getItem() instanceof AirBlockItem) {
|
||||
InvUtils.move().from(slot - 4).toId(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean manage = true;
|
||||
int slot = -1;
|
||||
int dropSlot = -1;
|
||||
for (int i = 32; i < 41; i++) {
|
||||
if (EnchantmentHelper.getLevel(Enchantments.SHARPNESS, mc.player.currentScreenHandler.getSlot(i).getStack()) > 5) {
|
||||
manage = false;
|
||||
slot = i;
|
||||
break;
|
||||
}else if (mc.player.currentScreenHandler.getSlot(i).getStack().getItem() instanceof SwordItem
|
||||
&& EnchantmentHelper.getLevel(Enchantments.SHARPNESS, mc.player.currentScreenHandler.getSlot(i).getStack()) <= 5) {
|
||||
dropSlot = i;
|
||||
}
|
||||
}
|
||||
if (dropSlot != -1) InvUtils.drop().slot(dropSlot);
|
||||
if(autoMove.get() && manage){
|
||||
int slot2 = mc.player.getInventory().getEmptySlot();
|
||||
if (slot2 < 9 && slot2 != -1 && EnchantmentHelper.getLevel(Enchantments.SHARPNESS, mc.player.currentScreenHandler.getSlot(0).getStack()) > 5) {
|
||||
InvUtils.move().fromId(0).to(slot2 - 4);
|
||||
} else if (EnchantmentHelper.getLevel(Enchantments.SHARPNESS, mc.player.currentScreenHandler.getSlot(0).getStack()) <= 5 && mc.player.currentScreenHandler.getSlot(0).getStack().getItem() != Items.AIR) {
|
||||
InvUtils.drop().slotId(0);
|
||||
}
|
||||
}
|
||||
if(slot != -1) {
|
||||
mc.player.getInventory().selectedSlot = slot - 32;
|
||||
}
|
||||
}else this.toggle();
|
||||
}
|
||||
}
|
||||
|
||||
private List<BlockPos> findValidBlocksHopper(){
|
||||
Iterator<BlockPos> allBlocks = getRange(mc.player.getBlockPos(), placeRange.get()).iterator();
|
||||
List<BlockPos> validBlocks = new ArrayList<>();
|
||||
for(BlockPos i = null; allBlocks.hasNext(); i = allBlocks.next()){
|
||||
if(i == null) continue;
|
||||
if(!mc.world.getBlockState(i).getMaterial().isReplaceable()
|
||||
&& (mc.world.getBlockState(i.up()).getBlock() == Blocks.AIR && mc.world.getOtherEntities(null, new Box(i.up().getX(), i.up().getY(), i.up().getZ(), i.up().getX() + 1.0D, i.up().getY() + 2.0D, i.up().getZ() + 1.0D)).isEmpty())
|
||||
&& mc.world.getBlockState(i.up(2)).getBlock() == Blocks.AIR && mc.world.getOtherEntities(null, new Box(i.up(2).getX(), i.up(2).getY(), i.up(2).getZ(), i.up(2).getX() + 1.0D, i.up(2).getY() + 2.0D, i.up(2).getZ() + 1.0D)).isEmpty()){
|
||||
validBlocks.add(i);
|
||||
}
|
||||
}
|
||||
return validBlocks;
|
||||
}
|
||||
|
||||
private BlockPos findValidBlocksDispenser(){
|
||||
List<BlockPos> allBlocksNotSorted = getRange(mc.player.getBlockPos(), placeRange.get());
|
||||
allBlocksNotSorted.sort(Comparator.comparingDouble(value -> mc.player.squaredDistanceTo(value.getX(), value.getY(), value.getZ())));
|
||||
Iterator<BlockPos> allBlocks = allBlocksNotSorted.iterator();
|
||||
for(BlockPos i = null; allBlocks.hasNext(); i = allBlocks.next()){
|
||||
if(i == null) continue;
|
||||
if(!mc.world.getBlockState(i).getMaterial().isReplaceable()
|
||||
&& (mc.world.getBlockState(i.up()).getBlock() == Blocks.AIR && mc.world.getOtherEntities(null, new Box(i.up().getX(), i.up().getY(), i.up().getZ(), i.up().getX() + 1.0D, i.up().getY() + 2.0D, i.up().getZ() + 1.0D)).isEmpty())
|
||||
&& (mc.world.getBlockState(i.up(2)).getBlock() == Blocks.AIR && mc.world.getOtherEntities(null, new Box(i.up(2).getX(), i.up(2).getY(), i.up(2).getZ(), i.up(2).getX() + 1.0D, i.up(2).getY() + 2.0D, i.up(2).getZ() + 1.0D)).isEmpty())
|
||||
&& (mc.world.getBlockState(i.up(3)).getBlock() == Blocks.AIR && mc.world.getOtherEntities(null, new Box(i.up(3).getX(), i.up(3).getY(), i.up(3).getZ(), i.up(2).getX() + 1.0D, i.up(2).getY() + 2.0D, i.up(2).getZ() + 1.0D)).isEmpty())){
|
||||
if (mc.world.getBlockState(i.add(-1, 1, 0)).getBlock() == Blocks.AIR && mc.world.getOtherEntities(null, new Box(i.add(-1, 1, 0).getX(), i.add(-1, 1, 0).getY(), i.add(-1, 1, 0).getZ(), i.add(-1, 1, 0).getX() + 1.0D, i.add(-1, 1, 0).getY() + 2.0D, i.add(-1, 1, 0).getZ() + 1.0D)).isEmpty()
|
||||
&& mc.world.getBlockState(i.add(-1, 0, 0)).getBlock() == Blocks.AIR && mc.world.getOtherEntities(null, new Box(i.add(-1, 0, 0).getX(), i.add(-1, 0, 0).getY(), i.add(-1, 0, 0).getZ(), i.add(-1, 0, 0).getX() + 1.0D, i.add(-1, 0, 0).getY() + 2.0D, i.add(-1, 0, 0).getZ() + 1.0D)).isEmpty()) {
|
||||
x = -1;
|
||||
z = 0;
|
||||
return i;
|
||||
}else if (mc.world.getBlockState(i.add(1, 1, 0)).getBlock() == Blocks.AIR && mc.world.getOtherEntities(null, new Box(i.add(1, 1, 0).getX(), i.add(1, 1, 0).getY(), i.add(1, 1, 0).getZ(), i.add(1, 1, 0).getX() + 1.0D, i.add(1, 1, 0).getY() + 2.0D, i.add(1, 1, 0).getZ() + 1.0D)).isEmpty()
|
||||
&& mc.world.getBlockState(i.add(1, 0, 0)).getBlock() == Blocks.AIR && mc.world.getOtherEntities(null, new Box(i.add(1, 0, 0).getX(), i.add(1, 0, 0).getY(), i.add(1, 0, 0).getZ(), i.add(1, 0, 0).getX() + 1.0D, i.add(1, 0, 0).getY() + 2.0D, i.add(1, 0, 0).getZ() + 1.0D)).isEmpty()) {
|
||||
x = 1;
|
||||
z = 0;
|
||||
return i;
|
||||
}else if (mc.world.getBlockState(i.add(0, 1, -1)).getBlock() == Blocks.AIR && mc.world.getOtherEntities(null, new Box(i.add(0, 1, -1).getX(), i.add(0, 1, -1).getY(), i.add(0, 1, -1).getZ(), i.add(0, 1, -1).getX() + 1.0D, i.add(0, 1, -1).getY() + 2.0D, i.add(0, 1, -1).getZ() + 1.0D)).isEmpty()
|
||||
&& mc.world.getBlockState(i.add(0, 0, -1)).getBlock() == Blocks.AIR && mc.world.getOtherEntities(null, new Box(i.add(0, 0, -1).getX(), i.add(0, 0, -1).getY(), i.add(0, 0, -1).getZ(), i.add(0, 0, -1).getX() + 1.0D, i.add(0, 0, -1).getY() + 2.0D, i.add(0, 0, -1).getZ() + 1.0D)).isEmpty()) {
|
||||
x = 0;
|
||||
z = -1;
|
||||
return i;
|
||||
}else if (mc.world.getBlockState(i.add(0, 1, 1)).getBlock() == Blocks.AIR && mc.world.getOtherEntities(null, new Box(i.add(0, 1, 1).getX(), i.add(0, 1, 1).getY(), i.add(0, 1, 1).getZ(), i.add(0, 1, 1).getX() + 1.0D, i.add(0, 1, 1).getY() + 2.0D, i.add(0, 1, 1).getZ() + 1.0D)).isEmpty()
|
||||
&& mc.world.getBlockState(i.add(0, 0, 1)).getBlock() == Blocks.AIR && mc.world.getOtherEntities(null, new Box(i.add(0, 0, 1).getX(), i.add(0, 0, 1).getY(), i.add(0, 0, 1).getZ(), i.add(0, 0, 1).getX() + 1.0D, i.add(0, 0, 1).getY() + 2.0D, i.add(0, 0, 1).getZ() + 1.0D)).isEmpty()) {
|
||||
x = 0;
|
||||
z = 1;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isShulkerBox(ItemStack stack) {
|
||||
Item item = stack.getItem();
|
||||
if (!(item instanceof BlockItem)) return false;
|
||||
Block block = ((BlockItem)item).getBlock();
|
||||
return block instanceof ShulkerBoxBlock;
|
||||
}
|
||||
|
||||
private List<BlockPos> getRange(BlockPos player, double range){
|
||||
List<BlockPos> allBlocks = new ArrayList<>();
|
||||
for(double i = player.getX() - range; i < player.getX() + range; i++){
|
||||
for(double j = player.getZ() - range; j < player.getZ() + range; j++){
|
||||
for(int k = player.getY() - 3; k < player.getY() + 3; k++){
|
||||
BlockPos x = new BlockPos(i, k, j);
|
||||
allBlocks.add(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
return allBlocks;
|
||||
}
|
||||
|
||||
private boolean isValidSlot(FindItemResult findItemResult){
|
||||
return findItemResult.getSlot() == -1 || findItemResult.getSlot() >= 9;
|
||||
}
|
||||
|
||||
private List<Block> setDefaultBlocks(){
|
||||
List<Block> list = new ArrayList<>();
|
||||
list.add(Blocks.OBSIDIAN);
|
||||
list.add(Blocks.COBBLESTONE);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
138
src/main/java/anticope/rejects/modules/AutoBedTrap.java
Normal file
138
src/main/java/anticope/rejects/modules/AutoBedTrap.java
Normal file
@@ -0,0 +1,138 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.settings.BlockListSetting;
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.DoubleSetting;
|
||||
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.misc.Pool;
|
||||
import meteordevelopment.meteorclient.utils.player.FindItemResult;
|
||||
import meteordevelopment.meteorclient.utils.player.InvUtils;
|
||||
import meteordevelopment.meteorclient.utils.world.BlockIterator;
|
||||
import meteordevelopment.meteorclient.utils.world.BlockUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BedBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public class AutoBedTrap extends Module {
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Integer> bpt = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("blocks-per-tick")
|
||||
.description("How many blocks to place per tick")
|
||||
.defaultValue(2)
|
||||
.min(1)
|
||||
.sliderMax(8)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> rotate = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("rotate")
|
||||
.description("Rotates when placing")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Double> range = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("range")
|
||||
.description("The break range.")
|
||||
.defaultValue(4)
|
||||
.min(0)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<List<Block>> blockTypes = sgGeneral.add(new BlockListSetting.Builder()
|
||||
.name("blocks")
|
||||
.description("The blocks you bedtrap with.")
|
||||
.defaultValue(Arrays.asList(Blocks.OBSIDIAN))
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Pool<BlockPos.Mutable> blockPosPool = new Pool<>(BlockPos.Mutable::new);
|
||||
private final List<BlockPos.Mutable> blocks = new ArrayList<>();
|
||||
|
||||
int cap = 0;
|
||||
|
||||
public AutoBedTrap() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "auto-bed-trap", "Automatically places obsidian around beds");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivate() {
|
||||
for (BlockPos.Mutable blockPos : blocks) blockPosPool.free(blockPos);
|
||||
blocks.clear();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Pre event) {
|
||||
|
||||
BlockIterator.register((int) Math.ceil(range.get()), (int) Math.ceil(range.get()), (blockPos, blockState) -> {
|
||||
if (!BlockUtils.canBreak(blockPos, blockState)) return;
|
||||
|
||||
if (!(blockState.getBlock() instanceof BedBlock)) return;
|
||||
|
||||
blocks.add(blockPosPool.get().set(blockPos));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTickPost(TickEvent.Post event) {
|
||||
boolean noBlocks = false;
|
||||
for (BlockPos blockPos : blocks) {
|
||||
if (!placeTickAround(blockPos)) {
|
||||
noBlocks = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (noBlocks && isActive()) toggle();
|
||||
}
|
||||
|
||||
public boolean placeTickAround(BlockPos block) {
|
||||
for (BlockPos b : new BlockPos[]{
|
||||
block.up(), block.west(),
|
||||
block.north(), block.south(),
|
||||
block.east(), block.down()}) {
|
||||
|
||||
if (cap >= bpt.get()) {
|
||||
cap = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (blockTypes.get().contains(mc.world.getBlockState(b).getBlock())) return true;
|
||||
|
||||
FindItemResult findBlock = InvUtils.findInHotbar((item) -> {
|
||||
if (!(item.getItem() instanceof BlockItem)) return false;
|
||||
BlockItem bitem = (BlockItem)item.getItem();
|
||||
return blockTypes.get().contains(bitem.getBlock());
|
||||
});
|
||||
if (!findBlock.found()) {
|
||||
error("No specified blocks found. Disabling.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (BlockUtils.place(b, findBlock, rotate.get(), 10, false)) {
|
||||
cap++;
|
||||
if (cap >= bpt.get()) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
cap = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
81
src/main/java/anticope/rejects/modules/AutoCraft.java
Normal file
81
src/main/java/anticope/rejects/modules/AutoCraft.java
Normal file
@@ -0,0 +1,81 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.ItemListSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.client.gui.screen.recipebook.RecipeResultCollection;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.screen.CraftingScreenHandler;
|
||||
import net.minecraft.screen.slot.SlotActionType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class AutoCraft extends Module {
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<List<Item>> items = sgGeneral.add(new ItemListSetting.Builder()
|
||||
.name("items")
|
||||
.description("Items you want to get crafted.")
|
||||
.defaultValue(Arrays.asList())
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> antiDesync = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("anti-desync")
|
||||
.description("Try to prevent inventory desync.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> craftAll = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("craft-all")
|
||||
.description("Crafts maximum possible amount amount per craft (shift-clicking)")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> drop = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("drop")
|
||||
.description("Automatically drops crafted items (useful for when not enough inventory space)")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
public AutoCraft() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "auto-craft", "Automatically crafts items.");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Post event) {
|
||||
if (mc.interactionManager == null) return;
|
||||
if (items.get().isEmpty()) return;
|
||||
|
||||
if (!(mc.player.currentScreenHandler instanceof CraftingScreenHandler)) return;
|
||||
|
||||
|
||||
if (antiDesync.get())
|
||||
mc.player.getInventory().updateItems();
|
||||
|
||||
// Danke schön GhostTypes
|
||||
// https://github.com/GhostTypes/orion/blob/main/src/main/java/me/ghosttypes/orion/modules/main/AutoBedCraft.java
|
||||
CraftingScreenHandler currentScreenHandler = (CraftingScreenHandler) mc.player.currentScreenHandler;
|
||||
List<Item> itemList = items.get();
|
||||
List<RecipeResultCollection> recipeResultCollectionList = mc.player.getRecipeBook().getOrderedResults();
|
||||
for (RecipeResultCollection recipeResultCollection : recipeResultCollectionList) {
|
||||
for (Recipe<?> recipe : recipeResultCollection.getRecipes(true)) {
|
||||
if (!itemList.contains(recipe.getOutput().getItem())) continue;
|
||||
mc.interactionManager.clickRecipe(currentScreenHandler.syncId, recipe, craftAll.get());
|
||||
mc.interactionManager.clickSlot(currentScreenHandler.syncId, 0, 1,
|
||||
drop.get() ? SlotActionType.THROW : SlotActionType.QUICK_MOVE, mc.player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
188
src/main/java/anticope/rejects/modules/AutoExtinguish.java
Normal file
188
src/main/java/anticope/rejects/modules/AutoExtinguish.java
Normal file
@@ -0,0 +1,188 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
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.player.PlayerUtils;
|
||||
import meteordevelopment.meteorclient.utils.player.Rotations;
|
||||
import meteordevelopment.meteorclient.utils.world.BlockIterator;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.effect.StatusEffect;
|
||||
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.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;
|
||||
|
||||
public class AutoExtinguish extends Module {
|
||||
private final SettingGroup sgGeneral = settings.createGroup("Extinguish Fire around you");
|
||||
private final SettingGroup sgBucket = settings.createGroup("Extinguish yourself");
|
||||
|
||||
private final Setting<Boolean> extinguish = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("extinguish")
|
||||
.description("Automatically extinguishes fire around you.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
private final Setting<Integer> horizontalRadius = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("horizontal-radius")
|
||||
.description("Horizontal radius in which to search for fire.")
|
||||
.defaultValue(4)
|
||||
.min(0)
|
||||
.sliderMax(6)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> verticalRadius = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("vertical-radius")
|
||||
.description("Vertical radius in which to search for fire.")
|
||||
.defaultValue(4)
|
||||
.min(0)
|
||||
.sliderMax(6)
|
||||
.build()
|
||||
);
|
||||
private final Setting<Integer> maxBlockPerTick = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("block-per-tick")
|
||||
.description("Maximum amount of Blocks to extinguish per tick.")
|
||||
.defaultValue(5)
|
||||
.min(1)
|
||||
.sliderMax(50)
|
||||
.build()
|
||||
);
|
||||
private final Setting<Boolean> waterBucket = sgBucket.add(new BoolSetting.Builder()
|
||||
.name("water")
|
||||
.description("Automatically places water when you are on fire (and don't have fire resistance).")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
private final Setting<Boolean> center = sgBucket.add(new BoolSetting.Builder()
|
||||
.name("center")
|
||||
.description("Automatically centers you when placing water.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
private final Setting<Boolean> onGround = sgBucket.add(new BoolSetting.Builder()
|
||||
.name("on-ground")
|
||||
.description("Only place when you are on ground.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private boolean hasPlacedWater = false;
|
||||
private BlockPos blockPos = null;
|
||||
private boolean doesWaterBucketWork = true;
|
||||
|
||||
private static final StatusEffect FIRE_RESISTANCE = Registry.STATUS_EFFECT.get(new Identifier("fire_resistance"));
|
||||
|
||||
public AutoExtinguish() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "auto-extinguish", "Automatically extinguishes fire around you");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Pre event) {
|
||||
if (mc.world.getDimension().isRespawnAnchorWorking()) {
|
||||
if (doesWaterBucketWork) {
|
||||
warning("Water Buckets don't work in this dimension!");
|
||||
doesWaterBucketWork = false;
|
||||
|
||||
}
|
||||
} else {
|
||||
if (!doesWaterBucketWork) {
|
||||
warning("Enabled Water Buckets!");
|
||||
doesWaterBucketWork = true;
|
||||
}
|
||||
}
|
||||
if (onGround.get() && !mc.player.isOnGround()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (waterBucket.get() && doesWaterBucketWork) {
|
||||
if (hasPlacedWater) {
|
||||
final int slot = findSlot(Items.BUCKET);
|
||||
blockPos = mc.player.getBlockPos();
|
||||
place(slot);
|
||||
hasPlacedWater = false;
|
||||
|
||||
} else if (!mc.player.hasStatusEffect(FIRE_RESISTANCE) && mc.player.isOnFire()) {
|
||||
blockPos = mc.player.getBlockPos();
|
||||
final int slot = findSlot(Items.WATER_BUCKET);
|
||||
if (mc.world.getBlockState(blockPos).getBlock() == Blocks.FIRE || mc.world.getBlockState(blockPos).getBlock() == Blocks.SOUL_FIRE) {
|
||||
float yaw = mc.gameRenderer.getCamera().getYaw() % 360;
|
||||
float pitch = mc.gameRenderer.getCamera().getPitch() % 360;
|
||||
if (center.get()) {
|
||||
PlayerUtils.centerPlayer();
|
||||
}
|
||||
Rotations.rotate(yaw, 90);
|
||||
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, blockPos, Direction.UP));
|
||||
mc.player.swingHand(Hand.MAIN_HAND);
|
||||
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, blockPos, Direction.UP));
|
||||
|
||||
Rotations.rotate(yaw, pitch);
|
||||
}
|
||||
place(slot);
|
||||
hasPlacedWater = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (extinguish.get()) {
|
||||
AtomicInteger blocksPerTick = new AtomicInteger();
|
||||
BlockIterator.register(horizontalRadius.get(), verticalRadius.get(), (blockPos, blockState) -> {
|
||||
if (blocksPerTick.get() <= maxBlockPerTick.get()) {
|
||||
if (blockState.getBlock() == Blocks.FIRE || mc.world.getBlockState(blockPos).getBlock() == Blocks.SOUL_FIRE) {
|
||||
extinguishFire(blockPos);
|
||||
blocksPerTick.getAndIncrement();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void place(int slot) {
|
||||
if (slot != -1) {
|
||||
final int preSlot = mc.player.getInventory().selectedSlot;
|
||||
if (center.get()) {
|
||||
PlayerUtils.centerPlayer();
|
||||
}
|
||||
mc.player.getInventory().selectedSlot = slot;
|
||||
float yaw = mc.gameRenderer.getCamera().getYaw() % 360;
|
||||
float pitch = mc.gameRenderer.getCamera().getPitch() % 360;
|
||||
|
||||
Rotations.rotate(yaw, 90);
|
||||
mc.interactionManager.interactItem(mc.player, mc.player.world, Hand.MAIN_HAND);
|
||||
mc.player.getInventory().selectedSlot = preSlot;
|
||||
Rotations.rotate(yaw, pitch);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void extinguishFire(BlockPos blockPos) {
|
||||
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, blockPos, net.minecraft.util.math.Direction.UP));
|
||||
mc.player.swingHand(Hand.MAIN_HAND);
|
||||
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, blockPos, net.minecraft.util.math.Direction.UP));
|
||||
}
|
||||
|
||||
private int findSlot(Item item) {
|
||||
int slot = -1;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
ItemStack block = mc.player.getInventory().getStack(i);
|
||||
if (block.getItem() == item) {
|
||||
slot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return slot;
|
||||
}
|
||||
|
||||
}
|
||||
175
src/main/java/anticope/rejects/modules/AutoEz.java
Normal file
175
src/main/java/anticope/rejects/modules/AutoEz.java
Normal file
@@ -0,0 +1,175 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.meteorclient.events.entity.player.AttackEntityEvent;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.friends.Friends;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.network.MeteorExecutor;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.decoration.EndCrystalEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Pair;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class AutoEz extends Module {
|
||||
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<String> format = sgGeneral.add(new StringSetting.Builder()
|
||||
.name("message")
|
||||
.description("Send a chat message about killing a player.")
|
||||
.defaultValue("EZ! {name}!")
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> minArmor = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("min-armor")
|
||||
.description("Minimum number of armor elements.")
|
||||
.defaultValue(2)
|
||||
.min(0)
|
||||
.max(4)
|
||||
.sliderMin(0)
|
||||
.sliderMax(4)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> ignoreFriends = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("ignore-friends")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
ArrayList<Pair<UUID, Long>> players = new ArrayList<>();
|
||||
ArrayList<String> msgplayers = new ArrayList<>();
|
||||
|
||||
|
||||
public AutoEz() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "auto-ez", "Send a chat message after killing a player.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
players.clear();
|
||||
msgplayers.clear();
|
||||
}
|
||||
|
||||
private boolean checkArmor(PlayerEntity p) {
|
||||
|
||||
int armor = 0;
|
||||
|
||||
if (p.getEquippedStack(EquipmentSlot.HEAD).getItem() != Items.AIR) armor++;
|
||||
if (p.getEquippedStack(EquipmentSlot.CHEST).getItem() != Items.AIR) armor++;
|
||||
if (p.getEquippedStack(EquipmentSlot.LEGS).getItem() != Items.AIR) armor++;
|
||||
if (p.getEquippedStack(EquipmentSlot.FEET).getItem() != Items.AIR) armor++;
|
||||
|
||||
return armor < minArmor.get();
|
||||
}
|
||||
|
||||
|
||||
private boolean checkFriend(PlayerEntity p) {
|
||||
return (ignoreFriends.get() && Friends.get().isFriend(p));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void AttackEntity(AttackEntityEvent e) {
|
||||
if (e.entity instanceof EndCrystalEntity) {
|
||||
List<AbstractClientPlayerEntity> worldplayers = mc.world.getPlayers();
|
||||
for (int x = 0; x < worldplayers.size(); x++) {
|
||||
PlayerEntity p = worldplayers.get(x);
|
||||
if (!p.isSpectator() && !p.isCreative() && !p.isInvulnerable() && !mc.player.equals(p) && !checkArmor(p) && !checkFriend(p) && p.distanceTo(e.entity) < 12) {
|
||||
|
||||
Pair<UUID, Long> pair = new Pair<>(p.getUuid(), System.currentTimeMillis());
|
||||
int index = -1;
|
||||
for (int w = 0; w < players.size(); w++) {
|
||||
if (players.get(w).getLeft().equals(p.getUuid())) {
|
||||
index = w;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index == -1) {
|
||||
players.add(pair);
|
||||
} else {
|
||||
players.set(index, pair);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (e.entity instanceof PlayerEntity) {
|
||||
PlayerEntity p = (PlayerEntity) e.entity;
|
||||
if (!p.isSpectator() && !p.isCreative() && !p.isInvulnerable() && !mc.player.equals(p) && !checkArmor(p) && !checkFriend(p)) {
|
||||
|
||||
Pair<UUID, Long> pair = new Pair<>(p.getUuid(), System.currentTimeMillis());
|
||||
int index = -1;
|
||||
for (int w = 0; w < players.size(); w++) {
|
||||
if (players.get(w).getLeft().equals(p.getUuid())) {
|
||||
index = w;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index == -1) {
|
||||
players.add(pair);
|
||||
} else {
|
||||
players.set(index, pair);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Pre e) {
|
||||
if (players.size() == 0) return;
|
||||
|
||||
ArrayList<Pair<UUID, Long>> newPlayers = players;
|
||||
|
||||
for (int x = 0; x < players.size(); x++) {
|
||||
Pair<UUID, Long> w = players.get(x);
|
||||
long time = w.getRight();
|
||||
|
||||
PlayerEntity p = mc.world.getPlayerByUuid(w.getLeft());
|
||||
|
||||
if (System.currentTimeMillis() - time > 2000 || p == null) {
|
||||
newPlayers.remove(x);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (p.isDead()) {
|
||||
if (!msgplayers.contains(p.getName().asString()))
|
||||
msgplayers.add(p.getName().asString());
|
||||
newPlayers.remove(x);
|
||||
MeteorExecutor.execute(() -> send());
|
||||
}
|
||||
}
|
||||
|
||||
players = newPlayers;
|
||||
}
|
||||
|
||||
private void send() {
|
||||
int size = msgplayers.size();
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (size != msgplayers.size()) {
|
||||
MeteorExecutor.execute(() -> send());
|
||||
return;
|
||||
}
|
||||
|
||||
if (msgplayers.size() == 0) return;
|
||||
String message = format.get();
|
||||
message = message.replace("{name}", String.join(", ", msgplayers));
|
||||
mc.player.sendChatMessage(message);
|
||||
|
||||
msgplayers.clear();
|
||||
}
|
||||
|
||||
}
|
||||
415
src/main/java/anticope/rejects/modules/AutoPot.java
Normal file
415
src/main/java/anticope/rejects/modules/AutoPot.java
Normal file
@@ -0,0 +1,415 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
//import baritone.api.BaritoneAPI;
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.entity.player.ItemUseCrosshairTargetEvent;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import meteordevelopment.meteorclient.systems.modules.combat.AnchorAura;
|
||||
import meteordevelopment.meteorclient.systems.modules.combat.BedAura;
|
||||
import meteordevelopment.meteorclient.systems.modules.combat.CrystalAura;
|
||||
import meteordevelopment.meteorclient.systems.modules.combat.KillAura;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.utils.Utils;
|
||||
import meteordevelopment.meteorclient.utils.player.Rotations;
|
||||
import net.minecraft.entity.effect.StatusEffect;
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.potion.PotionUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class AutoPot extends Module {
|
||||
private static final Class<? extends Module>[] AURAS = new Class[] { KillAura.class, CrystalAura.class, AnchorAura.class, BedAura.class };
|
||||
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Boolean> Healing = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("Healing")
|
||||
.description("Enables healing potions.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
private final Setting<Boolean> Strength = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("Strength")
|
||||
.description("Enables strength potions.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
private final Setting<Boolean> useSplashPots = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("Splash-Pots")
|
||||
.description("Allow the use of splash pots")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
private final Setting<Integer> health = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("health")
|
||||
.description("If health goes below this point, Healing Pot will trigger.")
|
||||
.defaultValue(15)
|
||||
.min(0)
|
||||
.sliderMax(20)
|
||||
.build()
|
||||
);
|
||||
private final Setting<Boolean> pauseAuras = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("pause-auras")
|
||||
.description("Pauses all auras when eating.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> pauseBaritone = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("pause-baritone")
|
||||
.description("Pause baritone when eating.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
private final Setting<Boolean> lookDown = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("rotate")
|
||||
.description("Forces you to rotate downwards when throwing bottles.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
private int slot, prevSlot;
|
||||
private boolean drinking, splashing;
|
||||
private final List<Class<? extends Module>> wasAura = new ArrayList<>();
|
||||
private boolean wasBaritone;
|
||||
public AutoPot() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "auto-pot", "Automatically Drinks Potions");
|
||||
}
|
||||
//Gilded's first module, lets see how much i'll die making this
|
||||
//TODO:Rework everything to accept all pots
|
||||
//TODO: Does strength work better if you throw it up? will check.
|
||||
@Override
|
||||
public void onDeactivate() {
|
||||
if (drinking) stopDrinking();
|
||||
if (splashing) stopSplashing();
|
||||
}
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Pre event) {
|
||||
if (Healing.get()) {
|
||||
if (ShouldDrinkHealth()) {
|
||||
//Heal Pot Slot
|
||||
int slot = HealingpotionSlot();
|
||||
//Slot Not Invalid
|
||||
if (slot != -1) {
|
||||
startDrinking();
|
||||
} else if (HealingpotionSlot() == -1 && useSplashPots.get()) {
|
||||
slot = HealingSplashpotionSlot();
|
||||
if (slot != -1) {
|
||||
startSplashing();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (drinking) {
|
||||
if (ShouldDrinkHealth()) {
|
||||
if (isNotPotion(mc.player.getInventory().getStack(slot))) {
|
||||
slot = HealingpotionSlot();
|
||||
if (slot == -1) {
|
||||
info("Ran out of Pots while drinking");
|
||||
stopDrinking();
|
||||
return;
|
||||
}
|
||||
} else changeSlot(slot);
|
||||
}
|
||||
drink();
|
||||
if (ShouldNotDrinkHealth()) {
|
||||
info("Health Full");
|
||||
stopDrinking();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (splashing) {
|
||||
if (ShouldDrinkHealth()) {
|
||||
if (isNotSplashPotion(mc.player.getInventory().getStack(slot))) {
|
||||
slot = HealingSplashpotionSlot();
|
||||
if (slot == -1) {
|
||||
info("Ran out of Pots while splashing");
|
||||
stopSplashing();
|
||||
return;
|
||||
} else changeSlot(slot);
|
||||
}
|
||||
splash();
|
||||
if (ShouldNotDrinkHealth()) {
|
||||
info("Health Full");
|
||||
stopSplashing();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Strength.get()) {
|
||||
if (ShouldDrinkStrength()) {
|
||||
//Strength Pot Slot
|
||||
int slot = StrengthpotionSlot();
|
||||
//Slot Not Invalid
|
||||
if (slot != -1) {
|
||||
startDrinking();
|
||||
}
|
||||
else if (StrengthpotionSlot() == -1 && useSplashPots.get()) {
|
||||
slot = StrengthSplashpotionSlot();
|
||||
if (slot != -1) {
|
||||
startSplashing();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (drinking) {
|
||||
if (ShouldDrinkStrength()) {
|
||||
if (isNotPotion(mc.player.getInventory().getStack(slot))) {
|
||||
slot = StrengthpotionSlot();
|
||||
if (slot == -1) {
|
||||
stopDrinking();
|
||||
info("Out of Pots");
|
||||
return;
|
||||
} else changeSlot(slot);
|
||||
}
|
||||
drink();
|
||||
} else {
|
||||
stopDrinking();
|
||||
}
|
||||
}
|
||||
if (splashing) {
|
||||
if (ShouldDrinkStrength()) {
|
||||
if (isNotSplashPotion(mc.player.getInventory().getStack(slot))) {
|
||||
slot = StrengthSplashpotionSlot();
|
||||
if (slot == -1) {
|
||||
info("Ran out of Pots while splashing");
|
||||
stopSplashing();
|
||||
return;
|
||||
} else changeSlot(slot);
|
||||
}
|
||||
splash();
|
||||
} else {
|
||||
stopSplashing();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@EventHandler
|
||||
private void onItemUseCrosshairTarget(ItemUseCrosshairTargetEvent event) {
|
||||
if (drinking) event.target = null;
|
||||
}
|
||||
private void setPressed(boolean pressed) {
|
||||
mc.options.keyUse.setPressed(pressed);
|
||||
}
|
||||
private void startDrinking() {
|
||||
prevSlot = mc.player.getInventory().selectedSlot;
|
||||
drink();
|
||||
// Pause auras
|
||||
wasAura.clear();
|
||||
if (pauseAuras.get()) {
|
||||
for (Class<? extends Module> klass : AURAS) {
|
||||
Module module = Modules.get().get(klass);
|
||||
|
||||
if (module.isActive()) {
|
||||
wasAura.add(klass);
|
||||
module.toggle();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Pause baritone
|
||||
wasBaritone = false;
|
||||
//if (pauseBaritone.get() && BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing()) {
|
||||
// wasBaritone = true;
|
||||
// BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute("pause");
|
||||
//}
|
||||
}
|
||||
private void startSplashing() {
|
||||
prevSlot = mc.player.getInventory().selectedSlot;
|
||||
if (lookDown.get()){
|
||||
Rotations.rotate(mc.player.getYaw(), 90); splash();
|
||||
}
|
||||
splash();
|
||||
// Pause auras
|
||||
wasAura.clear();
|
||||
if (pauseAuras.get()) {
|
||||
for (Class<? extends Module> klass : AURAS) {
|
||||
Module module = Modules.get().get(klass);
|
||||
|
||||
if (module.isActive()) {
|
||||
wasAura.add(klass);
|
||||
module.toggle();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Pause baritone
|
||||
//wasBaritone = false;
|
||||
//if (pauseBaritone.get() && BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing()) {
|
||||
// wasBaritone = true;
|
||||
// BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute("pause");
|
||||
//}
|
||||
}
|
||||
private void drink() {
|
||||
changeSlot(slot);
|
||||
setPressed(true);
|
||||
if (!mc.player.isUsingItem()) Utils.rightClick();
|
||||
|
||||
drinking = true;
|
||||
}
|
||||
private void splash() {
|
||||
changeSlot(slot);
|
||||
setPressed(true);
|
||||
splashing = true;
|
||||
}
|
||||
private void stopDrinking() {
|
||||
changeSlot(prevSlot);
|
||||
setPressed(false);
|
||||
drinking = false;
|
||||
|
||||
// Resume auras
|
||||
if (pauseAuras.get()) {
|
||||
for (Class<? extends Module> klass : AURAS) {
|
||||
Module module = Modules.get().get(klass);
|
||||
|
||||
if (wasAura.contains(klass) && !module.isActive()) {
|
||||
module.toggle();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Resume baritone
|
||||
//if (pauseBaritone.get() && wasBaritone) {
|
||||
// BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute("resume");
|
||||
//}
|
||||
}
|
||||
private void stopSplashing() {
|
||||
changeSlot(prevSlot);
|
||||
setPressed(false);
|
||||
|
||||
splashing = false;
|
||||
|
||||
// Resume auras
|
||||
if (pauseAuras.get()) {
|
||||
for (Class<? extends Module> klass : AURAS) {
|
||||
Module module = Modules.get().get(klass);
|
||||
|
||||
if (wasAura.contains(klass) && !module.isActive()) {
|
||||
module.toggle();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Resume baritone
|
||||
//if (pauseBaritone.get() && wasBaritone) {
|
||||
// BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute("resume");
|
||||
//}
|
||||
}
|
||||
private double truehealth() {
|
||||
assert mc.player != null;
|
||||
return mc.player.getHealth();
|
||||
}
|
||||
private void changeSlot(int slot) {
|
||||
mc.player.getInventory().selectedSlot = slot;
|
||||
this.slot = slot;
|
||||
}
|
||||
//Sunk 7 hours into these checks, if i die blame checks
|
||||
//Heal pot checks
|
||||
private int HealingpotionSlot() {
|
||||
int slot = -1;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
// Skip if item stack is empty
|
||||
ItemStack stack = mc.player.getInventory().getStack(i);
|
||||
if (stack.isEmpty()) continue;
|
||||
if (stack.getItem() != Items.POTION) continue;
|
||||
if (stack.getItem() == Items.POTION) {
|
||||
List<StatusEffectInstance> effects = PotionUtil.getPotion(mc.player.getInventory().getStack(i)).getEffects();
|
||||
if (effects.size() > 0) {
|
||||
StatusEffectInstance effect = effects.get(0);
|
||||
if (effect.getTranslationKey().equals("effect.minecraft.instant_health")) {
|
||||
slot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return slot;
|
||||
}
|
||||
private int HealingSplashpotionSlot() {
|
||||
int slot = -1;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
// Skip if item stack is empty
|
||||
ItemStack stack = mc.player.getInventory().getStack(i);
|
||||
if (stack.isEmpty()) continue;
|
||||
if (stack.getItem() != Items.SPLASH_POTION) continue;
|
||||
if (stack.getItem() == Items.SPLASH_POTION) {
|
||||
List<StatusEffectInstance> effects = PotionUtil.getPotion(mc.player.getInventory().getStack(i)).getEffects();
|
||||
if (effects.size() > 0) {
|
||||
StatusEffectInstance effect = effects.get(0);
|
||||
if (effect.getTranslationKey().equals("effect.minecraft.instant_health")) {
|
||||
slot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return slot;
|
||||
}
|
||||
//Strength Pot Checks
|
||||
private int StrengthSplashpotionSlot () {
|
||||
int slot = -1;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
// Skip if item stack is empty
|
||||
ItemStack stack = mc.player.getInventory().getStack(i);
|
||||
if (stack.isEmpty()) continue;
|
||||
if (stack.getItem() != Items.SPLASH_POTION) continue;
|
||||
if (stack.getItem() == Items.SPLASH_POTION) {
|
||||
List<StatusEffectInstance> effects = PotionUtil.getPotion(mc.player.getInventory().getStack(i)).getEffects();
|
||||
if (effects.size() > 0) {
|
||||
StatusEffectInstance effect = effects.get(0);
|
||||
if (effect.getTranslationKey().equals("effect.minecraft.strength")) {
|
||||
slot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return slot;
|
||||
}
|
||||
private int StrengthpotionSlot () {
|
||||
int slot = -1;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
// Skip if item stack is empty
|
||||
ItemStack stack = mc.player.getInventory().getStack(i);
|
||||
if (stack.isEmpty()) continue;
|
||||
if (stack.getItem() != Items.POTION) continue;
|
||||
if (stack.getItem() == Items.POTION) {
|
||||
List<StatusEffectInstance> effects = PotionUtil.getPotion(mc.player.getInventory().getStack(i)).getEffects();
|
||||
if (effects.size() > 0) {
|
||||
StatusEffectInstance effect = effects.get(0);
|
||||
if (effect.getTranslationKey().equals("effect.minecraft.strength")) {
|
||||
slot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return slot;
|
||||
}
|
||||
private boolean isNotPotion(ItemStack stack) {
|
||||
Item item = stack.getItem();
|
||||
return item != Items.POTION;
|
||||
}
|
||||
private boolean isNotSplashPotion(ItemStack stack) {
|
||||
Item item = stack.getItem();
|
||||
return item != Items.SPLASH_POTION;
|
||||
}
|
||||
private boolean ShouldDrinkHealth(){
|
||||
if (truehealth() < health.get()) return true;
|
||||
return false;
|
||||
}
|
||||
private boolean ShouldNotDrinkHealth(){
|
||||
if (truehealth() >= health.get()) return true;
|
||||
return false;
|
||||
}
|
||||
private boolean ShouldDrinkStrength(){
|
||||
Map<StatusEffect, StatusEffectInstance> effects = mc.player.getActiveStatusEffects();
|
||||
return !effects.containsKey(StatusEffects.STRENGTH);
|
||||
}
|
||||
}
|
||||
222
src/main/java/anticope/rejects/modules/AutoTNT.java
Normal file
222
src/main/java/anticope/rejects/modules/AutoTNT.java
Normal file
@@ -0,0 +1,222 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import anticope.rejects.utils.TntDamage;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
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.misc.Pool;
|
||||
import meteordevelopment.meteorclient.utils.player.FindItemResult;
|
||||
import meteordevelopment.meteorclient.utils.player.InvUtils;
|
||||
import meteordevelopment.meteorclient.utils.player.PlayerUtils;
|
||||
import meteordevelopment.meteorclient.utils.world.BlockIterator;
|
||||
import meteordevelopment.meteorclient.utils.world.BlockUtils;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.block.TntBlock;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class AutoTNT extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
// General
|
||||
|
||||
private final Setting<Boolean> ignite = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("ignite")
|
||||
.description("Whether to ignite tnt.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> place = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("place")
|
||||
.description("Whether to place tnt. (VERY LAGGY)")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> igniteDelay = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("ignition-delay")
|
||||
.description("Delay in ticks between ignition")
|
||||
.defaultValue(1)
|
||||
.visible(ignite::get)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> placeDelay = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("place-delay")
|
||||
.description("Delay in ticks between placement")
|
||||
.defaultValue(1)
|
||||
.visible(place::get)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> horizontalRange = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("horizontal-range")
|
||||
.description("Horizontal range of ignition and placement")
|
||||
.defaultValue(4)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> verticalRange = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("vertical-range")
|
||||
.description("Vertical range of ignition and placement")
|
||||
.defaultValue(4)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> antiBreak = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("anti-break")
|
||||
.description("Whether to save flint and steel from breaking.")
|
||||
.defaultValue(true)
|
||||
.visible(ignite::get)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> fireCharge = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("fire-charge")
|
||||
.description("Whether to also use fire charges.")
|
||||
.defaultValue(true)
|
||||
.visible(ignite::get)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> rotate = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("rotate")
|
||||
.description("Whether to rotate towards action.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final List<BlockPos.Mutable> blocksToIgnite = new ArrayList<>();
|
||||
private final Pool<BlockPos.Mutable> ignitePool = new Pool<>(BlockPos.Mutable::new);
|
||||
private final List<TntPos> blocksToPlace = new ArrayList<>();
|
||||
private final Pool<TntPos> placePool = new Pool<>(TntPos::new);
|
||||
private int igniteTick = 0;
|
||||
private int placeTick = 0;
|
||||
|
||||
public AutoTNT() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "auto-tnt", "Places and/or ignites tnt automatically. Good for griefing.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivate() {
|
||||
igniteTick = 0;
|
||||
placeTick = 0;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onPreTick(TickEvent.Pre event) {
|
||||
if (ignite.get() && igniteTick > igniteDelay.get()) {
|
||||
// Clear blocks
|
||||
for (BlockPos.Mutable blockPos : blocksToIgnite) ignitePool.free(blockPos);
|
||||
blocksToIgnite.clear();
|
||||
|
||||
// Register
|
||||
BlockIterator.register(horizontalRange.get(), verticalRange.get(), (blockPos, blockState) -> {
|
||||
if (blockState.getBlock() instanceof TntBlock) blocksToIgnite.add(ignitePool.get().set(blockPos));
|
||||
});
|
||||
}
|
||||
|
||||
if (place.get() && placeTick > placeDelay.get()) {
|
||||
// Clear blocks
|
||||
for (TntPos tntPos : blocksToPlace) placePool.free(tntPos);
|
||||
blocksToPlace.clear();
|
||||
|
||||
// Register
|
||||
BlockIterator.register(horizontalRange.get(), verticalRange.get(), (blockPos, blockState) -> {
|
||||
if (BlockUtils.canPlace(blockPos)) blocksToPlace.add(placePool.get().set(blockPos, TntDamage.calculate(blockPos)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onPostTick(TickEvent.Post event) {
|
||||
// Ignition
|
||||
if (ignite.get() && blocksToIgnite.size() > 0) {
|
||||
if (igniteTick > igniteDelay.get()) {
|
||||
// Sort based on closest tnt
|
||||
blocksToIgnite.sort(Comparator.comparingDouble(PlayerUtils::distanceTo));
|
||||
|
||||
// Ignition
|
||||
FindItemResult itemResult = InvUtils.findInHotbar(item -> {
|
||||
if (item.getItem() instanceof FlintAndSteelItem) {
|
||||
return (antiBreak.get() && (item.getMaxDamage() - item.getDamage()) > 10);
|
||||
}
|
||||
else if (item.getItem() instanceof FireChargeItem) {
|
||||
return fireCharge.get();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (!itemResult.found()) {
|
||||
error("No flint and steel in hotbar");
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
ignite(blocksToIgnite.get(0), itemResult);
|
||||
|
||||
// Reset ticks
|
||||
igniteTick = 0;
|
||||
}
|
||||
}
|
||||
igniteTick++;
|
||||
|
||||
// Placement
|
||||
if (place.get() && blocksToPlace.size() > 0) {
|
||||
if (placeTick > placeDelay.get()) {
|
||||
// Sort based on closest tnt
|
||||
blocksToPlace.sort(Comparator.comparingInt(o -> o.score));
|
||||
|
||||
// Placement
|
||||
FindItemResult itemResult = InvUtils.findInHotbar(item -> item.getItem() == Items.TNT);
|
||||
if (!itemResult.found()) {
|
||||
error("No tnt in hotbar");
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
place(blocksToPlace.get(0).blockPos, itemResult);
|
||||
|
||||
// Reset ticks
|
||||
placeTick = 0;
|
||||
}
|
||||
}
|
||||
placeTick++;
|
||||
}
|
||||
|
||||
private void ignite(BlockPos pos, FindItemResult item) {
|
||||
InvUtils.swap(item.getSlot(), true);
|
||||
|
||||
mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5), Direction.UP, pos, true));
|
||||
|
||||
InvUtils.swapBack();
|
||||
}
|
||||
|
||||
private void place(BlockPos pos, FindItemResult item) {
|
||||
BlockUtils.place(pos, item, rotate.get(), 10);
|
||||
}
|
||||
|
||||
private class TntPos {
|
||||
public BlockPos.Mutable blockPos;
|
||||
public int score;
|
||||
|
||||
public TntPos set(BlockPos blockPos, int score) {
|
||||
if (this.blockPos != null)
|
||||
this.blockPos.set(blockPos);
|
||||
|
||||
this.score = score;
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
342
src/main/java/anticope/rejects/modules/AutoWither.java
Normal file
342
src/main/java/anticope/rejects/modules/AutoWither.java
Normal file
@@ -0,0 +1,342 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.meteorclient.events.render.Render3DEvent;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.renderer.ShapeMode;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.misc.Pool;
|
||||
import meteordevelopment.meteorclient.utils.player.FindItemResult;
|
||||
import meteordevelopment.meteorclient.utils.player.InvUtils;
|
||||
import meteordevelopment.meteorclient.utils.player.PlayerUtils;
|
||||
import meteordevelopment.meteorclient.utils.player.Rotations;
|
||||
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
|
||||
import meteordevelopment.meteorclient.utils.world.BlockIterator;
|
||||
import meteordevelopment.meteorclient.utils.world.BlockUtils;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
public class AutoWither extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
private final SettingGroup sgRender = settings.createGroup("Render");
|
||||
|
||||
// General
|
||||
|
||||
private final Setting<Integer> horizontalRadius = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("horizontal-radius")
|
||||
.description("Horizontal radius for placement")
|
||||
.defaultValue(4)
|
||||
.min(0)
|
||||
.sliderMax(6)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> verticalRadius = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("vertical-radius")
|
||||
.description("Vertical radius for placement")
|
||||
.defaultValue(3)
|
||||
.min(0)
|
||||
.sliderMax(6)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Priority> priority = sgGeneral.add(new EnumSetting.Builder<Priority>()
|
||||
.name("priority")
|
||||
.description("Priority")
|
||||
.defaultValue(Priority.Random)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> witherDelay = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("wither-delay")
|
||||
.description("Delay in ticks between wither placements")
|
||||
.defaultValue(1)
|
||||
.min(1)
|
||||
.sliderMax(10)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> blockDelay = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("block-delay")
|
||||
.description("Delay in ticks between block placements")
|
||||
.defaultValue(1)
|
||||
.min(0)
|
||||
.sliderMax(10)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> rotate = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("rotate")
|
||||
.description("Whether or not to rotate while building")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> turnOff = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("turn-off")
|
||||
.description("Turns off automatically after building a single wither.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
// Render
|
||||
|
||||
private final Setting<ShapeMode> shapeMode = sgRender.add(new EnumSetting.Builder<ShapeMode>()
|
||||
.name("shape-mode")
|
||||
.description("How the shapes are rendered.")
|
||||
.defaultValue(ShapeMode.Both)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<SettingColor> sideColor = sgRender.add(new ColorSetting.Builder()
|
||||
.name("side-color")
|
||||
.description("The side color of the target block rendering.")
|
||||
.defaultValue(new SettingColor(197, 137, 232, 10))
|
||||
.build()
|
||||
);
|
||||
private final Setting<SettingColor> lineColor = sgRender.add(new ColorSetting.Builder()
|
||||
.name("line-color")
|
||||
.description("The line color of the target block rendering.")
|
||||
.defaultValue(new SettingColor(197, 137, 232))
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Pool<Wither> witherPool = new Pool<>(Wither::new);
|
||||
private final ArrayList<Wither> withers = new ArrayList<>();
|
||||
private Wither wither;
|
||||
|
||||
private int witherTicksWaited, blockTicksWaited;
|
||||
|
||||
public AutoWither() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "auto-wither", "Automatically builds withers.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivate() {
|
||||
wither = null;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Pre event) {
|
||||
if (wither == null) {
|
||||
// Delay
|
||||
if (witherTicksWaited < witherDelay.get() - 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear pool and list
|
||||
for (Wither wither : withers) witherPool.free(wither);
|
||||
withers.clear();
|
||||
|
||||
// Register
|
||||
BlockIterator.register(horizontalRadius.get(), verticalRadius.get(), (blockPos, blockState) -> {
|
||||
Direction dir = Direction.fromRotation(Rotations.getYaw(blockPos)).getOpposite();
|
||||
if (isValidSpawn(blockPos, dir)) withers.add(witherPool.get().set(blockPos, dir));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onPostTick(TickEvent.Post event) {
|
||||
if (wither == null) {
|
||||
// Delay
|
||||
if (witherTicksWaited < witherDelay.get() - 1) {
|
||||
witherTicksWaited++;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (withers.isEmpty()) return;
|
||||
|
||||
// Sorting
|
||||
switch (priority.get()) {
|
||||
case Closest:
|
||||
withers.sort(Comparator.comparingDouble(w -> PlayerUtils.distanceTo(w.foot)));
|
||||
case Furthest:
|
||||
withers.sort((w1, w2) -> {
|
||||
int sort = Double.compare(PlayerUtils.distanceTo(w1.foot), PlayerUtils.distanceTo(w2.foot));
|
||||
if (sort == 0) return 0;
|
||||
return sort > 0 ? -1 : 1;
|
||||
});
|
||||
case Random:
|
||||
Collections.shuffle(withers);
|
||||
}
|
||||
|
||||
wither = withers.get(0);
|
||||
}
|
||||
|
||||
// Soul sand/soil and skull slot
|
||||
FindItemResult findSoulSand = InvUtils.findInHotbar(Items.SOUL_SAND);
|
||||
if (!findSoulSand.found()) findSoulSand = InvUtils.findInHotbar(Items.SOUL_SOIL);
|
||||
FindItemResult findWitherSkull = InvUtils.findInHotbar(Items.WITHER_SKELETON_SKULL);
|
||||
|
||||
// Check for enough resources
|
||||
if (!findSoulSand.found() || !findWitherSkull.found()) {
|
||||
error("Not enough resources in hotbar");
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Build
|
||||
if (blockDelay.get() == 0) {
|
||||
// All in 1 tick
|
||||
|
||||
// Body
|
||||
BlockUtils.place(wither.foot, findSoulSand, rotate.get(), -50);
|
||||
BlockUtils.place(wither.foot.up(), findSoulSand, rotate.get(), -50);
|
||||
BlockUtils.place(wither.foot.up().offset(wither.axis, -1), findSoulSand, rotate.get(), -50);
|
||||
BlockUtils.place(wither.foot.up().offset(wither.axis, 1), findSoulSand, rotate.get(), -50);
|
||||
|
||||
// Head
|
||||
BlockUtils.place(wither.foot.up().up(), findWitherSkull, rotate.get(), -50);
|
||||
BlockUtils.place(wither.foot.up().up().offset(wither.axis, -1), findWitherSkull, rotate.get(), -50);
|
||||
BlockUtils.place(wither.foot.up().up().offset(wither.axis, 1), findWitherSkull, rotate.get(), -50);
|
||||
|
||||
|
||||
// Auto turnoff
|
||||
if (turnOff.get()) {
|
||||
wither = null;
|
||||
toggle();
|
||||
}
|
||||
|
||||
} else {
|
||||
// Delay
|
||||
if (blockTicksWaited < blockDelay.get() - 1) {
|
||||
blockTicksWaited++;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (wither.stage) {
|
||||
case 0:
|
||||
if (BlockUtils.place(wither.foot, findSoulSand, rotate.get(), -50)) wither.stage++;
|
||||
break;
|
||||
case 1:
|
||||
if (BlockUtils.place(wither.foot.up(), findSoulSand, rotate.get(), -50)) wither.stage++;
|
||||
break;
|
||||
case 2:
|
||||
if (BlockUtils.place(wither.foot.up().offset(wither.axis, -1), findSoulSand, rotate.get(), -50)) wither.stage++;
|
||||
break;
|
||||
case 3:
|
||||
if (BlockUtils.place(wither.foot.up().offset(wither.axis, 1), findSoulSand, rotate.get(), -50)) wither.stage++;
|
||||
break;
|
||||
case 4:
|
||||
if (BlockUtils.place(wither.foot.up().up(), findWitherSkull, rotate.get(), -50)) wither.stage++;
|
||||
break;
|
||||
case 5:
|
||||
if (BlockUtils.place(wither.foot.up().up().offset(wither.axis, -1), findWitherSkull, rotate.get(), -50)) wither.stage++;
|
||||
break;
|
||||
case 6:
|
||||
if (BlockUtils.place(wither.foot.up().up().offset(wither.axis, 1), findWitherSkull, rotate.get(), -50)) wither.stage++;
|
||||
break;
|
||||
case 7:
|
||||
// Auto turnoff
|
||||
if (turnOff.get()) {
|
||||
wither = null;
|
||||
toggle();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
witherTicksWaited = 0;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onRender(Render3DEvent event) {
|
||||
if (wither == null) return;
|
||||
|
||||
// Body
|
||||
event.renderer.box(wither.foot, sideColor.get(), lineColor.get(), shapeMode.get(), 0);
|
||||
event.renderer.box(wither.foot.up(), sideColor.get(), lineColor.get(), shapeMode.get(), 0);
|
||||
event.renderer.box(wither.foot.up().offset(wither.axis, -1), sideColor.get(), lineColor.get(), shapeMode.get(), 0);
|
||||
event.renderer.box(wither.foot.up().offset(wither.axis, 1), sideColor.get(), lineColor.get(), shapeMode.get(), 0);
|
||||
|
||||
// Head
|
||||
BlockPos midHead = wither.foot.up().up();
|
||||
BlockPos leftHead = wither.foot.up().up().offset(wither.axis, -1);
|
||||
BlockPos rightHead = wither.foot.up().up().offset(wither.axis, 1);
|
||||
|
||||
event.renderer.box((double) midHead.getX() + 0.2, (double) midHead.getX(), (double) midHead.getX() + 0.2,
|
||||
(double) midHead.getX() + 0.8, (double) midHead.getX() + 0.7, (double) midHead.getX() + 0.8,
|
||||
sideColor.get(), lineColor.get(), shapeMode.get(), 0);
|
||||
|
||||
event.renderer.box((double) leftHead.getX() + 0.2, (double) leftHead.getX(), (double) leftHead.getX() + 0.2,
|
||||
(double) leftHead.getX() + 0.8, (double) leftHead.getX() + 0.7, (double) leftHead.getX() + 0.8,
|
||||
sideColor.get(), lineColor.get(), shapeMode.get(), 0);
|
||||
|
||||
event.renderer.box((double) rightHead.getX() + 0.2, (double) rightHead.getX(), (double) rightHead.getX() + 0.2,
|
||||
(double) rightHead.getX() + 0.8, (double) rightHead.getX() + 0.7, (double) rightHead.getX() + 0.8,
|
||||
sideColor.get(), lineColor.get(), shapeMode.get(), 0);
|
||||
}
|
||||
|
||||
private boolean isValidSpawn(BlockPos blockPos, Direction direction) {
|
||||
// Withers are 3x3x1
|
||||
|
||||
// Check if y > (255 - 3)
|
||||
// Because withers are 3 blocks tall
|
||||
if (blockPos.getY() > 252) return false;
|
||||
|
||||
// Determine width from direction
|
||||
int widthX = 0;
|
||||
int widthZ = 0;
|
||||
|
||||
if (direction == Direction.EAST || direction == Direction.WEST) widthZ = 1;
|
||||
if (direction == Direction.NORTH || direction == Direction.SOUTH) widthX = 1;
|
||||
|
||||
|
||||
// Check for non air blocks and entities
|
||||
BlockPos.Mutable bp = new BlockPos.Mutable();
|
||||
for (int x = blockPos.getX() - widthX; x <= blockPos.getX() + widthX; x++) {
|
||||
for (int z = blockPos.getZ() - widthZ; z <= blockPos.getZ(); z++) {
|
||||
for (int y = blockPos.getY(); y <= blockPos.getY() + 2; y++) {
|
||||
bp.set(x, y, z);
|
||||
if (!mc.world.getBlockState(bp).getMaterial().isReplaceable()) return false;
|
||||
if (!mc.world.canPlace(Blocks.STONE.getDefaultState(), bp, ShapeContext.absent())) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public enum Priority {
|
||||
Closest,
|
||||
Furthest,
|
||||
Random
|
||||
}
|
||||
|
||||
private static class Wither {
|
||||
public int stage;
|
||||
// 0 = foot
|
||||
// 1 = mid body
|
||||
// 2 = left arm
|
||||
// 3 = right arm
|
||||
// 4 = mid head
|
||||
// 5 = left head
|
||||
// 6 = right head
|
||||
// 7 = end
|
||||
public BlockPos.Mutable foot = new BlockPos.Mutable();
|
||||
public Direction facing;
|
||||
public Direction.Axis axis;
|
||||
|
||||
public Wither set(BlockPos pos, Direction dir) {
|
||||
this.stage = 0;
|
||||
this.foot.set(pos);
|
||||
this.facing = dir;
|
||||
this.axis = dir.getAxis();
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
183
src/main/java/anticope/rejects/modules/BedrockWalk.java
Normal file
183
src/main/java/anticope/rejects/modules/BedrockWalk.java
Normal file
@@ -0,0 +1,183 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.FluidBlock;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.mixininterface.IVec3d;
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.DoubleSetting;
|
||||
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;
|
||||
|
||||
public class BedrockWalk extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Double> activationWindow = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("activation-window")
|
||||
.description("The area above the target Y level at which pull activates.")
|
||||
.min(0.2D)
|
||||
.max(5.0D)
|
||||
.sliderMin(0.2D)
|
||||
.sliderMax(5.0D)
|
||||
.defaultValue(0.5D)
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
private final Setting<Integer> driftToHeight = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("drift-to-height")
|
||||
.description("Y level to find blocks to drift onto.")
|
||||
.min(0)
|
||||
.max(256)
|
||||
.sliderMin(0)
|
||||
.sliderMax(256)
|
||||
.defaultValue(5)
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
private final Setting<Double> horizontalPullStrength = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("horizontal-pull")
|
||||
.description("The horizontal speed/strength at which you drift to the goal block.")
|
||||
.min(0.1D)
|
||||
.max(10.0D)
|
||||
.sliderMin(0.1D)
|
||||
.sliderMax(10.0D)
|
||||
.defaultValue(1.0D)
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
private final Setting<Double> verticalPullStrength = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("vertical-pull")
|
||||
.description("The vertical speed/strength at which you drift to the goal block.")
|
||||
.min(0.1D)
|
||||
.max(10.0D)
|
||||
.sliderMin(0.1D)
|
||||
.sliderMax(10.0D)
|
||||
.defaultValue(1.0D)
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
private final Setting<Integer> searchRadius = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("search-radius")
|
||||
.description("The radius at which tanuki mode searches for blocks (odd numbers only).")
|
||||
.min(3)
|
||||
.max(15)
|
||||
.sliderMin(3)
|
||||
.sliderMax(15)
|
||||
.defaultValue(3)
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
private final Setting<Boolean> updatePositionFailsafe = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("failsafe")
|
||||
.description("Updates your position to the top of the target block if you miss the jump.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
private final Setting<Double> failsafeWindow = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("failsafe-window")
|
||||
.description("Window below the target block to fall to trigger failsafe.")
|
||||
.min(0.01D)
|
||||
.max(1.0D)
|
||||
.sliderMin(0.01D)
|
||||
.sliderMax(1.0D)
|
||||
.defaultValue(0.1D)
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
private final Setting<Double> successfulLandingMargin = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("landing-margin")
|
||||
.description("The distance from a landing block to be considered a successful landing.")
|
||||
.min(0.01D)
|
||||
.max(10.0D)
|
||||
.sliderMin(0.01D)
|
||||
.sliderMax(10.0D)
|
||||
.defaultValue(1.0D)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final BlockPos.Mutable blockPos = new BlockPos.Mutable(0, 0, 0);
|
||||
private final ArrayList<BlockPos> validBlocks = new ArrayList<>();
|
||||
private final TreeMap<Double, BlockPos> sortedBlocks = new TreeMap<>();
|
||||
private final BlockPos.Mutable playerHorizontalPos = new BlockPos.Mutable();
|
||||
private boolean successfulLanding;
|
||||
|
||||
|
||||
public BedrockWalk() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "bedrock-walk", "Makes moving on bedrock easier.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
if (this.searchRadius.get() % 2 == 0) {
|
||||
info("%d is not valid for radius, rounding up", this.searchRadius.get());
|
||||
searchRadius.set(searchRadius.get() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Post event) {
|
||||
if (mc.player.getY() > driftToHeight.get() + activationWindow.get()) return;
|
||||
Vec3d targetPos = findNearestBlock(mc.player.getX(), driftToHeight.get() -1, mc.player.getZ());
|
||||
if (targetPos == null) return;
|
||||
if (mc.player.getY() == targetPos.getY() + 1.0D) return;
|
||||
if (mc.options.keyJump.isPressed()) return;
|
||||
if (updatePositionFailsafe.get() && !successfulLanding && mc.player.getY() < (driftToHeight.get() - failsafeWindow.get())) {
|
||||
mc.player.setPos(targetPos.getX(), targetPos.getY() + 1.0D, targetPos.getZ());
|
||||
}
|
||||
Vec3d normalizedDirection = targetPos.subtract(mc.player.getPos()).normalize();
|
||||
Vec3d velocity = mc.player.getVelocity();
|
||||
((IVec3d)mc.player.getVelocity()).set(
|
||||
velocity.x + normalizedDirection.x * horizontalPullStrength.get() * mc.getTickDelta(),
|
||||
velocity.y + normalizedDirection.y * verticalPullStrength.get() * mc.getTickDelta(),
|
||||
velocity.z + normalizedDirection.z * horizontalPullStrength.get() * mc.getTickDelta()
|
||||
);
|
||||
|
||||
successfulLanding = mc.player.getPos().isInRange(targetPos, successfulLandingMargin.get());
|
||||
}
|
||||
|
||||
private Vec3d findNearestBlock(double x, int y, double z) {
|
||||
validBlocks.clear();
|
||||
sortedBlocks.clear();
|
||||
|
||||
playerHorizontalPos.set(x, y, z);
|
||||
|
||||
int rad = searchRadius.get();
|
||||
for (int ix = 0; ix < rad; ix++) {
|
||||
for (int iy = 0; iy < rad; iy++) {
|
||||
BlockState block = mc.world.getBlockState(blockPos.set(x - ((rad - 1) / 2 - ix), y, x - ((rad - 1) / 2 - iy)));
|
||||
if (!block.isAir() &&!(block.getBlock() instanceof FluidBlock)) {
|
||||
validBlocks.add(blockPos.mutableCopy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
validBlocks.forEach(blockPos -> {
|
||||
sortedBlocks.put(blockPos.getSquaredDistance(x, y, z, true), blockPos);
|
||||
});
|
||||
|
||||
Map.Entry<Double, BlockPos> firstEntry = sortedBlocks.firstEntry();
|
||||
|
||||
if (firstEntry == null) return null;
|
||||
|
||||
return Vec3d.ofBottomCenter(firstEntry.getValue());
|
||||
}
|
||||
}
|
||||
146
src/main/java/anticope/rejects/modules/BlockIn.java
Normal file
146
src/main/java/anticope/rejects/modules/BlockIn.java
Normal file
@@ -0,0 +1,146 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.player.FindItemResult;
|
||||
import meteordevelopment.meteorclient.utils.player.InvUtils;
|
||||
import meteordevelopment.meteorclient.utils.player.PlayerUtils;
|
||||
import meteordevelopment.meteorclient.utils.world.BlockUtils;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.FallingBlock;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public class BlockIn extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Boolean> multiPlace = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("multi-place")
|
||||
.description("Whether to place all blocks in a single tick")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> center = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("center")
|
||||
.description("Whether to center to avoid obstructing placement")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> rotate = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("rotate")
|
||||
.description("Whether to rotate towards block placements.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> turnOff = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("turn-off")
|
||||
.description("Whether to turn off after finished placing.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> onlyOnGround = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("only-on-ground")
|
||||
.description("Only places when you are standing on blocks (not in midair).")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final BlockPos.Mutable bp = new BlockPos.Mutable();
|
||||
private boolean return_;
|
||||
|
||||
public BlockIn() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "block-in", "Block yourself in using any block.");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onPreTick(TickEvent.Pre event) {
|
||||
if (center.get()) PlayerUtils.centerPlayer();
|
||||
if (onlyOnGround.get() && !mc.player.isOnGround()) return;
|
||||
|
||||
return_ = false;
|
||||
|
||||
// Multiplace
|
||||
if (multiPlace.get()) {
|
||||
// Bottom
|
||||
boolean p1 = place(0, -1, 0);
|
||||
// Lower sides
|
||||
boolean p2 = place(1, 0, 0);
|
||||
boolean p3 = place(-1, 0, 0);
|
||||
boolean p4 = place(0, 0, 1);
|
||||
boolean p5 = place(0, 0, -1);
|
||||
// Upper sides
|
||||
boolean p6 = place(1, 1, 0);
|
||||
boolean p7 = place(-1, 1, 0);
|
||||
boolean p8 = place(0, 1, 1);
|
||||
boolean p9 = place(0, 1, -1);
|
||||
// Top
|
||||
boolean p10 = place(0, 2, 0);
|
||||
|
||||
// Turn off
|
||||
if (turnOff.get() && p1 && p2 && p3 && p4 && p5 && p6 && p7 && p8 && p9 && p10) toggle();
|
||||
|
||||
// No multiplace
|
||||
} else {
|
||||
// Bottom
|
||||
boolean p1 = place(0, -1, 0);
|
||||
if (return_) return;
|
||||
// Lower sides
|
||||
boolean p2 = place(1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p3 = place(-1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p4 = place(0, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p5 = place(0, 0, -1);
|
||||
if (return_) return;
|
||||
// Upper sides
|
||||
boolean p6 = place(1, 1, 0);
|
||||
if (return_) return;
|
||||
boolean p7 = place(-1, 1, 0);
|
||||
if (return_) return;
|
||||
boolean p8 = place(0, 1, 1);
|
||||
if (return_) return;
|
||||
boolean p9 = place(0, 1, -1);
|
||||
if (return_) return;
|
||||
// Top
|
||||
boolean p10 = place(0, 2, 0);
|
||||
|
||||
// Turn off
|
||||
if (turnOff.get() && p1 && p2 && p3 && p4 && p5 && p6 && p7 && p8 && p9 && p10) toggle();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean place(int x, int y, int z) {
|
||||
setBlockPos(x, y, z);
|
||||
FindItemResult findItemResult = InvUtils.findInHotbar(itemStack -> validItem(itemStack, bp));
|
||||
if (!BlockUtils.canPlace(bp)) return true;
|
||||
|
||||
if (BlockUtils.place(bp, findItemResult, rotate.get(), 100, true)) {
|
||||
return_ = true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setBlockPos(int x, int y, int z) {
|
||||
bp.set(mc.player.getX() + x, mc.player.getY() + y, mc.player.getZ() + z);
|
||||
}
|
||||
|
||||
private boolean validItem(ItemStack itemStack, BlockPos pos) {
|
||||
if (!(itemStack.getItem() instanceof BlockItem)) return false;
|
||||
Block block = ((BlockItem) itemStack.getItem()).getBlock();
|
||||
|
||||
if (!Block.isShapeFullCube(block.getDefaultState().getCollisionShape(mc.world, pos))) return false;
|
||||
return !(block instanceof FallingBlock) || !FallingBlock.canFallThrough(mc.world.getBlockState(pos));
|
||||
}
|
||||
}
|
||||
130
src/main/java/anticope/rejects/modules/BoatGlitch.java
Normal file
130
src/main/java/anticope/rejects/modules/BoatGlitch.java
Normal file
@@ -0,0 +1,130 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.entity.BoatMoveEvent;
|
||||
import meteordevelopment.meteorclient.events.meteor.KeyEvent;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import meteordevelopment.meteorclient.utils.misc.input.KeyAction;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket;
|
||||
import net.minecraft.util.Hand;
|
||||
|
||||
public class BoatGlitch extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Boolean> toggleAfter = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("toggle-after")
|
||||
.description("Disables the module when finished.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> remount = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("remount")
|
||||
.description("Remounts the boat when finished.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private Entity boat = null;
|
||||
private int dismountTicks = 0;
|
||||
private int remountTicks = 0;
|
||||
private boolean dontPhase = true;
|
||||
private boolean boatPhaseEnabled;
|
||||
|
||||
public BoatGlitch() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "boat-glitch", "Glitches your boat into the block beneath you. Dismount to trigger.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
dontPhase = true;
|
||||
dismountTicks = 0;
|
||||
remountTicks = 0;
|
||||
boat = null;
|
||||
if (Modules.get().isActive(BoatPhase.class)) {
|
||||
boatPhaseEnabled = true;
|
||||
Modules.get().get(BoatPhase.class).toggle();
|
||||
}
|
||||
else {
|
||||
boatPhaseEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivate() {
|
||||
if (boat != null) {
|
||||
boat.noClip = false;
|
||||
boat = null;
|
||||
}
|
||||
if (boatPhaseEnabled && !(Modules.get().isActive(BoatPhase.class))) {
|
||||
Modules.get().get(BoatPhase.class).toggle();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onBoatMove(BoatMoveEvent event) {
|
||||
if (dismountTicks == 0 && !dontPhase) {
|
||||
if (boat != event.boat) {
|
||||
if (boat != null) {
|
||||
boat.noClip = false;
|
||||
}
|
||||
if (mc.player.getVehicle() != null && event.boat == mc.player.getVehicle()) {
|
||||
boat = event.boat;
|
||||
}
|
||||
else {
|
||||
boat = null;
|
||||
}
|
||||
}
|
||||
if (boat != null) {
|
||||
boat.noClip = true;
|
||||
//boat.pushSpeedReduction = 1;
|
||||
dismountTicks = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Post event) {
|
||||
if (dismountTicks > 0) {
|
||||
dismountTicks--;
|
||||
if (dismountTicks == 0) {
|
||||
if (boat != null) {
|
||||
boat.noClip = false;
|
||||
if (toggleAfter.get() && !remount.get()) {
|
||||
toggle();
|
||||
}
|
||||
else if (remount.get()) {
|
||||
remountTicks = 5;
|
||||
}
|
||||
}
|
||||
dontPhase = true;
|
||||
}
|
||||
}
|
||||
if (remountTicks > 0) {
|
||||
remountTicks--;
|
||||
if (remountTicks == 0) {
|
||||
mc.getNetworkHandler().sendPacket( PlayerInteractEntityC2SPacket.interact(boat, false, Hand.MAIN_HAND));
|
||||
if (toggleAfter.get()) {
|
||||
toggle();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@EventHandler
|
||||
private void onKey(KeyEvent event) {
|
||||
if (event.key == mc.options.keySneak.getDefaultKey().getCode() && event.action == KeyAction.Press) {
|
||||
if (mc.player.getVehicle() != null && mc.player.getVehicle().getType().equals(EntityType.BOAT)) {
|
||||
dontPhase = false;
|
||||
boat = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
137
src/main/java/anticope/rejects/modules/BoatPhase.java
Normal file
137
src/main/java/anticope/rejects/modules/BoatPhase.java
Normal file
@@ -0,0 +1,137 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.entity.BoatMoveEvent;
|
||||
import meteordevelopment.meteorclient.mixininterface.IVec3d;
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.DoubleSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import meteordevelopment.meteorclient.utils.player.PlayerUtils;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public class BoatPhase extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
private final SettingGroup sgSpeeds = settings.createGroup("Speeds");
|
||||
|
||||
private final Setting<Boolean> lockYaw = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("lock-boat-yaw")
|
||||
.description("Locks boat yaw to the direction you're facing.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> verticalControl = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("vertical-control")
|
||||
.description("Whether or not space/ctrl can be used to move vertically.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> adjustHorizontalSpeed = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("adjust-horizontal-speed")
|
||||
.description("Whether or not horizontal speed is modified.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> fall = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("fall")
|
||||
.description("Toggles vertical glide.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Double> horizontalSpeed = sgSpeeds.add(new DoubleSetting.Builder()
|
||||
.name("horizontal-speed")
|
||||
.description("Horizontal speed in blocks per second.")
|
||||
.defaultValue(10)
|
||||
.min(0)
|
||||
.sliderMax(50)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Double> verticalSpeed = sgSpeeds.add(new DoubleSetting.Builder()
|
||||
.name("vertical-speed")
|
||||
.description("Vertical speed in blocks per second.")
|
||||
.defaultValue(5)
|
||||
.min(0)
|
||||
.sliderMax(20)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Double> fallSpeed = sgSpeeds.add(new DoubleSetting.Builder()
|
||||
.name("fall-speed")
|
||||
.description("How fast you fall in blocks per second.")
|
||||
.defaultValue(0.625)
|
||||
.min(0)
|
||||
.sliderMax(10)
|
||||
.build()
|
||||
);
|
||||
|
||||
private BoatEntity boat = null;
|
||||
|
||||
public BoatPhase() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "boat-phase", "Phase through blocks using a boat.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
boat = null;
|
||||
if (Modules.get().isActive(BoatGlitch.class)) Modules.get().get(BoatGlitch.class).toggle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivate() {
|
||||
if (boat != null) {
|
||||
boat.noClip = false;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onBoatMove(BoatMoveEvent event) {
|
||||
if (mc.player.getVehicle() != null && mc.player.getVehicle().getType().equals(EntityType.BOAT)) {
|
||||
if (boat != mc.player.getVehicle()) {
|
||||
if (boat != null) {
|
||||
boat.noClip = false;
|
||||
}
|
||||
boat = (BoatEntity) mc.player.getVehicle();
|
||||
}
|
||||
} else boat = null;
|
||||
|
||||
if (boat != null) {
|
||||
boat.noClip = true;
|
||||
//boat.pushSpeedReduction = 1;
|
||||
|
||||
if (lockYaw.get()) {
|
||||
boat.setYaw(mc.player.getYaw());
|
||||
}
|
||||
|
||||
Vec3d vel;
|
||||
|
||||
if (adjustHorizontalSpeed.get()) {
|
||||
vel = PlayerUtils.getHorizontalVelocity(horizontalSpeed.get());
|
||||
}
|
||||
else {
|
||||
vel = boat.getVelocity();
|
||||
}
|
||||
|
||||
double velX = vel.x;
|
||||
double velY = 0;
|
||||
double velZ = vel.z;
|
||||
|
||||
if (verticalControl.get()) {
|
||||
if (mc.options.keyJump.isPressed()) velY += verticalSpeed.get() / 20;
|
||||
if (mc.options.keySprint.isPressed()) velY -= verticalSpeed.get() / 20;
|
||||
else if (fall.get()) velY -= fallSpeed.get() / 20;
|
||||
} else if (fall.get()) velY -= fallSpeed.get() / 20;
|
||||
|
||||
((IVec3d) boat.getVelocity()).set(velX,velY,velZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
38
src/main/java/anticope/rejects/modules/Boost.java
Normal file
38
src/main/java/anticope/rejects/modules/Boost.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import meteordevelopment.meteorclient.settings.DoubleSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
|
||||
public class Boost extends Module {
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Double> strength = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("strength")
|
||||
.description("Strength to yeet you with.")
|
||||
.defaultValue(4.0)
|
||||
.min(0.5)
|
||||
.sliderMax(10)
|
||||
.build()
|
||||
);
|
||||
|
||||
public Boost() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "boost", "Works like a dash move.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
if (mc.player == null) {
|
||||
this.toggle();
|
||||
return;
|
||||
}
|
||||
Vec3d v = mc.player.getRotationVecClient().multiply(strength.get());
|
||||
mc.player.addVelocity(v.getX(), v.getY(), v.getZ());
|
||||
this.toggle();
|
||||
}
|
||||
}
|
||||
157
src/main/java/anticope/rejects/modules/ChatBot.java
Normal file
157
src/main/java/anticope/rejects/modules/ChatBot.java
Normal file
@@ -0,0 +1,157 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtString;
|
||||
import net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket;
|
||||
|
||||
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.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.orbit.EventHandler;
|
||||
import meteordevelopment.starscript.Script;
|
||||
import meteordevelopment.starscript.compiler.Compiler;
|
||||
import meteordevelopment.starscript.compiler.Parser;
|
||||
import meteordevelopment.starscript.utils.StarscriptError;
|
||||
|
||||
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("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()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> help = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("help")
|
||||
.description("Add help command.")
|
||||
.defaultValue(true)
|
||||
.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.getNetworkHandler().sendPacket(new ChatMessageC2SPacket("Avaliable commands: " + String.join(", ", commands.keySet())));
|
||||
return;
|
||||
}
|
||||
for (String cmd : commands.keySet()) {
|
||||
if (msg.endsWith(prefix.get()+cmd)) {
|
||||
Script script = compile(commands.get(cmd));
|
||||
if (script == null) mc.player.sendChatMessage("An error occurred");
|
||||
try {
|
||||
mc.player.sendChatMessage(MeteorStarscript.ss.run(script));
|
||||
} catch (StarscriptError e) {
|
||||
MeteorStarscript.printChatError(e);
|
||||
mc.player.sendChatMessage("An error occurred");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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)).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);
|
||||
if (result.hasErrors()) {
|
||||
MeteorStarscript.printChatError(result.errors.get(0));
|
||||
return null;
|
||||
}
|
||||
return Compiler.compile(result);
|
||||
}
|
||||
}
|
||||
43
src/main/java/anticope/rejects/modules/ColorSigns.java
Normal file
43
src/main/java/anticope/rejects/modules/ColorSigns.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket;
|
||||
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.packets.PacketEvent;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket;
|
||||
|
||||
public class ColorSigns extends Module {
|
||||
|
||||
public ColorSigns() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "color-signs", "Allows you to use colors on signs on NON-PAPER servers (use \"&\" for color symbols)");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onPacketSend(PacketEvent.Send event) {
|
||||
if (event.packet instanceof GameJoinS2CPacket) {
|
||||
checkWarning();
|
||||
return;
|
||||
}
|
||||
if (!(event.packet instanceof UpdateSignC2SPacket)) return;
|
||||
UpdateSignC2SPacket p = (UpdateSignC2SPacket)event.packet;
|
||||
for (int l = 0; l < p.getText().length; l++) {
|
||||
String newText = p.getText()[l].replaceAll("(?i)\u00a7|&([0-9A-FK-OR])", "\u00a7\u00a7$1$1");
|
||||
p.getText()[l] = newText;
|
||||
}
|
||||
event.packet = p;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
super.onActivate();
|
||||
checkWarning();
|
||||
}
|
||||
|
||||
private void checkWarning() {
|
||||
String brand = mc.player.getServerBrand();
|
||||
if (brand == null) return;
|
||||
if (brand.contains("Paper")) warning("You are on a paper server. Color signs won't work here");
|
||||
}
|
||||
}
|
||||
213
src/main/java/anticope/rejects/modules/Confuse.java
Normal file
213
src/main/java/anticope/rejects/modules/Confuse.java
Normal file
@@ -0,0 +1,213 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.meteorclient.events.render.Render3DEvent;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.Utils;
|
||||
import meteordevelopment.meteorclient.utils.entity.SortPriority;
|
||||
import meteordevelopment.meteorclient.utils.entity.TargetUtils;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.RaycastContext;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// Too much much spaghetti!
|
||||
// -StormyBytes
|
||||
|
||||
public class Confuse extends Module {
|
||||
|
||||
public enum Mode {
|
||||
RandomTP,
|
||||
Switch,
|
||||
Circle
|
||||
}
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Mode> mode = sgGeneral.add(new EnumSetting.Builder<Mode>()
|
||||
.name("mode")
|
||||
.defaultValue(Mode.RandomTP)
|
||||
.description("Mode")
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> delay = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("delay")
|
||||
.description("Delay")
|
||||
.defaultValue(3)
|
||||
.min(0)
|
||||
.sliderMax(20)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> range = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("radius")
|
||||
.description("Range to confuse opponents")
|
||||
.defaultValue(6)
|
||||
.min(0).sliderMax(10)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<SortPriority> priority = sgGeneral.add(new EnumSetting.Builder<SortPriority>()
|
||||
.name("priority")
|
||||
.description("Targetting priority")
|
||||
.defaultValue(SortPriority.LowestHealth)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> circleSpeed = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("circle-speed")
|
||||
.description("Circle mode speed")
|
||||
.defaultValue(10)
|
||||
.min(1)
|
||||
.sliderMax(180)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> moveThroughBlocks = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("move-through-blocks")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> budgetGraphics = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("budget-graphics")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<SettingColor> circleColor = sgGeneral.add(new ColorSetting.Builder()
|
||||
.name("circle-color")
|
||||
.description("Color for circle rendering")
|
||||
.defaultValue(new SettingColor(0, 255, 0))
|
||||
.visible(budgetGraphics::get)
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
int delayWaited = 0;
|
||||
double circleProgress = 0;
|
||||
double addition = 0.0;
|
||||
Entity target = null;
|
||||
|
||||
public Confuse() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "confuse", "Makes your enemies shit themselves");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
delayWaited = 0;
|
||||
circleProgress = 0;
|
||||
addition = 0.0;
|
||||
target = null;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Pre event) {
|
||||
|
||||
// Delay
|
||||
delayWaited++;
|
||||
if (delayWaited < delay.get()) return;
|
||||
delayWaited = 0;
|
||||
|
||||
|
||||
// Targetting
|
||||
target = TargetUtils.getPlayerTarget(range.get(), priority.get());
|
||||
|
||||
if (target == null) return;
|
||||
|
||||
Vec3d entityPos = target.getPos();
|
||||
Vec3d playerPos = mc.player.getPos();
|
||||
Random r = new Random();
|
||||
BlockHitResult hit;
|
||||
int halfRange = range.get() / 2;
|
||||
|
||||
switch (mode.get()) {
|
||||
case RandomTP:
|
||||
double x = r.nextDouble() * range.get() - halfRange;
|
||||
double y = 0;
|
||||
double z = r.nextDouble() * range.get() - halfRange;
|
||||
Vec3d addend = new Vec3d(x, y, z);
|
||||
Vec3d goal = entityPos.add(addend);
|
||||
if (mc.world.getBlockState(new BlockPos(goal.x, goal.y, goal.z)).getBlock() != Blocks.AIR) {
|
||||
goal = new Vec3d(x, playerPos.y, z);
|
||||
}
|
||||
if (mc.world.getBlockState(new BlockPos(goal.x, goal.y, goal.z)).getBlock() == Blocks.AIR) {
|
||||
hit = mc.world.raycast(new RaycastContext(mc.player.getPos(),goal, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player));
|
||||
if (!moveThroughBlocks.get() && hit.isInsideBlock()) {
|
||||
delayWaited = (int) (delay.get() - 1);
|
||||
break;
|
||||
}
|
||||
mc.player.updatePosition(goal.x, goal.y, goal.z);
|
||||
} else {
|
||||
delayWaited = (int) (delay.get() - 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case Switch:
|
||||
Vec3d diff = entityPos.subtract(playerPos);
|
||||
Vec3d diff1 = new Vec3d(Utils.clamp(diff.x, -halfRange, halfRange), Utils.clamp(diff.y, -halfRange, halfRange), Utils.clamp(diff.z, -halfRange, halfRange));
|
||||
Vec3d goal2 = entityPos.add(diff1);
|
||||
hit = mc.world.raycast(new RaycastContext(mc.player.getPos(), goal2, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player));
|
||||
if (!moveThroughBlocks.get() && hit.isInsideBlock()) {
|
||||
delayWaited = (int) (delay.get() - 1);
|
||||
break;
|
||||
}
|
||||
mc.player.updatePosition(goal2.x, goal2.y, goal2.z);
|
||||
break;
|
||||
|
||||
case Circle:
|
||||
delay.set(0);
|
||||
circleProgress += circleSpeed.get();
|
||||
if (circleProgress > 360) circleProgress -= 360;
|
||||
double rad = Math.toRadians(circleProgress);
|
||||
double sin = Math.sin(rad) * 3;
|
||||
double cos = Math.cos(rad) * 3;
|
||||
Vec3d current = new Vec3d(entityPos.x + sin, playerPos.y, entityPos.z + cos);
|
||||
hit = mc.world.raycast(new RaycastContext(mc.player.getPos(), current, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player));
|
||||
if (!moveThroughBlocks.get() && hit.isInsideBlock())
|
||||
break;
|
||||
mc.player.updatePosition(current.x, current.y, current.z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onRender(Render3DEvent event) {
|
||||
if (target == null) return;
|
||||
|
||||
boolean flag = budgetGraphics.get();
|
||||
Vec3d last = null;
|
||||
addition += flag ? 0 : 1.0;
|
||||
if (addition > 360) addition = 0;
|
||||
for (int i = 0; i < 360; i += flag ? 7 : 1) {
|
||||
Color c1;
|
||||
if (flag) c1 = circleColor.get();
|
||||
else {
|
||||
double rot = (255.0 * 3) * (((((double) i) + addition) % 360) / 360.0);
|
||||
int seed = (int) Math.floor(rot / 255.0);
|
||||
double current = rot % 255;
|
||||
double red = seed == 0 ? current : (seed == 1 ? Math.abs(current - 255) : 0);
|
||||
double green = seed == 1 ? current : (seed == 2 ? Math.abs(current - 255) : 0);
|
||||
double blue = seed == 2 ? current : (seed == 0 ? Math.abs(current - 255) : 0);
|
||||
c1 = new Color((int) red, (int) green, (int) blue);
|
||||
}
|
||||
Vec3d tp = target.getPos();
|
||||
double rad = Math.toRadians(i);
|
||||
double sin = Math.sin(rad) * 3;
|
||||
double cos = Math.cos(rad) * 3;
|
||||
Vec3d c = new Vec3d(tp.x + sin, tp.y + target.getHeight() / 2, tp.z + cos);
|
||||
if (last != null) event.renderer.line(last.x, last.y, last.z, c.x, c.y, c.z, c1);
|
||||
last = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
184
src/main/java/anticope/rejects/modules/CoordLogger.java
Normal file
184
src/main/java/anticope/rejects/modules/CoordLogger.java
Normal file
@@ -0,0 +1,184 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.meteorclient.events.packets.PacketEvent;
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.DoubleSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.player.ChatUtils;
|
||||
import meteordevelopment.meteorclient.utils.player.PlayerUtils;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.passive.TameableEntity;
|
||||
import net.minecraft.network.packet.s2c.play.EntityPositionS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.WorldEventS2CPacket;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.text.BaseText;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class CoordLogger extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
private final SettingGroup sgTeleports = settings.createGroup("Teleports");
|
||||
private final SettingGroup sgWorldEvents = settings.createGroup("World Events");
|
||||
private final SettingGroup sgSounds = settings.createGroup("Sounds");
|
||||
|
||||
// General
|
||||
|
||||
private final Setting<Double> minDistance = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("minimum-distance")
|
||||
.description("Minimum distance to log event.")
|
||||
.min(5)
|
||||
.max(100)
|
||||
.sliderMin(5)
|
||||
.sliderMax(100)
|
||||
.defaultValue(10)
|
||||
.build()
|
||||
);
|
||||
|
||||
// Teleports
|
||||
|
||||
private final Setting<Boolean> players = sgTeleports.add(new BoolSetting.Builder()
|
||||
.name("players")
|
||||
.description("Logs player teleports.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> wolves = sgTeleports.add(new BoolSetting.Builder()
|
||||
.name("wolves")
|
||||
.description("Logs wolf teleports.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
// World events
|
||||
|
||||
private final Setting<Boolean> enderDragons = sgWorldEvents.add(new BoolSetting.Builder()
|
||||
.name("ender-dragons")
|
||||
.description("Logs killed ender dragons.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> endPortals = sgWorldEvents.add(new BoolSetting.Builder()
|
||||
.name("end-portals")
|
||||
.description("Logs opened end portals.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> withers = sgWorldEvents.add(new BoolSetting.Builder()
|
||||
.name("withers")
|
||||
.description("Logs wither spawns.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
private final Setting<Boolean> otherEvents = sgWorldEvents.add(new BoolSetting.Builder()
|
||||
.name("other-global-events")
|
||||
.description("Logs other global events.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
// Sounds
|
||||
|
||||
private final Setting<Boolean> thunder = sgSounds.add(new BoolSetting.Builder()
|
||||
.name("thunder")
|
||||
.description("Logs thunder sounds.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
public CoordLogger() {
|
||||
super(MeteorRejectsAddon.CATEGORY,"coord-logger", "Logs coordinates of various events. Might not work on Spigot/Paper servers.");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onPacketReceive(PacketEvent.Receive event) {
|
||||
// Teleports
|
||||
if (event.packet instanceof EntityPositionS2CPacket) {
|
||||
EntityPositionS2CPacket packet = (EntityPositionS2CPacket) event.packet;
|
||||
|
||||
try {
|
||||
Entity entity = mc.world.getEntityById(packet.getId());
|
||||
|
||||
// Player teleport
|
||||
if (entity.getType().equals(EntityType.PLAYER) && players.get()) {
|
||||
Vec3d packetPosition = new Vec3d(packet.getX(), packet.getY(), packet.getZ());
|
||||
Vec3d playerPosition = entity.getPos();
|
||||
|
||||
if (playerPosition.distanceTo(packetPosition) >= minDistance.get()) {
|
||||
info(formatMessage("Player '" + entity.getEntityName() + "' has teleported to ", packetPosition));
|
||||
}
|
||||
}
|
||||
|
||||
// World teleport
|
||||
else if (entity.getType().equals(EntityType.WOLF) && wolves.get()) {
|
||||
Vec3d packetPosition = new Vec3d(packet.getX(), packet.getY(), packet.getZ());
|
||||
Vec3d wolfPosition = entity.getPos();
|
||||
|
||||
UUID ownerUuid = ((TameableEntity) entity).getOwnerUuid();
|
||||
|
||||
if (ownerUuid != null && wolfPosition.distanceTo(packetPosition) >= minDistance.get()) {
|
||||
info(formatMessage("Wolf has teleported to ", packetPosition));
|
||||
}
|
||||
}
|
||||
} catch(NullPointerException ignored) {}
|
||||
|
||||
// World events
|
||||
} else if (event.packet instanceof WorldEventS2CPacket) {
|
||||
WorldEventS2CPacket worldEventS2CPacket = (WorldEventS2CPacket) event.packet;
|
||||
|
||||
if (worldEventS2CPacket.isGlobal()) {
|
||||
// Min distance
|
||||
if (PlayerUtils.distanceTo(worldEventS2CPacket.getPos()) <= minDistance.get()) return;
|
||||
|
||||
switch (worldEventS2CPacket.getEventId()) {
|
||||
case 1023:
|
||||
if (withers.get()) info(formatMessage("Wither spawned at ", worldEventS2CPacket.getPos()));
|
||||
break;
|
||||
case 1038:
|
||||
if (endPortals.get()) info(formatMessage("End portal opened at ", worldEventS2CPacket.getPos()));
|
||||
break;
|
||||
case 1028:
|
||||
if (enderDragons.get()) info(formatMessage("Ender dragon killed at ", worldEventS2CPacket.getPos()));
|
||||
break;
|
||||
default:
|
||||
if (otherEvents.get()) info(formatMessage("Unknown global event at ", worldEventS2CPacket.getPos()));
|
||||
}
|
||||
}
|
||||
|
||||
// Sounds
|
||||
} else if (thunder.get() && event.packet instanceof PlaySoundS2CPacket playSoundS2CPacket) {
|
||||
// Check for thunder sound
|
||||
if (playSoundS2CPacket.getSound() != SoundEvents.ENTITY_LIGHTNING_BOLT_IMPACT) return;
|
||||
|
||||
// Min distance
|
||||
if (PlayerUtils.distanceTo(playSoundS2CPacket.getX(), playSoundS2CPacket.getY(), playSoundS2CPacket.getZ()) <= minDistance.get()) return;
|
||||
|
||||
info("Thunder noise at %d %d %d", playSoundS2CPacket.getX(), playSoundS2CPacket.getY(), playSoundS2CPacket.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
public BaseText formatMessage(String message, Vec3d coords) {
|
||||
BaseText text = new LiteralText(message);
|
||||
text.append(ChatUtils.formatCoords(coords));
|
||||
text.append(Formatting.GRAY.toString()+".");
|
||||
return text;
|
||||
}
|
||||
|
||||
public BaseText formatMessage(String message, BlockPos coords) {
|
||||
return formatMessage(message, new Vec3d(coords.getX(), coords.getY(), coords.getZ()));
|
||||
}
|
||||
}
|
||||
119
src/main/java/anticope/rejects/modules/CustomPackets.java
Normal file
119
src/main/java/anticope/rejects/modules/CustomPackets.java
Normal file
@@ -0,0 +1,119 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import anticope.rejects.events.CustomPayloadEvent;
|
||||
import com.google.gson.*;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.player.ChatUtils;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.text.*;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
public class CustomPackets extends Module {
|
||||
private static final Gson GSON_NON_PRETTY = new GsonBuilder().enableComplexMapKeySerialization().disableHtmlEscaping().create();
|
||||
private static final Type BADLION_MODS_TYPE = new TypeToken<Map<String, BadlionMod>>() {}.getType();
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
private final SettingGroup sgBadlion = settings.createGroup("Bad Lion");
|
||||
|
||||
|
||||
private final Setting<Boolean> unknownPackets = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("unknown-packets")
|
||||
.description("Whether to print unknown packets.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> mods = sgBadlion.add(new BoolSetting.Builder()
|
||||
.name("disallowed-mods")
|
||||
.description("Whether to print what badlion mods are disallowed.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
public CustomPackets() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "custom-packets", "Handles different non-vanilla protocols.");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onCustomPayloadPacket(CustomPayloadEvent event) {
|
||||
switch (event.packet.getChannel().toString()) {
|
||||
case "badlion:mods" -> onBadlionModsPacket(event);
|
||||
default -> onUnknownPacket(event);
|
||||
}
|
||||
}
|
||||
|
||||
private void onUnknownPacket(CustomPayloadEvent event) {
|
||||
if (!unknownPackets.get()) return;
|
||||
BaseText text = new LiteralText(event.packet.getChannel().toString());
|
||||
text.setStyle(text.getStyle()
|
||||
.withHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new LiteralText(readString(event.packet.getData()))
|
||||
)));
|
||||
info(text);
|
||||
}
|
||||
|
||||
private void onBadlionModsPacket(CustomPayloadEvent event) {
|
||||
if (!mods.get()) return;
|
||||
String json = readString(event.packet.getData());
|
||||
Map<String, BadlionMod> mods = GSON_NON_PRETTY.fromJson(json, BADLION_MODS_TYPE);
|
||||
ChatUtils.sendMsg("Badlion", format("Mods", formatMods(mods)));
|
||||
event.cancel();
|
||||
}
|
||||
|
||||
private BaseText format(String type, BaseText message) {
|
||||
BaseText text = new LiteralText(String.format("[%s%s%s]",
|
||||
Formatting.AQUA,
|
||||
type,
|
||||
Formatting.GRAY
|
||||
));
|
||||
text.append(" ");
|
||||
text.append(message);
|
||||
return text;
|
||||
}
|
||||
|
||||
private BaseText format(String type, String message) {
|
||||
return format(type, new LiteralText(message));
|
||||
}
|
||||
|
||||
private String readString(PacketByteBuf data) {
|
||||
return data.readCharSequence(
|
||||
data.readableBytes(),
|
||||
StandardCharsets.UTF_8
|
||||
).toString();
|
||||
}
|
||||
|
||||
private BaseText formatMods(Map<String, BadlionMod> mods) {
|
||||
BaseText text = new LiteralText("Disallowed mods: \n");
|
||||
|
||||
mods.forEach((name, data) -> {
|
||||
BaseText modLine = new LiteralText(String.format("- %s%s%s ", Formatting.YELLOW, name, Formatting.GRAY));
|
||||
modLine.append(data.disabled ? "disabled" : "enabled");
|
||||
modLine.append("\n");
|
||||
if (data.extra_data != null) {
|
||||
modLine.setStyle(modLine.getStyle()
|
||||
.withHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new LiteralText(data.extra_data.toString())
|
||||
)));
|
||||
}
|
||||
text.append(modLine);
|
||||
});
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
private static class BadlionMod {
|
||||
private boolean disabled;
|
||||
private JsonObject extra_data;
|
||||
private JsonObject settings;
|
||||
}
|
||||
}
|
||||
158
src/main/java/anticope/rejects/modules/InteractionMenu.java
Normal file
158
src/main/java/anticope/rejects/modules/InteractionMenu.java
Normal file
@@ -0,0 +1,158 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import anticope.rejects.gui.screens.InteractionScreen;
|
||||
import it.unimi.dsi.fastutil.objects.Object2BooleanMap;
|
||||
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.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.Utils;
|
||||
import meteordevelopment.meteorclient.utils.misc.Keybind;
|
||||
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
|
||||
import net.minecraft.client.render.debug.DebugRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtString;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class InteractionMenu extends Module {
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
private final SettingGroup sgStyle = settings.createGroup("Style");
|
||||
|
||||
private final Setting<Object2BooleanMap<EntityType<?>>> entities = sgGeneral.add(new EntityTypeListSetting.Builder()
|
||||
.name("entities")
|
||||
.description("Entities")
|
||||
.defaultValue(Utils.asO2BMap(
|
||||
EntityType.PLAYER))
|
||||
.build()
|
||||
);
|
||||
public final Setting<Keybind> keybind = sgGeneral.add(new KeybindSetting.Builder()
|
||||
.name("keybind")
|
||||
.description("The keybind to open.")
|
||||
.action(this::onKey)
|
||||
.build()
|
||||
);
|
||||
|
||||
// Style
|
||||
public final Setting<SettingColor> selectedDotColor = sgStyle.add(new ColorSetting.Builder()
|
||||
.name("selected-dot-color")
|
||||
.description("Color of the dot when selected.")
|
||||
.defaultValue(new SettingColor(76, 255, 0))
|
||||
.build()
|
||||
);
|
||||
public final Setting<SettingColor> dotColor = sgStyle.add(new ColorSetting.Builder()
|
||||
.name("dot-color")
|
||||
.description("Color of the dot when.")
|
||||
.defaultValue(new SettingColor(0, 148, 255))
|
||||
.build()
|
||||
);
|
||||
public final Setting<SettingColor> backgroundColor = sgStyle.add(new ColorSetting.Builder()
|
||||
.name("background-color")
|
||||
.description("Color of the background.")
|
||||
.defaultValue(new SettingColor(128, 128, 128, 128))
|
||||
.build()
|
||||
);
|
||||
public final Setting<SettingColor> borderColor = sgStyle.add(new ColorSetting.Builder()
|
||||
.name("border-color")
|
||||
.description("Color of the border.")
|
||||
.defaultValue(new SettingColor(0,0,0))
|
||||
.build()
|
||||
);
|
||||
public final Setting<SettingColor> textColor = sgStyle.add(new ColorSetting.Builder()
|
||||
.name("text-color")
|
||||
.description("Color of the text.")
|
||||
.defaultValue(new SettingColor(255,255,255))
|
||||
.build()
|
||||
);
|
||||
|
||||
public final HashMap<String,String> messages = new HashMap<>();
|
||||
private String currMsgK = "", currMsgV = "";
|
||||
|
||||
public InteractionMenu() {
|
||||
super(MeteorRejectsAddon.CATEGORY,"interaction-menu","An interaction screen when looking at an entity.");
|
||||
}
|
||||
|
||||
public void onKey() {
|
||||
if (mc.currentScreen != null) return;
|
||||
Optional<Entity> lookingAt = DebugRenderer.getTargetedEntity(mc.player, 20);
|
||||
if (lookingAt.isPresent()) {
|
||||
Entity e = lookingAt.get();
|
||||
if (entities.get().getBoolean(e.getType())) {
|
||||
mc.setScreen(new InteractionScreen(e, this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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)).minWidth(100).expandX().widget();
|
||||
textBoxV.action = () -> {
|
||||
currMsgV = textBoxV.get();
|
||||
};
|
||||
WPlus add = table.add(theme.plus()).widget();
|
||||
add.action = () -> {
|
||||
if (currMsgK != "" && currMsgV != "") {
|
||||
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);
|
||||
}
|
||||
}
|
||||
269
src/main/java/anticope/rejects/modules/Lavacast.java
Normal file
269
src/main/java/anticope/rejects/modules/Lavacast.java
Normal file
@@ -0,0 +1,269 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.render.Render3DEvent;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.renderer.ShapeMode;
|
||||
import meteordevelopment.meteorclient.settings.IntSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.utils.player.FindItemResult;
|
||||
import meteordevelopment.meteorclient.utils.player.InvUtils;
|
||||
import meteordevelopment.meteorclient.utils.player.Rotations;
|
||||
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.RaycastContext;
|
||||
|
||||
|
||||
public class Lavacast extends Module {
|
||||
|
||||
private enum Stage {
|
||||
None,
|
||||
LavaDown,
|
||||
LavaUp,
|
||||
WaterDown,
|
||||
WaterUp
|
||||
}
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
private final SettingGroup sgShape = settings.createGroup("Shape", false);
|
||||
private final Setting<Integer> tickInterval = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("tick-interval")
|
||||
.description("Interval")
|
||||
.defaultValue(2)
|
||||
.min(0)
|
||||
.sliderMax(20)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> distMin = sgShape.add(new IntSetting.Builder()
|
||||
.name("minimum-distance")
|
||||
.description("Top plane cutoff")
|
||||
.defaultValue(5)
|
||||
.min(0)
|
||||
.sliderMax(10)
|
||||
.build()
|
||||
);
|
||||
private final Setting<Integer> lavaDownMult = sgShape.add(new IntSetting.Builder()
|
||||
.name("lava-down-mulipiler")
|
||||
.description("Controlls the shape of the cast")
|
||||
.defaultValue(40)
|
||||
.min(1)
|
||||
.sliderMax(100)
|
||||
.build()
|
||||
);
|
||||
private final Setting<Integer> lavaUpMult = sgShape.add(new IntSetting.Builder()
|
||||
.name("lava-up-mulipiler")
|
||||
.description("Controlls the shape of the cast")
|
||||
.defaultValue(8)
|
||||
.min(1)
|
||||
.sliderMax(100)
|
||||
.build()
|
||||
);
|
||||
private final Setting<Integer> waterDownMult = sgShape.add(new IntSetting.Builder()
|
||||
.name("water-down-mulipiler")
|
||||
.description("Controlls the shape of the cast")
|
||||
.defaultValue(4)
|
||||
.min(1)
|
||||
.sliderMax(100)
|
||||
.build()
|
||||
);
|
||||
private final Setting<Integer> waterUpMult = sgShape.add(new IntSetting.Builder()
|
||||
.name("water-up-mulipiler")
|
||||
.description("Controlls the shape of the cast")
|
||||
.defaultValue(1)
|
||||
.min(1)
|
||||
.sliderMax(100)
|
||||
.build()
|
||||
);
|
||||
|
||||
private int dist;
|
||||
private BlockPos placeFluidPos;
|
||||
private int tick;
|
||||
private Stage stage = Stage.None;
|
||||
|
||||
public Lavacast() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "lavacast", "Automatically Lavacasts");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
if (mc.player == null || mc.world == null) toggle();
|
||||
tick = 0;
|
||||
stage = Stage.None;
|
||||
placeFluidPos = getTargetBlockPos();
|
||||
if (placeFluidPos == null) {
|
||||
placeFluidPos = mc.player.getBlockPos().down(2);
|
||||
} else {
|
||||
placeFluidPos = placeFluidPos.up();
|
||||
}
|
||||
dist=-1;
|
||||
getDistance(new Vec3i(1,0,0));
|
||||
getDistance(new Vec3i(-1,0,0));
|
||||
getDistance(new Vec3i(0,0,1));
|
||||
getDistance(new Vec3i(1,0,-1));
|
||||
if (dist<1) {
|
||||
error("Couldn't locate bottom.");
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
info("Distance: (highlight)%d(default).", dist);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Pre event) {
|
||||
if (mc.player == null || mc.world == null) return;
|
||||
tick++;
|
||||
if (shouldBreakOnTick()) return;
|
||||
if (dist < distMin.get()) toggle();
|
||||
tick = 0;
|
||||
if (checkMineBlock()) return;
|
||||
switch (stage) {
|
||||
case None: {
|
||||
Rotations.rotate(Rotations.getYaw(placeFluidPos),Rotations.getPitch(placeFluidPos),100, this::placeLava);
|
||||
stage = Stage.LavaDown;
|
||||
break;
|
||||
}
|
||||
case LavaDown: {
|
||||
Rotations.rotate(Rotations.getYaw(placeFluidPos),Rotations.getPitch(placeFluidPos),100, this::pickupLiquid);
|
||||
stage = Stage.LavaUp;
|
||||
break;
|
||||
}
|
||||
case LavaUp: {
|
||||
Rotations.rotate(Rotations.getYaw(placeFluidPos),Rotations.getPitch(placeFluidPos),100, this::placeWater);
|
||||
stage = Stage.WaterDown;
|
||||
break;
|
||||
}
|
||||
case WaterDown: {
|
||||
Rotations.rotate(Rotations.getYaw(placeFluidPos),Rotations.getPitch(placeFluidPos),100, this::pickupLiquid);
|
||||
stage = Stage.WaterUp;
|
||||
break;
|
||||
}
|
||||
case WaterUp: {
|
||||
dist--;
|
||||
Rotations.rotate(Rotations.getYaw(placeFluidPos),Rotations.getPitch(placeFluidPos),100, this::placeLava);
|
||||
stage = Stage.LavaDown;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldBreakOnTick() {
|
||||
if (stage == Stage.LavaDown && tick < dist*lavaDownMult.get()) return true;
|
||||
if (stage == Stage.LavaUp && tick < dist*lavaUpMult.get()) return true;
|
||||
if (stage == Stage.WaterDown && tick < dist*waterDownMult.get()) return true;
|
||||
if (stage == Stage.WaterUp && tick < dist*waterUpMult.get()) return true;
|
||||
if (tick < tickInterval.get()) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean checkMineBlock() {
|
||||
if (stage == Stage.None && mc.world.getBlockState(placeFluidPos).getBlock() != Blocks.AIR) {
|
||||
Rotations.rotate(Rotations.getYaw(placeFluidPos), Rotations.getPitch(placeFluidPos), 100, this::updateBlockBreakingProgress);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onRender(Render3DEvent event) {
|
||||
if (placeFluidPos == null) return;
|
||||
double x1 = placeFluidPos.getX();
|
||||
double y1 = placeFluidPos.getY();
|
||||
double z1 = placeFluidPos.getZ();
|
||||
double x2 = x1+1;
|
||||
double y2 = y1+1;
|
||||
double z2 = z1+1;
|
||||
|
||||
SettingColor color = new SettingColor(128, 128, 128);
|
||||
if (stage == Stage.LavaDown) color = new SettingColor(255, 180, 10);
|
||||
if (stage == Stage.LavaUp) color = new SettingColor(255, 180, 128);
|
||||
if (stage == Stage.WaterDown) color = new SettingColor(10, 10, 255);
|
||||
if (stage == Stage.WaterUp) color = new SettingColor(128, 128, 255);
|
||||
SettingColor color1 = color;
|
||||
color1.a = 75;
|
||||
|
||||
event.renderer.box(x1, y1, z1, x2, y2, z2, color1, color, ShapeMode.Both, 0);
|
||||
}
|
||||
|
||||
private void placeLava() {
|
||||
FindItemResult findItemResult = InvUtils.findInHotbar(Items.LAVA_BUCKET);
|
||||
if (!findItemResult.found()) {
|
||||
error("No lava bucket found.");
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
int prevSlot = mc.player.getInventory().selectedSlot;
|
||||
mc.player.getInventory().selectedSlot = findItemResult.getSlot();
|
||||
mc.interactionManager.interactItem(mc.player,mc.world,Hand.MAIN_HAND);
|
||||
mc.player.getInventory().selectedSlot = prevSlot;
|
||||
}
|
||||
|
||||
private void placeWater() {
|
||||
FindItemResult findItemResult = InvUtils.findInHotbar(Items.WATER_BUCKET);
|
||||
if (!findItemResult.found()) {
|
||||
error("No water bucket found.");
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
int prevSlot = mc.player.getInventory().selectedSlot;
|
||||
mc.player.getInventory().selectedSlot = findItemResult.getSlot();
|
||||
mc.interactionManager.interactItem(mc.player,mc.world,Hand.MAIN_HAND);
|
||||
mc.player.getInventory().selectedSlot = prevSlot;
|
||||
}
|
||||
|
||||
private void pickupLiquid() {
|
||||
FindItemResult findItemResult = InvUtils.findInHotbar(Items.BUCKET);
|
||||
if (!findItemResult.found()) {
|
||||
error("No bucket found.");
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
int prevSlot = mc.player.getInventory().selectedSlot;
|
||||
mc.player.getInventory().selectedSlot = findItemResult.getSlot();
|
||||
mc.interactionManager.interactItem(mc.player,mc.world,Hand.MAIN_HAND);
|
||||
mc.player.getInventory().selectedSlot = prevSlot;
|
||||
}
|
||||
|
||||
private void updateBlockBreakingProgress() {
|
||||
mc.interactionManager.updateBlockBreakingProgress(placeFluidPos,Direction.UP);
|
||||
}
|
||||
|
||||
private BlockPos getTargetBlockPos() {
|
||||
HitResult blockHit = mc.crosshairTarget;
|
||||
if (blockHit.getType() != HitResult.Type.BLOCK) {
|
||||
return null;
|
||||
}
|
||||
return ((BlockHitResult) blockHit).getBlockPos();
|
||||
}
|
||||
|
||||
private void getDistance(Vec3i offset) {
|
||||
BlockPos pos = placeFluidPos.down().add(offset);
|
||||
int new_dist;
|
||||
final BlockHitResult result = mc.world.raycast(new RaycastContext(
|
||||
Vec3d.ofCenter(pos), Vec3d.ofCenter(pos.down(250)), RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player
|
||||
));
|
||||
if (result == null || result.getType() != HitResult.Type.BLOCK) {
|
||||
return;
|
||||
}
|
||||
new_dist = placeFluidPos.getY() - result.getBlockPos().getY();
|
||||
if (new_dist>dist) dist = new_dist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInfoString() {
|
||||
return stage.toString();
|
||||
}
|
||||
}
|
||||
158
src/main/java/anticope/rejects/modules/NewChunks.java
Normal file
158
src/main/java/anticope/rejects/modules/NewChunks.java
Normal file
@@ -0,0 +1,158 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.packets.PacketEvent;
|
||||
import meteordevelopment.meteorclient.events.render.Render3DEvent;
|
||||
import meteordevelopment.meteorclient.renderer.ShapeMode;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.network.packet.s2c.play.*;
|
||||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.world.chunk.WorldChunk;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/*
|
||||
Ported from: https://github.com/BleachDrinker420/BleachHack/blob/master/BleachHack-Fabric-1.16/src/main/java/bleach/hack/module/mods/NewChunks.java
|
||||
*/
|
||||
public class NewChunks extends Module {
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Boolean> remove = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("remove")
|
||||
.description("Removes the cached chunks when disabling the module.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<SettingColor> newChunksColor = sgGeneral.add(new ColorSetting.Builder()
|
||||
.name("new-chunks-color")
|
||||
.description("Color of the chunks that are (most likely) completely new.")
|
||||
.defaultValue(new SettingColor(204, 153, 217))
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<SettingColor> oldChunksColor = sgGeneral.add(new ColorSetting.Builder()
|
||||
.name("old-chunks-color")
|
||||
.description("Color of the chunks that have (most likely) been loaded before.")
|
||||
.defaultValue(new SettingColor(230, 51, 51))
|
||||
.build()
|
||||
);
|
||||
|
||||
private Set<ChunkPos> newChunks = Collections.synchronizedSet(new HashSet<>());
|
||||
private Set<ChunkPos> oldChunks = Collections.synchronizedSet(new HashSet<>());
|
||||
private static final Direction[] searchDirs = new Direction[] { Direction.EAST, Direction.NORTH, Direction.WEST, Direction.SOUTH, Direction.UP };
|
||||
|
||||
public NewChunks() {
|
||||
super(MeteorRejectsAddon.CATEGORY,"new-chunks", "Detects completely new chunks using certain traits of them");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivate() {
|
||||
if (remove.get()) {
|
||||
newChunks.clear();
|
||||
oldChunks.clear();
|
||||
}
|
||||
super.onDeactivate();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onRender(Render3DEvent event) {
|
||||
if (newChunksColor.get().a > 5) {
|
||||
synchronized (newChunks) {
|
||||
for (ChunkPos c : newChunks) {
|
||||
if (mc.getCameraEntity().getBlockPos().isWithinDistance(c.getStartPos(), 1024)) {
|
||||
drawBoxOutline(new Box(c.getStartPos(), c.getStartPos().add(16, 0, 16)), newChunksColor.get(), event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (oldChunksColor.get().a > 5){
|
||||
synchronized (oldChunks) {
|
||||
for (ChunkPos c : oldChunks) {
|
||||
if (mc.getCameraEntity().getBlockPos().isWithinDistance(c.getStartPos(), 1024)) {
|
||||
drawBoxOutline(new Box(c.getStartPos(), c.getStartPos().add(16, 0, 16)), oldChunksColor.get(), event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void drawBoxOutline(Box box, Color color, Render3DEvent event) {
|
||||
event.renderer.box(
|
||||
box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ,
|
||||
new Color(0,0,0,0), color, ShapeMode.Lines, 0
|
||||
);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onReadPacket(PacketEvent.Receive event) {
|
||||
if (event.packet instanceof ChunkDeltaUpdateS2CPacket) {
|
||||
ChunkDeltaUpdateS2CPacket packet = (ChunkDeltaUpdateS2CPacket) event.packet;
|
||||
|
||||
packet.visitUpdates((pos, state) -> {
|
||||
if (!state.getFluidState().isEmpty() && !state.getFluidState().isStill()) {
|
||||
ChunkPos chunkPos = new ChunkPos(pos);
|
||||
|
||||
for (Direction dir: searchDirs) {
|
||||
if (mc.world.getBlockState(pos.offset(dir)).getFluidState().isStill() && !oldChunks.contains(chunkPos)) {
|
||||
newChunks.add(chunkPos);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
else if (event.packet instanceof BlockUpdateS2CPacket) {
|
||||
BlockUpdateS2CPacket packet = (BlockUpdateS2CPacket) event.packet;
|
||||
|
||||
if (!packet.getState().getFluidState().isEmpty() && !packet.getState().getFluidState().isStill()) {
|
||||
ChunkPos chunkPos = new ChunkPos(packet.getPos());
|
||||
|
||||
for (Direction dir: searchDirs) {
|
||||
if (mc.world.getBlockState(packet.getPos().offset(dir)).getFluidState().isStill() && !oldChunks.contains(chunkPos)) {
|
||||
newChunks.add(chunkPos);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (event.packet instanceof ChunkDataS2CPacket && mc.world != null) {
|
||||
ChunkDataS2CPacket packet = (ChunkDataS2CPacket) event.packet;
|
||||
|
||||
ChunkPos pos = new ChunkPos(packet.getX(), packet.getZ());
|
||||
|
||||
if (!newChunks.contains(pos) && mc.world.getChunkManager().getChunk(packet.getX(), packet.getZ()) == null) {
|
||||
WorldChunk chunk = new WorldChunk(mc.world, pos, null);
|
||||
try {
|
||||
chunk.loadFromPacket(null, packet.getReadBuffer(), new NbtCompound(), packet.getVerticalStripBitmask());
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int y = mc.world.getBottomY(); y < mc.world.getTopY(); y++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
FluidState fluid = chunk.getFluidState(x, y, z);
|
||||
|
||||
if (!fluid.isEmpty() && !fluid.isStill()) {
|
||||
oldChunks.add(pos);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
119
src/main/java/anticope/rejects/modules/ObsidianFarm.java
Normal file
119
src/main/java/anticope/rejects/modules/ObsidianFarm.java
Normal file
@@ -0,0 +1,119 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import meteordevelopment.meteorclient.systems.modules.player.AutoEat;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class ObsidianFarm extends Module {
|
||||
|
||||
private boolean allowBreakAgain;
|
||||
|
||||
public ObsidianFarm() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "obsidian-farm", "Auto obsidian farm(portals).");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
allowBreakAgain = true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Post event) {
|
||||
if (mc.player == null) return;
|
||||
if (mc.world == null) return;
|
||||
if (mc.interactionManager == null) return;
|
||||
if (mc.world.getDimension().isRespawnAnchorWorking()) {
|
||||
allowBreakAgain = true;
|
||||
return;
|
||||
}
|
||||
if (!allowBreakAgain) return;
|
||||
if ((mc.player.isUsingItem() || Modules.get().get(AutoEat.class).isActive()) && (mc.player.getOffHandStack().getItem().isFood() || mc.player.getMainHandStack().getItem().isFood()))
|
||||
return;
|
||||
|
||||
if(mc.player.getMainHandStack().getItem() != Items.NETHERITE_PICKAXE && mc.player.getMainHandStack().getItem() != Items.DIAMOND_PICKAXE) {
|
||||
int pickAxe = findPickAxe();
|
||||
if (pickAxe == -1) {
|
||||
if (this.isActive()) {
|
||||
this.toggle();
|
||||
return;
|
||||
}
|
||||
}
|
||||
mc.player.getInventory().selectedSlot = pickAxe;
|
||||
}
|
||||
|
||||
BlockPos obsidian = findObsidian();
|
||||
if (obsidian == null) return;
|
||||
|
||||
mc.interactionManager.updateBlockBreakingProgress(obsidian, Direction.UP);
|
||||
mc.player.swingHand(Hand.MAIN_HAND);
|
||||
|
||||
if (mc.player.getBlockPos().down().equals(obsidian) && mc.world.getBlockState(obsidian).getBlock() != Blocks.OBSIDIAN) {
|
||||
allowBreakAgain = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private BlockPos findObsidian() {
|
||||
List<BlockPos> blocksList = new ArrayList<>();
|
||||
|
||||
for (int x = -2; x < 3; x++) {
|
||||
for (int z = -2; z < 3; z++) {
|
||||
int y = 2;
|
||||
BlockPos block = new BlockPos(mc.player.getBlockPos().getX() + x, mc.player.getBlockPos().getY() + y, mc.player.getBlockPos().getZ() + z);
|
||||
blocksList.add(block);
|
||||
}
|
||||
}
|
||||
|
||||
Optional<BlockPos> result = blocksList.stream()
|
||||
.parallel()
|
||||
.filter(blockPos -> mc.world.getBlockState(blockPos).getBlock() == Blocks.OBSIDIAN)
|
||||
.min(Comparator.comparingDouble(blockPos -> mc.player.squaredDistanceTo(blockPos.getX(), blockPos.getY(), blockPos.getZ())));
|
||||
if (result.isPresent()) return result.get();
|
||||
|
||||
blocksList.clear();
|
||||
for (int x = -2; x < 3; x++) {
|
||||
for (int z = -2; z < 3; z++) {
|
||||
for (int y = 3; y > -2; y--) {
|
||||
BlockPos block = new BlockPos(mc.player.getBlockPos().getX() + x, mc.player.getBlockPos().getY() + y, mc.player.getBlockPos().getZ() + z);
|
||||
blocksList.add(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Optional<BlockPos> result2 = blocksList.stream()
|
||||
.parallel()
|
||||
.filter(blockPos -> !mc.player.getBlockPos().down().equals(blockPos))
|
||||
.filter(blockPos -> mc.world.getBlockState(blockPos).getBlock() == Blocks.OBSIDIAN)
|
||||
.min(Comparator.comparingDouble(blockPos -> mc.player.squaredDistanceTo(blockPos.getX(), blockPos.getY(), blockPos.getZ())));
|
||||
if (result2.isPresent()) return result2.get();
|
||||
|
||||
if (mc.world.getBlockState(mc.player.getBlockPos().down()).getBlock() == Blocks.OBSIDIAN)
|
||||
return mc.player.getBlockPos().down();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private int findPickAxe() {
|
||||
int result = -1;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (mc.player.getInventory().getStack(i).getItem() == Items.NETHERITE_PICKAXE) return i;
|
||||
if (mc.player.getInventory().getStack(i).getItem() == Items.DIAMOND_PICKAXE) result = i;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
210
src/main/java/anticope/rejects/modules/PacketFly.java
Normal file
210
src/main/java/anticope/rejects/modules/PacketFly.java
Normal file
@@ -0,0 +1,210 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import io.netty.util.internal.ConcurrentSet;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.entity.player.PlayerMoveEvent;
|
||||
import meteordevelopment.meteorclient.events.entity.player.SendMovementPacketsEvent;
|
||||
import meteordevelopment.meteorclient.events.packets.PacketEvent;
|
||||
import meteordevelopment.meteorclient.mixin.PlayerPositionLookS2CPacketAccessor;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.player.PlayerUtils;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
||||
import net.minecraft.network.packet.c2s.play.TeleportConfirmC2SPacket;
|
||||
import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class PacketFly extends Module {
|
||||
private final Set<PlayerMoveC2SPacket> packets = new ConcurrentSet();
|
||||
private final SettingGroup sgMovement = settings.createGroup("movement");
|
||||
private final SettingGroup sgClient = settings.createGroup("client");
|
||||
private final SettingGroup sgBypass = settings.createGroup("bypass");
|
||||
|
||||
private final Setting<Double> horizontalSpeed = sgMovement.add(new DoubleSetting.Builder()
|
||||
.name("horizontal-speed")
|
||||
.description("Horizontal speed in blocks per second.")
|
||||
.defaultValue(5.2)
|
||||
.min(0.0)
|
||||
.max(20.0)
|
||||
.sliderMin(0.0)
|
||||
.sliderMax(20.0)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Double> verticalSpeed = sgMovement.add(new DoubleSetting.Builder()
|
||||
.name("vertical-speed")
|
||||
.description("Vertical speed in blocks per second.")
|
||||
.defaultValue(1.24)
|
||||
.min(0.0)
|
||||
.max(20.0)
|
||||
.sliderMin(0.0)
|
||||
.sliderMax(20.0)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> sendTeleport = sgMovement.add(new BoolSetting.Builder()
|
||||
.name("teleport")
|
||||
.description("Sends teleport packets.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> setYaw = sgClient.add(new BoolSetting.Builder()
|
||||
.name("set-yaw")
|
||||
.description("Sets yaw client side.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> setMove = sgClient.add(new BoolSetting.Builder()
|
||||
.name("set-move")
|
||||
.description("Sets movement client side.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> setPos = sgClient.add(new BoolSetting.Builder()
|
||||
.name("set-pos")
|
||||
.description("Sets position client side.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> setID = sgClient.add(new BoolSetting.Builder()
|
||||
.name("set-id")
|
||||
.description("Updates teleport id when a position packet is received.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> antiKick = sgBypass.add(new BoolSetting.Builder()
|
||||
.name("anti-kick")
|
||||
.description("Moves down occasionally to prevent kicks.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> downDelay = sgBypass.add(new IntSetting.Builder()
|
||||
.name("down-delay")
|
||||
.description("How often you move down when not flying upwards. (ticks)")
|
||||
.defaultValue(4)
|
||||
.sliderMin(1)
|
||||
.sliderMax(30)
|
||||
.min(1)
|
||||
.max(30)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> downDelayFlying = sgBypass.add(new IntSetting.Builder()
|
||||
.name("flying-down-delay")
|
||||
.description("How often you move down when flying upwards. (ticks)")
|
||||
.defaultValue(10)
|
||||
.sliderMin(1)
|
||||
.sliderMax(30)
|
||||
.min(1)
|
||||
.max(30)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> invalidPacket = sgBypass.add(new BoolSetting.Builder()
|
||||
.name("invalid-packet")
|
||||
.description("Sends invalid movement packets.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private int flightCounter = 0;
|
||||
private int teleportID = 0;
|
||||
|
||||
public PacketFly() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "packet-fly", "Fly using packets.");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSendMovementPackets(SendMovementPacketsEvent.Pre event) {
|
||||
mc.player.setVelocity(0.0,0.0,0.0);
|
||||
double speed = 0.0;
|
||||
boolean checkCollisionBoxes = checkHitBoxes();
|
||||
|
||||
speed = mc.player.input.jumping && (checkCollisionBoxes || !(mc.player.input.movementForward != 0.0 || mc.player.input.movementSideways != 0.0)) ? (antiKick.get() && !checkCollisionBoxes ? (resetCounter(downDelayFlying.get()) ? -0.032 : verticalSpeed.get()/20) : verticalSpeed.get()/20) : (mc.player.input.sneaking ? verticalSpeed.get()/-20 : (!checkCollisionBoxes ? (resetCounter(downDelay.get()) ? (antiKick.get() ? -0.04 : 0.0) : 0.0) : 0.0));
|
||||
|
||||
Vec3d horizontal = PlayerUtils.getHorizontalVelocity(horizontalSpeed.get());
|
||||
|
||||
mc.player.setVelocity(horizontal.x, speed, horizontal.z);
|
||||
sendPackets(mc.player.getVelocity().x, mc.player.getVelocity().y, mc.player.getVelocity().z, sendTeleport.get());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMove (PlayerMoveEvent event) {
|
||||
if (setMove.get() && flightCounter != 0) {
|
||||
event.movement = new Vec3d(mc.player.getVelocity().x, mc.player.getVelocity().y, mc.player.getVelocity().z);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPacketSent(PacketEvent.Send event) {
|
||||
if (event.packet instanceof PlayerMoveC2SPacket && !packets.remove((PlayerMoveC2SPacket) event.packet)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPacketReceive(PacketEvent.Receive event) {
|
||||
if (event.packet instanceof PlayerPositionLookS2CPacket && !(mc.player == null || mc.world == null)) {
|
||||
BlockPos pos = new BlockPos(mc.player.getPos().x, mc.player.getPos().y, mc.player.getPos().z);
|
||||
PlayerPositionLookS2CPacket packet = (PlayerPositionLookS2CPacket) event.packet;
|
||||
if (setYaw.get()) {
|
||||
((PlayerPositionLookS2CPacketAccessor) event.packet).setPitch(mc.player.getPitch());
|
||||
((PlayerPositionLookS2CPacketAccessor) event.packet).setYaw(mc.player.getYaw());
|
||||
}
|
||||
if (setID.get()) {
|
||||
teleportID = packet.getTeleportId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkHitBoxes() {
|
||||
return !(mc.world.getBlockCollisions(mc.player, mc.player.getBoundingBox().expand(-0.0625,-0.0625,-0.0625)).count() == 0);
|
||||
}
|
||||
|
||||
private boolean resetCounter(int counter) {
|
||||
if (++flightCounter >= counter) {
|
||||
flightCounter = 0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void sendPackets(double x, double y, double z, boolean teleport) {
|
||||
Vec3d vec = new Vec3d(x, y, z);
|
||||
Vec3d position = mc.player.getPos().add(vec);
|
||||
Vec3d outOfBoundsVec = outOfBoundsVec(vec, position);
|
||||
packetSender(new PlayerMoveC2SPacket.PositionAndOnGround(position.x, position.y, position.z, mc.player.isOnGround()));
|
||||
if (invalidPacket.get()) {
|
||||
packetSender(new PlayerMoveC2SPacket.PositionAndOnGround(outOfBoundsVec.x, outOfBoundsVec.y, outOfBoundsVec.z, mc.player.isOnGround()));
|
||||
}
|
||||
if (setPos.get()) {
|
||||
mc.player.setPos(position.x, position.y, position.z);
|
||||
}
|
||||
teleportPacket(position, teleport);
|
||||
}
|
||||
|
||||
private void teleportPacket(Vec3d pos, boolean shouldTeleport) {
|
||||
if (shouldTeleport) {
|
||||
mc.player.networkHandler.sendPacket(new TeleportConfirmC2SPacket(++teleportID));
|
||||
}
|
||||
}
|
||||
|
||||
private Vec3d outOfBoundsVec(Vec3d offset, Vec3d position) {
|
||||
return position.add(0.0, 1500.0, 0.0);
|
||||
}
|
||||
|
||||
private void packetSender(PlayerMoveC2SPacket packet) {
|
||||
packets.add(packet);
|
||||
mc.player.networkHandler.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
162
src/main/java/anticope/rejects/modules/Painter.java
Normal file
162
src/main/java/anticope/rejects/modules/Painter.java
Normal file
@@ -0,0 +1,162 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import anticope.rejects.utils.WorldUtils;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.player.FindItemResult;
|
||||
import meteordevelopment.meteorclient.utils.player.InvUtils;
|
||||
import meteordevelopment.meteorclient.utils.world.BlockUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Painter extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Block> block = sgGeneral.add(new BlockSetting.Builder()
|
||||
.name("block")
|
||||
.description("Block to use for painting")
|
||||
.defaultValue(Blocks.STONE_BUTTON)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> range = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("range")
|
||||
.description("Range of placement")
|
||||
.min(0)
|
||||
.defaultValue(0)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> delay = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("delay")
|
||||
.description("Delay between block placement (in ticks)")
|
||||
.min(0)
|
||||
.defaultValue(0)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> rotate = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("rotate")
|
||||
.description("Whether or not to rotate towards block while placing")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> topSurfaces = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("top-surface")
|
||||
.description("Whether or not to cover top surfaces")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> sideSurfaces = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("side-surface")
|
||||
.description("Whether or not to cover side surfaces")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> bottomSurfaces = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("bottom-surface")
|
||||
.description("Whether or not to cover bottom surfaces")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> oneBlockHeight = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("one-block-height")
|
||||
.description("Whether or not to cover in one block high gaps")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private ArrayList<BlockPos> positions = new ArrayList<>();
|
||||
private int ticksWaited;
|
||||
|
||||
public Painter() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "painter", "Automatically paints/covers surfaces (good for trolling)");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Post event) {
|
||||
// Tick delay
|
||||
if (delay.get() != 0 && ticksWaited < delay.get() - 1) {
|
||||
ticksWaited++;
|
||||
return;
|
||||
}
|
||||
else ticksWaited = 0;
|
||||
|
||||
// Get slot
|
||||
FindItemResult findItemResult = InvUtils.findInHotbar(itemStack -> block.get() == Block.getBlockFromItem(itemStack.getItem()));
|
||||
if (!findItemResult.found()) {
|
||||
error("No selected blocks in hotbar");
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
|
||||
// Find spots
|
||||
for (BlockPos blockPos : WorldUtils.getSphere(mc.player.getBlockPos(), range.get(), range.get())) {
|
||||
if (shouldPlace(blockPos, block.get())) positions.add(blockPos);
|
||||
}
|
||||
|
||||
// Place
|
||||
for (BlockPos blockPos : positions) {
|
||||
BlockUtils.place(blockPos, findItemResult, rotate.get(), -100, false);
|
||||
|
||||
// Delay 0
|
||||
if (delay.get() != 0) break;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldPlace(BlockPos blockPos, Block useBlock) {
|
||||
// Self
|
||||
if (!mc.world.getBlockState(blockPos).getMaterial().isReplaceable()) return false;
|
||||
|
||||
// One block height
|
||||
if (!oneBlockHeight.get() &&
|
||||
!mc.world.getBlockState(blockPos.up()).getMaterial().isReplaceable() &&
|
||||
!mc.world.getBlockState(blockPos.down()).getMaterial().isReplaceable()) return false;
|
||||
|
||||
|
||||
boolean north = true;
|
||||
boolean south = true;
|
||||
boolean east = true;
|
||||
boolean west = true;
|
||||
boolean up = true;
|
||||
boolean bottom = true;
|
||||
BlockState northState = mc.world.getBlockState(blockPos.north());
|
||||
BlockState southState = mc.world.getBlockState(blockPos.south());
|
||||
BlockState eastState = mc.world.getBlockState(blockPos.east());
|
||||
BlockState westState = mc.world.getBlockState(blockPos.west());
|
||||
BlockState upState = mc.world.getBlockState(blockPos.up());
|
||||
BlockState bottomState = mc.world.getBlockState(blockPos.down());
|
||||
|
||||
// Top surface
|
||||
if (topSurfaces.get()) {
|
||||
if (upState.getMaterial().isReplaceable() || upState.getBlock() == useBlock) up = false;
|
||||
}
|
||||
|
||||
// Side surfaces
|
||||
if (sideSurfaces.get()) {
|
||||
|
||||
if (northState.getMaterial().isReplaceable() || northState.getBlock() == useBlock) north = false;
|
||||
if (southState.getMaterial().isReplaceable() || southState.getBlock() == useBlock) south = false;
|
||||
if (eastState.getMaterial().isReplaceable() || eastState.getBlock() == useBlock) east = false;
|
||||
if (westState.getMaterial().isReplaceable() || westState.getBlock() == useBlock) west = false;
|
||||
}
|
||||
|
||||
// Bottom surface
|
||||
if (bottomSurfaces.get()) {
|
||||
if (bottomState.getMaterial().isReplaceable() || bottomState.getBlock() == useBlock) bottom = false;
|
||||
}
|
||||
|
||||
return north || south || east || west || up || bottom;
|
||||
}
|
||||
}
|
||||
159
src/main/java/anticope/rejects/modules/Phase.java
Normal file
159
src/main/java/anticope/rejects/modules/Phase.java
Normal file
@@ -0,0 +1,159 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
|
||||
import meteordevelopment.meteorclient.events.world.CollisionShapeEvent;
|
||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||
import meteordevelopment.meteorclient.settings.DoubleSetting;
|
||||
import meteordevelopment.meteorclient.settings.EnumSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
|
||||
public class Phase extends Module {
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Mode> mode = sgGeneral.add(new EnumSetting.Builder<Mode>()
|
||||
.name("mode")
|
||||
.description("The phase mode used.")
|
||||
.defaultValue(Mode.NRNB)
|
||||
.onChanged(v -> { setPos(); })
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Double> distance = sgGeneral.add(new DoubleSetting.Builder()
|
||||
.name("speed")
|
||||
.description("The X and Z distance per clip.")
|
||||
.defaultValue(0.1)
|
||||
.min(0.0)
|
||||
.sliderMin(0.0)
|
||||
.sliderMax(10.0)
|
||||
.visible(() -> (mode.get() != Mode.CollisionShape))
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
private double prevX = Double.NaN;
|
||||
private double prevZ = Double.NaN;
|
||||
|
||||
public Phase() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "phase", "Lets you clip through ground sometimes.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
if (mc.player == null) return;
|
||||
setPos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivate() {
|
||||
prevX = Double.NaN;
|
||||
prevZ = Double.NaN;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onCollisionShape(CollisionShapeEvent event) {
|
||||
if (mc.world == null || mc.player == null) return;
|
||||
if (mode.get() != Mode.CollisionShape) return;
|
||||
if (event == null || event.pos == null) return;
|
||||
if (event.type != CollisionShapeEvent.CollisionType.BLOCK) return;
|
||||
if (event.pos.getY() < mc.player.getY()) {
|
||||
if (mc.player.isSneaking()) {
|
||||
event.shape = VoxelShapes.empty();
|
||||
}
|
||||
} else {
|
||||
event.shape = VoxelShapes.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Post post) {
|
||||
if (mode.get() == Mode.CollisionShape) return;
|
||||
if (mc.player == null) return;
|
||||
|
||||
if (Double.isNaN(prevX) || Double.isNaN(prevZ)) setPos();
|
||||
|
||||
Vec3d yawForward = Vec3d.fromPolar((float)0.0f, (float)mc.player.getYaw());
|
||||
Vec3d yawBack = Vec3d.fromPolar((float)0.0f, (float)mc.player.getYaw() - 180f);
|
||||
Vec3d yawLeft = Vec3d.fromPolar((float)0.0f, (float)mc.player.getYaw() - 90f);
|
||||
Vec3d yawRight = Vec3d.fromPolar((float)0.0f, (float)mc.player.getYaw() - 270f);
|
||||
|
||||
if (mode.get() == Mode.Normal) {
|
||||
|
||||
if (mc.options.keyForward.isPressed()) {
|
||||
mc.player.setPos(
|
||||
mc.player.getX() + yawForward.x * distance.get(),
|
||||
mc.player.getY(),
|
||||
mc.player.getZ() + yawForward.z * distance.get()
|
||||
);
|
||||
}
|
||||
|
||||
if (mc.options.keyBack.isPressed()) {
|
||||
mc.player.setPos(
|
||||
mc.player.getX() + yawBack.x * distance.get(),
|
||||
mc.player.getY(),
|
||||
mc.player.getZ() + yawBack.z * distance.get()
|
||||
);
|
||||
}
|
||||
|
||||
if (mc.options.keyLeft.isPressed()) {
|
||||
mc.player.setPos(
|
||||
mc.player.getX() + yawLeft.x * distance.get(),
|
||||
mc.player.getY(),
|
||||
mc.player.getZ() + yawLeft.z * distance.get()
|
||||
);
|
||||
}
|
||||
|
||||
if (mc.options.keyRight.isPressed()) {
|
||||
mc.player.setPos(
|
||||
mc.player.getX() + yawRight.x * distance.get(),
|
||||
mc.player.getY(),
|
||||
mc.player.getZ() + yawRight.z * distance.get()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
else if (mode.get() == Mode.NRNB) {
|
||||
if (mc.options.keyForward.isPressed()) {
|
||||
prevX += yawForward.x * distance.get();
|
||||
prevZ += yawForward.z * distance.get();
|
||||
mc.player.setPos(prevX, mc.player.getY(), prevZ);
|
||||
}
|
||||
|
||||
if (mc.options.keyBack.isPressed()) {
|
||||
prevX += yawBack.x * distance.get();
|
||||
prevZ += yawBack.z * distance.get();
|
||||
mc.player.setPos(prevX, mc.player.getY(), prevZ);
|
||||
}
|
||||
|
||||
if (mc.options.keyLeft.isPressed()) {
|
||||
prevX += yawLeft.x * distance.get();
|
||||
prevZ += yawLeft.z * distance.get();
|
||||
mc.player.setPos(prevX, mc.player.getY(), prevZ);
|
||||
}
|
||||
|
||||
if (mc.options.keyRight.isPressed()) {
|
||||
prevX += yawRight.x * distance.get();
|
||||
prevZ += yawRight.z * distance.get();
|
||||
mc.player.setPos(prevX, mc.player.getY(), prevZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setPos() {
|
||||
if (mc.player == null) return;
|
||||
prevX = mc.player.getX();
|
||||
prevZ = mc.player.getZ();
|
||||
}
|
||||
|
||||
public static enum Mode {
|
||||
NRNB,
|
||||
Normal,
|
||||
CollisionShape
|
||||
}
|
||||
}
|
||||
24
src/main/java/anticope/rejects/modules/Prone.java
Normal file
24
src/main/java/anticope/rejects/modules/Prone.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.meteorclient.events.world.CollisionShapeEvent;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
|
||||
public class Prone extends Module {
|
||||
|
||||
public Prone() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "prone", "Become prone on demand.");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onCollisionShape(CollisionShapeEvent event) {
|
||||
if (mc.world == null || mc.player == null) return;
|
||||
if (event.state == null) return;
|
||||
|
||||
if (event.pos.getY() != mc.player.getY() + 1) return;
|
||||
|
||||
event.shape = VoxelShapes.fullCube();
|
||||
}
|
||||
}
|
||||
142
src/main/java/anticope/rejects/modules/Rendering.java
Normal file
142
src/main/java/anticope/rejects/modules/Rendering.java
Normal file
@@ -0,0 +1,142 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import net.minecraft.client.gl.ShaderEffect;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import meteordevelopment.meteorclient.settings.EnumSetting;
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
|
||||
public class Rendering extends Module {
|
||||
|
||||
public enum Shader {
|
||||
None,
|
||||
Notch,
|
||||
FXAA,
|
||||
Art,
|
||||
Bumpy,
|
||||
Blobs,
|
||||
Blobs2,
|
||||
Pencil,
|
||||
Vibrant,
|
||||
Deconverge,
|
||||
Flip,
|
||||
Invert,
|
||||
NTSC,
|
||||
Outline,
|
||||
Phosphor,
|
||||
Scanline,
|
||||
Sobel,
|
||||
Bits,
|
||||
Desaturate,
|
||||
Green,
|
||||
Blur,
|
||||
Wobble,
|
||||
Antialias,
|
||||
Creeper,
|
||||
Spider
|
||||
}
|
||||
|
||||
private final SettingGroup sgInvisible = settings.createGroup("Invisible");
|
||||
private final SettingGroup sgFun = settings.createGroup("Fun");
|
||||
|
||||
private final Setting<Boolean> structureVoid = sgInvisible.add(new BoolSetting.Builder()
|
||||
.name("structure-void")
|
||||
.description("Render structure void blocks.")
|
||||
.defaultValue(true)
|
||||
.onChanged(onChanged -> {
|
||||
if(this.isActive()) {
|
||||
mc.worldRenderer.reload();
|
||||
}
|
||||
})
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Shader> shaderEnum = sgFun.add(new EnumSetting.Builder<Shader>()
|
||||
.name("shader")
|
||||
.description("Select which shader to use")
|
||||
.defaultValue(Shader.None)
|
||||
.onChanged(this::onChanged)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> dinnerbone = sgFun.add(new BoolSetting.Builder()
|
||||
.name("dinnerbone")
|
||||
.description("Apply dinnerbone effects to all entities")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> deadmau5Ears = sgFun.add(new BoolSetting.Builder()
|
||||
.name("deadmau5-ears")
|
||||
.description("Add deadmau5 ears to all players")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> disableToasts = sgFun.add(new BoolSetting.Builder()
|
||||
.name("disable-toasts")
|
||||
.description("Disable toasts (e.g. advancements)")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
private ShaderEffect shader = null;
|
||||
|
||||
public Rendering() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "Rendering", "Various Render Tweaks");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
mc.worldRenderer.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivate() {
|
||||
mc.worldRenderer.reload();
|
||||
}
|
||||
|
||||
public void onChanged(Shader s) {
|
||||
String name;
|
||||
if (s == Shader.Vibrant) name = "color_convolve";
|
||||
else if (s == Shader.Scanline) name = "scan_pincushion";
|
||||
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);
|
||||
this.shader = shader;
|
||||
} catch (IOException e) {
|
||||
this.shader = null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean renderStructureVoid() {
|
||||
return this.isActive() && structureVoid.get();
|
||||
}
|
||||
|
||||
public ShaderEffect getShaderEffect() {
|
||||
if (!this.isActive()) return null;
|
||||
return shader;
|
||||
}
|
||||
|
||||
public boolean dinnerboneEnabled() {
|
||||
if (!this.isActive()) return false;
|
||||
return dinnerbone.get();
|
||||
}
|
||||
|
||||
public boolean deadmau5EarsEnabled() {
|
||||
if (!this.isActive()) return false;
|
||||
return deadmau5Ears.get();
|
||||
}
|
||||
|
||||
public boolean disableToasts() {
|
||||
if (!this.isActive()) return false;
|
||||
return disableToasts.get();
|
||||
}
|
||||
}
|
||||
199
src/main/java/anticope/rejects/modules/SkeletonESP.java
Normal file
199
src/main/java/anticope/rejects/modules/SkeletonESP.java
Normal file
@@ -0,0 +1,199 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.render.Render3DEvent;
|
||||
import meteordevelopment.meteorclient.settings.*;
|
||||
import meteordevelopment.meteorclient.systems.config.Config;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.Freecam;
|
||||
import meteordevelopment.meteorclient.utils.player.PlayerUtils;
|
||||
import meteordevelopment.meteorclient.utils.player.Rotations;
|
||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.option.Perspective;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.render.entity.LivingEntityRenderer;
|
||||
import net.minecraft.client.render.entity.PlayerEntityRenderer;
|
||||
import net.minecraft.client.render.entity.model.PlayerEntityModel;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.*;
|
||||
|
||||
public class SkeletonESP extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Freecam freecam;
|
||||
|
||||
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()
|
||||
);
|
||||
|
||||
public SkeletonESP() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "skeleton-esp", "Looks cool as fuck");
|
||||
freecam = Modules.get().get(Freecam.class);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onRender(Render3DEvent event) {
|
||||
MatrixStack matrixStack = event.matrices;
|
||||
float g = event.tickDelta;
|
||||
RenderSystem.setShader(GameRenderer::getPositionColorShader);
|
||||
RenderSystem.disableTexture();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.disableDepthTest();
|
||||
RenderSystem.depthMask(MinecraftClient.isFabulousGraphicsOrBetter());
|
||||
RenderSystem.enableCull();
|
||||
mc.world.getEntities().forEach(entity -> {
|
||||
if (!(entity instanceof PlayerEntity)) return;
|
||||
if (mc.options.getPerspective() == Perspective.FIRST_PERSON && !freecam.isActive() && mc.player == entity) return;
|
||||
int rotationHoldTicks = Config.get().rotationHoldTicks;
|
||||
|
||||
Color skeletonColor = PlayerUtils.getPlayerColor((PlayerEntity)entity, skeletonColorSetting.get());
|
||||
PlayerEntity playerEntity = (PlayerEntity) entity;
|
||||
|
||||
Vec3d footPos = getEntityRenderPosition(playerEntity, g);
|
||||
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;
|
||||
float j = MathHelper.lerpAngleDegrees(g, playerEntity.prevHeadYaw, playerEntity.headYaw);
|
||||
if (mc.player == entity && Rotations.rotationTimer < rotationHoldTicks) j = Rotations.serverYaw;
|
||||
|
||||
float q = playerEntity.limbAngle - playerEntity.limbDistance * (1.0F - g);
|
||||
float p = MathHelper.lerp(g, playerEntity.lastLimbDistance, playerEntity.limbDistance);
|
||||
float o = (float)playerEntity.age + g;
|
||||
float k = j - h;
|
||||
float m = playerEntity.getPitch(g);
|
||||
if (mc.player == entity && Rotations.rotationTimer < rotationHoldTicks) m = Rotations.serverPitch;
|
||||
|
||||
playerEntityModel.animateModel(playerEntity, q, p, g);
|
||||
playerEntityModel.setAngles(playerEntity, q, p, o, k, m);
|
||||
|
||||
boolean swimming = playerEntity.isInSwimmingPose();
|
||||
boolean sneaking = playerEntity.isSneaking();
|
||||
boolean flying = playerEntity.isFallFlying();
|
||||
|
||||
ModelPart head = playerEntityModel.head;
|
||||
ModelPart leftArm = playerEntityModel.leftArm;
|
||||
ModelPart rightArm = playerEntityModel.rightArm;
|
||||
ModelPart leftLeg = playerEntityModel.leftLeg;
|
||||
ModelPart rightLeg = playerEntityModel.rightLeg;
|
||||
|
||||
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));
|
||||
if (swimming)
|
||||
matrixStack.translate(0, -0.95f, 0);
|
||||
|
||||
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
|
||||
bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION_COLOR);
|
||||
|
||||
Matrix4f matrix4f = matrixStack.peek().getModel();
|
||||
bufferBuilder.vertex(matrix4f, 0, sneaking ? 0.6f : 0.7f, sneaking ? 0.23f : 0).color(skeletonColor.r, skeletonColor.g, skeletonColor.b, skeletonColor.a).next();
|
||||
bufferBuilder.vertex(matrix4f, 0, sneaking ? 1.05f : 1.4f, 0).color(skeletonColor.r, skeletonColor.g, skeletonColor.b, skeletonColor.a).next();//spine
|
||||
|
||||
bufferBuilder.vertex(matrix4f, -0.37f, sneaking ? 1.05f : 1.35f, 0).color(skeletonColor.r, skeletonColor.g, skeletonColor.b, skeletonColor.a).next();//shoulders
|
||||
bufferBuilder.vertex(matrix4f, 0.37f, sneaking ? 1.05f : 1.35f, 0).color(skeletonColor.r, skeletonColor.g, skeletonColor.b, skeletonColor.a).next();
|
||||
|
||||
bufferBuilder.vertex(matrix4f, -0.15f, sneaking ? 0.6f : 0.7f, sneaking ? 0.23f : 0).color(skeletonColor.r, skeletonColor.g, skeletonColor.b, skeletonColor.a).next();//pelvis
|
||||
bufferBuilder.vertex(matrix4f, 0.15f, sneaking ? 0.6f : 0.7f, sneaking ? 0.23f : 0).color(skeletonColor.r, skeletonColor.g, skeletonColor.b, skeletonColor.a).next();
|
||||
|
||||
matrixStack.push();//head
|
||||
matrixStack.translate(0, sneaking ? 1.05f : 1.4f, 0);
|
||||
rotate(matrixStack, head);
|
||||
matrix4f = matrixStack.peek().getModel();
|
||||
bufferBuilder.vertex(matrix4f, 0, 0, 0).color(skeletonColor.r, skeletonColor.g, skeletonColor.b, skeletonColor.a).next();
|
||||
bufferBuilder.vertex(matrix4f, 0, 0.15f, 0).color(skeletonColor.r, skeletonColor.g, skeletonColor.b, skeletonColor.a).next();
|
||||
matrixStack.pop();
|
||||
|
||||
matrixStack.push();//right leg
|
||||
matrixStack.translate(0.15f, sneaking ? 0.6f : 0.7f, sneaking ? 0.23f : 0);
|
||||
rotate(matrixStack, rightLeg);
|
||||
matrix4f = matrixStack.peek().getModel();
|
||||
bufferBuilder.vertex(matrix4f, 0, 0, 0).color(skeletonColor.r, skeletonColor.g, skeletonColor.b, skeletonColor.a).next();
|
||||
bufferBuilder.vertex(matrix4f, 0, -0.6f, 0).color(skeletonColor.r, skeletonColor.g, skeletonColor.b, skeletonColor.a).next();
|
||||
matrixStack.pop();
|
||||
|
||||
matrixStack.push();//left leg
|
||||
matrixStack.translate(-0.15f, sneaking ? 0.6f : 0.7f, sneaking ? 0.23f : 0);
|
||||
rotate(matrixStack, leftLeg);
|
||||
matrix4f = matrixStack.peek().getModel();
|
||||
bufferBuilder.vertex(matrix4f, 0, 0, 0).color(skeletonColor.r, skeletonColor.g, skeletonColor.b, skeletonColor.a).next();
|
||||
bufferBuilder.vertex(matrix4f, 0, -0.6f, 0).color(skeletonColor.r, skeletonColor.g, skeletonColor.b, skeletonColor.a).next();
|
||||
matrixStack.pop();
|
||||
|
||||
matrixStack.push();//right arm
|
||||
matrixStack.translate(0.37f, sneaking ? 1.05f : 1.35f, 0);
|
||||
rotate(matrixStack, rightArm);
|
||||
matrix4f = matrixStack.peek().getModel();
|
||||
bufferBuilder.vertex(matrix4f, 0, 0, 0).color(skeletonColor.r, skeletonColor.g, skeletonColor.b, skeletonColor.a).next();
|
||||
bufferBuilder.vertex(matrix4f, 0, -0.55f, 0).color(skeletonColor.r, skeletonColor.g, skeletonColor.b, skeletonColor.a).next();
|
||||
matrixStack.pop();
|
||||
|
||||
matrixStack.push();//left arm
|
||||
matrixStack.translate(-0.37f, sneaking ? 1.05f : 1.35f, 0);
|
||||
rotate(matrixStack, leftArm);
|
||||
matrix4f = matrixStack.peek().getModel();
|
||||
bufferBuilder.vertex(matrix4f, 0, 0, 0).color(skeletonColor.r, skeletonColor.g, skeletonColor.b, skeletonColor.a).next();
|
||||
bufferBuilder.vertex(matrix4f, 0, -0.55f, 0).color(skeletonColor.r, skeletonColor.g, skeletonColor.b, skeletonColor.a).next();
|
||||
matrixStack.pop();
|
||||
|
||||
bufferBuilder.end();
|
||||
BufferRenderer.draw(bufferBuilder);
|
||||
|
||||
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)
|
||||
matrixStack.translate(0, -0.35f, 0);
|
||||
|
||||
matrixStack.multiply(new Quaternion(new Vec3f(0, 1, 0), h + 180, true));
|
||||
matrixStack.translate(-footPos.x, -footPos.y, -footPos.z);
|
||||
});
|
||||
RenderSystem.enableTexture();
|
||||
RenderSystem.disableCull();
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.enableDepthTest();
|
||||
RenderSystem.depthMask(true);
|
||||
}
|
||||
|
||||
private void rotate(MatrixStack matrix, ModelPart modelPart) {
|
||||
if (modelPart.roll != 0.0F) {
|
||||
matrix.multiply(Vec3f.POSITIVE_Z.getRadialQuaternion(modelPart.roll));
|
||||
}
|
||||
|
||||
if (modelPart.yaw != 0.0F) {
|
||||
matrix.multiply(Vec3f.NEGATIVE_Y.getRadialQuaternion(modelPart.yaw));
|
||||
}
|
||||
|
||||
if (modelPart.pitch != 0.0F) {
|
||||
matrix.multiply(Vec3f.NEGATIVE_X.getRadialQuaternion(modelPart.pitch));
|
||||
}
|
||||
}
|
||||
|
||||
private Vec3d getEntityRenderPosition(Entity entity, double partial) {
|
||||
double x = entity.prevX + ((entity.getX() - entity.prevX) * partial) - mc.getEntityRenderDispatcher().camera.getPos().x;
|
||||
double y = entity.prevY + ((entity.getY() - entity.prevY) * partial) - mc.getEntityRenderDispatcher().camera.getPos().y;
|
||||
double z = entity.prevZ + ((entity.getZ() - entity.prevZ) * partial) - mc.getEntityRenderDispatcher().camera.getPos().z;
|
||||
return new Vec3d(x, y, z);
|
||||
}
|
||||
}
|
||||
56
src/main/java/anticope/rejects/modules/SoundLocator.java
Normal file
56
src/main/java/anticope/rejects/modules/SoundLocator.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package anticope.rejects.modules;
|
||||
|
||||
import anticope.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.meteorclient.events.world.PlaySoundEvent;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.settings.SoundEventListSetting;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.utils.player.ChatUtils;
|
||||
|
||||
import net.minecraft.client.sound.SoundInstance;
|
||||
import net.minecraft.client.sound.WeightedSoundSet;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.text.MutableText;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SoundLocator extends Module {
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<List<SoundEvent>> sounds = sgGeneral.add(new SoundEventListSetting.Builder()
|
||||
.name("sounds")
|
||||
.description("Sounds to find.")
|
||||
.defaultValue(new ArrayList<>(0))
|
||||
.build()
|
||||
);
|
||||
|
||||
public SoundLocator() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "sound-locator", "Prints locations of sound events.");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onPlaySound(PlaySoundEvent event) {
|
||||
for (SoundEvent sound : sounds.get()) {
|
||||
if (sound.getId().equals(event.sound.getId())) {
|
||||
printSound(event.sound);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void printSound(SoundInstance sound) {
|
||||
WeightedSoundSet soundSet = mc.getSoundManager().get(sound.getId());
|
||||
MutableText text = soundSet.getSubtitle().copy();
|
||||
text.append(String.format("%s at ", Formatting.RESET));
|
||||
Vec3d pos = new Vec3d(sound.getX(), sound.getY(), sound.getZ());
|
||||
text.append(ChatUtils.formatCoords(pos));
|
||||
text.append(String.format("%s.", Formatting.RESET));
|
||||
info(text);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package anticope.rejects.modules.modifier;
|
||||
|
||||
import anticope.rejects.mixin.meteor.modules.NoRenderAccessor;
|
||||
import meteordevelopment.meteorclient.settings.BoolSetting;
|
||||
import meteordevelopment.meteorclient.settings.Setting;
|
||||
import meteordevelopment.meteorclient.settings.SettingGroup;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import meteordevelopment.meteorclient.systems.modules.render.NoRender;
|
||||
|
||||
public class NoRenderModifier {
|
||||
static SettingGroup sgOverlay;
|
||||
|
||||
public static Setting<Boolean> noCommandSuggestions;
|
||||
|
||||
public static boolean noCommandSuggestions() {
|
||||
return Modules.get().get(NoRender.class).isActive() && noCommandSuggestions.get();
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
sgOverlay = ((NoRenderAccessor) Modules.get().get(NoRender.class)).getSgOverlay();
|
||||
noCommandSuggestions = sgOverlay.add(new BoolSetting.Builder()
|
||||
.name("command-suggestions")
|
||||
.description("Disables command suggestions in chat.")
|
||||
.defaultValue(false)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
}
|
||||
203
src/main/java/anticope/rejects/utils/GiveUtils.java
Normal file
203
src/main/java/anticope/rejects/utils/GiveUtils.java
Normal file
@@ -0,0 +1,203 @@
|
||||
package anticope.rejects.utils;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtList;
|
||||
import net.minecraft.nbt.StringNbtReader;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import org.apache.commons.lang3.tuple.Triple;
|
||||
|
||||
import static meteordevelopment.meteorclient.utils.Utils.mc;
|
||||
|
||||
public class GiveUtils {
|
||||
|
||||
public static final Map<String, Function<Boolean, ItemStack>> PRESETS = new HashMap<>();
|
||||
|
||||
private final static SimpleCommandExceptionType NOT_IN_CREATIVE = new SimpleCommandExceptionType(new LiteralText("You must be in creative mode to use this."));
|
||||
private final static SimpleCommandExceptionType NO_SPACE = new SimpleCommandExceptionType(new LiteralText("No space in hotbar."));
|
||||
|
||||
private static final List<Identifier> HIDDEN_ENTITIES = Arrays.asList(
|
||||
new Identifier("giant"),
|
||||
new Identifier("ender_dragon"),
|
||||
new Identifier("wither"),
|
||||
new Identifier("iron_golem"),
|
||||
new Identifier("ender_dragon"),
|
||||
new Identifier("tnt_minecart"),
|
||||
new Identifier("lightning_bolt"));
|
||||
|
||||
// Ported from: https://github.com/BleachDrinker420/BleachHack/blob/master/BleachHack-Fabric-1.16/src/main/java/bleach/hack/command/commands/CmdGive.java
|
||||
private static final List<Triple<String, Item, String>> STRING_PRESETS = Arrays.asList(
|
||||
Triple.of("lag_spawner", Items.SPAWNER, "{BlockEntityTag:{MaxNearbyEntities:32767,RequiredPlayerRange:32767,SpawnCount:32767,MaxSpawnDelay:0,SpawnRange:32767,Delay:0,MinSpawnDelay:0}}"),
|
||||
Triple.of("tnt_spawner", Items.SPAWNER, "{BlockEntityTag:{MaxNearbyEntities:32767,RequiredPlayerRange:32767,SpawnCount:50,SpawnData:{Fuse:1,id:\"minecraft:tnt\"},MaxSpawnDelay:0,SpawnRange:10,Delay:0,MinSpawnDelay:0}}"),
|
||||
Triple.of("boat_spawner", Items.SPAWNER, "{BlockEntityTag:{SpawnData:{Type:\"jungle\",CustomName:'{\"text\":\"Boat\",\"color\":\"aqua\",\"bold\":true,\"italic\":true,\"underlined\":true}',Invulnerable:1b,id:\"minecraft:boat\",Glowing:1b,CustomNameVisible:1b},SpawnRange:10,SpawnCount:50}}"),
|
||||
Triple.of("pigs_egg", Items.CHICKEN_SPAWN_EGG, "{EntityTag:{MaxNearbyEntities:1000,RequiredPlayerRange:100,CustomDisplayTile:1b,DisplayState:{Properties:{hinge:\"left\",half:\"upper\",open:\"true\"},Name:\"minecraft:acacia_door\"},SpawnData:{id:\"minecraft:minecart\"},id:\"minecraft:spawner_minecart\",MaxSpawnDelay:0,Delay:1,MinSpawnDelay:0}}"),
|
||||
Triple.of("end_portal_arrow", Items.ELDER_GUARDIAN_SPAWN_EGG, "{EntityTag:{SoundEvent:\"block.end_portal.spawn\",pickup:1b,id:\"minecraft:arrow\"}}"),
|
||||
Triple.of("wither_spawn_arrow", Items.ELDER_GUARDIAN_SPAWN_EGG, "{EntityTag:{SoundEvent:\"entity.wither.spawn\",pickup:1b,id:\"minecraft:arrow\"}}"),
|
||||
Triple.of("eg_curse_arrow", Items.ELDER_GUARDIAN_SPAWN_EGG, "{EntityTag:{SoundEvent:\"entity.elder_guardian.curse\",pickup:1b,id:\"minecraft:arrow\"}}"),
|
||||
Triple.of("big_slime", Items.SLIME_SPAWN_EGG, "{EntityTag:{Size:50,id:\"minecraft:slime\"}}"),
|
||||
Triple.of("particle_area_expand", Items.SKELETON_SPAWN_EGG, "{EntityTag:{Particle:\"angry_villager\",Radius:1.0f,RadiusOnUse:1.0f,Duration:10000,id:\"minecraft:area_effect_cloud\",RadiusPerTick:10.0f}}"),
|
||||
Triple.of("armor_stand_spawner_minecart", Items.BAT_SPAWN_EGG, "{EntityTag:{SpawnData:{id:\"minecraft:armor_stand\"},id:\"minecraft:spawner_minecart\"}}")
|
||||
);
|
||||
|
||||
private static final Random random = new Random();
|
||||
|
||||
public static void giveItem(ItemStack item) throws CommandSyntaxException {
|
||||
if (!mc.player.getAbilities().creativeMode) throw NOT_IN_CREATIVE.create();
|
||||
|
||||
if (!mc.player.getInventory().insertStack(item)) {
|
||||
throw NO_SPACE.create();
|
||||
}
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
STRING_PRESETS.forEach((preset) -> {
|
||||
PRESETS.put(preset.getLeft(), (preview) -> {
|
||||
if (preview) preset.getMiddle().getDefaultStack();
|
||||
ItemStack item = preset.getMiddle().getDefaultStack();
|
||||
try {
|
||||
item.setNbt(StringNbtReader.parse(preset.getRight()));
|
||||
} catch (CommandSyntaxException e) { }
|
||||
item.setCustomName(new LiteralText(toName(preset.getLeft())));
|
||||
return item;
|
||||
});
|
||||
});
|
||||
|
||||
PRESETS.put("force_op", (preview) -> {
|
||||
if (preview) Items.SPIDER_SPAWN_EGG.getDefaultStack();
|
||||
ItemStack item = Items.SPIDER_SPAWN_EGG.getDefaultStack();
|
||||
String nick = mc.player.getName().asString();
|
||||
try {
|
||||
item.setNbt(StringNbtReader.parse("{EntityTag:{Time:1,BlockState:{Name:\"minecraft:spawner\"},id:\"minecraft:falling_block\",TileEntityData:{SpawnCount:20,SpawnData:{id:\"minecraft:villager\",Passengers:[{Time:1,BlockState:{Name:\"minecraft:redstone_block\"},id:\"minecraft:falling_block\",Passengers:[{id:\"minecraft:fox\",Passengers:[{Time:1,BlockState:{Name:\"minecraft:activator_rail\"},id:\"minecraft:falling_block\",Passengers:[{Command:\"execute as @e run op "+nick+"\",id:\"minecraft:command_block_minecart\"}]}],NoAI:1b,Health:1.0f,ActiveEffects:[{Duration:1000,Id:20b,Amplifier:4b}]}]}],NoAI:1b,Health:1.0f,ActiveEffects:[{Duration:1000,Id:20b,Amplifier:4b}]},MaxSpawnDelay:100,SpawnRange:10,Delay:1,MinSpawnDelay:100}}}"));
|
||||
} catch (CommandSyntaxException e) { }
|
||||
item.setCustomName(new LiteralText("Force OP"));
|
||||
return item;
|
||||
});
|
||||
|
||||
PRESETS.put("troll_potion", (preview) -> {
|
||||
if (preview) Items.LINGERING_POTION.getDefaultStack();
|
||||
ItemStack stack = Items.LINGERING_POTION.getDefaultStack();
|
||||
NbtList effects = new NbtList();
|
||||
for(int i = 1; i <= 31; i++)
|
||||
{
|
||||
NbtCompound effect = new NbtCompound();
|
||||
effect.putByte("Amplifier", (byte)127);
|
||||
effect.putInt("Duration", Integer.MAX_VALUE);
|
||||
effect.putInt("Id", i);
|
||||
effects.add(effect);
|
||||
}
|
||||
NbtCompound nbt = new NbtCompound();
|
||||
nbt.put("CustomPotionEffects", effects);
|
||||
stack.setNbt(nbt);
|
||||
stack.setCustomName(new LiteralText("Lingering Potion of Trolling"));
|
||||
return stack;
|
||||
});
|
||||
|
||||
PRESETS.put("32k", (preview) -> {
|
||||
if (preview) return Items.DIAMOND_SWORD.getDefaultStack();
|
||||
ItemStack stack =Items.DIAMOND_SWORD.getDefaultStack();
|
||||
NbtList enchants = new NbtList();
|
||||
addEnchant(enchants, "minecraft:sharpness");
|
||||
addEnchant(enchants, "minecraft:knockback");
|
||||
addEnchant(enchants, "minecraft:fire_aspect");
|
||||
addEnchant(enchants, "minecraft:looting", (short)10);
|
||||
addEnchant(enchants, "minecraft:sweeping", (short)3);
|
||||
addEnchant(enchants, "minecraft:unbreaking");
|
||||
addEnchant(enchants, "minecraft:mending", (short)1);
|
||||
addEnchant(enchants, "minecraft:vanishing_curse", (short)1);
|
||||
NbtCompound nbt = new NbtCompound();
|
||||
nbt.put("Enchantments", enchants);
|
||||
stack.setNbt(nbt);
|
||||
stack.setCustomName(new LiteralText("Bonk"));
|
||||
return stack;
|
||||
});
|
||||
|
||||
PRESETS.put("crash_chest", (preview) -> {
|
||||
if (preview) return Items.CHEST.getDefaultStack();
|
||||
ItemStack stack = Items.CHEST.getDefaultStack();
|
||||
NbtCompound nbtCompound = new NbtCompound();
|
||||
NbtList nbtList = new NbtList();
|
||||
for(int i = 0; i < 40000; i++)
|
||||
nbtList.add(new NbtList());
|
||||
nbtCompound.put("nothingsuspicioushere", nbtList);
|
||||
stack.setNbt(nbtCompound);
|
||||
stack.setCustomName(new LiteralText("Copy Me"));
|
||||
return stack;
|
||||
});
|
||||
|
||||
PRESETS.put("firework", (preview) -> {
|
||||
if (preview) return Items.FIREWORK_ROCKET.getDefaultStack();
|
||||
|
||||
ItemStack firework = new ItemStack(Items.FIREWORK_ROCKET);
|
||||
NbtCompound baseCompound = new NbtCompound();
|
||||
NbtCompound tagCompound = new NbtCompound();
|
||||
NbtList explosionList = new NbtList();
|
||||
for(int i = 0; i < 5000; i++)
|
||||
{
|
||||
NbtCompound explosionCompound = new NbtCompound();
|
||||
explosionCompound.putByte("Type", (byte)random.nextInt(5));
|
||||
|
||||
int colors[] = {1973019,11743532,3887386,5320730,2437522,8073150,2651799,11250603,4408131,14188952,4312372,14602026,6719955,12801229,15435844,15790320};
|
||||
|
||||
explosionCompound.putIntArray("Colors", colors);
|
||||
explosionList.add(explosionCompound);
|
||||
}
|
||||
tagCompound.putInt("Flight", 0);
|
||||
tagCompound.put("Explosions", explosionList);
|
||||
baseCompound.put("Fireworks", tagCompound);
|
||||
firework.setNbt(baseCompound);
|
||||
return firework;
|
||||
});
|
||||
|
||||
HIDDEN_ENTITIES.forEach((id) -> {
|
||||
PRESETS.put(id.getPath()+"_spawn_egg", (preview) -> {
|
||||
if (preview) return Items.PIG_SPAWN_EGG.getDefaultStack();
|
||||
ItemStack egg = Items.PIG_SPAWN_EGG.getDefaultStack();
|
||||
NbtCompound tag = new NbtCompound();
|
||||
NbtCompound entityTag = new NbtCompound();
|
||||
entityTag.putString("id", id.toString());
|
||||
tag.put("EntityTag", entityTag);
|
||||
egg.setNbt(tag);
|
||||
egg.setCustomName(new LiteralText(String.format("%s", toName(id.getPath()))));
|
||||
return egg;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public static ItemStack getPreset(String name, boolean preview) {
|
||||
return PRESETS.get(name).apply(preview);
|
||||
}
|
||||
|
||||
public static ItemStack getPreset(String name) {
|
||||
return getPreset(name, false);
|
||||
}
|
||||
|
||||
private static String toName(Object id) {
|
||||
return WordUtils.capitalizeFully(id.toString().replace("_", " "));
|
||||
}
|
||||
|
||||
private static void addEnchant(NbtList tag, String id, short v) {
|
||||
NbtCompound enchant = new NbtCompound();
|
||||
enchant.putShort("lvl", v);
|
||||
enchant.putString("id", id);
|
||||
tag.add(enchant);
|
||||
}
|
||||
|
||||
private static void addEnchant(NbtList tag, String id) {
|
||||
addEnchant(tag, id, Short.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
78
src/main/java/anticope/rejects/utils/RejectsConfig.java
Normal file
78
src/main/java/anticope/rejects/utils/RejectsConfig.java
Normal file
@@ -0,0 +1,78 @@
|
||||
package anticope.rejects.utils;
|
||||
|
||||
import meteordevelopment.meteorclient.systems.System;
|
||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||
import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import meteordevelopment.meteorclient.MeteorClient;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtElement;
|
||||
import net.minecraft.nbt.NbtList;
|
||||
import net.minecraft.nbt.NbtString;
|
||||
|
||||
public class RejectsConfig extends System<RejectsConfig> {
|
||||
private static final RejectsConfig INSTANCE = new RejectsConfig();
|
||||
|
||||
public enum HttpAllowed {
|
||||
Everything,
|
||||
NotMeteorApi,
|
||||
NotMeteorPing,
|
||||
Nothing
|
||||
}
|
||||
|
||||
public HttpAllowed httpAllowed = HttpAllowed.Everything;
|
||||
public Set<String> hiddenModules = new HashSet<String>();
|
||||
|
||||
public RejectsConfig() {
|
||||
super("rejects-config");
|
||||
init();
|
||||
load(MeteorClient.FOLDER);
|
||||
}
|
||||
|
||||
public static RejectsConfig get() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void setHiddenModules(List<Module> newList) {
|
||||
for (Module module : newList) {
|
||||
if (module.isActive()) module.toggle();
|
||||
hiddenModules.add(module.name);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Module> getHiddenModules() {
|
||||
Modules modules = Modules.get();
|
||||
if (modules == null) return Arrays.asList();
|
||||
return hiddenModules.stream().map(modules::get).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NbtCompound toTag() {
|
||||
NbtCompound tag = new NbtCompound();
|
||||
tag.putString("httpAllowed", httpAllowed.toString());
|
||||
|
||||
NbtList modulesTag = new NbtList();
|
||||
for (String module : hiddenModules) modulesTag.add(NbtString.of(module));
|
||||
tag.put("hiddenModules", modulesTag);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RejectsConfig fromTag(NbtCompound tag) {
|
||||
httpAllowed = HttpAllowed.valueOf(tag.getString("httpAllowed"));
|
||||
|
||||
NbtList valueTag = tag.getList("hiddenModules", 8);
|
||||
for (NbtElement tagI : valueTag) {
|
||||
hiddenModules.add(tagI.asString());
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
32
src/main/java/anticope/rejects/utils/RejectsUtils.java
Normal file
32
src/main/java/anticope/rejects/utils/RejectsUtils.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package anticope.rejects.utils;
|
||||
|
||||
import anticope.rejects.utils.seeds.Seeds;
|
||||
import meteordevelopment.meteorclient.MeteorClient;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class RejectsUtils {
|
||||
public static int CPS = 0;
|
||||
|
||||
public static void init() {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
RejectsConfig.get().save(MeteorClient.FOLDER);
|
||||
Seeds.get().save(MeteorClient.FOLDER);
|
||||
}));
|
||||
|
||||
new Timer().scheduleAtFixedRate(newTimerTaskFromLambda(() -> CPS = 0), 0, 1000);
|
||||
}
|
||||
|
||||
public static TimerTask newTimerTaskFromLambda(Runnable runnable)
|
||||
{
|
||||
return new TimerTask()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
runnable.run();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
37
src/main/java/anticope/rejects/utils/TntDamage.java
Normal file
37
src/main/java/anticope/rejects/utils/TntDamage.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package anticope.rejects.utils;
|
||||
|
||||
import meteordevelopment.meteorclient.utils.Utils;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class TntDamage {
|
||||
public static int calculate(BlockPos bp) {
|
||||
if (!Utils.canUpdate()) return 0;
|
||||
int score = 0;
|
||||
|
||||
for(int j = -5; j <= 5; ++j) {
|
||||
for(int k = -5; k <= 5; ++k) {
|
||||
for(int l = -5; l <= 5; ++l) {
|
||||
BlockPos blockPos = new BlockPos(j, k, l);
|
||||
BlockState blockState = Utils.mc.world.getBlockState(blockPos);
|
||||
FluidState fluidState = Utils.mc.world.getFluidState(blockPos);
|
||||
|
||||
float h = 2.8F;
|
||||
Optional<Float> optional = blockState.isAir() && fluidState.isEmpty() ? Optional.empty() : Optional.of(Math.max(blockState.getBlock().getBlastResistance(), fluidState.getBlastResistance()));;
|
||||
if (optional.isPresent()) {
|
||||
h -= (optional.get() + 0.3F) * 0.3F;
|
||||
}
|
||||
|
||||
if (h > 0.0F) {
|
||||
score++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return score;
|
||||
}
|
||||
}
|
||||
349
src/main/java/anticope/rejects/utils/WorldGenUtils.java
Normal file
349
src/main/java/anticope/rejects/utils/WorldGenUtils.java
Normal file
@@ -0,0 +1,349 @@
|
||||
package anticope.rejects.utils;
|
||||
|
||||
import anticope.rejects.utils.seeds.Seed;
|
||||
import anticope.rejects.utils.seeds.Seeds;
|
||||
import baritone.api.BaritoneAPI;
|
||||
import kaptainwutax.biomeutils.source.BiomeSource;
|
||||
import kaptainwutax.featureutils.misc.SlimeChunk;
|
||||
import kaptainwutax.featureutils.structure.*;
|
||||
import kaptainwutax.mcutils.rand.ChunkRand;
|
||||
import kaptainwutax.mcutils.state.Dimension;
|
||||
import kaptainwutax.mcutils.util.data.SpiralIterator;
|
||||
import kaptainwutax.mcutils.util.pos.*;
|
||||
import kaptainwutax.mcutils.version.MCVersion;
|
||||
import kaptainwutax.terrainutils.TerrainGenerator;
|
||||
import meteordevelopment.meteorclient.utils.player.ChatUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.mob.*;
|
||||
import net.minecraft.entity.passive.IronGolemEntity;
|
||||
import net.minecraft.entity.passive.VillagerEntity;
|
||||
import net.minecraft.entity.vehicle.ChestMinecartEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.*;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import static meteordevelopment.meteorclient.utils.Utils.mc;
|
||||
|
||||
public class WorldGenUtils {
|
||||
|
||||
private static final Logger LOG = LogManager.getLogger();
|
||||
|
||||
private static final HashMap<Feature, List<Block>> FEATURE_BLOCKS = new HashMap<>(){{
|
||||
put(Feature.nether_fortress, Arrays.asList(
|
||||
Blocks.NETHER_BRICKS,
|
||||
Blocks.NETHER_BRICK_FENCE,
|
||||
Blocks.NETHER_WART
|
||||
));
|
||||
put(Feature.ocean_monument, Arrays.asList(
|
||||
Blocks.PRISMARINE_BRICKS,
|
||||
Blocks.SEA_LANTERN,
|
||||
Blocks.DARK_PRISMARINE
|
||||
));
|
||||
put(Feature.stronghold, Arrays.asList(
|
||||
Blocks.END_PORTAL_FRAME,
|
||||
Blocks.END_PORTAL
|
||||
));
|
||||
put(Feature.end_city, Arrays.asList(
|
||||
Blocks.PURPUR_BLOCK,
|
||||
Blocks.PURPUR_PILLAR,
|
||||
Blocks.PURPUR_STAIRS,
|
||||
Blocks.END_ROD
|
||||
));
|
||||
put(Feature.village, Arrays.asList(
|
||||
Blocks.BELL,
|
||||
Blocks.BREWING_STAND,
|
||||
Blocks.SMOKER,
|
||||
Blocks.BLAST_FURNACE,
|
||||
Blocks.FLETCHING_TABLE,
|
||||
Blocks.STONECUTTER,
|
||||
Blocks.LOOM,
|
||||
Blocks.GRINDSTONE,
|
||||
Blocks.LECTERN
|
||||
));
|
||||
put(Feature.mineshaft, Collections.singletonList(
|
||||
Blocks.RAIL
|
||||
));
|
||||
put(Feature.desert_pyramid, Arrays.asList(
|
||||
Blocks.TNT,
|
||||
Blocks.CHISELED_SANDSTONE,
|
||||
Blocks.STONE_PRESSURE_PLATE
|
||||
));
|
||||
}};
|
||||
|
||||
private static final HashMap<Feature, List<Class<? extends Entity>>> FEATURE_ENTITIES = new HashMap<>(){{
|
||||
put(Feature.ocean_monument, Arrays.asList(
|
||||
ElderGuardianEntity.class,
|
||||
GuardianEntity.class
|
||||
));
|
||||
put(Feature.nether_fortress, Arrays.asList(
|
||||
BlazeEntity.class,
|
||||
WitherSkeletonEntity.class
|
||||
));
|
||||
put(Feature.mansion, Collections.singletonList(
|
||||
EvokerEntity.class
|
||||
));
|
||||
put(Feature.slime_chunk, Collections.singletonList(
|
||||
SlimeEntity.class
|
||||
));
|
||||
put(Feature.bastion_remnant, Collections.singletonList(
|
||||
PiglinBruteEntity.class
|
||||
));
|
||||
put(Feature.end_city, Collections.singletonList(
|
||||
ShulkerEntity.class
|
||||
));
|
||||
put(Feature.village, Arrays.asList(
|
||||
VillagerEntity.class,
|
||||
IronGolemEntity.class
|
||||
));
|
||||
put(Feature.mineshaft, Collections.singletonList(
|
||||
ChestMinecartEntity.class
|
||||
));
|
||||
}};
|
||||
|
||||
public enum Feature {
|
||||
buried_treasure,
|
||||
mansion,
|
||||
stronghold,
|
||||
nether_fortress,
|
||||
ocean_monument,
|
||||
bastion_remnant,
|
||||
end_city,
|
||||
village,
|
||||
mineshaft,
|
||||
slime_chunk,
|
||||
desert_pyramid
|
||||
}
|
||||
|
||||
public static BlockPos locateFeature(Feature feature, BlockPos center) {
|
||||
Seed seed = Seeds.get().getSeed();
|
||||
BlockPos pos = null;
|
||||
if (seed != null) {
|
||||
try {
|
||||
pos = locateFeature(seed, feature, center);
|
||||
} catch (Exception | Error ex) {
|
||||
LOG.error(ex);
|
||||
}
|
||||
if (pos != null) return pos;
|
||||
}
|
||||
if (mc.player != null) {
|
||||
ItemStack stack = mc.player.getStackInHand(Hand.MAIN_HAND);
|
||||
if (stack.getItem() != Items.FILLED_MAP)
|
||||
stack = mc.player.getStackInHand(Hand.OFF_HAND);
|
||||
if (stack.getItem() == Items.FILLED_MAP) {
|
||||
try {
|
||||
pos = locateFeatureMap(feature, stack);
|
||||
} catch (Exception | Error ex) {
|
||||
LOG.error(ex);
|
||||
}
|
||||
if (pos != null) return pos;
|
||||
}
|
||||
}
|
||||
try {
|
||||
pos = locateFeatureEntities(feature);
|
||||
} catch (Exception | Error ex) {
|
||||
LOG.error(ex);
|
||||
}
|
||||
if (pos != null) return pos;
|
||||
try {
|
||||
pos = locateFeatureBlocks(feature);
|
||||
} catch (Exception | Error ex) {
|
||||
LOG.error(ex);
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
private static BlockPos locateFeatureMap(Feature feature, ItemStack stack) {
|
||||
if (!isValidMap(feature, stack)) return null;
|
||||
return getMapMarker(stack);
|
||||
}
|
||||
|
||||
private static BlockPos locateFeatureBlocks(Feature feature) {
|
||||
List<Block> blocks = FEATURE_BLOCKS.get(feature);
|
||||
if (blocks == null) return null;
|
||||
List<BlockPos> posList = BaritoneAPI
|
||||
.getProvider()
|
||||
.getWorldScanner()
|
||||
.scanChunkRadius(
|
||||
BaritoneAPI
|
||||
.getProvider()
|
||||
.getPrimaryBaritone()
|
||||
.getPlayerContext(),
|
||||
blocks,64,10,32);
|
||||
if (posList.isEmpty()) return null;
|
||||
if (posList.size() < 5) {
|
||||
ChatUtils.warning("Locate", "Only %d block(s) found. This search might be a false positive.", posList.size());
|
||||
}
|
||||
return posList.get(0);
|
||||
}
|
||||
|
||||
private static BlockPos locateFeatureEntities(Feature feature) {
|
||||
List<Class<? extends Entity>> entities = FEATURE_ENTITIES.get(feature);
|
||||
if (entities == null) return null;
|
||||
if (mc.world == null) return null;
|
||||
for (Entity e: mc.world.getEntities()) {
|
||||
for (Class<? extends Entity> clazz: entities) {
|
||||
if (clazz.isInstance(e))
|
||||
return e.getBlockPos();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static BlockPos locateFeature(Seed seed, Feature feature, BlockPos center) {
|
||||
if (feature == Feature.slime_chunk) return locateSlimeChunk(seed, center);
|
||||
return locateStructure(seed, feature, center);
|
||||
}
|
||||
|
||||
private static BlockPos locateSlimeChunk(Seed seed, BlockPos center) {
|
||||
Dimension dimension = getDimension(Feature.slime_chunk);
|
||||
MCVersion mcVersion = seed.version;
|
||||
CPos centerChunk = new CPos(center.getX() >> 4, center.getZ() >> 4);
|
||||
CPos slimeChunkPos = locateSlimeChunk(new SlimeChunk(mcVersion), centerChunk, 6400, seed.seed, new ChunkRand(), dimension);
|
||||
if (slimeChunkPos == null) return null;
|
||||
return toBlockPos(slimeChunkPos.toBlockPos());
|
||||
}
|
||||
|
||||
private static CPos locateSlimeChunk(SlimeChunk slimeChunk, CPos centerChunk, int radius, long seed, ChunkRand rand, Dimension dimension) {
|
||||
if (!slimeChunk.isValidDimension(dimension))
|
||||
return null;
|
||||
SpiralIterator<CPos> spiralIterator = new SpiralIterator<>(centerChunk, new CPos(radius, radius), (x, y, z) -> new CPos(x, z));
|
||||
for (CPos next : spiralIterator) {
|
||||
SlimeChunk.Data data = slimeChunk.at(next.getX(), next.getZ(), true);
|
||||
if (data.testStart(seed, rand)) {
|
||||
return next;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static BlockPos locateStructure(Seed seed, Feature feature, BlockPos center) {
|
||||
Dimension dimension = getDimension(feature);
|
||||
MCVersion mcVersion = seed.version;
|
||||
Structure<?, ?> structure = getStructure(feature, mcVersion);
|
||||
if (structure == null) return null;
|
||||
BiomeSource biomeSource = BiomeSource.of(dimension, mcVersion, seed.seed);
|
||||
if (!structure.isValidDimension(biomeSource.getDimension()))
|
||||
return null;
|
||||
BPos structurePos = locateStructure(structure, new BPos(center.getX(), center.getY(), center.getZ()), 6400, new ChunkRand(), biomeSource, TerrainGenerator.of(biomeSource));
|
||||
if (structurePos == null) return null;
|
||||
return toBlockPos(structurePos);
|
||||
}
|
||||
|
||||
private static BPos locateStructure(Structure<?, ?> structure, BPos center, int radius, ChunkRand chunkRand, BiomeSource source, TerrainGenerator terrainGenerator) {
|
||||
if (structure instanceof RegionStructure<?, ?> regionStructure) {
|
||||
int chunkInRegion = regionStructure.getSpacing();
|
||||
int regionSize = chunkInRegion * 16;
|
||||
|
||||
final int border = 30_000_000;
|
||||
SpiralIterator<RPos> spiralIterator = new SpiralIterator<>(center.toRegionPos(regionSize), new BPos(-border, 0, -border).toRegionPos(regionSize), new BPos(border, 0, border).toRegionPos(regionSize), 1, (x, y, z) -> new RPos(x, z, regionSize));
|
||||
return StreamSupport.stream(spiralIterator.spliterator(), false)
|
||||
.map(rPos -> regionStructure.getInRegion(source.getWorldSeed(), rPos.getX(), rPos.getZ(), chunkRand))
|
||||
.filter(Objects::nonNull)
|
||||
.filter(cPos -> (regionStructure.canSpawn(cPos, source)) && (terrainGenerator == null || regionStructure.canGenerate(cPos, terrainGenerator)))
|
||||
.findAny().map(cPos -> cPos.toBlockPos().add(9, 0, 9)).orElse(null);
|
||||
} else {
|
||||
if (structure instanceof Stronghold strongholdStructure) {
|
||||
CPos currentChunkPos = center.toChunkPos();
|
||||
int squaredDistance = Integer.MAX_VALUE;
|
||||
CPos closest = new CPos(0, 0);
|
||||
for (CPos stronghold : strongholdStructure.getAllStarts(source, chunkRand)) {
|
||||
int newSquaredDistance = (currentChunkPos.getX() - stronghold.getX()) * (currentChunkPos.getX() - stronghold.getX()) + (currentChunkPos.getZ() - stronghold.getZ()) * (currentChunkPos.getZ() - stronghold.getZ());
|
||||
if (newSquaredDistance < squaredDistance) {
|
||||
squaredDistance = newSquaredDistance;
|
||||
closest = stronghold;
|
||||
}
|
||||
}
|
||||
BPos dimPos = closest.toBlockPos().add(9, 0, 9);
|
||||
return new BPos(dimPos.getX(), 0, dimPos.getZ());
|
||||
} else if (structure instanceof Mineshaft mineshaft) {
|
||||
SpiralIterator<CPos> spiralIterator = new SpiralIterator<>(new CPos(center.getX() >> 4, center.getZ() >> 4), new CPos(radius, radius), (x, y, z) -> new CPos(x, z));
|
||||
|
||||
return StreamSupport.stream(spiralIterator.spliterator(), false)
|
||||
.filter(cPos -> {
|
||||
kaptainwutax.featureutils.Feature.Data<Mineshaft> data = mineshaft.at(cPos.getX(), cPos.getZ());
|
||||
return data.testStart(source.getWorldSeed(), chunkRand) && data.testBiome(source) && data.testGenerate(terrainGenerator);
|
||||
})
|
||||
.findAny().map(cPos -> cPos.toBlockPos().add(9, 0, 9)).orElse(null);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Dimension getDimension(Feature feature) {
|
||||
switch (feature) {
|
||||
case buried_treasure -> { return Dimension.OVERWORLD; }
|
||||
case mansion -> { return Dimension.OVERWORLD; }
|
||||
case stronghold -> { return Dimension.OVERWORLD; }
|
||||
case nether_fortress -> { return Dimension.NETHER; }
|
||||
case ocean_monument -> { return Dimension.OVERWORLD; }
|
||||
case bastion_remnant -> { return Dimension.NETHER; }
|
||||
case slime_chunk -> { return Dimension.OVERWORLD; }
|
||||
case village -> { return Dimension.OVERWORLD; }
|
||||
case mineshaft -> { return Dimension.OVERWORLD; }
|
||||
case end_city -> { return Dimension.END; }
|
||||
case desert_pyramid -> { return Dimension.OVERWORLD; }
|
||||
default -> { return Dimension.OVERWORLD; }
|
||||
}
|
||||
}
|
||||
|
||||
private static Structure<?, ?> getStructure(Feature feature, MCVersion version) {
|
||||
switch (feature) {
|
||||
case buried_treasure -> { return new BuriedTreasure(version); }
|
||||
case mansion -> { return new Mansion(version); }
|
||||
case stronghold -> { return new Stronghold(version); }
|
||||
case nether_fortress -> { return new Fortress(version); }
|
||||
case ocean_monument -> { return new Monument(version); }
|
||||
case bastion_remnant -> { return new BastionRemnant(version); }
|
||||
case end_city -> { return new EndCity(version); }
|
||||
case village -> { return new Village(version); }
|
||||
case mineshaft -> { return new Mineshaft(version); }
|
||||
case desert_pyramid -> { return new DesertPyramid(version); }
|
||||
default -> { return null;}
|
||||
}
|
||||
}
|
||||
|
||||
private static BlockPos toBlockPos(BPos pos) {
|
||||
return new BlockPos(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
private static boolean isValidMap(Feature feature, ItemStack stack) {
|
||||
if (!stack.hasNbt()) return false;
|
||||
if (!stack.getNbt().contains("display")) return false;
|
||||
NbtCompound displayTag = stack.getNbt().getCompound("display");
|
||||
if (!displayTag.contains("Name")) return false;
|
||||
String nameTag = displayTag.getString("Name");
|
||||
if (!nameTag.contains("translate")) return false;
|
||||
|
||||
if (feature == Feature.buried_treasure) {
|
||||
return nameTag.contains("filled_map.buried_treasure");
|
||||
} else if (feature == Feature.ocean_monument) {
|
||||
return nameTag.contains("filled_map.monument");
|
||||
} else if (feature == Feature.mansion) {
|
||||
return nameTag.contains("filled_map.mansion");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static BlockPos getMapMarker(ItemStack stack) {
|
||||
if (!stack.hasNbt()) return null;
|
||||
if (!stack.getNbt().contains("Decorations")) return null;
|
||||
NbtList decorationsTag = stack.getNbt().getList("Decorations", NbtElement.COMPOUND_TYPE);
|
||||
if (decorationsTag.size() < 1) return null;
|
||||
NbtCompound iconTag = decorationsTag.getCompound(0);
|
||||
return new BlockPos(
|
||||
(int)iconTag.getDouble("x"),
|
||||
(int)iconTag.getDouble("y"),
|
||||
(int)iconTag.getDouble("z")
|
||||
);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user