Пример #1
0
 @Override
 public void onNeighborBlockChange(
     World world, BlockPos pos, IBlockState state, Block neighborBlock) {
   if (world.isAirBlock(pos.up())) {
     this.dropBlockAsItem(world, pos, state, 0);
     world.setBlockToAir(pos);
   }
 }
  private static void expandPortal(
      World world,
      int i,
      int j,
      int k,
      Collection<ChunkCoordinates> set,
      Stack<ChunkCoordinates> created) {
    if (!world.isAirBlock(i, j, k)) {
      return;
    }

    int score =
        isValidLinkPortalBlock(world.getBlock(i + 1, j, k))
            + isValidLinkPortalBlock(world.getBlock(i - 1, j, k))
            + isValidLinkPortalBlock(world.getBlock(i, j + 1, k))
            + isValidLinkPortalBlock(world.getBlock(i, j - 1, k))
            + isValidLinkPortalBlock(world.getBlock(i, j, k + 1))
            + isValidLinkPortalBlock(world.getBlock(i, j, k - 1));
    if (score > 1) {
      world.setBlock(i, j, k, NailedBlocks.portal, 0, 0);
      created.push(new ChunkCoordinates(i, j, k));
      addSurrounding(set, i, j, k);
    }
  }