Mojira Archive
MC-118918

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

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 @s tipped_arrow[potion_contents={potion:leaping}]
    
  2. Shoot it in the ground
  3. Wait 30 seconds
    The arrow loses its effects and particles, additionally /data 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
    /data get entity @n[type=arrow] life
    

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

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.

Unresolved

Marcono1234

2017-06-23, 11:09 AM

2025-02-05, 06:27 PM

5

4

Confirmed

(Unassigned)

effect, inGround, nbt, tipped_arrow

Minecraft 1.12 - 1.21.4Minecraft 1.12, 20w07a, 20w51a, 1.20.1, 23w32a, 1.21.4

-