Skip to main content

đŸ“Ļī¸ Datapack

info

Visit https://misode.github.io/ for better datapack development environment.

Block State Provider​

CraftEngine allows you to use custom blocks in datapacks, enabling terrain generation, trees, ore veins, and more through datapack configuration.

Here's a tree configuration example for Minecraft 1.21.4 using CraftEngine:

{
"type": "minecraft:tree",
"config": {
"ignore_vines": true,
"force_dirt": false,
"minimum_size": {
"type": "minecraft:two_layers_feature_size",
"min_clipped_height": 10,
"limit": 1,
"lower_size": 0,
"upper_size": 2
},
"dirt_provider": {
"type": "minecraft:simple_state_provider",
"state": {
"Name": "minecraft:sand"
}
},
"trunk_provider": {
"type": "craftengine:simple_state_provider",
"state": {
"Name": "default:palm_log",
"Properties": {
"axis": "y"
}
}
},
"foliage_provider": {
"type": "craftengine:simple_state_provider",
"state": {
"Name": "default:palm_leaves",
"Properties": {
"distance": "7",
"persistent": "false",
"waterlogged": "false"
}
}
},
"trunk_placer": {
"type": "minecraft:straight_trunk_placer",
"base_height": 6,
"height_rand_a": 5,
"height_rand_b": 0
},
"foliage_placer": {
"type": "minecraft:cherry_foliage_placer",
"radius": 5,
"offset": 0,
"height": 4,
"wide_bottom_layer_hole_chance": 0.8,
"corner_hole_chance": 1,
"hanging_leaves_chance": 0.8,
"hanging_leaves_extension_chance": 0.4
},
"decorators": []
}
}

tip

Compared to the native Minecraft datapack, the main difference is that the namespace has been changed from minecraft to craftengine, while all other configuration formats remain the same. Currently, CraftEngine supports the following block state types:

  • craftengine:simple_state_provider
  • craftengine:weighted_state_provider
  • craftengine:rotated_block_provider
  • craftengine:randomized_int_state_provider

The usage and effects of these types are consistent with their counterparts in the native Minecraft datapack.

Configured feature​

When placing double-height plants or other multi-state blocks, Minecraft's native placement logic suffers from hardcoded limitations that often lead to errors such as only generating the bottom half. To address this, CraftEngine introduces a new configured feature type called craftengine:simple_block. While its usage is similar to minecraft:simple_block, it provides enhanced compatibility and better handling for multi-state blocks within CraftEngine.

{
"type": "minecraft:random_patch",
"config": {
"feature": {
"feature": {
"type": "craftengine:simple_block",
"config": {
"to_place": {
"type": "craftengine:simple_state_provider",
"state": {
"Name": "default:palm_door"
}
}
}
},
"placement": [
{
"type": "minecraft:block_predicate_filter",
"predicate": {
"type": "minecraft:matching_blocks",
"blocks": "minecraft:air"
}
}
]
},
"tries": 96,
"xz_spread": 7,
"y_spread": 3
}
}

caution

Please note: custom IDs are currently only resolved for feature types registered directly through CraftEngine. Due to some hardcoded vanilla limitations, you may need to use the internal block ID (e.g., craftengine:custom_0) in certain contexts where the CraftEngine ID is not recognized.

Click here to learn how to obtain the real block ID of a custom block.

Loots​

When you want to use items from CraftEngine as loot, simply configure them in the following way. This method applies to chests, block drops, fishing loot, and more.

{
"type": "minecraft:fishing",
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "craftengine:item",
"name": "default:palm_log",
"weight": 60
},
{
"type": "craftengine:item",
"name": "default:chinese_lantern",
"weight": 25
},
{
"type": "minecraft:item",
"name": "minecraft:tropical_fish",
"weight": 2
},
{
"type": "minecraft:item",
"name": "minecraft:pufferfish",
"weight": 13
}
],
"rolls": 1.0
}
],
"random_sequence": "minecraft:gameplay/fishing/fish"
}