3

I'm developing a Minecraft server which incorporates realism using a command block network in the center of the map. I'm trying to simulate food spoiling via testing for the age of an item (i.e. if a bread item is left in a chest for 5 ingame days then it becomes spoiled). If a player eats such a food, then they will receive the poison effect. Is it possible to do this via commands (without plugins, of course)?

NB: One drawback of this is that foodstuffs are stackable, causing each individual item to lose their age property when combined with others. Asked a question regarding this

6
  • To which part of the question are you asking if it is possible? See this post for applying potion effects for eating certain foods. As for making items unstackable, create custom NBT for each item. When an item is summoned, this can be done with summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:dirt",Count:1b,tag:{test:1b}}}.
    – David
    Aug 16 at 14:54
  • @David What does the 1b mean?
    – Corsaka
    Aug 16 at 15:00
  • @Corsaka 1b refers to 1 byte, or true. It's just a true or false value.
    – David
    Aug 16 at 15:05
  • @David So isn't it the same every time? Why does it make things unstackable?
    – Corsaka
    Aug 16 at 15:05
  • @Corsaka Changing "test" to a different tag will cause the tag to be different. I should have clarified. Different custom nbt tags will make items non-stackable.
    – David
    Aug 16 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.