The neighborchanged event is an event that can only be used for custom blocks. This event is triggered when a block is changed near the block containing the event. e.x.

neighborchanged="world.setBlockId(origin, 222)";

The above event will change the current block into another block with the id of 222 when a block is placed near it. The neighborchanged event can use world functions and the origin variable.


If using script to change the current block, it can trigger the neighborchanged event for blocks next to it as well. If a loop is set up, the block with switch back and forth infinitely and cause massive lag until the blocks are broken.

Triggers for neighborchanged event

  • placing a block
  • world.setBlockId
  • world.setBlockMetadata
  • world.setBlockIdAndMetadata

Example uses

  • black holes
  • block scanners