コード例 #1
0
 private static boolean func_150119_a(Block p_150119_0_) {
   if (disableValidation) return true;
   return p_150119_0_.getMaterial().isOpaque() && p_150119_0_.renderAsNormalBlock()
       || p_150119_0_ == Blocks.glowstone
       || p_150119_0_ instanceof BlockSlab
       || p_150119_0_ instanceof BlockStairs;
 }
コード例 #2
0
ファイル: BlockSudis.java プロジェクト: Toldea/RomeCraft
  public static boolean canConnectSudisTo(IBlockAccess par1IBlockAccess, int x, int y, int z) {
    int l = par1IBlockAccess.getBlockId(x, y, z);

    if (l != BlockManager.blockSudis.blockID && l != BlockManager.blockSudis.blockID) {
      Block block = Block.blocksList[l];
      return block != null && block.blockMaterial.isOpaque() && block.renderAsNormalBlock()
          ? block.blockMaterial != Material.pumpkin
          : false;
    } else {
      return true;
    }
  }
コード例 #3
0
  /** Ticks the block if it's been scheduled */
  public void updateTick(
      World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) {
    if (!p_149674_1_.isRemote && p_149674_1_.rand.nextInt(4) == 0) {
      byte b0 = 4;
      int l = 5;
      boolean flag = false;
      int i1;
      int j1;
      int k1;
      label134:
      for (i1 = p_149674_2_ - b0; i1 <= p_149674_2_ + b0; ++i1) {
        for (j1 = p_149674_4_ - b0; j1 <= p_149674_4_ + b0; ++j1) {
          for (k1 = p_149674_3_ - 1; k1 <= p_149674_3_ + 1; ++k1) {
            if (p_149674_1_.getBlock(i1, k1, j1) == this) {
              --l;

              if (l <= 0) {
                flag = true;
                break label134;
              }
            }
          }
        }
      }

      i1 = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_);
      j1 = p_149674_1_.rand.nextInt(6);
      k1 = Direction.facingToDirection[j1];
      int l1;

      if (j1 == 1
          && p_149674_3_ < 255
          && p_149674_1_.isAirBlock(p_149674_2_, p_149674_3_ + 1, p_149674_4_)) {
        if (flag) {
          return;
        }

        int j2 = p_149674_1_.rand.nextInt(16) & i1;

        if (j2 > 0) {
          for (l1 = 0; l1 <= 3; ++l1) {
            if (!this.func_150093_a(
                p_149674_1_.getBlock(
                    p_149674_2_ + Direction.offsetX[l1],
                    p_149674_3_ + 1,
                    p_149674_4_ + Direction.offsetZ[l1]))) {
              j2 &= ~(1 << l1);
            }
          }

          if (j2 > 0) {
            p_149674_1_.setBlock(p_149674_2_, p_149674_3_ + 1, p_149674_4_, this, j2, 2);
          }
        }
      } else {
        Block block;
        int i2;

        if (j1 >= 2 && j1 <= 5 && (i1 & 1 << k1) == 0) {
          if (flag) {
            return;
          }

          block =
              p_149674_1_.getBlock(
                  p_149674_2_ + Direction.offsetX[k1],
                  p_149674_3_,
                  p_149674_4_ + Direction.offsetZ[k1]);

          if (block.getMaterial() == Material.air) {
            l1 = k1 + 1 & 3;
            i2 = k1 + 3 & 3;

            if ((i1 & 1 << l1) != 0
                && this.func_150093_a(
                    p_149674_1_.getBlock(
                        p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[l1],
                        p_149674_3_,
                        p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[l1]))) {
              p_149674_1_.setBlock(
                  p_149674_2_ + Direction.offsetX[k1],
                  p_149674_3_,
                  p_149674_4_ + Direction.offsetZ[k1],
                  this,
                  1 << l1,
                  2);
            } else if ((i1 & 1 << i2) != 0
                && this.func_150093_a(
                    p_149674_1_.getBlock(
                        p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[i2],
                        p_149674_3_,
                        p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[i2]))) {
              p_149674_1_.setBlock(
                  p_149674_2_ + Direction.offsetX[k1],
                  p_149674_3_,
                  p_149674_4_ + Direction.offsetZ[k1],
                  this,
                  1 << i2,
                  2);
            } else if ((i1 & 1 << l1) != 0
                && p_149674_1_.isAirBlock(
                    p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[l1],
                    p_149674_3_,
                    p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[l1])
                && this.func_150093_a(
                    p_149674_1_.getBlock(
                        p_149674_2_ + Direction.offsetX[l1],
                        p_149674_3_,
                        p_149674_4_ + Direction.offsetZ[l1]))) {
              p_149674_1_.setBlock(
                  p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[l1],
                  p_149674_3_,
                  p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[l1],
                  this,
                  1 << (k1 + 2 & 3),
                  2);
            } else if ((i1 & 1 << i2) != 0
                && p_149674_1_.isAirBlock(
                    p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[i2],
                    p_149674_3_,
                    p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[i2])
                && this.func_150093_a(
                    p_149674_1_.getBlock(
                        p_149674_2_ + Direction.offsetX[i2],
                        p_149674_3_,
                        p_149674_4_ + Direction.offsetZ[i2]))) {
              p_149674_1_.setBlock(
                  p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[i2],
                  p_149674_3_,
                  p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[i2],
                  this,
                  1 << (k1 + 2 & 3),
                  2);
            } else if (this.func_150093_a(
                p_149674_1_.getBlock(
                    p_149674_2_ + Direction.offsetX[k1],
                    p_149674_3_ + 1,
                    p_149674_4_ + Direction.offsetZ[k1]))) {
              p_149674_1_.setBlock(
                  p_149674_2_ + Direction.offsetX[k1],
                  p_149674_3_,
                  p_149674_4_ + Direction.offsetZ[k1],
                  this,
                  0,
                  2);
            }
          } else if (block.getMaterial().isOpaque() && block.renderAsNormalBlock()) {
            p_149674_1_.setBlockMetadataWithNotify(
                p_149674_2_, p_149674_3_, p_149674_4_, i1 | 1 << k1, 2);
          }
        } else if (p_149674_3_ > 1) {
          block = p_149674_1_.getBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_);

          if (block.getMaterial() == Material.air) {
            l1 = p_149674_1_.rand.nextInt(16) & i1;

            if (l1 > 0) {
              p_149674_1_.setBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_, this, l1, 2);
            }
          } else if (block == this) {
            l1 = p_149674_1_.rand.nextInt(16) & i1;
            i2 = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_ - 1, p_149674_4_);

            if (i2 != (i2 | l1)) {
              p_149674_1_.setBlockMetadataWithNotify(
                  p_149674_2_, p_149674_3_ - 1, p_149674_4_, i2 | l1, 2);
            }
          }
        }
      }
    }
  }
コード例 #4
0
 private boolean func_150093_a(Block p_150093_1_) {
   return p_150093_1_.renderAsNormalBlock() && p_150093_1_.getMaterial().blocksMovement();
 }