The destroyed event is an event that can only be used for custom blocks. The destroyed event will activate when the block that contains the event is destroyed. The destroyed event can use world functions, customstuff functions, and the origin variable. An example of how to use the destroyed event can be found below.

destroyed="world.spawnMob(origin, 'Creeper');";

The above example will cause a creeper to spawn when the block with this event is destroyed.

Methods that do not trigger the destroyed event:

  • Removing a block with world.setBlockId(origin, 0); or world.setBlockIdAndMetadata(origin, 0, 0);
  • Destroying a block with world.harvestBlock(origin);
  • Harvesting a block using a piston when collision=false;

Example Uses

  • unstable blocks that can only be picked up by tools using world.harvestBlock(origin); in their script.
  • blocks that expand on destruction.(fire extinquishing block?)
  • explosion alarm blocks (currently cannot output redstone signal or sound though)