MCPcopy Create free account
hub / github.com/cabaletta/baritone / render

Method render

src/main/java/baritone/utils/GuiClick.java:65–84  ·  view source on GitHub ↗
(GuiGraphics stack, int mouseX, int mouseY, float partialTicks)

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 12

toWorldMethod · 0.95
posXMethod · 0.95
posYMethod · 0.95
posZMethod · 0.95
getProviderMethod · 0.95
getWidthMethod · 0.80
addMethod · 0.80
getHeightMethod · 0.65
playerMethod · 0.65
getPlayerContextMethod · 0.65
getPrimaryBaritoneMethod · 0.65
getTypeMethod · 0.45

Tested by

no test coverage detected