@Override
  public void onBlockAdded(World world, int i, int j, int k) {
    super.onBlockAdded(world, i, j, k);

    if (world.isBlockIndirectlyGettingPowered(i, j, k)
        && world.getBlockMetadata(i, j, k) != 12
        && world.getBlockMetadata(i, j, k) != 0
        && world.getBlockMetadata(i, j, k) != 15) {
      onBlockDestroyedByExplosion(world, i, j, k);
      world.setBlockWithNotify(i, j, k, 0);
    }
  }
예제 #2
0
 public TileEntity getChunkBlockTileEntity(int i, int j, int k) {
   ChunkPosition chunkposition = new ChunkPosition(i, j, k);
   TileEntity tileentity = (TileEntity) chunkTileEntityMap.get(chunkposition);
   if (tileentity == null) {
     int l = getBlockID(i, j, k);
     if (!Block.isBlockContainer[l]) {
       return null;
     }
     BlockContainer blockcontainer = (BlockContainer) Block.blocksList[l];
     blockcontainer.onBlockAdded(worldObj, xPosition * 16 + i, j, zPosition * 16 + k);
     tileentity = (TileEntity) chunkTileEntityMap.get(chunkposition);
   }
   if (tileentity != null && tileentity.func_31006_g()) {
     chunkTileEntityMap.remove(chunkposition);
     return null;
   } else {
     return tileentity;
   }
 }
  /** Called whenever the block is added into the world. Args: world, x, y, z */
  public void onBlockAdded(World par1World, int par2, int par3, int par4) {
    super.onBlockAdded(par1World, par2, par3, par4);
    this.unifyAdjacentChests(par1World, par2, par3, par4);
    int var5 = par1World.getBlockId(par2, par3, par4 - 1);
    int var6 = par1World.getBlockId(par2, par3, par4 + 1);
    int var7 = par1World.getBlockId(par2 - 1, par3, par4);
    int var8 = par1World.getBlockId(par2 + 1, par3, par4);

    if (var5 == this.blockID) {
      this.unifyAdjacentChests(par1World, par2, par3, par4 - 1);
    }

    if (var6 == this.blockID) {
      this.unifyAdjacentChests(par1World, par2, par3, par4 + 1);
    }

    if (var7 == this.blockID) {
      this.unifyAdjacentChests(par1World, par2 - 1, par3, par4);
    }

    if (var8 == this.blockID) {
      this.unifyAdjacentChests(par1World, par2 + 1, par3, par4);
    }
  }
  public void onBlockAdded(World world, int x, int y, int z) {

    super.onBlockAdded(world, x, y, z);
    this.setDefaultDirection(world, x, y, z);
  }