From b0083707ae046972c3093e80bf7079ae461f788e Mon Sep 17 00:00:00 2001 From: BuildTools Date: Wed, 2 Aug 2023 15:29:36 +0100 Subject: [PATCH] use centre of each block when calculating closest block --- .../a5h73y/parkour/listener/move/ParkourBlockListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/a5h73y/parkour/listener/move/ParkourBlockListener.java b/src/main/java/io/github/a5h73y/parkour/listener/move/ParkourBlockListener.java index f91ef06c..0ce0b8d3 100644 --- a/src/main/java/io/github/a5h73y/parkour/listener/move/ParkourBlockListener.java +++ b/src/main/java/io/github/a5h73y/parkour/listener/move/ParkourBlockListener.java @@ -165,7 +165,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();