Skip to content

Commit 8a1f956

Browse files
committed
fixed cursor again
1 parent 0ff7d86 commit 8a1f956

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

src/main/java/com/solegendary/reignofnether/cursor/CursorClientEvents.java

+2-11
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ public static void onDrawScreen(ScreenEvent.Render evt) {
188188
cursorWorldPos.z
189189
);
190190
cursorWorldPos = MiscUtil.screenPosToWorldPos(MC, evt.getMouseX(), evt.getMouseY());
191-
//cursorWorldPos.y -= 1.3f;
192-
//cursorWorldPos.z -= 2.0f;
193191

194192
// calc near and far cursorWorldPos to get a cursor line vector
195193
Vector3d lookVector = MiscUtil.getPlayerLookVector(MC);
@@ -201,7 +199,7 @@ public static void onDrawScreen(ScreenEvent.Render evt) {
201199

202200
Vec3 hitPos = getRefinedCursorWorldPos(cursorWorldPosNear, cursorWorldPosFar);
203201
cursorWorldPos = new Vector3d(hitPos.x, hitPos.y, hitPos.z);
204-
preselectedBlockPos = new BlockPos((int) hitPos.x, (int) hitPos.y, (int) hitPos.z);
202+
preselectedBlockPos = new BlockPos((int) Math.floor(hitPos.x), (int) Math.floor(hitPos.y), (int) Math.floor(hitPos.z));
205203

206204
boolean usingPosAbove = false;
207205

@@ -240,14 +238,7 @@ else if (ResourceSources.GATHERABLE_PLANTS.contains(MC.level.getBlockState(prese
240238
// inflate by set amount to improve click accuracy
241239
AABB entityaabb = entity.getBoundingBox().inflate(0.1);
242240

243-
Vector3d cursorWorldPosAdj = new Vector3d(
244-
cursorWorldPos.x,
245-
cursorWorldPos.y,// + 1.3f,
246-
cursorWorldPos.z// + 2.0f
247-
);
248-
Vector3d cursorWorldPosNearAdj = MyMath.addVector3d(cursorWorldPosAdj, lookVector, -200);
249-
250-
if (MyMath.rayIntersectsAABBCustom(cursorWorldPosNearAdj, MiscUtil.getPlayerLookVector(MC), entityaabb)) {
241+
if (MyMath.rayIntersectsAABBCustom(cursorWorldPosNear, MiscUtil.getPlayerLookVector(MC), entityaabb)) {
251242
UnitClientEvents.addPreselectedUnit(entity);
252243
if (UnitClientEvents.getPreselectedUnits().size() > 0)
253244
break; // only allow one moused-over unit at a time

src/main/java/com/solegendary/reignofnether/util/MiscUtil.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public static Vector3d screenPosToWorldPos(Minecraft MC, int mouseX, int mouseY)
185185
// for some reason position is off by some y coord so just move it down manually
186186
return new Vector3d(
187187
MC.player.xo - XZRotated.x,
188-
MC.player.yo + y,
188+
MC.player.yo + y + 1.5f,
189189
MC.player.zo - XZRotated.y
190190
);
191191
}

0 commit comments

Comments
 (0)