How do I check if a player has eaten rotten flesh in minecraft? [duplicate]
I'm working on a illness thing, and I need to make it so it checks if a player has eaten some rotten flesh then gives the player infinite hunger.
Best Answer
This is really easy with scoreboards. Take a look at my answer for preventing someone from using a diamond sword. The concept is pretty much identical, especially the pre-1.8 method I described. For this reason, I won't go into great detail here.
First, set up a scoreboard objective to track when someone eats rotten flesh:
/scoreboard objectives add AteRottenFlesh stat.useItem.minecraft.rotten_flesh
Next you need two command blocks, one that will induce the hunger, and the other to reset the scoreboard objective:
effect @a[score_AteRottenFlesh_min=1] minecraft:hunger 1000000 1
scoreboard players set @a[score_AteRottenFlesh_min=1] AteRottenFlesh 0
Throw those two commands on a redstone clock, making sure the effect will execute first, and you're basically done.
So you can't actually give a player infinite hunger without constantly reapplying it, which is why I used the max time (one million seconds, or a bit better than 11.5 days) instead. You can set it to always reapply simply by not running the scoreboard command block.
You might want to also want to increase the potency of the hunger (the last number in the effect command). It defaults to 0, I set it to one, but I found that a person's hunger still doesn't go down all that fast. A player can easily keep up with that hunger by eating rotten flesh, but at higher levels, would need steak or lots of cake.
Pictures about "How do I check if a player has eaten rotten flesh in minecraft? [duplicate]"
![How do I check if a player has eaten rotten flesh in minecraft? [duplicate] - Man in Black and White Ice Hockey Jersey Playing Hockey How do I check if a player has eaten rotten flesh in minecraft? [duplicate] - Man in Black and White Ice Hockey Jersey Playing Hockey](/assets/images/how_do_i_check_if_a_player_has_eaten_rotten_flesh_in_minecraft_duplicate_1.jpeg)
![How do I check if a player has eaten rotten flesh in minecraft? [duplicate] - Black and Red Helmet on White and Red Textile How do I check if a player has eaten rotten flesh in minecraft? [duplicate] - Black and Red Helmet on White and Red Textile](/assets/images/how_do_i_check_if_a_player_has_eaten_rotten_flesh_in_minecraft_duplicate_2.jpeg)
![How do I check if a player has eaten rotten flesh in minecraft? [duplicate] - Man in White Nike Crew Neck T-shirt Holding Black and Red Tennis Racket How do I check if a player has eaten rotten flesh in minecraft? [duplicate] - Man in White Nike Crew Neck T-shirt Holding Black and Red Tennis Racket](/assets/images/how_do_i_check_if_a_player_has_eaten_rotten_flesh_in_minecraft_duplicate_3.jpeg)
Is there a purpose for rotten flesh in Minecraft?
Rotten flesh can be used to breed and heal tamed wolves, lead them around, and make baby tamed wolves grow up faster by 10% of the remaining time. Wolves are immune to the Hunger effect.How do you recycle rotten flesh in Minecraft?
Rotten Flesh to Leather is a very basic mod; as the name implies, it allows players to turn Rotten Flesh to Leather. To do this simply place rotten flesh into the top slot of a furnace and allow it to smelt. This will turn it into Leather.Can rotten flesh be smelted?
Rotten flesh can be used to create a "Hunger" potion.What Is Rotten Flesh Used For In Minecraft
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Victoria Borodinova, Ron Lach, Ron Lach, Centre for Ageing Better
