.save-skin, better .give, interactionMenu, cate...
This commit is contained in:
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user