Let take tomato as an example to configure the crop settings
Unique Identifier for Your Crop:
Start by naming your crop under a unique identifier like tomato. This makes it easy to reference and customize later on.
Define the Crop Type:
Set the type to either BLOCK or FURNITURE. For "tomato", it is set to BLOCK. This setting affects all custom item types that appear in the entire configuration. But you can also set the type of an item individually through some additional configuration.
# Item type
# BLOCK / FURNITURE
type: BLOCK
Set Planting Restrictions:
Use the pot-whitelist to specify which pots are allowed for planting. The "tomato" crop can only be planted in the default pot. If you modify the configuration of the pot, please be sure to modify this configuration simultaneously.
# The crop can only be planted on whitelisted pots
pot-whitelist:
- default
Configure Seed Information:
The seed field identifies the item used to plant the crop. Here, tomato_seeds is the seed for the tomato crop.
# Seed of the crop
seed: tomato_seeds
Manage Rotation (FURNITURE Mode Only):
random-rotation controls whether the crop rotates randomly when planted. This only applies if the type is FURNITURE.
# Only works in FURNITURE mode
random-rotation: true
Set Basic Requirements:
Define conditions under requirements for this crop. For example, the "tomato" can only be planted in Spring or Autumn, and an action bar message is displayed if these conditions are not met.
# Break/Plant/Interact requirements
requirements:
interact: {}
break: {}
plant:
requirement_1:
type: season
value:
- Spring
- Autumn
not-met-actions:
message_action:
type: message
value: '<red><bold>[X] It''s not a good season to plant tomato'
Configure Event Settings:
Customize crop events under events for actions like planting or breaking. For instance, when planting a "tomato," a sound (minecraft:item.hoe.till) is played, and a hand-swing animation occurs. Available events for crops: reach_limit/plant/break/interact/death
events:
break: {}
interact: {}
death: {}
reach_limit:
actionbar_action:
type: actionbar
value: '<red><bold>[X] You are not allowed to plant more crops'
plant:
# Swing the main hand
swing_hand_action:
type: swing-hand
value: true
# Send sound while planting
sound_action:
type: sound
value:
source: player
key: minecraft:item.hoe.till
volume: 1
pitch: 1
Define Growth Stages and Models:
Use the points section to outline crop growth stages. For each stage, specify a model (appearance) and actions that occur, such as seed dropping or hologram adjustments.
Available events for crops: grow/break/interact
# This determines the maximum stages for crops to grow
max-points: 6
# Actions and settings for each growth stage of the crop
points:
0:
# Model representing the crop at this growth stage
model: tomato_stage_1
# Adjusts hologram position to match the crop model's height
hologram-offset-correction: 0.2
# Set the type for this stage if it's different from the global type set above
type: BLOCK
# Break/Interact requirements for this stage
requirements:
break:
...
interact:
...
# Events triggered when the crop is broken at this stage
events:
grow: {}
interact: {}
break:
# 30% chance to drop tomato seeds when broken
action_1:
type: drop-item
value:
ignore-fertilizer: true
item: tomato_seeds
min: 1
max: 1
chance: 0.3
Customize Growth and Death Conditions:
Use grow-conditions to set conditions for crop growth, such as the season or water level. Similarly, death-conditions determine when a crop should die, like during a crow attack or in an unsuitable season.
# Conditions under which the crop can grow
grow-conditions:
default:
point: 1
conditions:
season_condition:
type: suitable_season
value:
- Spring
- Autumn
water_condition:
type: water_more_than
value: 0
# Conditions that may cause the crop to die
death-conditions:
no_water:
# Custom model for the death stage, triggered by lack of water
model: crop_stage_death
conditions:
'&&':
condition_1:
type: water_less_than
value: 1
condition_2:
type: random
value: 0.7
unsuitable_season:
# Crop dies in unsuitable seasons
model: crop_stage_death
conditions:
condition_1:
type: unsuitable_season
value:
- Winter
crow_attack:
# Crop removal due to crow attack
conditions:
condition_1:
type: crow_attack
value:
chance: 0.005
fly-model: crow_fly
stand-model: crow_stand
# Delay before the crop is removed after a crow attack
delay: 150
Define Custom Bone Meal Effects:
Under custom-bone-meal, configure special effects and actions triggered by using bone meal, such as particles, sounds, or the chance of growth.
# Custom settings for bone meal use
custom-bone-meal:
bone_meal_1:
item: BONE_MEAL
# Allows use with a dispenser
dispenser: true
chance:
2: 0.2
1: 0.6
actions:
swing_action:
type: swing-hand
value: true
particle_action:
type: particle
value:
particle: VILLAGER_HAPPY
x: 0.5
y: 0.5
z: 0.5
count: 5
offset-x: 0.3
offset-y: 0.3
offset-z: 0.3
sound_action:
type: sound
value:
source: player
key: minecraft:item.bone_meal.use
volume: 1
pitch: 1