Syntax: Plant Config File - Kosinkadink/PerformantPlants GitHub Wiki
A plant configuration file is composed of the following subsections inside a YAML file:
- Plant Item (REQUIRED)
- Plant Goods (optional)
- Recipes (optional)
- Growing (optional)
- Stored Script Blocks (optional)
- Tasks (optional)
Plant Item Id of item created by a plant config file is the filename of the plant config. E.g. plant item created by file named corn.yml would have the id of 'corn'.
TODO: write stuff here on the sections mentioned above
Plant configs have fields that may support either only YAML values or both YAML values and PlantScript blocks of certain Script types. There are some fields that take a list or map of values. For clarity, YAML values will always be referred to in lowercase, while Script types will always be referred to in uppercase.
-
int -> Denoted by numbers that don't contain a decimal place and are not surrounded by quotes.
- Examples: 0, -20, 5023
-
double -> Denoted by numbers that contain a decimal place and are not surrounded by quotes.
- Examples: 1.0, -20.5, 5023.4532
-
string -> Denoted by any sequence of characters on a line that may or may not be surrounded by quotes. If a parameter is of type string, then a sequence of numbers will also be read as a string.
- Examples: hello, 'hello', "hello123", 12345
-
boolean -> Denoted by writing true or false. Only strings 'true' and 'false' in parameters of type boolean will be transformed into their corresponding boolean values.
- Examples: true, false, 'true', 'false', "true", "false"
- LONG -> Denoted by any YAML int or any PlantScript block of type LONG.
- DOUBLE -> Denoted by any YAML double or any PlantScript block of type DOUBLE.
- STRING -> Denoted by any YAML string or any PlantScript block of type STRING.
- BOOLEAN -> Denoted by any YAML boolean or any PlantScript block of type BOOLEAN.
- SCRIPT -> Supports use of any PlantScript block of any type.
-
list of (YAML Value) -> Denoted by a lines starting with '-' that contain values of the corresponding YAML value.
- Example of list of strings:
- "hello" - "there"
-
list of (Section) -> Denoted by a map, where the names of the keys are ignored but must be unique in the same map, and the values are Sections of stated type.
- Example of list of Consumable Sections, which is the definition of a Consumable Storage Section (the 0 and 1 can be any strings that are unique):
consumable: 0: # (Consumable Section) 1: # (Consumable Section)
-
map of (Section) -> Denoted by a map, where the names of the keys are not ignored and must be unique in the same map, and the values are Section of stated type.
- Example of map of Item Sections:
goods: 'item1': # (Item Section) 'item2': # (Item Section)
An Item Section describes the characteristics of an ItemStack. When defining a Plant Item, there are additional parameters that can be provided for Plant Item behavior, which will be in the Plant Item Section.
Note: Plant Item Definitions can take additional parameters, listed below this section.
- material -> (string, optional) Defines appearance of item by Material enum. If set to PLAYER_HEAD or PLAYER_WALL_HEAD, skull-texture field is applied. Not used if link field is set.
- skull-texture -> (string, optional) Encoded texture url to apply to PLAYER_HEAD or PLAYER_WALL_HEAD. Only used if material is set to those values.
- link -> (string, optional) Links to plant item/good/seed defined in any present plant config. Item sections that create a plant item cannot contain a link to avoid circular references.
- display-name -> (string, optional but recommended) Display name of item. Supports formatting codes with the '&' symbol. By default, the display name will be colored light purple.
- amount -> (int > 0, default: 1) Amount of item in item stack.
- lore -> (list of strings, optional) Lore to display alongside item. Supports formatting codes with the '&' symbol.
- damage -> (int, optional) Damage to apply to an item (0 is no damage). Only applicable to damageable item types.
- unbreakable -> (true/false, optional) Sets whether item is breakable. Only applicable to damageable item types.
- custom-model-data -> (int, optional) Sets CustomModelData property of item. As of version 1.15, cannot be longer than 7 digits and cannot start with 0.
- flags -> (list of strings, optional) Item Flags to apply to an item by ItemFlag enum. Include only one flag per list item.
- enchantments -> (list of strings, optional) Enchantments to apply to item by Enchantment enum. Syntax is "enchantment:level", starting at 1 for Level 1.
- potion-effects -> (list of strings, optional) Potion effects to apply to item by PotionEffectType enum. Only applied if material is of type Potion. Syntax is "potionEffectType:duration:amplifier", or "potionEffectType:duration" if amplifier is assumed to be 0. Amplifier value of 0 is the default level of potion effect and lags behind the number in the name by 1. E.g. amplifier value 1 produces a level 2 potion effect.
-
potion-data -> (subsection, optional) Base potion, only applied if material is of type Potion.
- type -> (string, required) Base potion defined by PotionType enum.
- extended -> (true/false, default: false) Sets whether potion is extended; as if added redstone to base potion.
- upgraded -> (true/false, default: false) Sets whether potion is upgraded; as if added glowstone to base potion.
-
potion-color -> (subsection, optional) Color for potion, only applied if material is of type Potion. Expects r/g/b values between 0 and 255.
- r -> (int, 0-255)
- g -> (int, 0-255)
- b -> (int, 0-255)
- buy-price -> (double/int, optional) Price to buy item. Only relevant if Vault plugin is present.
- sell-price -> (double/int, optional) Price to sell item. Only relevant if Vault plugin is present.
- consumable -> (Consumable Storage Section, optional) Defines consumable behavior for item (right click).
- clickable -> (Consumable Storage Section, optional) Defines clickable behavior for item (left click).
- burn-time -> (int, default: 0) Amount of ticks to act as fuel if put in a Furnace/Smoker/Blast Furnace fuel slot, or how many items to allow brewing for if put in a Brewing Stand fuel slot. If 0, cannot be used as fuel. Note, this only applies if the item Material can be used within said fuel slots; it does not allow unburnable Materials to be used as fuel.
- allow-anvil -> (boolean, default: false) Whether item can be used in vanilla ways in an Anvil, such as if the Plant Item is a tool/weapon Material.
- allow-rename -> (boolean, default: false) Whether item can be renamed in an anvil; a rename will cause the Plant Item to no longer be recognized as a Plant Item.
- allow-smithing -> (boolean, default: false) Whether item can be used in vanilla ways in a Smithing Table.
- allow-grindstone -> (boolean, default: false) Whether item can be used in vanilla ways in a Grindstone.
- allow-stonecutter -> (boolean, default: false) Whether item can be used in vanilla ways in a Stonecutter.
- allow-enchanting -> (boolean, default: false) Whether item can be used in vanilla ways in an Enchanting Table.
- allow-beacon -> (boolean, default: false) Whether item can be used in vanilla ways in a Beacon.
- allow-loom -> (boolean, default: false) Whether item can be used in vanilla ways in a Loom.
- allow-cartography -> (boolean, default: false) Whether item can be used in vanilla ways in a Cartography Table.
- allow-crafting -> (boolean, default: false) Whether item can be used in vanilla ways in a Crafting Table.
- allow-fuel -> (boolean, default: false) Whether item can be used in vanilla ways in as fuel in Furnace/Smoker/Blast Furnace/Brewing Stand.
- allow-smelting -> (boolean, default: false) Whether item can be used in vanilla ways as item to be cooked in Furnace/Smoker/Blast Furnace/Campfire.
- allow-brewing -> (boolean, default: false) Whether item can be used in vanilla ways in a Brewing Stand's potion section.
- allow-ingredient -> (boolean, default: false) Whether item can be used in vanilla ways as an ingredient in a Brewing Stand.
- allow-consume -> (boolean, default: false) Whether item can be eaten in vanilla ways.
- allow-entity-interact -> (boolean, default: false) Whether item can be used in vanilla ways to interact with entities, such as animals and mobs.
- allow-wear -> (boolean, default: false) Whether item can be worn by Player or applied to Armor Stands in vanilla ways. Works for armor and PLAYER_HEAD Material.
Item Section Fields Raw:
material: <Material> # (string, ignored if link set)
skull-texture: <Encoded Texture String> # (string, only relevant if material is PLAYER_HEAD or PLAYER_WALL_HEAD)
link: <plant id> # (string, optional)
display-name: <name> # (string, optional but recommended)
amount: <amount> # (int, default: 1)
lore: # (list of strings, optional)
- 'list of lore strings'
damage: <damage amount> # (int, optional)
unbreakable: <true/false> # (boolean, optional)
custom-model-data: <data> # (int, optional)
flags: # (list of strings, optional)
- '<item flag>' # (e.g. -> 'HIDE_ENCHANTS')
enchantments: # (list of strings, optional)
- '<enchantment:level>' # (e.g. -> 'sharpness:5')
potion-effects: # (list of strings, optional)
- '<potionEffectType:duration:amplifier>' # (e.g. -> 'regeneration:200:1)
- '<potionEffectType:duration> # (assumes amplifier is 0)
potion-data: # (base potion, string, optional)
type: <potion type> # (string, required)
extended: <true/false> # (extended duration, boolean, optional)
upgraded: <true/false> # (upgraded effect, boolean, optional)
potion-color: # (optional)
r: <0-255> # (int)
g: <0-255> # (int)
b: <0-255> # (int)
#### Plant Item Definition-Only Parameters
buy-price: <price> # (double/int, optional)
sell-price: <price> # (double/int, optional)
consumable:
# (Consumable Storage Section, optional)
clickable:
# (Consumable Storage Section, optional)
burn-time: <ticks> # (int > 0, default: 0)
allow-anvil: <true/false> # (boolean, default: false)
allow-rename: <true/false> # (boolean, default: false)
allow-smithing: <true/false> # (boolean, default: false)
allow-grindstone: <true/false> # (boolean, default: false)
allow-stonecutter: <true/false> # (boolean, default: false)
allow-enchanting: <true/false> # (boolean, default: false)
allow-beacon: <true/false> # (boolean, default: false)
allow-loom: <true/false> # (boolean, default: false)
allow-cartography: <true/false> # (boolean, default: false)
allow-crafting: <true/false> # (boolean, default: false)
allow-fuel: <true/false> # (boolean, default: false)
allow-smelting: <true/false> # (boolean, default: false)
allow-brewing: <true/false> # (boolean, default: false)
allow-ingredient: <true/false> # (boolean, default: false)
allow-consume: <true/false> # (boolean, default: false)
allow-entity-interact: <true/false> # (boolean, default: false)
allow-wear: <true/false> # (boolean, default: false)
An Interact Storage Section defines behavior for a plant block, but can be used in other ways to filter behavior based on a player's inventory. It consists of an 'items' section (list of Interact Sections) and a 'default' section (standalone Interact Section) that is only used if there is no 'items' section or there are no matches in the 'items' section. At least one of these sections must be defined for an Interact Storage Section, that being 'items' and 'default'. If multiple Interact Sections match, the last match will be used.
Interact Storage Section Fields Raw:
'items':
0:
# (Interact Section)
'default':
# (Interact Section)
An Interact Section defines 1) conditions for an Interact Section to be matched and 2) actions to perform if selected.
Conditions for matching are given by the following fields:
- condition -> (BOOLEAN, default: true) PlantScript to execute to check if this Interact Section should be used.
- required-block-faces -> (list of strings, optional) Block Faces interacted with by BlockFace
- match-material -> (boolean, optional) Determines if item matching should compare Material instead of full Item Stack similarity.
- match-enchantments -> (boolean, optional) Determines if item matching should compare Enchantments instead of full Item Stack similarity.
- match-enchantment-level -> (boolean, optional) Determines if item matching should compare Enchantment Levels instead of full Item Stack similarity.
Actions to perform are given by the following fields:
-
do-if -> (BOOLEAN, default: true) PlantScript to execute to determine if '-on-do' actions should be done.
-
script -> (SCRIPT, optional) PlantScript to execute regardless of 'do-if' result
-
script-on-do -> (SCRIPT, optional) PlantScript to execute only if 'do-if' is true.
-
script-on-not-do -> (SCRIPT, optional) PlantScript to execute only if 'do-if' is false.
-
take-item -> (BOOLEAN, default: true) Whether the consumable item should be taken/decremented.
-
only-take-item-on-do -> (BOOLEAN, default: true) Whether take-item only matters if 'do-if' is true; if this field is true, then item can only be taken if 'do-if' is true.
-
effects -> Effect Storage Section of effects to perform.
-
only-effects-on-do -> (BOOLEAN, default: true) Whether 'effects' should happen only if 'do-if' is true.
-
consumable -> Consumable Storage Section that contains effects to perform within a consumable.
-
only-consumable-effects-on-do -> (BOOLEAN, default: true) Whether 'comsumable' should happen only if 'do-if' is true.
A Consumable Storage Section is a list of Consumable Sections with different requirements defined. If multiple Consumable Sections have matching requirements, the last match will be used.
Consumable Storage Section Fields Raw:
0:
# (Consumable Section, required)
1:
# (Consumable Section, only one is required)
A Consumable Section defines 1) conditions for a Consumable Section to be matched and 2) actions to perform if selected.
Conditions for matching are given by the following fields:
- condition -> (BOOLEAN, default: true) PlantScript to execute to check if this Consumable Section should be used.
- required-items -> List of Required Item Sections that contains the required items for this Consumable Section to be matched.
- missing-food -> (BOOLEAN, default: false) Whether player needs to have a non-full food bar for this Consumable Section to be matched.
Actions to perform are given by the following fields:
- do-if -> (BOOLEAN, default: true) PlantScript to execute to determine if '-on-do' actions should be done.
- script -> (SCRIPT, optional) PlantScript to execute regardless of 'do-if' result
- script-on-do -> (SCRIPT, optional) PlantScript to execute only if 'do-if' is true.
- script-on-not-do -> (SCRIPT, optional) PlantScript to execute only if 'do-if' is false.
- take-item -> (BOOLEAN, default: true) Whether the consumable item should be taken/decremented.
- only-take-item-on-do -> (BOOLEAN, default: true) Whether take-item only matters if 'do-if' is true; if this field is true, then item can only be taken if 'do-if' is true.
- normal-eat -> (BOOLEAN, default: true) Whether item should be consumed directly on click or if item needs to be 'eaten' same as vanilla. This only applies to items with Materials that are eatable in vanilla, otherwise it has no effect.
- effects -> Effect Storage Section of effects to perform.
- only-effects-on-do -> (BOOLEAN, default: true) Whether 'effects' should happen only if 'do-if' is true.
- add-damage -> (LONG > 0, default: 0) Damage to be added to required item. Only affects damageable items.
- only-add-damage-on-do -> (BOOLEAN, default: true) Whether 'add-damage' should happen only if 'do-if' is true.
- give-items -> List of Item Sections that contains items to give to player.
- only-give-items-on-do -> (BOOLEAN, default: true) Whether items should be given only if 'do-if' is true.
Consumable Subsection Fields Raw:
##### Matching
condition: <BOOLEAN>
required-items: (map of Required Item Section, optional, defaults to no required items)
0: # (Required Item Section)
missing-food: <BOOLEAN>
##### Action
do-if: <BOOLEAN>
script: <SCRIPT>
script-on-do: <SCRIPT>
script-on-not-do: <SCRIPT>
take-item: <BOOLEAN>
only-take-item-on-do: <BOOLEAN>
normal-eat: <BOOLEAN>
effects:
# (Effect Storage Section)
only-effects-on-do: <BOOLEAN>
add-damage: <damage amount> # (LONG > 0)
only-add-damage-on-do: <BOOLEAN>
give-items: # (map of Item Section)
0:
# (Item Section)
only-give-items-on-do: <BOOLEAN>
A Required Item Section can contain the following fields:
- item -> (Item Section, required) Item that is required; can include link to a plant item.
- take-item -> (BOOLEAN, default: false) Whether the required item should be taken/decremented.
- in-hand -> (BOOLEAN, default: false) Whether the required item should be in hand (either main or offhand) to count.
- add-damage -> (LONG > 0, default: 0) Damage to be added to required item. Only affects damageable items.
- condition -> (BOOLEAN, default: true) PlantScript to execute to check if this required item should be used.
Required Item Section Fields Raw:
item:
# (Item Section, required)
take-item: <BOOLEAN>
in-hand: <BOOLEAN>
add-damage: <LONG> # (LONG > 0)
condition: <BOOLEAN>
TODO: write stuff about syntax for each effect type
TODO: write stuff about syntax for each recipe type