Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-101003

If look ray doesn't intersect any block's collision box or pass through an un-collidable block, Minecraft.objectMouseOver is null

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Duplicate
    • Affects Version/s: Minecraft 1.9.2, Minecraft 16w15b
    • Fix Version/s: None
    • Labels:
      None
    • Confirmation Status:
      Confirmed

      Description

      Note: I have looked into this issue as I thought it was an issue with my mod, and will try to save you time by giving my analysis of the issue at the end. This analysis is done in MCP 1.8.9, so things may be a little different in 1.9+

      Issue:

      The issue is that if the player's look ray doesn't hit any bounding box and doesn't go through an "un-collidable" block such as air, the hit position is null. This means that every time a player clicks (right or left) the log message [Client thread/ERROR]: Null returned as 'hitResult', this shouldn't happen! is printed.

      Reproducing:

      Put a long line of bottom slabs, longer than the reach distance of the player, and look through them without the look ray going outside the block bounds. Right or left click and look at the logs.

      My analysis:

      Everything here is using MCP 1.8.9-11.15.1.1808

      Toward the end of World.rayTraceBlocks the variable movingobjectposition2 is only set if Block.canCollideCheck() is false, but all of the blocks do have collide checks, so movingobjectposition2 is never set. The problem comes in when all of the blocks return null from the Block.collisionRayTrace() method, since no MOP is returned, it goes on to returnLastUncollidableBlock ? movingobjectposition2 : null, but since all of the blocks had collide checks this was never set to anything but null, meaning Minecraft.objectMouseOver is set to null.

        Attachments

        1. FirstPerson.png
          FirstPerson.png
          25 kB
        2. mc-101003.png
          mc-101003.png
          101 kB
        3. ThirdPerson.png
          ThirdPerson.png
          85 kB

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              TheCodeWarrior Pierce Corcoran
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                CHK: