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

Method toWorld

src/main/java/baritone/utils/GuiClick.java:137–156  ·  view source on GitHub ↗
(double x, double y, double z)

Source from the content-addressed store, hash-verified

135 }
136
137 private Vec3 toWorld(double x, double y, double z) {
138 if (this.projectionViewMatrix == null) {
139 return null;
140 }
141
142 x /= mc.getWindow().getWidth();
143 y /= mc.getWindow().getHeight();
144 x = x * 2 - 1;
145 y = y * 2 - 1;
146
147 Vector4f pos = new Vector4f((float) x, (float) y, (float) z, 1.0F);
148 projectionViewMatrix.transform(pos);
149
150 if (pos.w() == 0) {
151 return null;
152 }
153
154 pos.mul(1/pos.w());
155 return new Vec3(pos.x(), pos.y(), pos.z());
156 }
157}

Callers 1

renderMethod · 0.95

Calls 3

getWidthMethod · 0.80
getHeightMethod · 0.65
transformMethod · 0.45

Tested by

no test coverage detected