コード例 #1
0
  /**
   * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed
   * (coordinates passed are their own) Args: x, y, z, neighbor blockID
   */
  public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) {
    super.onNeighborBlockChange(par1World, par2, par3, par4, par5);
    TileEntityChest var6 = (TileEntityChest) par1World.getBlockTileEntity(par2, par3, par4);

    if (var6 != null) {
      var6.updateContainingBlockInfo();
    }
  }
コード例 #2
0
ファイル: BlockSign.java プロジェクト: JSut210/ModSRC
  /**
   * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed
   * (coordinates passed are their own) Args: x, y, z, neighbor blockID
   */
  public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) {
    boolean var6 = false;

    if (this.isFreestanding) {
      if (!par1World.getBlockMaterial(par2, par3 - 1, par4).isSolid()) {
        var6 = true;
      }
    } else {
      int var7 = par1World.getBlockMetadata(par2, par3, par4);
      var6 = true;

      if (var7 == 2 && par1World.getBlockMaterial(par2, par3, par4 + 1).isSolid()) {
        var6 = false;
      }

      if (var7 == 3 && par1World.getBlockMaterial(par2, par3, par4 - 1).isSolid()) {
        var6 = false;
      }

      if (var7 == 4 && par1World.getBlockMaterial(par2 + 1, par3, par4).isSolid()) {
        var6 = false;
      }

      if (var7 == 5 && par1World.getBlockMaterial(par2 - 1, par3, par4).isSolid()) {
        var6 = false;
      }
    }

    if (var6) {
      this.dropBlockAsItem(
          par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
      par1World.setBlockWithNotify(par2, par3, par4, 0);
    }

    super.onNeighborBlockChange(par1World, par2, par3, par4, par5);
  }