Slightly fix AutoTNT
This commit is contained in:
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