Effects added by modifying ActiveEffects tag are not updated instantaneously
This workaround works for 16w43a and 1.10
Use values for the Duration which are a multiples of 600 and then add 1, for example 601, 1201, 1801...
This currently works because the potions are updated when one of them has a duration % 600 == 0. Before this test happens the duration is decreased by one, which is why you have to add 1.
The bug
Changing the ActiveEffects tag of a mob does not update the potion effects. This means for example that mobs won't become invisible instantaneously.
Tried using /effect and it works properly
Video: https://youtu.be/nnkTrLmWk_Q
How to reproduce
- Summon a couple of creepers in a world
- Give them invisibility with:
/entitydata @e[type=creeper] {ActiveEffects:[{Id:14,Amplifier:0,Duration:1000000}]}Some (maybe all) of them don't disappear.
Re enter your world; now they've disappeared.
Code analysis
The following is based on a decompiled version of Minecraft 1.10 using MCP 9.30.
The problem is that when the ActivePotionEffects tag is read, the method net.minecraft.entity.EntityLivingBase.markPotionsDirty() is not called if the tag contained potion effects.
Environment
Java 8u73
Created Issue:
Most of the times entities don't get invisibility as it's applied
Most of the times, when you apply invisibility to a mob using entitydata, it becomes invisible after 10-30 seconds.
Reproduce
{Id:14,Amplifier:0,Duration:1000000}
Summon a couple of creepers in a world
Give them invisibility with: /entitydata @e[type=Creeper] {ActiveEffects:[]}
Some (maybe all) of them don't disappear.
Re enter your world; now they've disappeared.Tried using /effect and it works properly, but with /entitydata entities get invisibility but it's not rendered
Video: https://youtu.be/nnkTrLmWk_Q
Environment
Java 8u73
Most of the times, when you apply invisibility to a mob using entitydata, it becomes invisible after 10-30 seconds.
Reproduce
{Id:14,Amplifier:0,Duration:1000000}
Summon a couple of creepers in a world
Give them invisibility with: /entitydata @e[type=Creeper]{ActiveEffects:[]}
Some (maybe all) of them don't disappear.
Re enter your world; now they've disappeared.Tried using /effect and it works properly, but with /entitydata entities get invisibility but it's not rendered
Video:
https://youtu.be/nnkTrLmWk_QWorkaroundThis workaround works for 16w43a and 1.10
Use values for the Duration which are a multiples of 600 and then add 1, for example 601, 1201, 1801...
This currently works because the potions are updated when one of them has a duration % 600 == 0. Before this test happens the duration is decreased by one, which is why you have to add 1.The bug
Changing the ActiveEffects tag of a mob does not update the potion effects. This means for example that mobs won't become invisible instantaneously.
Tried using /effect and it works properly
Video: https://youtu.be/nnkTrLmWk_Q
How to reproduce
- Summon a couple of creepers in a world
- Give them invisibility with:
/entitydata @e[type=creeper] {ActiveEffects:[{Id:14,Amplifier:0,Duration:1000000}]}Some (maybe all) of them don't disappear.
Re enter your world; now they've disappeared.Code analysis
The following is based on a decompiled version of Minecraft 1.10 using MCP 9.30.
The problem is that when the ActivePotionEffects tag is read, the method net.minecraft.entity.EntityLivingBase.markPotionsDirty() is not called if the tag contained potion effects.
Most of the times entities don't get invisibility as it's appliedEffects added by modifying ActiveEffects tag are not updated instantaneously
Confirmed in 1.9.4
Cannot reproduce in 16w42a.
Is this still an issue for you in the most recent versions (currently that is 1.10.2, or 16w42a) of Minecraft? If so, please update the affected versions and help us keeping this ticket updated from time to time. If you are the owner/reporter of this ticket, you can modify the affected version(s) yourself.
Works as intended, see Searge's comment on
MC-66293