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

Field to track time before tipped arrow loses effects is not normal arrow in ground time and not written to NBT

    XMLWordPrintable

    Details

    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      The bug

      Arrows use two separate fields to track how long they have been in the ground. The one which is used to remove the effects is not stored in NBT and therefore reset when loading the arrow again.

      How to reproduce

      1. Give yourself a tipped arrow with effects
        /give @p tipped_arrow 1 0 {Potion:"leaping",CustomPotionEffects:[{Id:1b,Amplifier:1b,Duration:1200}]}
        
      2. Shoot it in the ground
      3. Wait 30 seconds
        → The arrow loses its effects, additionally /entitydata should show a life value above 600
      4. Repeat steps 1 and 2 but this time wait less than 30 seconds and reopen the world
      5. Inspect the NBT data of the arrow
        /entitydata @e[type=arrow] {}
        

        → It shows a life value higher than 600 but the arrow still has its effects

      Code analysis

      Based on 1.12 decompiled using MCP 9.40 PRE 1

      The net.minecraft.entity.projectile.EntityArrow has two fields which both track how long the arrow is stuck in the ground. ticksInGround is used to remove the arrow after one minute and is written to NBT (life tag). timeInGround is used to remove the effects but is not written to NBT.

      Since both fields are apparently tracking the same thing timeInGround should probably be removed and the life tag should be renamed to ticksInGround.

      Additionally there are some situations in which ticksInGround is reset (methods EntityArrow.setThrowableHeading(double, double, double, float, float) and EntityArrow.setVelocity(double, double, double)) where inGround is not necessarily false.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              marcono1234 [Mod] Marcono1234
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                CHK: