Skip to content
edbefee3-3888-462a-9411-741b7e9eb54e edited this page May 7, 2018 · 11 revisions

So, you think you've mastered the basic foods, huh? Alright, well here's some more complicated things you can do to further customize your foods.

These values allow you to define a few things. Firstly, what the foods drop from (blocks and entities) and how many drop. Secondly, you can add potion effects to your items.

Some of these values are string arrays, meaning they are defined as such (where name is animals or blocks):

"name": ["value1", "value2"]
Value Type Description Default
animals String array An array of the names of entities that this food drops from. This uses the entity's simple name, such as "Pig", or "Sheep", or "CaveSpider". [ ]
blocks String array An array of the names of blocks that this food drops from. A block name is defined as "name;meta", where name is the string the block is registered under, and the meta is the metadata value of the block in the world. The metadata part is optional (e.g. just "name" is valid) and leaving it out will mean that ALL metadata values will drop the item. [ ]
minDropped Integer The minimum amount of food dropped when the block is broken. Number Most Be At Least 0 0
maxDropped Integer The maximum amount of food dropped when the block is broken. Any number above 0 is valid.. 0
dropChance Decimal The chance that a drop will occur at all. This can be used for drops you want to be a very low chance, such as from tree leaves (for jaded ;D) 1.0
effects Custom object array An array of different effects that the food will give the player when eaten. A table of the effect object's fields is below. [ ]

Here is a quick rundown of the fields a potion effect object has.

Value Type Description Default
name String The unlocalized name of this potion effect, for vanilla it is something like "potion.healthBoost" or similar. "null"
time Integer The amount of ticks this potion will last. There are 20 ticks in one second. 1200
level Integer The level of this potion effect. 0 is level I. So for "Speed III" the level would be 2. 0
chance Decimal The chance this potion will affect the player after the food is eaten. Value from 0 to 1. 1.0

Notes: For dropped foods, the number that is actually dropped will be an even random distribution between minDropped and maxDropped.