The bug
I shot a regular arrow on the ground and reloaded my world, the arrow now has particles as if it's a tipped arrow, yet when I pick up the arrow it gives a regular arrow.
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
The Color
tag is only written if the arrow has a custom color. The problem is that the game calls the method net.minecraft.entity.projectile.EntityTippedArrow.refreshColor()
when an arrow without Color
tag is loaded. This method sets the color to the water color.
This could be fixed by always writing the Color
tag to make sure tipped water arrows keep their particles as well. Additionally the check if the Color
tag exists when reading the NBT data can be removed then.
Related issues
is duplicated by
relates to
Attachments
Comments


Simply summoning an arrow also gives it particules, and without having to reload the world.
Back in 16w50a. Possibly related to MC-108943.

Confirmed for 17w06a

Confirmed for 17w17a.

Editing the NBTdata of an arrow using /entitydata also triggeres this bug. (1.11.2)
@unknown, you are talking about MC-111533.

Confirmed for 1.12-pre4.

confirmed for 1.12 pre7

Confirmed for 1.12.

@unknown, it was already marked as affected.
Can confirm for 17w47b

Confirm for 18w03b

confirmed in 18w07b. Using /data get entity @e[type=arrow,limit=1,sort=nearest] does not show anything unusual, not even a potion related tag when the bug is active.

Merged MC-111533 into this one, as it's the same cause: reading from NBT will create the particles:
reload -> needs to be loaded from nbt and created in an entity
edit -> the entity is (basically) changed to it's NBT data, changes applied and read from NBT data again
summon -> entity is created with nbt data applied

Affects 18w11a

Affects 18w21b

Confirmed for 18w22c
Can confirm for 1.13-pre1

Easy fix to summon arrow with no particles!!!
summon arrow ~ ~ ~ {Color:-1}
If you set the color value to -1 the particles are invisible, no worries anymore 😃
They can fix this bug by giving it that value as default

Can confirm for 1.13.2 release and 1.14 snapshot 18w43c.

Affects all 1.14 snapshots even without exiting the world first.

There's a more specific bit of code at the root of this bug. (Basing this off the source of 1.12.2.) When writing an arrow entity to NBT (i.e. on save or when modifying the data), it only writes the color tag if its fixedColor property is true. This property is only set in the setFixedColor and refreshColor methods, the latter of which sets the color to the default blue. This means that for normal arrows, it's false by default, and will never be written to NBT data; so when it reloads, the color tag isn't there, and it's refreshed to blue.
Â
The fix to this is quite simple, and requires only two small changes. In the tipped arrow entity's setPotionEffect method, instead of setting the color directly on the data manager, it should call setFixedColor to do this, which will then set the boolean flag properly and allow -1 to be written with the arrow's NBT, fixing the issue for bow-fired arrows.
The second change is to fix the issue for dispenser-fired arrows. In the registerDispenserBehaviors method of the Bootstrap class, when it registers the arrow behaviors for normal arrows, it just needs to call entitytippedarrow.setFixedColor(-1) somewhere between creating the entity and returning it. (The method is currently private, as is the flag, so this would need to actually call a new setter or just make the setFixedColor method public.)
Those small changes should fix this long-standing bug for good 🙂

Can confirm for all versions 1.14