.save-skin, better .give, interactionMenu, cate...
This commit is contained in:
@@ -2,8 +2,10 @@ package cloudburst.rejects;
|
||||
|
||||
import minegame159.meteorclient.MeteorAddon;
|
||||
import minegame159.meteorclient.systems.commands.Commands;
|
||||
import minegame159.meteorclient.systems.modules.Category;
|
||||
import minegame159.meteorclient.systems.modules.Modules;
|
||||
|
||||
import net.minecraft.item.Items;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -12,22 +14,38 @@ import cloudburst.rejects.modules.*;
|
||||
|
||||
public class MeteorRejectsAddon extends MeteorAddon {
|
||||
public static final Logger LOG = LogManager.getLogger();
|
||||
public static final Category CATEGORY = new Category("Rejects", Items.PODZOL.getDefaultStack());
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
LOG.info("Initializing Meteor Rejects Addon");
|
||||
|
||||
Modules modules = Modules.get();
|
||||
modules.add(new AntiBot());
|
||||
modules.add(new AntiSpawnpoint());
|
||||
modules.add(new AntiVanish());
|
||||
modules.add(new AutoExtinguish());
|
||||
//modules.add(new AutoHighway());
|
||||
modules.add(new AutoPot());
|
||||
modules.add(new Confuse());
|
||||
//modules.add(new Confuse());
|
||||
modules.add(new InteractionMenu());
|
||||
modules.add(new Glide());
|
||||
modules.add(new Lavacast());
|
||||
//modules.add(new ObsidianFarm());
|
||||
modules.add(new RenderInvisible());
|
||||
modules.add(new SoundLocator());
|
||||
modules.add(new TPSSync());
|
||||
|
||||
Commands commands = Commands.get();
|
||||
commands.add(new AntiAntiXrayCommand());
|
||||
commands.add(new BookDupeCommand());
|
||||
commands.add(new GiveCommand());
|
||||
commands.add(new SaveSkinCommand());
|
||||
commands.add(new TpsCommand());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRegisterCategories() {
|
||||
Modules.registerCategory(CATEGORY);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,90 @@
|
||||
package cloudburst.rejects.commands;
|
||||
|
||||
import com.google.gson.*;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import minegame159.meteorclient.systems.commands.Command;
|
||||
import minegame159.meteorclient.systems.commands.arguments.PlayerArgumentType;
|
||||
import minegame159.meteorclient.utils.network.HttpUtils;
|
||||
import minegame159.meteorclient.utils.player.ChatUtils;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.command.argument.GameProfileArgumentType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
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 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.endsWith(".png")) path += ".png";
|
||||
saveSkin(playerEntity.getUuidAsString(),path);
|
||||
return SINGLE_SUCCESS;
|
||||
}));
|
||||
}
|
||||
|
||||
private void saveSkin(String uuid, String path) {
|
||||
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 = HttpUtils.get(String.format(PROFILE_REQUEST_URL, uuid),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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
src/main/java/cloudburst/rejects/commands/TpsCommand.java
Normal file
36
src/main/java/cloudburst/rejects/commands/TpsCommand.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package cloudburst.rejects.commands;
|
||||
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import minegame159.meteorclient.systems.commands.Command;
|
||||
import minegame159.meteorclient.utils.player.ChatUtils;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import minegame159.meteorclient.utils.world.TickRate;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
|
||||
|
||||
public class TpsCommand extends Command {
|
||||
public TpsCommand() {
|
||||
super("tps", "Display current TPS");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(LiteralArgumentBuilder<CommandSource> builder) {
|
||||
builder.executes(ctx -> {
|
||||
float tps = TickRate.INSTANCE.getTickRate();
|
||||
Formatting color = Formatting.WHITE;
|
||||
if (tps>17.0f) {
|
||||
color = Formatting.GREEN;
|
||||
}
|
||||
else if (tps>12.0f) {
|
||||
color = Formatting.YELLOW;
|
||||
}
|
||||
else {
|
||||
color = Formatting.RED;
|
||||
}
|
||||
ChatUtils.prefixInfo("TPS", "Current TPS: %s%.2f", color, tps);
|
||||
return SINGLE_SUCCESS;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package cloudburst.rejects.mixin;
|
||||
|
||||
import net.minecraft.entity.passive.HorseBaseEntity;
|
||||
import net.minecraft.inventory.SimpleInventory;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(HorseBaseEntity.class)
|
||||
public interface HorseBaseEntityAccessor {
|
||||
@Accessor("items")
|
||||
SimpleInventory getItems();
|
||||
}
|
||||
100
src/main/java/cloudburst/rejects/modules/AntiBot.java
Normal file
100
src/main/java/cloudburst/rejects/modules/AntiBot.java
Normal file
@@ -0,0 +1,100 @@
|
||||
package cloudburst.rejects.modules;
|
||||
|
||||
import cloudburst.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import minegame159.meteorclient.events.world.TickEvent;
|
||||
import minegame159.meteorclient.settings.BoolSetting;
|
||||
import minegame159.meteorclient.settings.Setting;
|
||||
import minegame159.meteorclient.settings.SettingGroup;
|
||||
import minegame159.meteorclient.systems.modules.Categories;
|
||||
import minegame159.meteorclient.systems.modules.Module;
|
||||
import minegame159.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();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
60
src/main/java/cloudburst/rejects/modules/AntiSpawnpoint.java
Normal file
60
src/main/java/cloudburst/rejects/modules/AntiSpawnpoint.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package cloudburst.rejects.modules;
|
||||
|
||||
import cloudburst.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import minegame159.meteorclient.events.packets.PacketEvent;
|
||||
import minegame159.meteorclient.settings.BoolSetting;
|
||||
import minegame159.meteorclient.settings.Setting;
|
||||
import minegame159.meteorclient.settings.SettingGroup;
|
||||
import minegame159.meteorclient.systems.modules.Categories;
|
||||
import minegame159.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
140
src/main/java/cloudburst/rejects/modules/AntiVanish.java
Normal file
140
src/main/java/cloudburst/rejects/modules/AntiVanish.java
Normal file
@@ -0,0 +1,140 @@
|
||||
package cloudburst.rejects.modules;
|
||||
|
||||
import cloudburst.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 minegame159.meteorclient.events.game.GameLeftEvent;
|
||||
import minegame159.meteorclient.events.packets.PacketEvent;
|
||||
import minegame159.meteorclient.events.world.TickEvent;
|
||||
import minegame159.meteorclient.systems.modules.Categories;
|
||||
import minegame159.meteorclient.systems.modules.Module;
|
||||
import minegame159.meteorclient.utils.entity.EntityUtils;
|
||||
import minegame159.meteorclient.utils.player.ChatUtils;
|
||||
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.Objects;
|
||||
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;
|
||||
|
||||
@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) {
|
||||
ChatUtils.moduleWarning(this, 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 AntiVanish() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "anti-vanish", "Notifies user when a admin uses /vanish");
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
193
src/main/java/cloudburst/rejects/modules/AutoExtinguish.java
Normal file
193
src/main/java/cloudburst/rejects/modules/AutoExtinguish.java
Normal file
@@ -0,0 +1,193 @@
|
||||
package cloudburst.rejects.modules;
|
||||
|
||||
import cloudburst.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import minegame159.meteorclient.events.world.TickEvent;
|
||||
import minegame159.meteorclient.settings.BoolSetting;
|
||||
import minegame159.meteorclient.settings.IntSetting;
|
||||
import minegame159.meteorclient.settings.Setting;
|
||||
import minegame159.meteorclient.settings.SettingGroup;
|
||||
import minegame159.meteorclient.systems.modules.Categories;
|
||||
import minegame159.meteorclient.systems.modules.Module;
|
||||
import minegame159.meteorclient.utils.player.ChatUtils;
|
||||
import minegame159.meteorclient.utils.player.InvUtils;
|
||||
import minegame159.meteorclient.utils.player.PlayerUtils;
|
||||
import minegame159.meteorclient.utils.player.RotationUtils;
|
||||
import minegame159.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 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");
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Pre event) {
|
||||
if (mc.world.getDimension().isRespawnAnchorWorking()) {
|
||||
if (doesWaterBucketWork) {
|
||||
ChatUtils.warning("Water Buckets don't work in this dimension!");
|
||||
doesWaterBucketWork = false;
|
||||
|
||||
}
|
||||
} else {
|
||||
if (!doesWaterBucketWork) {
|
||||
ChatUtils.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();
|
||||
}
|
||||
RotationUtils.packetRotate(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));
|
||||
|
||||
RotationUtils.packetRotate(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.inventory.selectedSlot;
|
||||
if (center.get()) {
|
||||
PlayerUtils.centerPlayer();
|
||||
}
|
||||
mc.player.inventory.selectedSlot = slot;
|
||||
float yaw = mc.gameRenderer.getCamera().getYaw() % 360;
|
||||
float pitch = mc.gameRenderer.getCamera().getPitch() % 360;
|
||||
|
||||
RotationUtils.packetRotate(yaw, 90);
|
||||
mc.interactionManager.interactItem(mc.player, mc.player.world, Hand.MAIN_HAND);
|
||||
mc.player.inventory.selectedSlot = preSlot;
|
||||
RotationUtils.packetRotate(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.inventory.getStack(i);
|
||||
if (block.getItem() == item) {
|
||||
slot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return slot;
|
||||
}
|
||||
|
||||
}
|
||||
655
src/main/java/cloudburst/rejects/modules/AutoHighway.java
Normal file
655
src/main/java/cloudburst/rejects/modules/AutoHighway.java
Normal file
@@ -0,0 +1,655 @@
|
||||
package cloudburst.rejects.modules;
|
||||
|
||||
import cloudburst.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import minegame159.meteorclient.events.world.TickEvent;
|
||||
import minegame159.meteorclient.systems.modules.Categories;
|
||||
import minegame159.meteorclient.systems.modules.Module;
|
||||
import minegame159.meteorclient.settings.BoolSetting;
|
||||
import minegame159.meteorclient.settings.IntSetting;
|
||||
import minegame159.meteorclient.settings.Setting;
|
||||
import minegame159.meteorclient.settings.SettingGroup;
|
||||
import minegame159.meteorclient.utils.player.InvUtils;
|
||||
import minegame159.meteorclient.utils.world.BlockUtils;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class AutoHighway extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
private final Setting<Boolean> disableOnJump = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("disable-on-jump")
|
||||
.description("Automatically disables when you jump.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Integer> size = sgGeneral.add(new IntSetting.Builder()
|
||||
.name("highway-size")
|
||||
.description("The size of highway.")
|
||||
.defaultValue(3)
|
||||
.min(3)
|
||||
.sliderMin(3)
|
||||
.max(7)
|
||||
.sliderMax(7)
|
||||
.build()
|
||||
);
|
||||
|
||||
private final Setting<Boolean> rotate = sgGeneral.add(new BoolSetting.Builder()
|
||||
.name("rotate")
|
||||
.description("Automatically faces towards the obsidian being placed.")
|
||||
.defaultValue(true)
|
||||
.build()
|
||||
);
|
||||
|
||||
private enum Direction {
|
||||
SOUTH,
|
||||
SOUTH_WEST,
|
||||
WEST,
|
||||
WEST_NORTH,
|
||||
NORTH,
|
||||
NORTH_EAST,
|
||||
EAST,
|
||||
EAST_SOUTH
|
||||
}
|
||||
private Direction direction;
|
||||
private final BlockPos.Mutable blockPos = new BlockPos.Mutable();
|
||||
private boolean return_;
|
||||
private int highwaySize;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public AutoHighway() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "auto-highway", "Automatically build highway.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
direction = getDirection(mc.player);
|
||||
blockPos.set(mc.player.getBlockPos());
|
||||
changeBlockPos(0,-1,0);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Pre event) {
|
||||
if (disableOnJump.get() && mc.options.keyJump.isPressed()) {
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
// Check Obsidian
|
||||
if(InvUtils.findItemInHotbar(Items.OBSIDIAN) == -1) return;
|
||||
// Get Size
|
||||
highwaySize = getSize();
|
||||
// Place
|
||||
return_ = false;
|
||||
// Distance Check
|
||||
if(getDistance(mc.player) > 12) return;
|
||||
// Placing
|
||||
if(direction == Direction.SOUTH){
|
||||
if(highwaySize == 3) {
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p3 = place(-1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p4 = place(-2, 1, 0);
|
||||
if (return_) return;
|
||||
boolean p5 = place(2, 1, 0);
|
||||
if(p1&&p2&&p3&&p4&&p5) nextLayer();
|
||||
}else if(highwaySize == 5){
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p3 = place(-1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p4 = place(-2, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p5 = place(2, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p6 = place(-3, 1, 0);
|
||||
if (return_) return;
|
||||
boolean p7 = place(3, 1, 0);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7) nextLayer();
|
||||
}else {
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p3 = place(-1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p4 = place(-2, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p5 = place(2, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p6 = place(-3, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p7 = place(3, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p8 = place(-4, 1, 0);
|
||||
if (return_) return;
|
||||
boolean p9 = place(4, 1, 0);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7&&p8&&p9) nextLayer();
|
||||
}
|
||||
}else if(direction == Direction.WEST){
|
||||
if(highwaySize == 3) {
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(0, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(0, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(0, 1, -2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(0, 1, 2);
|
||||
if(p1&&p2&&p3&&p4&&p5) nextLayer();
|
||||
}else if(highwaySize == 5){
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(0, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(0, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(0, 0, -2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(0, 0, 2);
|
||||
if (return_) return;
|
||||
boolean p6 = place(0, 1, -3);
|
||||
if (return_) return;
|
||||
boolean p7 = place(0, 1, 3);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7) nextLayer();
|
||||
}else {
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(0, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(0, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(0, 0, -2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(0, 0, 2);
|
||||
if (return_) return;
|
||||
boolean p6 = place(0, 0, -3);
|
||||
if (return_) return;
|
||||
boolean p7 = place(0, 0, 3);
|
||||
if (return_) return;
|
||||
boolean p8 = place(0, 1, -4);
|
||||
if (return_) return;
|
||||
boolean p9 = place(0, 1, 4);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7&&p8&&p9) nextLayer();
|
||||
}
|
||||
}else if(direction == Direction.NORTH){
|
||||
if(highwaySize == 3) {
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p3 = place(-1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p4 = place(-2, 1, 0);
|
||||
if (return_) return;
|
||||
boolean p5 = place(2, 1, 0);
|
||||
if(p1&&p2&&p3&&p4&&p5) nextLayer();
|
||||
}else if(highwaySize == 5){
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p3 = place(-1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p4 = place(-2, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p5 = place(2, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p6 = place(-3, 1, 0);
|
||||
if (return_) return;
|
||||
boolean p7 = place(3, 1, 0);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7) nextLayer();
|
||||
}else {
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p3 = place(-1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p4 = place(-2, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p5 = place(2, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p6 = place(-3, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p7 = place(3, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p8 = place(-4, 1, 0);
|
||||
if (return_) return;
|
||||
boolean p9 = place(4, 1, 0);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7&&p8&&p9) nextLayer();
|
||||
}
|
||||
}else if(direction == Direction.EAST){
|
||||
if(highwaySize == 3) {
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(0, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(0, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(0, 1, -2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(0, 1, 2);
|
||||
if(p1&&p2&&p3&&p4&&p5) nextLayer();
|
||||
}else if(highwaySize == 5){
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(0, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(0, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(0, 0, -2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(0, 0, 2);
|
||||
if (return_) return;
|
||||
boolean p6 = place(0, 1, -3);
|
||||
if (return_) return;
|
||||
boolean p7 = place(0, 1, 3);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7) nextLayer();
|
||||
}else {
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(0, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(0, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(0, 0, -2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(0, 0, 2);
|
||||
if (return_) return;
|
||||
boolean p6 = place(0, 0, -3);
|
||||
if (return_) return;
|
||||
boolean p7 = place(0, 0, 3);
|
||||
if (return_) return;
|
||||
boolean p8 = place(0, 1, -4);
|
||||
if (return_) return;
|
||||
boolean p9 = place(0, 1, 4);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7&&p8&&p9) nextLayer();
|
||||
}
|
||||
}else if(direction == Direction.EAST_SOUTH){
|
||||
if(highwaySize == 3) {
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(1, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(-1, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(1, 1, -2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(-2, 1, 1);
|
||||
if (return_) return;
|
||||
boolean p6 = place(1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p7 = place(0, 0, 1);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7) nextLayer();
|
||||
}else if(highwaySize == 5){
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(1, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(-1, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(2, 0, -2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(-2, 0, 2);
|
||||
if (return_) return;
|
||||
boolean p6 = place(2, 1, -3);
|
||||
if (return_) return;
|
||||
boolean p7 = place(-3, 1, 2);
|
||||
if (return_) return;
|
||||
boolean p8 = place(1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p9 = place(0, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p10 = place(2, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p11 = place(-1, 0, 2);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7&&p8&&p9&&p10&&p11) nextLayer();
|
||||
}else {
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(1, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(-1, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(2, 0, -2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(-2, 0, 2);
|
||||
if (return_) return;
|
||||
boolean p6 = place(3, 0, -3);
|
||||
if (return_) return;
|
||||
boolean p7 = place(-3, 0, 3);
|
||||
if (return_) return;
|
||||
boolean p8 = place(3, 1, -4);
|
||||
if (return_) return;
|
||||
boolean p9 = place(-4, 1, 3);
|
||||
if (return_) return;
|
||||
boolean p10 = place(1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p11 = place(0, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p12 = place(2, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p13 = place(-1, 0, 2);
|
||||
if (return_) return;
|
||||
boolean p14 = place(3, 0, -2);
|
||||
if (return_) return;
|
||||
boolean p15 = place(-2, 0, 3);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7&&p8&&p9&&p10&&p11&&p12&&p13&&p14&&p15) nextLayer();
|
||||
}
|
||||
}else if(direction == Direction.SOUTH_WEST){
|
||||
if(highwaySize == 3) {
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(-1, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(1, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(-1, 1, -2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(2, 1, 1);
|
||||
if (return_) return;
|
||||
boolean p6 = place(-1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p7 = place(0, 0, 1);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7) nextLayer();
|
||||
}else if(highwaySize == 5){
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(-1, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(1, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(-2, 0, -2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(2, 0, 2);
|
||||
if (return_) return;
|
||||
boolean p6 = place(-2, 1, -3);
|
||||
if (return_) return;
|
||||
boolean p7 = place(3, 1, 2);
|
||||
if (return_) return;
|
||||
boolean p8 = place(-1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p9 = place(0, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p10 = place(-2, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p11 = place(1, 0, 2);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7&&p8&&p9&&p10&&p11) nextLayer();
|
||||
}else {
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(-1, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(1, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(-2, 0, -2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(2, 0, 2);
|
||||
if (return_) return;
|
||||
boolean p6 = place(-3, 0, -3);
|
||||
if (return_) return;
|
||||
boolean p7 = place(3, 0, 3);
|
||||
if (return_) return;
|
||||
boolean p8 = place(-3, 1, -4);
|
||||
if (return_) return;
|
||||
boolean p9 = place(4, 1, 3);
|
||||
if (return_) return;
|
||||
boolean p10 = place(-1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p11 = place(0, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p12 = place(-2, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p13 = place(1, 0, 2);
|
||||
if (return_) return;
|
||||
boolean p14 = place(-3, 0, -2);
|
||||
if (return_) return;
|
||||
boolean p15 = place(2, 0, 3);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7&&p8&&p9&&p10&&p11&&p12&&p13&&p14&&p15) nextLayer();
|
||||
}
|
||||
}else if(direction == Direction.WEST_NORTH){
|
||||
if(highwaySize == 3) {
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(-1, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(1, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(-1, 1, 2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(2, 1, -1);
|
||||
if (return_) return;
|
||||
boolean p6 = place(-1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p7 = place(0, 0, -1);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7) nextLayer();
|
||||
}else if(highwaySize == 5){
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(-1, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(1, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(-2, 0, 2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(2, 0, -2);
|
||||
if (return_) return;
|
||||
boolean p6 = place(-2, 1, 3);
|
||||
if (return_) return;
|
||||
boolean p7 = place(3, 1, -2);
|
||||
if (return_) return;
|
||||
boolean p8 = place(-1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p9 = place(0, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p10 = place(-2, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p11 = place(1, 0, -2);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7&&p8&&p9&&p10&&p11) nextLayer();
|
||||
}else {
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(-1, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(1, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(-2, 0, 2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(2, 0, -2);
|
||||
if (return_) return;
|
||||
boolean p6 = place(-3, 0, 3);
|
||||
if (return_) return;
|
||||
boolean p7 = place(3, 0, -3);
|
||||
if (return_) return;
|
||||
boolean p8 = place(-3, 1, 4);
|
||||
if (return_) return;
|
||||
boolean p9 = place(4, 1, -3);
|
||||
if (return_) return;
|
||||
boolean p10 = place(-1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p11 = place(0, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p12 = place(-2, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p13 = place(1, 0, -2);
|
||||
if (return_) return;
|
||||
boolean p14 = place(-3, 0, 2);
|
||||
if (return_) return;
|
||||
boolean p15 = place(2, 0, -3);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7&&p8&&p9&&p10&&p11&&p12&&p13&&p14&&p15) nextLayer();
|
||||
}
|
||||
}else if(direction == Direction.NORTH_EAST){
|
||||
if(highwaySize == 3) {
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(1, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(-1, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(1, 1, 2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(-2, 1, -1);
|
||||
if (return_) return;
|
||||
boolean p6 = place(1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p7 = place(0, 0, -1);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7) nextLayer();
|
||||
}else if(highwaySize == 5){
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(1, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(-1, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(2, 0, 2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(-2, 0, -2);
|
||||
if (return_) return;
|
||||
boolean p6 = place(2, 1, 3);
|
||||
if (return_) return;
|
||||
boolean p7 = place(-3, 1, -2);
|
||||
if (return_) return;
|
||||
boolean p8 = place(1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p9 = place(0, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p10 = place(2, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p11 = place(-1, 0, -2);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7&&p8&&p9&&p10&&p11) nextLayer();
|
||||
}else {
|
||||
boolean p1 = place(0, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p2 = place(1, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p3 = place(-1, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p4 = place(2, 0, 2);
|
||||
if (return_) return;
|
||||
boolean p5 = place(-2, 0, -2);
|
||||
if (return_) return;
|
||||
boolean p6 = place(3, 0, 3);
|
||||
if (return_) return;
|
||||
boolean p7 = place(-3, 0, -3);
|
||||
if (return_) return;
|
||||
boolean p8 = place(3, 1, 4);
|
||||
if (return_) return;
|
||||
boolean p9 = place(-4, 1, -3);
|
||||
if (return_) return;
|
||||
boolean p10 = place(1, 0, 0);
|
||||
if (return_) return;
|
||||
boolean p11 = place(0, 0, -1);
|
||||
if (return_) return;
|
||||
boolean p12 = place(2, 0, 1);
|
||||
if (return_) return;
|
||||
boolean p13 = place(-1, 0, -2);
|
||||
if (return_) return;
|
||||
boolean p14 = place(3, 0, 2);
|
||||
if (return_) return;
|
||||
boolean p15 = place(-2, 0, -3);
|
||||
if(p1&&p2&&p3&&p4&&p5&&p6&&p7&&p8&&p9&&p10&&p11&&p12&&p13&&p14&&p15) nextLayer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getDistance(PlayerEntity player){
|
||||
return (int) Math.round(player.squaredDistanceTo(blockPos.getX(), blockPos.getY()-player.getStandingEyeHeight(), blockPos.getZ()));
|
||||
}
|
||||
|
||||
private boolean place(int x, int y, int z) {
|
||||
BlockPos placePos = setBlockPos(x, y, z);
|
||||
BlockState blockState = mc.world.getBlockState(placePos);
|
||||
|
||||
if (!blockState.getMaterial().isReplaceable()) return true;
|
||||
|
||||
int slot = findSlot();
|
||||
if (BlockUtils.place(placePos, Hand.MAIN_HAND, slot, rotate.get(), 10, true)) {
|
||||
return_ = true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private int getSize(){
|
||||
if (size.get() % 2 == 0) return size.get()-1;
|
||||
else return size.get();
|
||||
}
|
||||
|
||||
private void nextLayer(){
|
||||
if(direction == Direction.SOUTH) changeBlockPos(0,0,1);
|
||||
else if(direction == Direction.WEST) changeBlockPos(-1,0,0);
|
||||
else if(direction == Direction.NORTH) changeBlockPos(0,0,-1);
|
||||
else if(direction == Direction.EAST) changeBlockPos(1,0,0);
|
||||
else if(direction == Direction.EAST_SOUTH) changeBlockPos(1,0,1);
|
||||
else if(direction == Direction.SOUTH_WEST) changeBlockPos(-1,0,1);
|
||||
else if(direction == Direction.WEST_NORTH) changeBlockPos(-1,0,-1);
|
||||
else if(direction == Direction.NORTH_EAST) changeBlockPos(1,0,-1);
|
||||
}
|
||||
|
||||
private void changeBlockPos(int x, int y, int z) {
|
||||
blockPos.set(blockPos.getX() + x, blockPos.getY() + y, blockPos.getZ() + z);
|
||||
}
|
||||
private BlockPos setBlockPos(int x, int y, int z) {
|
||||
return new BlockPos(blockPos.getX() + x, blockPos.getY() + y, blockPos.getZ() + z);
|
||||
}
|
||||
|
||||
private Direction getDirection(PlayerEntity player){
|
||||
double yaw = player.yaw;
|
||||
if(yaw==0) return Direction.SOUTH;
|
||||
if(yaw<0){
|
||||
yaw = yaw - MathHelper.ceil(yaw / 360) * 360;
|
||||
if(yaw<-180) {
|
||||
yaw = 360 + yaw;
|
||||
}
|
||||
}else{
|
||||
yaw = yaw - MathHelper.floor(yaw / 360)*360;
|
||||
if(yaw>180) {
|
||||
yaw = -360 + yaw;
|
||||
}
|
||||
}
|
||||
|
||||
if(yaw >= 157.5 || yaw < -157.5) return Direction.NORTH;
|
||||
if(yaw >= -157.5 && yaw < -112.5) return Direction.NORTH_EAST;
|
||||
if(yaw >= -112.5 && yaw < -67.5) return Direction.EAST;
|
||||
if(yaw >= -67.5 && yaw < -22.5) return Direction.EAST_SOUTH;
|
||||
if((yaw >= -22.5 && yaw <=0) || (yaw > 0 && yaw < 22.5)) return Direction.SOUTH;
|
||||
if(yaw >= 22.5 && yaw < 67.5) return Direction.SOUTH_WEST;
|
||||
if(yaw >= 67.5 && yaw < 112.5) return Direction.WEST;
|
||||
if(yaw >= 112.5 && yaw < 157.5) return Direction.WEST_NORTH;
|
||||
return Direction.SOUTH;
|
||||
}
|
||||
|
||||
|
||||
private int findSlot() {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
Item item = mc.player.inventory.getStack(i).getItem();
|
||||
|
||||
if (!(item instanceof BlockItem)) continue;
|
||||
|
||||
if (item == Items.OBSIDIAN) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package cloudburst.rejects.modules;
|
||||
|
||||
import baritone.api.BaritoneAPI;
|
||||
import cloudburst.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import minegame159.meteorclient.events.entity.player.ItemUseCrosshairTargetEvent;
|
||||
import minegame159.meteorclient.events.world.TickEvent;
|
||||
@@ -84,7 +85,7 @@ public class AutoPot extends Module {
|
||||
private final List<Class<? extends Module>> wasAura = new ArrayList<>();
|
||||
private boolean wasBaritone;
|
||||
public AutoPot() {
|
||||
super(Categories.Player, "auto-pot", "Automatically Drinks Potions");
|
||||
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
|
||||
|
||||
@@ -2,6 +2,7 @@ package cloudburst.rejects.modules;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cloudburst.rejects.MeteorRejectsAddon;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
@@ -37,7 +38,7 @@ public class Confuse extends Module {
|
||||
}
|
||||
|
||||
public Confuse() {
|
||||
super(Categories.Misc, "confuse", "Makes your enemies shit themselves");
|
||||
super(MeteorRejectsAddon.CATEGORY, "confuse", "Makes your enemies shit themselves");
|
||||
}
|
||||
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import cloudburst.rejects.MeteorRejectsAddon;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -23,7 +24,7 @@ public class Glide extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
|
||||
public Glide() {
|
||||
super(Categories.Movement, "glide", "Makes you glide down slowly when falling.");
|
||||
super(MeteorRejectsAddon.CATEGORY, "glide", "Makes you glide down slowly when falling.");
|
||||
}
|
||||
|
||||
private final Setting<Double> fallSpeed = sgGeneral.add(new DoubleSetting.Builder()
|
||||
|
||||
126
src/main/java/cloudburst/rejects/modules/InteractionMenu.java
Normal file
126
src/main/java/cloudburst/rejects/modules/InteractionMenu.java
Normal file
@@ -0,0 +1,126 @@
|
||||
package cloudburst.rejects.modules;
|
||||
|
||||
import cloudburst.rejects.MeteorRejectsAddon;
|
||||
import cloudburst.rejects.screens.InteractionScreen;
|
||||
import it.unimi.dsi.fastutil.objects.Object2BooleanMap;
|
||||
import minegame159.meteorclient.MeteorClient;
|
||||
import minegame159.meteorclient.gui.GuiTheme;
|
||||
import minegame159.meteorclient.gui.widgets.WWidget;
|
||||
import minegame159.meteorclient.gui.widgets.containers.WTable;
|
||||
import minegame159.meteorclient.gui.widgets.input.WTextBox;
|
||||
import minegame159.meteorclient.gui.widgets.pressable.WMinus;
|
||||
import minegame159.meteorclient.gui.widgets.pressable.WPlus;
|
||||
import minegame159.meteorclient.gui.widgets.WWidget;
|
||||
import minegame159.meteorclient.settings.*;
|
||||
import minegame159.meteorclient.systems.modules.Module;
|
||||
import minegame159.meteorclient.utils.Utils;
|
||||
import minegame159.meteorclient.utils.misc.Keybind;
|
||||
import net.minecraft.client.render.debug.DebugRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.StringTag;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Optional;
|
||||
|
||||
public class InteractionMenu extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
public final HashMap<String,String> messages = new HashMap<>();
|
||||
private String currMsgK = "", currMsgV = "";
|
||||
|
||||
private final Setting<Object2BooleanMap<EntityType<?>>> entities = sgGeneral.add(new EntityTypeListSetting.Builder()
|
||||
.name("entities")
|
||||
.description("Entities")
|
||||
.defaultValue(Utils.asObject2BooleanOpenHashMap(
|
||||
EntityType.PLAYER))
|
||||
.build()
|
||||
);
|
||||
public final Setting<Keybind> keybind = sgGeneral.add(new KeybindSetting.Builder()
|
||||
.name("keybind")
|
||||
.description("The keybind to open.")
|
||||
.action(this::onKey)
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
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())) {
|
||||
//isOpen = true;
|
||||
mc.openScreen(new InteractionScreen(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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 CompoundTag toTag() {
|
||||
CompoundTag tag = super.toTag();
|
||||
|
||||
CompoundTag messTag = new CompoundTag();
|
||||
messages.keySet().forEach((key) -> {
|
||||
messTag.put(key, StringTag.of(messages.get(key)));
|
||||
});
|
||||
|
||||
tag.put("messages", messTag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Module fromTag(CompoundTag tag) {
|
||||
|
||||
if (tag.contains("messages")) {
|
||||
CompoundTag msgs = tag.getCompound("messages");
|
||||
msgs.getKeys().forEach((key) -> {
|
||||
messages.put(key, msgs.getString(key));
|
||||
});
|
||||
}
|
||||
|
||||
return super.fromTag(tag);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package cloudburst.rejects.modules;
|
||||
|
||||
import cloudburst.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import minegame159.meteorclient.events.render.RenderEvent;
|
||||
import minegame159.meteorclient.events.world.TickEvent;
|
||||
@@ -95,7 +96,7 @@ public class Lavacast extends Module {
|
||||
);
|
||||
|
||||
public Lavacast() {
|
||||
super(Categories.World, "lavacast", "Automatically Lavacasts");
|
||||
super(MeteorRejectsAddon.CATEGORY, "lavacast", "Automatically Lavacasts");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
122
src/main/java/cloudburst/rejects/modules/ObsidianFarm.java
Normal file
122
src/main/java/cloudburst/rejects/modules/ObsidianFarm.java
Normal file
@@ -0,0 +1,122 @@
|
||||
package cloudburst.rejects.modules;
|
||||
|
||||
import cloudburst.rejects.MeteorRejectsAddon;
|
||||
import com.google.common.collect.Streams;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import minegame159.meteorclient.events.world.TickEvent;
|
||||
import minegame159.meteorclient.systems.modules.Categories;
|
||||
import minegame159.meteorclient.systems.modules.Module;
|
||||
import minegame159.meteorclient.systems.modules.Modules;
|
||||
import minegame159.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 {
|
||||
|
||||
public ObsidianFarm() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "obsidian-farm", "Auto obsidian farm(portals).");
|
||||
}
|
||||
|
||||
|
||||
private boolean allowBreakAgain;
|
||||
|
||||
@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.inventory.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 = Streams.stream(blocksList)
|
||||
.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 = Streams.stream(blocksList)
|
||||
.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.inventory.getStack(i).getItem() == Items.NETHERITE_PICKAXE) return i;
|
||||
if (mc.player.inventory.getStack(i).getItem() == Items.DIAMOND_PICKAXE) result = i;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package cloudburst.rejects.modules;
|
||||
|
||||
import cloudburst.rejects.MeteorRejectsAddon;
|
||||
import minegame159.meteorclient.settings.BoolSetting;
|
||||
import minegame159.meteorclient.settings.Setting;
|
||||
import minegame159.meteorclient.settings.SettingGroup;
|
||||
@@ -52,7 +53,7 @@ public class RenderInvisible extends Module {
|
||||
}
|
||||
|
||||
public RenderInvisible() {
|
||||
super(Categories.Render, "render-invisible", "Renders invisible entities and blocks.");
|
||||
super(MeteorRejectsAddon.CATEGORY, "render-invisible", "Renders invisible entities and blocks.");
|
||||
}
|
||||
|
||||
public boolean renderEntities() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cloudburst.rejects.modules;
|
||||
|
||||
import cloudburst.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import minegame159.meteorclient.events.world.PlaySoundEvent;
|
||||
import minegame159.meteorclient.settings.Setting;
|
||||
@@ -30,7 +31,7 @@ public class SoundLocator extends Module {
|
||||
);
|
||||
|
||||
public SoundLocator() {
|
||||
super(Categories.Misc, "sound-locator", "Prints locations of sound events.");
|
||||
super(MeteorRejectsAddon.CATEGORY, "sound-locator", "Prints locations of sound events.");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
28
src/main/java/cloudburst/rejects/modules/TPSSync.java
Normal file
28
src/main/java/cloudburst/rejects/modules/TPSSync.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package cloudburst.rejects.modules;
|
||||
|
||||
import cloudburst.rejects.MeteorRejectsAddon;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import minegame159.meteorclient.events.world.TickEvent;
|
||||
import minegame159.meteorclient.systems.modules.Categories;
|
||||
import minegame159.meteorclient.systems.modules.Module;
|
||||
import minegame159.meteorclient.systems.modules.Modules;
|
||||
import minegame159.meteorclient.systems.modules.world.Timer;
|
||||
import minegame159.meteorclient.utils.world.TickRate;
|
||||
|
||||
public class TPSSync extends Module {
|
||||
public TPSSync() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "tps-sync", "Attemps to sync client tickrate with server's");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeactivate() {
|
||||
Timer timer = Modules.get().get(Timer.class);
|
||||
timer.setOverride(1);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Post event) {
|
||||
Timer timer = Modules.get().get(Timer.class);
|
||||
timer.setOverride(Math.max(TickRate.INSTANCE.getTickRate(), 1) / 20); // prevent client just dying alongside with server
|
||||
}
|
||||
}
|
||||
336
src/main/java/cloudburst/rejects/screens/InteractionScreen.java
Normal file
336
src/main/java/cloudburst/rejects/screens/InteractionScreen.java
Normal file
@@ -0,0 +1,336 @@
|
||||
package cloudburst.rejects.screens;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import cloudburst.rejects.modules.InteractionMenu;
|
||||
import minegame159.meteorclient.MeteorClient;
|
||||
import minegame159.meteorclient.systems.commands.commands.PeekCommand;
|
||||
import minegame159.meteorclient.systems.modules.Modules;
|
||||
import minegame159.meteorclient.utils.player.ChatUtils;
|
||||
import minegame159.meteorclient.utils.player.InvUtils;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.Saddleable;
|
||||
import net.minecraft.entity.passive.HorseBaseEntity;
|
||||
import net.minecraft.entity.passive.HorseEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.vehicle.ChestMinecartEntity;
|
||||
import net.minecraft.entity.vehicle.StorageMinecartEntity;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.SimpleInventory;
|
||||
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.screen.ShulkerBoxScreenHandler;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
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;
|
||||
|
||||
public InteractionScreen(Entity entity) {
|
||||
super(new LiteralText("Menu Screen"));
|
||||
this.entity = entity;
|
||||
functions = new HashMap<>();
|
||||
functions.put("Stats", (Entity e) -> {
|
||||
closeScreen();
|
||||
//Modules.get().get(InteractionMenu.class).isOpen = true;
|
||||
client.openScreen(new StatsScreen(e));
|
||||
});
|
||||
if (entity instanceof PlayerEntity) {
|
||||
functions.put("Open Inventory", (Entity e) -> {
|
||||
closeScreen();
|
||||
client.openScreen(new InventoryScreen((PlayerEntity) e));
|
||||
});
|
||||
functions.put("Message", (Entity e) -> {
|
||||
this.cursorMode(GLFW.GLFW_CURSOR);
|
||||
closeScreen();
|
||||
client.openScreen(new ChatScreen(String.format("/msg %s ", ((PlayerEntity)e).getGameProfile().getName())));
|
||||
});
|
||||
}
|
||||
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(new PlayerInteractEntityC2SPacket(entity, Hand.MAIN_HAND, false));
|
||||
client.player.openRidingInventory();
|
||||
client.player.networkHandler.sendPacket(new PlayerInputC2SPacket(0, 0, false, true));
|
||||
});
|
||||
functions.put("Ride", (Entity e) -> {
|
||||
closeScreen();
|
||||
client.player.networkHandler.sendPacket(new PlayerInteractEntityC2SPacket(entity, Hand.MAIN_HAND, false));
|
||||
});
|
||||
}
|
||||
else if (entity instanceof StorageMinecartEntity) {
|
||||
functions.put("Open Inventory", (Entity e) -> {
|
||||
closeScreen();
|
||||
client.player.networkHandler.sendPacket(new PlayerInteractEntityC2SPacket(entity, Hand.MAIN_HAND, false));
|
||||
});
|
||||
}
|
||||
else {
|
||||
functions.put("Open Inventory", (Entity e) -> {
|
||||
ItemStack[] stack = new ItemStack[27];
|
||||
final int[] 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();
|
||||
closeScreen();
|
||||
client.openScreen(new PeekCommand.PeekShulkerBoxScreen(new ShulkerBoxScreenHandler(0, client.player.inventory, new SimpleInventory(stack)), client.player.inventory, entity.getName()));
|
||||
});
|
||||
}
|
||||
if (entity.isGlowing()) {
|
||||
functions.put("Remove highlight", (Entity e) -> {
|
||||
entity.setGlowing(false);
|
||||
closeScreen();
|
||||
});
|
||||
} else {
|
||||
functions.put("Highlight", (Entity e) -> {
|
||||
entity.setGlowing(true);
|
||||
closeScreen();
|
||||
});
|
||||
}
|
||||
msgs = Modules.get().get(InteractionMenu.class).messages;
|
||||
msgs.keySet().forEach((key) -> {
|
||||
functions.put(key, (Entity e) -> {
|
||||
closeScreen();
|
||||
client.openScreen(new ChatScreen(replacePlaceholders(msgs.get(key), e)));
|
||||
});
|
||||
});
|
||||
functions.put("Cancel", (Entity e) -> {closeScreen();});
|
||||
}
|
||||
|
||||
public void init() {
|
||||
super.init();
|
||||
this.cursorMode(GLFW.GLFW_CURSOR_HIDDEN);
|
||||
yaw = client.player.yaw;
|
||||
pitch = client.player.pitch;
|
||||
}
|
||||
|
||||
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.openScreen((Screen) null);
|
||||
//Modules.get().get(InteractionMenu.class).isOpen = false;
|
||||
}
|
||||
|
||||
public void onClose() {
|
||||
cursorMode(GLFW.GLFW_CURSOR_NORMAL);
|
||||
// This makes the magic
|
||||
if (focusedString != null) {
|
||||
functions.get(focusedString).accept(this.entity);
|
||||
} else
|
||||
client.openScreen((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);
|
||||
*/
|
||||
client.getTextureManager().bindTexture(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.yaw = yaw + cross.x / 3;
|
||||
client.player.pitch = 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, 0xFF4CFF00);
|
||||
this.focusedString = cache[focusedDot];
|
||||
}
|
||||
else
|
||||
drawDot(matrix, point.x - 4, point.y - 4, 0xFF0094FF);
|
||||
}
|
||||
}
|
||||
|
||||
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, 0x80808080, 0xFF000000);
|
||||
drawStringWithShadow(matrix, textRenderer, key, x + 12, y - 4, 0xFFFFFFFF);
|
||||
} else {
|
||||
drawRect(matrix, x - 14 - textRenderer.getWidth(key), y - 8, textRenderer.getWidth(key) + 3, 15, 0x80808080, 0xFF000000);
|
||||
drawStringWithShadow(matrix, textRenderer, key, x - 12 - textRenderer.getWidth(key), y - 4, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
// 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, 0xFF000000);
|
||||
drawHorizontalLine(matrix, startX + 1, startX + 6, startY + 1, 0xFF000000);
|
||||
drawHorizontalLine(matrix, startX + 2, startX + 5, startY + 1, colorInner);
|
||||
fill(matrix, startX, startY + 2, startX + 8, startY + 6, 0xFF000000);
|
||||
fill(matrix, startX + 1, startY + 2, startX + 7, startY + 6, colorInner);
|
||||
drawHorizontalLine(matrix, startX + 1, startX + 6, startY + 6, 0xFF000000);
|
||||
drawHorizontalLine(matrix, startX + 2, startX + 5, startY + 6, colorInner);
|
||||
drawHorizontalLine(matrix, startX + 2, startX + 5, startY + 7, 0xFF000000);
|
||||
|
||||
// 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());
|
||||
}
|
||||
return in;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
62
src/main/java/cloudburst/rejects/screens/StatsScreen.java
Normal file
62
src/main/java/cloudburst/rejects/screens/StatsScreen.java
Normal file
@@ -0,0 +1,62 @@
|
||||
package cloudburst.rejects.screens;
|
||||
|
||||
import cloudburst.rejects.modules.InteractionMenu;
|
||||
import minegame159.meteorclient.systems.modules.Modules;
|
||||
import net.minecraft.client.resource.language.TranslationStorage;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffectUtil;
|
||||
import net.minecraft.util.Language;
|
||||
import net.minecraft.util.math.Box;
|
||||
|
||||
import minegame159.meteorclient.gui.GuiTheme;
|
||||
import minegame159.meteorclient.gui.GuiThemes;
|
||||
import minegame159.meteorclient.gui.WindowScreen;
|
||||
import minegame159.meteorclient.gui.widgets.containers.WSection;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class StatsScreen extends WindowScreen {
|
||||
public final Entity entity;
|
||||
public StatsScreen(Entity e) {
|
||||
super(GuiThemes.get(),e.getName().getString());
|
||||
this.entity = e;
|
||||
GuiTheme theme = GuiThemes.get();
|
||||
add(theme.label(String.format("Age: %d", entity.age)));
|
||||
if (entity instanceof LivingEntity) {
|
||||
LivingEntity liv = (LivingEntity) entity;
|
||||
add(theme.label(String.format("Health: %.2f/%.2f", liv.getHealth(), liv.getMaxHealth())));
|
||||
|
||||
Collection<StatusEffectInstance> statusEff = liv.getStatusEffects();
|
||||
if (!statusEff.isEmpty()) {
|
||||
WSection effectList = add(theme.section("Status Effects", true)).expandCellX().widget();
|
||||
Language lang = TranslationStorage.getInstance();
|
||||
statusEff.forEach((effect) -> {
|
||||
String status = lang.get(effect.getTranslationKey());
|
||||
if (effect.getAmplifier() != 0) {
|
||||
status += (String.format(" %d (%s)", effect.getAmplifier()+1, StatusEffectUtil.durationToString(effect, 1)));
|
||||
} else {
|
||||
status += (String.format(" (%s)", StatusEffectUtil.durationToString(effect, 1)));
|
||||
}
|
||||
effectList.add(theme.label(status)).expandCellX();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
WSection dimension = add(theme.section("Dimensions", false)).expandCellX().widget();
|
||||
dimension.add(theme.label(String.format("Position: %.2f, %.2f, %.2f", entity.getX(), entity.getY(), entity.getZ()))).expandCellX();
|
||||
dimension.add(theme.label(String.format("Yaw: %.2f, Pitch: %.2f", entity.yaw, entity.pitch))).expandCellX();
|
||||
Box box = entity.getBoundingBox();
|
||||
dimension.add(theme.label(String.format("Bounding Box: [%.2f, %.2f, %.2f] -> [%.2f, %.2f, %.2f]",
|
||||
box.minX, box.minY, box.minZ,
|
||||
box.maxX, box.maxY, box.maxZ
|
||||
))).expandCellX();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onClosed() {
|
||||
super.onClosed();
|
||||
//Modules.get().get(InteractionMenu.class).isOpen = false;
|
||||
}
|
||||
}
|
||||
288
src/main/java/cloudburst/rejects/utils/GiveUtils.java
Normal file
288
src/main/java/cloudburst/rejects/utils/GiveUtils.java
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user