autotnt stuff
This commit is contained in:
@@ -58,11 +58,15 @@ public class AutoTNT extends Module {
|
||||
);
|
||||
|
||||
private final ArrayList<BlockPos> blocks = new ArrayList<>();
|
||||
private BlockPos.Mutable bp = new BlockPos.Mutable();
|
||||
private final BlockPos.Mutable bp = new BlockPos.Mutable();
|
||||
private boolean ignited, messaged;
|
||||
private int ticks = 0;
|
||||
private int preSlot, slot;
|
||||
|
||||
public AutoTNT() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "auto-tnt", "Ignites TNT for you");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
ignited = false;
|
||||
@@ -74,19 +78,14 @@ public class AutoTNT extends Module {
|
||||
ticks = 0;
|
||||
}
|
||||
|
||||
public AutoTNT() {
|
||||
super(MeteorRejectsAddon.CATEGORY, "auto-tnt", "Ignites TNT for you");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
private void onTick(TickEvent.Post event) {
|
||||
if (ticks <= 0) {
|
||||
// Clear and get tnt blocks
|
||||
blocks.clear();
|
||||
for (BlockPos vec3d : BlockUtils.getSphere(mc.player.getBlockPos(), range.get(), range.get())) {
|
||||
setBpToVec3d(vec3d);
|
||||
|
||||
if (mc.world.getBlockState(bp).getBlock() instanceof TntBlock) blocks.add(bp.toImmutable());
|
||||
for (BlockPos blockPos : BlockUtils.getSphere(mc.player.getBlockPos(), range.get(), range.get())) {
|
||||
bp.set(blockPos);
|
||||
if (mc.world.getBlockState(blockPos).getBlock() instanceof TntBlock) blocks.add(bp);
|
||||
}
|
||||
|
||||
// Make sure there are TNTs around us
|
||||
@@ -104,8 +103,7 @@ public class AutoTNT extends Module {
|
||||
messaged = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else messaged = false;
|
||||
} else messaged = false;
|
||||
|
||||
// Sort based on closest tnt
|
||||
blocks.sort(Comparator.comparingDouble(PlayerUtils::distanceTo));
|
||||
@@ -143,8 +141,7 @@ public class AutoTNT extends Module {
|
||||
return InvUtils.findItemInHotbar(item -> item.getItem() instanceof FlintAndSteelItem && (antiBreak.get() && (item.getMaxDamage() - item.getDamage()) > 10));
|
||||
}
|
||||
|
||||
private void setBpToVec3d(BlockPos pos) {
|
||||
private void setBpToVec3d(Vec3d pos) {
|
||||
bp.set(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user