Skip to content

Commit ed545b8

Browse files
authored
small hitbox and sink fix (#715)
* changed hardcoded sink limit to be dynamic Changed hardcoded sink limit from `y < 5` to `y < (craft.getWorld().getMinHeight() + 5)` preserving the original 4 block buffer but accounting for the new minimum world heights of 1.18+ * Adjusted X, Y, Z lengths by +1 Adjusted X, Y, Z, lengths by +1 to compensate for coordinate vs block math. * Fixed missing `. ` * fixed missing `)` too
1 parent 6422b98 commit ed545b8

File tree

2 files changed

+4
-4
lines changed
  • Movecraft/src/main/java/net/countercraft/movecraft/async
  • api/src/main/java/net/countercraft/movecraft/util/hitboxes

2 files changed

+4
-4
lines changed

Movecraft/src/main/java/net/countercraft/movecraft/async/AsyncManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ private void processSinking() {
293293
if (!(craft instanceof SinkingCraft))
294294
continue;
295295

296-
if (craft.getHitBox().isEmpty() || craft.getHitBox().getMinY() < 5) {
296+
if (craft.getHitBox().isEmpty() || craft.getHitBox().getMinY() < (craft.getWorld().getMinHeight() +5 )) {
297297
CraftManager.getInstance().release(craft, CraftReleaseEvent.Reason.SUNK, false);
298298
continue;
299299
}

api/src/main/java/net/countercraft/movecraft/util/hitboxes/HitBox.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@ default int getXLength() {
2323
if (isEmpty())
2424
return 0;
2525

26-
return Math.abs(getMaxX() - getMinX());
26+
return Math.abs(getMaxX() - getMinX() +1 );
2727
}
2828

2929
default int getYLength() {
3030
if (isEmpty())
3131
return 0;
3232

33-
return Math.abs(getMaxY() - getMinY());
33+
return Math.abs(getMaxY() - getMinY() +1 );
3434
}
3535

3636
default int getZLength() {
3737
if (isEmpty())
3838
return 0;
3939

40-
return Math.abs(getMaxZ() -getMinZ());
40+
return Math.abs(getMaxZ() -getMinZ() +1 );
4141
}
4242

4343
default boolean isEmpty() {

0 commit comments

Comments
 (0)