Skip to content

Commit

Permalink
Fix NPE that can occur in HitboxEntities check
Browse files Browse the repository at this point in the history
  • Loading branch information
Axionize committed Dec 23, 2024
1 parent 631217a commit 31396cd
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static CollisionBox getOverlapHitbox(CollisionBox b1, CollisionBox b2) {

// Check if there's actual overlap along each axis
if (overlapMinX > overlapMaxX || overlapMinY > overlapMaxY || overlapMinZ > overlapMaxZ) {
return null; // No overlap, return null or an appropriate "empty" box representation
return NoCollisionBox.INSTANCE; // No overlap, return null or an appropriate "empty" box representation
}

// Return the overlapping hitbox
Expand Down Expand Up @@ -172,12 +172,6 @@ public CollisionBox getOverlapLocationCombined() {
startingLocation.maxX + (step * stepMaxX),
startingLocation.maxY + (step * stepMaxY),
startingLocation.maxZ + (step * stepMaxZ)));

if (overlapLocation == null) {
// No overlap found, you might want to handle this case specifically
// For example, return null or a default box
return NoCollisionBox.INSTANCE;
}
}

return overlapLocation;
Expand Down

0 comments on commit 31396cd

Please sign in to comment.