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