(GuiGraphics stack, int mouseX, int mouseY, float partialTicks)
| 63 | } |
| 64 | |
| 65 | @Override |
| 66 | public void render(GuiGraphics stack, int mouseX, int mouseY, float partialTicks) { |
| 67 | double mx = mc.mouseHandler.xpos(); |
| 68 | double my = mc.mouseHandler.ypos(); |
| 69 | |
| 70 | my = mc.getWindow().getScreenHeight() - my; |
| 71 | my *= mc.getWindow().getHeight() / (double) mc.getWindow().getScreenHeight(); |
| 72 | mx *= mc.getWindow().getWidth() / (double) mc.getWindow().getScreenWidth(); |
| 73 | Vec3 near = toWorld(mx, my, 0); |
| 74 | Vec3 far = toWorld(mx, my, 1); // "Use 0.945 that's what stack overflow says" - leijurv |
| 75 | |
| 76 | if (near != null && far != null) { |
| 77 | Vec3 viewerPos = new Vec3(PathRenderer.posX(), PathRenderer.posY(), PathRenderer.posZ()); |
| 78 | LocalPlayer player = BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().player(); |
| 79 | HitResult result = player.level().clip(new ClipContext(near.add(viewerPos), far.add(viewerPos), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player)); |
| 80 | if (result != null && result.getType() == HitResult.Type.BLOCK) { |
| 81 | currentMouseOver = ((BlockHitResult) result).getBlockPos(); |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | @Override |
| 87 | public boolean mouseReleased(double mouseX, double mouseY, int mouseButton) { |
nothing calls this directly
no test coverage detected