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

Certain entity animations stop after they've existed in world for too long

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.16.2, 1.18.1, 22w11a, 22w13a, 1.19 Pre-release 1, 1.19.2, 22w43a, 1.19.3, 23w03a, 1.20.1, 1.20.2, 23w44a, 1.20.4
    • Confirmed
    • Rendering
    • Normal
    • Platform

      The bug

      Certain Entities such as Bee and Bat stop their animations of their wings after they've been in the world for too long. I noticed this bug when I was making a mod for forge that extended the bee entity and I noticed that my bees wouldn't flap their wings after being in world for a while so I tested it in vanilla (unmodified) Minecraft and noticed it had the same problem so I went back to the vanilla bees model code and noticed it was using ageInTicks(tickexisted + partialticks) which back traced back to ticks existed so I tested again using a command block on repeat to see how long it would take for the bee it takes about 98000 ticks - 98200 ticks for the bee to stop flapping the wings while for the bat it took from 158400 ticks - 158600 ticks. the value is not random between these values its consistent I'm just giving a range due to my scoreboard taking a couple extra ticks to start the repeating of adding 1 to the scoreboard. This is likely due to the ticks existed variable multiplied by whatever value you guys set per entity model to then be used in your math classes cos method and then the method returning the same index every time due to the input value being so big. This could also happen on the phantom in theory but it would take about a full day according to calculations so I didn't test it but in theory it has the same code as the bat and the bee do for the cos method implementation so it should happen on it too.

      Expected result

      Bees and Bats and other entities that have animations that use the cos method not stop after they exceed a certain value.

      Observed result

      The bees and bats stopped their wing animations, you can see this happening in the videos provided.

      Reproduce

      1. Go into a world and spawn a bee and you can also spawn a bat if you wanna see it happen to that but you'll have to wait longer.
      2. Wait about 81 min
      3. then you'll see a bee not flapping its wings anymore
      4. and you can wait about another 51 min if you spawned the bat
      5. then you'll see a bat not flapping its wings anymore

      Code analysis and potential fix

      Code analysis by ampolive can be found in this comment.
      Potential fix by isXander can be found in this comment.

        1. bee_wings.mp4
          9.89 MB
        2. bat_wings.mp4
          7.59 MB
        3. 2020-09-01_23.59.05.png
          2020-09-01_23.59.05.png
          821 kB
        4. 2023-07-11 16-24-36.mp4
          1.58 MB

            Unassigned Unassigned
            TheGravyBoat ThatGravyBoat
            Votes:
            14 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              CHK: