fix selection splitting

This commit is contained in:
Daniella / Tove 2024-05-31 21:04:04 +02:00
parent ed03536d5a
commit daf7635cef
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
3 changed files with 4 additions and 3 deletions

View file

@ -78,6 +78,7 @@ public class RemoteEventManager {
private void runServer() { private void runServer() {
try { try {
id = 0; id = 0;
peers = 1;
server.setSoTimeout(1); server.setSoTimeout(1);
while(server != null) { while(server != null) {
try { try {
@ -89,7 +90,7 @@ public class RemoteEventManager {
s.getOutputStream().flush(); s.getOutputStream().flush();
s.setSoTimeout(1); s.setSoTimeout(1);
clients.add(s); clients.add(s);
publish(new RemoteInitEvent(clients.size())); publish(new RemoteInitEvent(clients.size() + 1));
BaseBand.notify("[Remote] Client connected."); BaseBand.notify("[Remote] Client connected.");
} else { } else {
s.close(); s.close();

View file

@ -18,7 +18,7 @@ public class BlockUtils {
zSideLength = sideLength; zSideLength = sideLength;
for (int i = 0; i < selections.length; i++) { for (int i = 0; i < selections.length; i++) {
BlockPos pos1 = selection.pos1.add(xSideLength * i, 0, zSideLength * i); BlockPos pos1 = selection.pos1.add(xSideLength * i, 0, zSideLength * i);
BlockPos pos2 = selection.pos2.add(Math.min(xSideLength * (i + 1), size.getX()), 0, Math.min(zSideLength * (i + 1), size.getZ())); BlockPos pos2 = selection.pos2.add(Math.min(xSideLength * (i + 1), size.getX() - 1), 0, Math.min(zSideLength * (i + 1), size.getZ() - 1));
selections[i] = new Selection(pos1, pos2); selections[i] = new Selection(pos1, pos2);
} }
return selections; return selections;

View file

@ -18,7 +18,7 @@ public class Selection {
public long area() { public long area() {
Vec3i size = size(); Vec3i size = size();
return (long) size.getX() * size.getX() * size.getX(); return (long) size.getX() * size.getY() * size.getZ();
} }
public long longestSide() { public long longestSide() {