Skip to content

Commit

Permalink
small hitbox and sink fix (#715)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
wolfebersahd authored Dec 14, 2024
1 parent 6422b98 commit ed545b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ private void processSinking() {
if (!(craft instanceof SinkingCraft))
continue;

if (craft.getHitBox().isEmpty() || craft.getHitBox().getMinY() < 5) {
if (craft.getHitBox().isEmpty() || craft.getHitBox().getMinY() < (craft.getWorld().getMinHeight() +5 )) {
CraftManager.getInstance().release(craft, CraftReleaseEvent.Reason.SUNK, false);
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ default int getXLength() {
if (isEmpty())
return 0;

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

default int getYLength() {
if (isEmpty())
return 0;

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

default int getZLength() {
if (isEmpty())
return 0;

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

default boolean isEmpty() {
Expand Down

0 comments on commit ed545b8

Please sign in to comment.