@@ -188,8 +188,6 @@ public static void onDrawScreen(ScreenEvent.Render evt) {
188
188
cursorWorldPos .z
189
189
);
190
190
cursorWorldPos = MiscUtil .screenPosToWorldPos (MC , evt .getMouseX (), evt .getMouseY ());
191
- //cursorWorldPos.y -= 1.3f;
192
- //cursorWorldPos.z -= 2.0f;
193
191
194
192
// calc near and far cursorWorldPos to get a cursor line vector
195
193
Vector3d lookVector = MiscUtil .getPlayerLookVector (MC );
@@ -201,7 +199,7 @@ public static void onDrawScreen(ScreenEvent.Render evt) {
201
199
202
200
Vec3 hitPos = getRefinedCursorWorldPos (cursorWorldPosNear , cursorWorldPosFar );
203
201
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 ) );
205
203
206
204
boolean usingPosAbove = false ;
207
205
@@ -240,14 +238,7 @@ else if (ResourceSources.GATHERABLE_PLANTS.contains(MC.level.getBlockState(prese
240
238
// inflate by set amount to improve click accuracy
241
239
AABB entityaabb = entity .getBoundingBox ().inflate (0.1 );
242
240
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 )) {
251
242
UnitClientEvents .addPreselectedUnit (entity );
252
243
if (UnitClientEvents .getPreselectedUnits ().size () > 0 )
253
244
break ; // only allow one moused-over unit at a time
0 commit comments