Slightly fix AutoTNT

This commit is contained in:
Cloudburst
2021-06-03 11:12:19 +02:00
parent 318cfbaf2f
commit a96b23c964
3 changed files with 48 additions and 9 deletions

View 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);
}
}