Slightly fix AutoTNT
This commit is contained in:
@@ -29,7 +29,7 @@ public class MeteorRejectsAddon extends MeteorAddon {
|
|||||||
modules.add(new AutoExtinguish());
|
modules.add(new AutoExtinguish());
|
||||||
modules.add(new AutoHighway());
|
modules.add(new AutoHighway());
|
||||||
modules.add(new AutoPot());
|
modules.add(new AutoPot());
|
||||||
//modules.add(new AutoTNT());
|
modules.add(new AutoTNT());
|
||||||
modules.add(new Confuse());
|
modules.add(new Confuse());
|
||||||
modules.add(new InteractionMenu());
|
modules.add(new InteractionMenu());
|
||||||
modules.add(new Glide());
|
modules.add(new Glide());
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package cloudburst.rejects.modules;
|
package cloudburst.rejects.modules;
|
||||||
|
|
||||||
|
import cloudburst.rejects.utils.WorldUtils;
|
||||||
import meteordevelopment.orbit.EventHandler;
|
import meteordevelopment.orbit.EventHandler;
|
||||||
import minegame159.meteorclient.events.world.TickEvent;
|
import minegame159.meteorclient.events.world.TickEvent;
|
||||||
import minegame159.meteorclient.settings.BoolSetting;
|
import minegame159.meteorclient.settings.BoolSetting;
|
||||||
@@ -9,7 +10,6 @@ import minegame159.meteorclient.settings.SettingGroup;
|
|||||||
import minegame159.meteorclient.systems.modules.Module;
|
import minegame159.meteorclient.systems.modules.Module;
|
||||||
import minegame159.meteorclient.utils.player.InvUtils;
|
import minegame159.meteorclient.utils.player.InvUtils;
|
||||||
import minegame159.meteorclient.utils.player.PlayerUtils;
|
import minegame159.meteorclient.utils.player.PlayerUtils;
|
||||||
import minegame159.meteorclient.utils.world.BlockUtils;
|
|
||||||
import net.minecraft.block.TntBlock;
|
import net.minecraft.block.TntBlock;
|
||||||
import net.minecraft.item.FlintAndSteelItem;
|
import net.minecraft.item.FlintAndSteelItem;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
@@ -83,11 +83,11 @@ public class AutoTNT extends Module {
|
|||||||
if (ticks <= 0) {
|
if (ticks <= 0) {
|
||||||
// Clear and get tnt blocks
|
// Clear and get tnt blocks
|
||||||
blocks.clear();
|
blocks.clear();
|
||||||
// TODO: Fix
|
|
||||||
// for (BlockPos blockPos : BlockUtils.getSphere(mc.player.getBlockPos(), range.get(), range.get())) {
|
for (BlockPos blockPos : WorldUtils.getSphere(mc.player.getBlockPos(), range.get(), range.get())) {
|
||||||
// bp.set(blockPos);
|
bp.set(blockPos);
|
||||||
// if (mc.world.getBlockState(blockPos).getBlock() instanceof TntBlock) blocks.add(bp);
|
if (mc.world.getBlockState(blockPos).getBlock() instanceof TntBlock) blocks.add(bp);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Make sure there are TNTs around us
|
// Make sure there are TNTs around us
|
||||||
if (blocks.size() <= 0) {
|
if (blocks.size() <= 0) {
|
||||||
@@ -129,9 +129,12 @@ public class AutoTNT extends Module {
|
|||||||
// Set slots
|
// Set slots
|
||||||
preSlot = mc.player.inventory.selectedSlot;
|
preSlot = mc.player.inventory.selectedSlot;
|
||||||
mc.player.inventory.selectedSlot = slot;
|
mc.player.inventory.selectedSlot = slot;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Ignited the tnt
|
// Ignited the tnt
|
||||||
ActionResult result = mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5), Direction.UP, pos, true));
|
//ActionResult result = mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5), Direction.UP, pos, true));
|
||||||
|
ActionResult result = mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(new Vec3d(pos.getX(), pos.getY(), pos.getZ()), Direction.UP, pos, false));
|
||||||
if (result == ActionResult.CONSUME || result == ActionResult.SUCCESS) ignited = true;
|
if (result == ActionResult.CONSUME || result == ActionResult.SUCCESS) ignited = true;
|
||||||
|
|
||||||
// Reset slot
|
// Reset slot
|
||||||
|
|||||||
36
src/main/java/cloudburst/rejects/utils/WorldUtils.java
Normal file
36
src/main/java/cloudburst/rejects/utils/WorldUtils.java
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
package cloudburst.rejects.utils;
|
||||||
|
|
||||||
|
import meteordevelopment.orbit.EventHandler;
|
||||||
|
import minegame159.meteorclient.MeteorClient;
|
||||||
|
import minegame159.meteorclient.events.game.GameLeftEvent;
|
||||||
|
import net.minecraft.client.render.BlockBreakingInfo;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class WorldUtils {
|
||||||
|
private static final ArrayList<BlockPos> blocks = new ArrayList<>();
|
||||||
|
|
||||||
|
public static List<BlockPos> getSphere(BlockPos centerPos, int radius, int height) {
|
||||||
|
blocks.clear();
|
||||||
|
|
||||||
|
for (int i = centerPos.getX() - radius; i < centerPos.getX() + radius; i++) {
|
||||||
|
for (int j = centerPos.getY() - height; j < centerPos.getY() + height; j++) {
|
||||||
|
for (int k = centerPos.getZ() - radius; k < centerPos.getZ() + radius; k++) {
|
||||||
|
BlockPos pos = new BlockPos(i, j, k);
|
||||||
|
if (distanceBetween(centerPos, pos) <= radius && !blocks.contains(pos)) blocks.add(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return blocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double distanceBetween(BlockPos blockPos1, BlockPos blockPos2) {
|
||||||
|
double d = blockPos1.getX() - blockPos2.getX();
|
||||||
|
double e = blockPos1.getY() - blockPos2.getY();
|
||||||
|
double f = blockPos1.getZ() - blockPos2.getZ();
|
||||||
|
return MathHelper.sqrt(d * d + e * e + f * f);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user