From 41d73db1d8ca8d2fe3f6e4b07b23d39dc5e32eb2 Mon Sep 17 00:00:00 2001 From: leumasme Date: Mon, 4 Mar 2024 01:17:55 +0100 Subject: [PATCH] Fix block highlight looking laggy It was using the tick position, now it is using the interpolated frame position of the player --- src/main/java/portablejim/bbw/core/BlockEvents.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/portablejim/bbw/core/BlockEvents.java b/src/main/java/portablejim/bbw/core/BlockEvents.java index 492db5a..3f73631 100644 --- a/src/main/java/portablejim/bbw/core/BlockEvents.java +++ b/src/main/java/portablejim/bbw/core/BlockEvents.java @@ -68,11 +68,14 @@ public void blockHighlightEvent(DrawBlockHighlightEvent event) { AxisAlignedBB boundingBox = AxisAlignedBB .getBoundingBox(block.x, block.y, block.z, block.x + 1, block.y + 1, block.z + 1) .contract(0.005, 0.005, 0.005); + double interpolatedX = event.player.lastTickPosX + + (event.player.posX - event.player.lastTickPosX) * event.partialTicks; + double interpolatedY = event.player.lastTickPosY + + (event.player.posY - event.player.lastTickPosY) * event.partialTicks; + double interpolatedZ = event.player.lastTickPosZ + + (event.player.posZ - event.player.lastTickPosZ) * event.partialTicks; RenderGlobal.drawOutlinedBoundingBox( - boundingBox.getOffsetBoundingBox( - -event.player.posX, - -event.player.posY, - -event.player.posZ), + boundingBox.getOffsetBoundingBox(-interpolatedX, -interpolatedY, -interpolatedZ), 0xC0C0C0); } GL11.glEnable(GL11.GL_TEXTURE_2D);