mojira.dev
MC-95735

(Splash) harming and healing potion still applys effect even if it's specified not to.

I was on my friend's server, which he wanted me to make a custom potion for him that doesn't give him the effects, which also has the color of the harming potion. So I did the following command:

/give @p minecraft:splash_potion 1 0 {CustomPotionEffects:[{Id:7,Amplifier:0,Duration:0}]}

which gives you a splash harming potion. So when I tested it out, for some reason, I still received the harming potion effect. Same thing happens with splash potion of healing.

Video link: https://youtu.be/TiY_0HK1I7Y


Code analysis by @unknown in this comment

Comments 5

{CustomPotionEffects:[{Id:7,Amplifier:0,Duration:0}]}

is a potion of instant harming, tier I.

Why shouldn't it do any effect ?

Confirmed for

  • 16w04a

This report seems valid because the according normal potion does not apply the effect

/give @p potion 1 0 {CustomPotionEffects:[{Id:7b,Duration:0,Amplifier:0b,ShowParticles:0b}]}

And incorrect duplicate link. To duplicate MC-89312 the command would need to contain the Potion tag for the NBT data of the potion.

Please link to this comment in the description

The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.

The reason why this happens is because the net.minecraft.entity.projectile.EntityPotion.onImpact(RayTraceResult) method (thrown potion) calls the net.minecraft.potion.Potion.affectEntity(Entity, Entity, EntityLivingBase, int, double) method for instant potion effects which does not test if the duration is higher than 0 whereas the net.minecraft.item.ItemPotion.onItemUseFinish(ItemStack, World, EntityLivingBase) method (normal potion) only adds all effects using the net.minecraft.entity.EntityLivingBase.addPotionEffect(PotionEffect) method.

Consistent behavior now for potions.

To create a splash potion with no effect but a custom color you can always use:
/give @p minecraft:splash_potion 1 0 {CustomPotionColor:"someColorValue"}

Logical_Cyclops

migrated

Confirmed

Minecraft 16w02a, Minecraft 16w03a, Minecraft 16w04a, Minecraft 16w05b, Minecraft 16w06a, ..., Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.1, Minecraft 1.9.2, Minecraft 16w14a, Minecraft 1.10.2

Minecraft 16w42a

Retrieved