Skip to content

Custom Leaves

Use the resourcestrees:resources_leaves_block builder type in StartupEvents.registry to register a custom Resources Leaves block.

Builder Type

js
event.create('<id>', 'resourcestrees:resources_leaves_block')

Builder Methods

.sapling(saplingId: string)

Sets the companion Resources Sapling block ID. Used for drop logic — the sapling that can drop from decaying leaves.

js
.sapling('kubejs:my_crystal_sapling')

.copyPropertiesFrom(block)

Inherits block properties from a vanilla leaves block. Controls hardness, sounds, and transparency behavior.

Use the leaves variant that matches your chosen tree grower:

js
.copyPropertiesFrom(Blocks.OAK_LEAVES)
.copyPropertiesFrom(Blocks.SPRUCE_LEAVES)
.copyPropertiesFrom(Blocks.BIRCH_LEAVES)
// etc.

Full Example

js
StartupEvents.registry('block', event => {
    event.create('my_obsidian_leaves', 'resourcestrees:resources_leaves_block')
        .sapling('kubejs:my_obsidian_sapling')
        .copyPropertiesFrom(Blocks.DARK_OAK_LEAVES);

    event.create('my_obsidian_sapling', 'resourcestrees:resources_sapling_block')
        .treeGrower('dark_oak')
        .leaves('kubejs:my_obsidian_leaves')
        .base('minecraft:dark_oak_sapling')
        .copyPropertiesFrom(Blocks.DARK_OAK_SAPLING);
});

Drop Behavior

Custom KubeJS leaves use the same drop logic as built-in Resources Leaves:

ToolResult
ShearsDrops the leaves block
Silk TouchDrops the leaves block
No tool / otherRolls for Leaf Fragments and Sapling drops

Drop chances are determined by the assigned resource type's leafDropChance and saplingDropChance values.

Visual Appearance

The item definition generated by the plugin applies the resourcestrees:resources_type_tint source:

json
{
  "model": {
    "type": "minecraft:model",
    "model": "kubejs:block/my_obsidian_leaves",
    "tints": [
      {
        "type": "resourcestrees:resources_type_tint",
        "default": -12012264
      }
    ]
  }
}

The default color (-12012264) is the standard oak leaf green, used as fallback before the resource type is synced from the server.

In-world block tinting is provided by ResourcesTypesTintSource, which reads the ResourcesTypesBlockEntity.

Auto-Generated Loot Table

json
{
  "type": "minecraft:block",
  "pools": [{
    "rolls": 1.0,
    "conditions": [{
      "condition": "minecraft:any_of",
      "terms": [
        {
          "condition": "minecraft:match_tool",
          "predicate": { "items": "minecraft:shears" }
        },
        {
          "condition": "minecraft:match_tool",
          "predicate": {
            "predicates": {
              "minecraft:enchantments": [{
                "enchantments": "minecraft:silk_touch",
                "levels": { "min": 1 }
              }]
            }
          }
        }
      ]
    }],
    "entries": [{ "type": "minecraft:item", "name": "kubejs:my_obsidian_leaves" }]
  }]
}

Fragment and sapling drops are handled in code and are not in the loot table.

Released under the All Rights Reserved License.