board with index 3 is now larger, toofaraway now depends on (close to) true center

This commit is contained in:
LunarAkai 2024-03-28 21:52:03 +01:00
commit 02c19075d7
3 changed files with 36 additions and 14 deletions

View file

@ -6,7 +6,7 @@
<groupId>de.lunarakai</groupId> <groupId>de.lunarakai</groupId>
<artifactId>Minecleaner</artifactId> <artifactId>Minecleaner</artifactId>
<version>1.0.1</version> <version>1.0.2</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Minecleaner</name> <name>Minecleaner</name>
@ -17,6 +17,7 @@
</properties> </properties>
<build> <build>
<finalName>${project.name}</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>

View file

@ -556,18 +556,39 @@ public class MinecleanerArena {
return true; return true;
} }
player.getLocation(tempLoc); player.getLocation(tempLoc);
double dist = tempLoc.distanceSquared(centerLocation);
switch (widthIndex) { double centerX = centerLocation.getX();
case 0: double centerY = centerLocation.getY() + (BoardSize.boardSizesHeight[widthIndex]/3)/2.0 - 1;
return dist > 64.0; double centerZ = centerLocation.getZ();
case 1:
return dist > 96.0; switch (orientation) {
case 2: case NORTH: {
return dist > 128.0; centerX = centerLocation.getX() - ((BoardSize.boardSizesWidth[widthIndex]/3)/2.0) + 1;
case 3: break;
return dist > 156.0; }
} case EAST: {
return dist > 64.0; centerZ = centerLocation.getZ() - ((BoardSize.boardSizesWidth[widthIndex]/3)/2.0) + 1;
break;
}
case SOUTH: {
centerX = centerLocation.getX() + ((BoardSize.boardSizesWidth[widthIndex]/3)/2.0) -1;
break;
}
case WEST: {
centerZ = centerLocation.getZ() + ((BoardSize.boardSizesWidth[widthIndex]/3)/2.0) - 1;
break;
}
default: {
break;
}
}
Location trueCenterLocation = new Location(player.getWorld(), centerX, centerY, centerZ);
double dist = tempLoc.distanceSquared(trueCenterLocation);
player.sendMessage(ChatColor.GOLD + "Dist: " + dist);
return dist > Math.pow((BoardSize.boardSizesWidth[widthIndex]/4.5) + 6, 2);
} }
public String getName() { public String getName() {

View file

@ -5,7 +5,7 @@ public class BoardSize {
9, 9,
12, 12,
18, 18,
33, 36,
}; };
public static int[] boardSizesHeight = { public static int[] boardSizesHeight = {