SteamWar/FightSystem
Archiviert
13
1

Fix HellsBells distribution

Dieser Commit ist enthalten in:
yoyosource 2021-06-26 17:21:42 +02:00
Ursprung 3ae18ab0b8
Commit bd5fb0d7c7

Datei anzeigen

@ -36,6 +36,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
public class HellsBells { public class HellsBells {
@ -79,6 +80,7 @@ public class HellsBells {
AtomicInteger length = new AtomicInteger(20 + random.nextInt(direction.getLength(zLength, xLength) - 20)); AtomicInteger length = new AtomicInteger(20 + random.nextInt(direction.getLength(zLength, xLength) - 20));
int width = 5 + random.nextInt(5); int width = 5 + random.nextInt(5);
Bukkit.getLogger().log(Level.INFO, "Calculating Starts");
int xOffset = getStart(direction.getLength(xLength, zLength), direction.getLength(length.get(), width)); int xOffset = getStart(direction.getLength(xLength, zLength), direction.getLength(length.get(), width));
int zOffset = getStart(direction.getLength(zLength, xLength), direction.getLength(width, length.get())); int zOffset = getStart(direction.getLength(zLength, xLength), direction.getLength(width, length.get()));
int yOffset = getHeightStart(); int yOffset = getHeightStart();
@ -114,6 +116,7 @@ public class HellsBells {
private int getStart(int regionSize, int length) { private int getStart(int regionSize, int length) {
double randomNumber = (random.nextDouble() - random.nextDouble()) / 2 + 0.5; double randomNumber = (random.nextDouble() - random.nextDouble()) / 2 + 0.5;
Bukkit.getLogger().log(Level.INFO, "Calculated Start: " + (int) (randomNumber * (regionSize - length)));
return Math.max(Math.min((int) (randomNumber * (regionSize - length)), regionSize - length), 0); return Math.max(Math.min((int) (randomNumber * (regionSize - length)), regionSize - length), 0);
} }