Package org.spout.api.material

Examples of org.spout.api.material.BlockMaterial


          if (weather.isSnowingAt(x, y, z)) {
            //Try to find the surface
            for (int dy = 1; dy < 16; dy++) {
              if (region.containsBlock(x, y - dy, z)) {
                Block block = region.getBlock(x, y - dy, z);
                BlockMaterial mat = block.getMaterial();
                if (mat instanceof VanillaBlockMaterial) {
                  VanillaBlockMaterial vbm = (VanillaBlockMaterial) mat;
                  //Place snow ontop of solid
                  if (vbm.canSupport(VanillaMaterials.SNOW, BlockFace.TOP)) {
                    Block above = block.translate(BlockFace.TOP);
View Full Code Here


  @Override
  public void fill() {
    for (int xx = 0; xx < layout.getRowLenght(); xx++) {
      for (int zz = 0; zz < layout.getColumnLenght(xx); zz++) {
        final BlockMaterial material = layout.getBlockMaterial(xx, zz);
        if (material != null) {
          setBlockMaterial(xx, zz, material);
        }
      }
    }
View Full Code Here

  public boolean isLocked(Block block) {
    BlockFace[] faces = new BlockFace[2];
    faces[1] = (faces[0] = BlockFaces.NESW.next(getFacing(block))).getOpposite();
    for (BlockFace face : faces) {
      Block rel = block.translate(face);
      BlockMaterial mat = rel.getMaterial();
      if (mat instanceof RedstoneRepeater && ((RedstoneRepeater) mat).hasDirectRedstonePower(rel, face.getOpposite(), RedstonePowerMode.ALL)) {
        return true;
      }
    }
    return false;
View Full Code Here

  @Override
  public boolean canAttachTo(Block block, BlockFace face) {
    if (!super.canAttachTo(block, face)) {
      return false;
    }
    BlockMaterial material = block.getMaterial();
    // Can always attach to sugar canes
    if (material.equals(VanillaMaterials.SUGAR_CANE_BLOCK)) {
      return true;
    }
    // Only attach to bases with water around it
    if (this.allowedBases.contains(material)) {
      for (BlockFace around : BlockFaces.NESW) {
View Full Code Here

    short power = this.getRedstonePower(block);
    if (power == REDSTONE_POWER_MIN) {
      return power;
    }

    BlockMaterial mat = block.translate(direction).getMaterial();
    if (mat instanceof RedstoneSource || !isDistractedFrom(block, direction)) {
      return power;
    }

    return REDSTONE_POWER_MIN;
View Full Code Here

  }

  public short getReceivingPower(Block block) {
    short maxPower = 0;
    Block rel, relvert;
    BlockMaterial mat;
    //detect power from direct neighbouring sources
    boolean topIsConductor = false;
    for (BlockFace face : BlockFaces.BTEWNS) {
      rel = block.translate(face);
      mat = rel.getMaterial();
      if (mat.equals(this)) {
        //handle neighbouring redstone wires
        maxPower = (short) Math.max(maxPower, this.getRedstonePower(rel) - 1);
      } else if (mat instanceof VanillaBlockMaterial) {
        //handle solid blocks and redstone sources
        maxPower = (short) Math.max(maxPower, ((VanillaBlockMaterial) mat).getRedstonePower(rel, RedstonePowerMode.ALLEXCEPTWIRE));
View Full Code Here

   * @param face to connect to
   * @return True if connected
   */
  public boolean isConnectedToSource(Block block, BlockFace face) {
    Block target = block.translate(face);
    BlockMaterial mat = target.getMaterial();
    if (mat instanceof RedstoneSource) {
      return true;
    }
    //check below
    if (!RedstoneUtil.isConductor(mat)) {
View Full Code Here

  }

  @Override
  public boolean isValidPosition(Block block, BlockFace attachedFace, boolean seekAlternative) {
    if (super.isValidPosition(block, attachedFace, seekAlternative)) {
      BlockMaterial mat;
      for (BlockFace face : BlockFaces.NESW) {
        mat = block.translate(face).getMaterial();
        if (mat.getShape() != null || this.deniedNeighbours.contains(mat)) {
          return false;
        }
      }
      return true;
    }
View Full Code Here

   * Grows a full-sized tree from the sapling at the block given
   *
   * @param block to place a tree at
   */
  public void growTree(Block block) {
    BlockMaterial mat = block.getMaterial();
    if (mat instanceof Sapling) {
      this.growTree(block, (Sapling) mat);
    }
  }
View Full Code Here

    Chunk c = p.getChunk(LoadOption.NO_LOAD);
    if (c == null) {
      throw new CommandException("Chunk not loaded");
    }
    int blockState = c.getBlockFullState(p.getBlockX(), p.getBlockY(), p.getBlockZ());
    BlockMaterial m = BlockMaterial.get(blockState);
    source.sendMessage("Material at " + p.getBlockX() + ", " + p.getBlockY() + ", " + p.getBlockZ() + " is " + m.getClass().getSimpleName());
  }
View Full Code Here

TOP

Related Classes of org.spout.api.material.BlockMaterial

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.