Skip to main content

Action On Block Break (Power Type)

Runs an entity action, a block action or both when the entity with the power breaks a block.

Type ID: apoli:action_on_block_break

Fields

FieldTypeDefaultDescription
entity_actionEntity Action TypeoptionalIf set, this action runs on the player when a block is broken.
block_actionBlock Action TypeoptionalIf set, this action runs on the block that was broken.
block_conditionBlock Condition TypeoptionalIf set, the actions only run when the broken block passes this condition.
only_when_harvestedBooleantrueIf true, the actions only run when the player harvests the block. For example, they don't run when stone is broken by hand.
note

The power fires after the block is removed, but block_condition is tested against the state captured beforehand. Conditions on the broken block work, and a block_action that places something acts on the now empty space.

"Harvested" means the player had the right tool (hasCorrectToolForDrops), the same test vanilla uses to decide whether the block drops. apoli:modify_harvest changes what counts as harvested here too.

A block the player breaks while one of these powers is running its actions, for example with "mine": true on apoli:break_block, fires their other action_on_block_break powers but not the one that is running. That keeps a power that mines more blocks from setting itself off again.

Examples

{
    "type": "apoli:action_on_block_break",
    "entity_action": {
        "type": "apoli:damage",
        "amount": 2.0,
        "damage_type": "minecraft:on_fire"
    },
    "block_action": {
        "type": "apoli:set_block",
        "block": "minecraft:lava"
    },
    "block_condition": {
        "type": "apoli:block",
        "block": "minecraft:magma_block"
    },
    "only_when_harvested": false
}

When the player breaks a magma block, this deals 1 heart of minecraft:on_fire damage to them and places lava where the magma block was.