円のポイントを取得する方法が必要です。オンラインで見つけた方法がありますが、残念ながら、ブール値を追加したいと思います。
public static Location[] getCylinderAt(Location loc, int r, int height) {
ArrayList<Location> list = new ArrayList<>();
int cx = loc.getBlockX();
int cy = loc.getBlockY();
int cz = loc.getBlockZ();
World w = loc.getWorld();
int rSquared = r * r;
for (int x = cx - r; x <= cx + r; x++) {
for (int y = cy - height; y <= cy + height; y++) {
for (int z = cz - r; z <= cz + r; z++) {
if ((cx - x) * (cx - x) + (cz - z) * (cz - z) <= rSquared) {
list.add(new Location(w, x, y, z));
}
}
}
}
return list.toArray(new Location[list.size()]);
}
私はこれに関係する数学に頭を悩ませることができず、Minecraft以外のソースを検索して独自のソースを作成してきましたが、役に立ちませんでした。
理想的には、メソッドを次のように変更できるようにしたいと思います。
public static Location[] getCylinderAt(Location loc, boolean filled, int r, int height)
みんなありがとう!必要に応じて、すべてのMinecraft参照を削除できますが、場所は基本的にいくつかのMinecraftのみの変数が追加されたベクトルであるため、必要だとは思いませんでした。
読んでくれてありがとう :)