🎋Saplings
Learn how to create custom saplings with Foliage.
How does it work?
In Minecraft, saplings are special blocks that can grow into trees. Our plugin extends this functionality to allow you to create custom saplings with unique properties:
Custom models and textures
Configurable growth conditions
Custom tree structures using schematics
Integration with ItemsAdder and Nexo
Custom sound effects
Default Example
custom_saplings:
maple_sapling: #Example using ItemsAdder integration
item:
itemsadder: custom_blocks:maple_sapling
block:
base_material: OAK_SAPLING
stage: 0
growth:
chance: 15
schematics:
- "maple_tree1.schem"
- "maple_tree2.schem"
random_rotation: true
min_light: 9
allow_bonemeal: true
required_blocks:
- "GRASS_BLOCK"
- "DIRT"
- "PODZOL"
required_height: 7
space_check:
enabled: true
radius: 2
height: 5
drops: "maple_sapling" #Use the name from drops.yml
fir_sapling: #Example using Nexo integration
item:
nexo: fir_sapling
block:
base_material: OAK_SAPLING
stage: 0
growth:
chance: 10
schematics:
- "fir_tree.schem"
random_rotation: true
drops: "fir_sapling"
Creating Custom Saplings
For example, let's create a Maple Sapling block. Let's assume that you have already created your custom model.
1. Custom Item Creation
Create a basic item using Nexo or ItemsAdder without setting a custom block mechanic. Alternatively, you can use a vanilla item with custom model data.
2. Hook Your Item
Hook your custom item to your custom sapling block in the item
section:
custom_saplings:
maple_sapling:
item:
itemsadder: custom_blocks:maple_sapling #ItemsAdder item
# OR
nexo: maple_sapling #Nexo item
# OR
material: PAPER
name: "<green>Maple Sapling</green>"
custom_model_data: 1000
lore:
- "<gray>A magical sapling that grows</gray>"
- "<gray>into a beautiful maple tree!</gray>"
3. Configure Block Properties
Set up the block properties in the block
section:
custom_saplings:
maple_sapling:
block:
base_material: OAK_SAPLING
stage: 0 # 0 or 1 for sapling growth stage
growth:
chance: 15 # Growth chance on random tick (out of 100)
schematics: # List of tree schematics to choose from
- "maple_tree1.schem"
- "maple_tree2.schem"
random_rotation: true # Randomly rotate the tree when growing
min_light: 9 # Minimum light level needed for growth
allow_bonemeal: true # Whether bonemeal can be used
required_blocks: # Valid blocks for planting
- "GRASS_BLOCK"
- "DIRT"
- "PODZOL"
required_height: 7 # Minimum space needed above
space_check: # Check for space around sapling
enabled: true
radius: 2
height: 5
4. Add Custom Sounds (Optional)
You can add custom sounds for various block interactions:
custom_saplings:
maple_sapling:
sound:
place: "BLOCK_GRASS_PLACE" # Sound when placed
break: "BLOCK_GRASS_BREAK" # Sound when broken
step: "BLOCK_GRASS_STEP" # Sound when stepped on
fall: "BLOCK_GRASS_FALL" # Sound when fallen on
hit: "BLOCK_GRASS_HIT" # Sound when hit
volume: 1.0
pitch: 1.0
5. Create a Drop Table
📑Drop Tables6. Connect the Drop Table
Link your drop table to the sapling:
custom_saplings:
maple_sapling:
drops: "maple_sapling" # Use the name from drops.yml
7. Reload the Plugin
Use /foliage reload
command to reload the plugin and load your new blocks.
8. Get the Block
Use /foliage give sapling maple_sapling
command to give yourself your custom sapling block.
Important Notes
Make sure your tree schematics are placed in the
plugins/Foliage/schematics
directoryThe
stage
property determines the sapling's growth stage (0 or 1)Growth chance is calculated per random tick
Required blocks define what blocks the sapling can be placed on
Space check ensures there's enough room for the tree to grow
Custom model data is only used for vanilla items (not needed for ItemsAdder/Nexo items)
Last updated