Modifications

This commit is contained in:
ThebestkillerTBK
2022-10-13 18:43:46 +08:00
committed by Cloudburst
parent 5893436184
commit d283b40c58
2 changed files with 21 additions and 20 deletions

View File

@@ -1,6 +1,7 @@
package anticope.rejects.modules; package anticope.rejects.modules;
import anticope.rejects.MeteorRejectsAddon; import anticope.rejects.MeteorRejectsAddon;
import anticope.rejects.utils.WorldUtils;
import meteordevelopment.meteorclient.events.world.TickEvent; import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.mixin.MinecraftClientAccessor; import meteordevelopment.meteorclient.mixin.MinecraftClientAccessor;
import meteordevelopment.meteorclient.settings.BoolSetting; import meteordevelopment.meteorclient.settings.BoolSetting;
@@ -75,8 +76,7 @@ public class TillAura extends Module {
return; return;
// get valid blocks // get valid blocks
ArrayList<BlockPos> validBlocks = ArrayList<BlockPos> validBlocks = getValidBlocks(range.get(), this::isCorrectBlock);
getValidBlocks(range.get(), this::isCorrectBlock);
if (multiTill.get()) { if (multiTill.get()) {
boolean shouldSwing = false; boolean shouldSwing = false;
@@ -96,23 +96,7 @@ public class TillAura extends Module {
break; break;
} }
public static ArrayList<BlockPos> getAllInBox(BlockPos from, BlockPos to) { private Vec3d getEyesPos() {
ArrayList<BlockPos> blocks = new ArrayList<>();
BlockPos min = new BlockPos(Math.min(from.getX(), to.getX()),
Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ()));
BlockPos max = new BlockPos(Math.max(from.getX(), to.getX()),
Math.max(from.getY(), to.getY()), Math.max(from.getZ(), to.getZ()));
for (int x = min.getX(); x <= max.getX(); x++)
for (int y = min.getY(); y <= max.getY(); y++)
for (int z = min.getZ(); z <= max.getZ(); z++)
blocks.add(new BlockPos(x, y, z));
return blocks;
}
public Vec3d getEyesPos() {
ClientPlayerEntity player = mc.player; ClientPlayerEntity player = mc.player;
return new Vec3d(player.getX(), return new Vec3d(player.getX(),
@@ -130,7 +114,7 @@ public class TillAura extends Module {
BlockPos min = center.add(-rangeI, -rangeI, -rangeI); BlockPos min = center.add(-rangeI, -rangeI, -rangeI);
BlockPos max = center.add(rangeI, rangeI, rangeI); BlockPos max = center.add(rangeI, rangeI, rangeI);
return getAllInBox(min, max).stream() return WorldUtils.getAllInBox(min, max).stream()
.filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq) .filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq)
.filter(validator) .filter(validator)
.sorted(Comparator.comparingDouble( .sorted(Comparator.comparingDouble(

View File

@@ -24,6 +24,23 @@ public class WorldUtils {
return blocks; return blocks;
} }
public static List<BlockPos> getAllInBox(BlockPos from, BlockPos to) {
blocks.clear();
BlockPos min = new BlockPos(Math.min(from.getX(), to.getX()),
Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ()));
BlockPos max = new BlockPos(Math.max(from.getX(), to.getX()),
Math.max(from.getY(), to.getY()), Math.max(from.getZ(), to.getZ()));
for (int x = min.getX(); x <= max.getX(); x++)
for (int y = min.getY(); y <= max.getY(); y++)
for (int z = min.getZ(); z <= max.getZ(); z++)
blocks.add(new BlockPos(x, y, z));
return blocks;
}
public static double distanceBetween(BlockPos pos1, BlockPos pos2) { public static double distanceBetween(BlockPos pos1, BlockPos pos2) {
double d = pos1.getX() - pos2.getX(); double d = pos1.getX() - pos2.getX();
double e = pos1.getY() - pos2.getY(); double e = pos1.getY() - pos2.getY();