FANDOM


The added function activates when a block is added to the world by some method, either by scripts or by player interaction. This event can only be used for custom block files. An example of how to set up this function can be found below.

added="world.createExplosion(origin, 4)"

When the block with this event is placed or in some way added to the world, then the block's event will trigger an explosion with a strenth of 4 where the block was added. Althought not every method for making the block appear can trigger the added event, most methods will. Below is a list of methods to add blocks that will and will not trigger the added event's code.

Things that will cause added to activate:

  • placing the block
  • the block is generated (needs testing?)
  • Block made using world.setBlockId(origin, 172);
  • Block is created using world.setBlockIdAndMeta(origin, 172, 0);
  • Block is placed using player.placeBlock(origin, 172, 0, side);

Things that do not cause added event to activate:

  • Changing metadata using world.setBlockMetadata(origin, 0);

Example Uses:

  • Custom structure/land generation when combined with ore generation (needs testing)
  • Initial corruption blocks (should not add itself to the map)
  • Missiles
  • Blocks that change id or damage value when placed.
  • House in a box (builds a house once placed)

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.