[MC-2573] Potions and Food are consumed on death Created: 09/Nov/12  Updated: 11/Jul/18  Resolved: 14/Nov/16

Status: Resolved
Project: Minecraft: Java Edition
Component/s: None
Affects Version/s: Minecraft 1.4.4, Minecraft 1.4.6, Minecraft 1.4.7, Minecraft 1.5, Minecraft 1.6.4, Minecraft 13w39b, Minecraft 14w30c, Minecraft 1.8.1-pre3, Minecraft 15w43b, Minecraft 1.9, Minecraft 1.10.2, Minecraft 16w32a, Minecraft 16w32b, Minecraft 16w33a, Minecraft 16w39c
Fix Version/s: Minecraft 16w33a, Minecraft 1.11

Type: Bug
Reporter: reuben searson Assignee: Unassigned
Resolution: Fixed Votes: 6
Labels: food, keepinventory, potion

Issue Links:
Cloners
is cloned by MC-133218 Usable items continue to be used on t... Open
Duplicate
is duplicated by MC-97230 Eating After Death Resolved
CHK:
Confirmation Status: Confirmed
Game Mode: Survival

 Description   

When using keepinventory = true. If the player is killed in the process of drinking a potion or eating food then the potion or food item will be consumed while on the death screen. This allows potions and food to be wasted when trying to keep from dying in combat.

The drinking process should stop on death and the potion or food should not be consumed until the end of the drinking animation.


The following is based on a decompiled version of Minecraft 1.10 using MCP 9.30.

To fix this, add an if statement to check if the player is alive in onItemUseFinish before depleting the item.

ItemFood.java
	public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) 
	{
		if (entityLiving.isEntityAlive()) 
		{

		}
		
		return stack;
		
	}
ItemPotion.java
	public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) 
	{
		EntityPlayer entityplayer = entityLiving instanceof EntityPlayer ? (EntityPlayer) entityLiving : null;

		if (entityplayer.isEntityAlive()) 
		{

		}
		
		return stack;
		
	}


 Comments   
Comment by Fabian Röling [ 01/Sep/16 ]

This is fixed in 16w35a and I'm pretty sure it also was in the previous version. I think it was also on mojang.com.

Comment by Fabian Röling [ 29/Jun/16 ]

This also happens with food.

Comment by null (Inactive) [ 23/Jun/16 ]

Confirmed for 1.10.2.

Comment by user-f2760 (Inactive) [ 18/Mar/16 ]

Reopened and changed reporter to harrypotter1a2b as spyman510 is no longer active.

Comment by reuben searson [ 18/Mar/16 ]

Still occurs in 1.9.

Comment by user-f2760 (Inactive) [ 17/Mar/16 ]

Is this still an issue in 1.9 or 1.9.1-pre3?

Comment by WesselH [ 22/Oct/15 ]

Still in 15w43b

Comment by Jared Jones [ 26/Jul/14 ]

I tested on version 14w30c and the problem has not changed.

Comment by Jared Jones [ 28/Sep/13 ]

It is still a problem in 1.6.4 and 13w39b. I tested it by hugging a creeper and drinking an instant health potion.

Comment by [Mod] CubeTheThird [ 26/Sep/13 ]

Is this still a concern in the current Minecraft version 1.6.4 / Launcher version 1.2.5 ? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

Comment by Tails [ 26/Dec/12 ]

Confirmed in 1.4.6.

Comment by TMCplays [ 24/Dec/12 ]

Confirmed in both gamemodes.

Comment by Jared Jones [ 11/Dec/12 ]

It was SSP.

Comment by Ender [ 11/Dec/12 ]

Is this in SMP or SSP?

Generated at Sun Jan 12 11:58:20 UTC 2025 using Jira 9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13.