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

deadmau5's ears are offset while sneaking and while flying with elytra

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • None
    • Minecraft 1.9 Pre-Release 4, Minecraft 1.9, Minecraft 1.11, Minecraft 1.12 Pre-Release 5, Minecraft 1.12.1, Minecraft 1.12.2 Pre-Release 1, Minecraft 1.12.2 Pre-Release 2, Minecraft 1.12.2, 1.14.4, 1.16.1, 20w29a, 1.16.3, 1.16.4, 20w45a, 20w46a, 20w48a, 20w49a, 20w51a, 21w03a, 21w07a, 21w08b, 21w10a
    • Confirmed
    • (Unassigned)

      The bug

      When a player named "deadmau5" sneaks or flies with an elytra (and rotates his head), his ears are offset.

      How to reproduce

      1. Copy the latest version folder in the .minecraft\versions directory and append _custom to the copied name, resulting in for example 1.12-pre5_custom
      2. Delete the .jar file inside the folder
      3. Append _custom to the version .json file name as well
      4. Replace the content of the version .json file with the following
        {
          "id": "#VERSION#_custom",
          "time": "2038-01-19T03:14:07+00:00",
          "releaseTime": "2038-01-19T03:14:07+00:00",
          "type": "snapshot",
          "minecraftArguments": "--username deadmau5 --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid 1e18d5ff643d45c8b50943b8461d8614 --accessToken ${auth_access_token} --userType ${user_type} --versionType ${version_type}",
          "inheritsFrom": "#VERSION#",
          "jar": "#VERSION#"
        }
        
      5. Replace all occurrences of #VERSION# with the version id you created a copy of, for example 1.12-pre5
      6. Select this version in the launcher and start the game
      7. Switch to third person view (F5) and sneak

      Code analysis

      by Bemoty

      The method net.minecraft.client.renderer.entity.layers.LayerDeadmau5Head.doRenderLayer() doesn't check if the to be rendered entity is sneaking. Thus, a simple way to fix the sneaking issue would be to add that specific check, which translates the ears a bit down. (I don't know the exact "sneak-shrink"-value, 0.25F is just an example!)

      net.minecraft.client.renderer.entity.layers.LayerDeadmau5Head.doRenderLayer()
      // ...
      if(entitylivingbaseIn.isSneaking()) {
      	GlStateManager.translate(0F, 0.25F, 0F);
      }
      float f2 = 1.3333334F;
      GlStateManager.scale(1.3333334F, 1.3333334F, 1.3333334F);
      this.playerRenderer.getMainModel().renderDeadmau5Head(0.0625F);
      // ...
      

      The fix I found for the elytra-flying issue is very similar to my proposed fix on MC-75279 – clamping the pitch of the ears does the job. Again, the values (-30F, -60F) are only examples, there may be other, way better values to use here.

      net.minecraft.client.renderer.entity.layers.LayerDeadmau5Head.doRenderLayer()
      // ...
      float f1 = entitylivingbaseIn.prevRotationPitch + (entitylivingbaseIn.rotationPitch - entitylivingbaseIn.prevRotationPitch) * partialTicks;
      GlStateManager.pushMatrix();
      if(entitylivingbaseIn.isElytraFlying()) {
      	f1 = MathHelper.clamp(f1, -60F, -30F);
      }
      // ...
      

      Note: I do not own the username "deadmau5" neither do I know the person owning it personally. The attached screenshots were created by using "deadmau5" as username. The screenshots were taken for testing purposes.

        1. FIX_sneaking.png
          FIX_sneaking.png
          439 kB
        2. FIX_flying_up.png
          FIX_flying_up.png
          400 kB
        3. FIX_flying_down.png
          FIX_flying_down.png
          15 kB
        4. Deadmau5 ears offset sneaking (1.9-pre4).png
          Deadmau5 ears offset sneaking (1.9-pre4).png
          215 kB
        5. 2017-10-08_20.19.31.png
          2017-10-08_20.19.31.png
          32 kB

            Unassigned Unassigned
            markderickson [Mod] markderickson
            Votes:
            17 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: