Skip to content

Commit

Permalink
Merge pull request #347 from steve4744/master
Browse files Browse the repository at this point in the history
use centre of each block when calculating closest block
  • Loading branch information
A5H73Y authored Aug 2, 2023
2 parents 89915e7 + b008370 commit ac07ed6
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private Material calculateClosestBlock(Player player) {
BlockFace result = BLOCK_FACES.stream()
.filter(blockFace -> !XBlock.isAir(blockBelow.getRelative(blockFace).getType()))
.min(Comparator.comparing(blockFace ->
blockBelow.getRelative(blockFace).getLocation().distance(player.getLocation())))
blockBelow.getRelative(blockFace).getLocation().add(0.5, 0.5, 0.5).distance(player.getLocation())))
.orElse(BlockFace.NORTH);

return blockBelow.getRelative(result).getType();
Expand Down

0 comments on commit ac07ed6

Please sign in to comment.