{ "format_version": "1.20.10", "minecraft:block": { "description": { "identifier": "craftables:cinnamon_leaves", "properties": { "craftables:decay_tier": [4, 3, 2, 1, 0], // Distance in blocks to find the log "craftables:should_decay": [true, false], // Used when placed by the player or with features "craftables:opaque": [false, true] // Optional; makes the leaves opaque when surrounded } }, "components": { "minecraft:loot": "loot_tables/empty.json", "minecraft:unit_cube": {}, "minecraft:on_player_placing": { "event": "craftables:stop_decay" }, // Triggers event that spawns different loot "minecraft:on_player_destroyed": { "event": "craftables:on_destroyed" }, // We need both of these to work with world generation "minecraft:queued_ticking": { "looping": true, "interval_range": [0, 0], "on_tick": { "event": "craftables:check" } }, "minecraft:random_ticking": { "on_tick": { "event": "craftables:check" } }, "minecraft:destructible_by_explosion": { "explosion_resistance": 1 }, "minecraft:destructible_by_mining": { "seconds_to_destroy": 0.3 }, "minecraft:map_color": "#FFFFFF", "minecraft:light_dampening": 0, "minecraft:material_instances": { "*": { "texture": "cinnamon_leaves", "render_method": "blend", "ambient_occlusion": true, "face_dimming": true } }, "tag:craftables:cinnamon_leaves": {} }, "events": { // Defines the loot for the tool "craftables:on_destroyed": { "sequence": [ { "condition": "q.is_item_name_any('slot.weapon.mainhand','minecraft:shears')", "spawn_loot": { "table": "loot_tables/blocks/cinnamon_leaves_block.json" } }, { "condition": "!q.is_item_name_any('slot.weapon.mainhand','minecraft:shears')", "spawn_loot": { "table": "loot_tables/blocks/cinnamon_leaves_loot.json" } } ] }, // Checks for the log "craftables:check": { "sequence": [ { "condition": "q.block_state('craftables:should_decay')", "set_block_state": { "craftables:decay_tier": "(q.block_neighbor_has_any_tag(0,0,-1,'craftables:cinnamon_log') || q.block_neighbor_has_any_tag(0,0,1,'craftables:cinnamon_log') || q.block_neighbor_has_any_tag(-1,0,0,'craftables:cinnamon_log') || q.block_neighbor_has_any_tag(1,0,0,'craftables:cinnamon_log') || q.block_neighbor_has_any_tag(0,-1,0,'craftables:cinnamon_log') || q.block_neighbor_has_any_tag(0,1,0,'craftables:cinnamon_log')) ? 4 : ((q.block_neighbor_has_any_tag(0,0,-1,'craftables:decay_tier_4') || q.block_neighbor_has_any_tag(0,0,1,'craftables:decay_tier_4') || q.block_neighbor_has_any_tag(-1,0,0,'craftables:decay_tier_4') || q.block_neighbor_has_any_tag(1,0,0,'craftables:decay_tier_4') || q.block_neighbor_has_any_tag(0,-1,0,'craftables:decay_tier_4') || q.block_neighbor_has_any_tag(0,1,0,'craftables:decay_tier_4')) ? 3 : ( (q.block_neighbor_has_any_tag(0,0,-1,'craftables:decay_tier_3') || q.block_neighbor_has_any_tag(0,0,1,'craftables:decay_tier_3 ') || q.block_neighbor_has_any_tag(-1,0,0,'craftables:decay_tier_3') || q.block_neighbor_has_any_tag(1,0,0,'craftables:decay_tier_3') || q.block_neighbor_has_any_tag(0,-1,0,'craftables:decay_tier_3') || q.block_neighbor_has_any_tag(0,1,0,'craftables:decay_tier_3')) ? 2 : ( (q.block_neighbor_has_any_tag(0,0,-1,'craftables:decay_tier_2') || q.block_neighbor_has_any_tag(0,0,1,'craftables:decay_tier_2') || q.block_neighbor_has_any_tag(-1,0,0,'craftables:decay_tier_2') || q.block_neighbor_has_any_tag(1,0,0,'craftables:decay_tier_2') || q.block_neighbor_has_any_tag(0,-1,0,'craftables:decay_tier_2') || q.block_neighbor_has_any_tag(0,1,0,'craftables:decay_tier_2')) ? 1 : 0 ) ) )" } }, { "set_block_state": { "craftables:opaque": "q.block_neighbor_has_any_tag(0,0,-1,'craftables:cinnamon_log','stone','craftables:cinnamon_leaves') && q.block_neighbor_has_any_tag(0,0,1,'craftables:cinnamon_log','stone','craftables:cinnamon_leaves') && q.block_neighbor_has_any_tag(0,1,0,'craftables:cinnamon_log','stone','craftables:cinnamon_leaves') && q.block_neighbor_has_any_tag(0,-1,0,'craftables:cinnamon_log','stone','craftables:cinnamon_leaves') && q.block_neighbor_has_any_tag(-1,0,0,'craftables:cinnamon_log','stone','craftables:cinnamon_leaves') && q.block_neighbor_has_any_tag(1,0,0,'craftables:cinnamon_log','stone','craftables:cinnamon_leaves')" } } ] }, // When placed "craftables:stop_decay": { "set_block_state": { "craftables:should_decay": false } }, // When decayed "craftables:decay": { "die": {}, "spawn_loot": { "table": "loot_tables/blocks/cinnamon_leaves_loot.json" } } }, "permutations": [ { "condition": "q.block_state('craftables:decay_tier') == 0", "components": { "minecraft:random_ticking": { "on_tick": { "event": "craftables:decay" } }, "tag:craftables:decay_tier_0": {} } }, { "condition": "q.block_state('craftables:decay_tier') == 1", "components": { "minecraft:unit_cube": {}, "tag:craftables:decay_tier_1": {} } }, { "condition": "q.block_state('craftables:decay_tier') == 2", "components": { "tag:craftables:decay_tier_2": {} } }, { "condition": "q.block_state('craftables:decay_tier') == 3", "components": { "tag:craftables:decay_tier_3": {} } }, { "condition": "q.block_state('craftables:decay_tier') == 4", "components": { "tag:craftables:decay_tier_4": {} } }, { "condition": "q.block_state('craftables:opaque')", "components": { "minecraft:material_instances": { "*": { "texture": "cinnamon_leaves", "render_method": "opaque" } } } } ] } }