Package org.spout.api.material

Examples of org.spout.api.material.BlockMaterial


  @Override
  public boolean canAttachTo(Block block, BlockFace face) {
    if (face != BlockFace.TOP) {
      return false;
    }
    BlockMaterial material = block.getMaterial();
    if (material instanceof Water) {
      return ((Water) material).isSource(block);
    }
    return false;
  }
View Full Code Here


          if (yy < 0) {
            break;
          }
          for (GroundCoverLayer layer : layers) {
            final int depthY = yy - layer.getDepth(x + xx, z + zz, (int) seed);
            final BlockMaterial cover = layer.getMaterial(y + yy < NormalGenerator.SEA_LEVEL);
            for (; yy > depthY; yy--) {
              if (yy < 0) {
                break yIteration;
              }
              if (blockData.get(x + xx, y + yy, z + zz).equals(VanillaMaterials.STONE)) {
View Full Code Here

          public int getEmittedLight(int x, int y, int z) {
            CuboidBlockMaterialBuffer b = materialBuffers[1][1][1];
            if (b == null) {
              return 0;
            }
            BlockMaterial m = b.get(bx + x, by + y, bz + z);
            short data = b.getData(bx + x, by + y, bz + z);
            return m.getLightLevel(data);
          }
        };
    boolean failure = false;
    for (int x = 0; x < Chunk.BLOCKS.SIZE; x++) {
      for (int y = 0; y < Chunk.BLOCKS.SIZE; y++) {
View Full Code Here

  public static int checkFlowFrom(BlockFace face, BlockMaterial[][][] materials, int[][][] lightLevels) {
    IntVector3 o = face.getIntOffset();
    int ox = o.getX() + 1;
    int oy = o.getY() + 1;
    int oz = o.getZ() + 1;
    BlockMaterial neighbor = materials[ox][oy][oz];
    if (neighbor == null) {
      return 0;
    }
    ByteBitSet occulusion = neighbor.getOcclusion(neighbor.getData());
    if (occulusion.get(face.getOpposite())) {
      return 0;
    }

    BlockMaterial center = materials[1][1][1];
    occulusion = center.getOcclusion(center.getData());
    if (occulusion.get(face)) {
      return 0;
    }
    return lightLevels[ox][oy][oz] - 1 - center.getOpacity();
  }
View Full Code Here

   * @param to the face it is powering
   * @param powerMode to use when reading power
   * @return True if emitting power, False if not
   */
  public static boolean isEmittingPower(Block block, BlockFace to, RedstonePowerMode powerMode) {
    BlockMaterial mat = block.getMaterial();
    if (!(mat instanceof IndirectRedstoneSource)) {
      return false;
    }
    // Powered itself?
    if (to == BlockFace.THIS) {
View Full Code Here

    return sb.toString();
  }

  private static String getLocation(int x, int y, int z, int[][][] light, BlockMaterial[][][] material) {
    int level = light[x][y][z];
    BlockMaterial m = material[x][y][z];
    if (m == null) {
      return "{" + level + ", null}";
    } else {
      return "{" + level + ", " + m.getClass().getSimpleName() + "}";
    }
  }
View Full Code Here

      return false;
    }
    byte adjacentStoneCount = 0;
    byte adjacentAirCount = 0;
    for (final BlockFace face : BlockFaces.NSEW) {
      final BlockMaterial material = block.translate(face).getMaterial();
      if (material == VanillaMaterials.AIR) {
        adjacentAirCount++;
      } else if (material == VanillaMaterials.STONE) {
        adjacentStoneCount++;
      }
View Full Code Here

  public boolean canPlaceObject(World w, int x, int y, int z) {
    byte missingWallBlocks = 0;
    for (byte yy = -1; yy < height + 2; yy++) {
      for (byte xx = (byte) (-radiusX - 1); xx < radiusX + 2; xx++) {
        for (byte zz = (byte) (-radiusZ - 1); zz < radiusZ + 2; zz++) {
          BlockMaterial material = w.getBlockMaterial(x + xx, y + yy, z + zz);
          if ((yy == -1 || yy == height + 1)
              && material.isMaterial(VanillaMaterials.AIR)) {
            return false;
          }
          if ((xx == -radiusX - 1 || xx == radiusX + 1
              || zz == -radiusZ - 1 || zz == radiusZ + 1)
              && yy == 0 && material.isMaterial(VanillaMaterials.AIR)
              && w.getBlockMaterial(x + xx, y + yy + 1, z + zz).isMaterial(VanillaMaterials.AIR)) {
            missingWallBlocks++;
          }
        }
      }
View Full Code Here

      }
    }
  }

  private void setPortalActive(Block origin, boolean active) {
    BlockMaterial material;
    if (active) {
      material = VanillaMaterials.END_PORTAL;
    } else {
      material = VanillaMaterials.AIR;
    }
View Full Code Here

    checkIfUseTextureMetadata();
  }

  @Override
  public boolean canPlaceObject(World w, int x, int y, int z) {
    final BlockMaterial under = w.getBlockMaterial(x, y - 1, z);
    if (!under.isMaterial(VanillaMaterials.DIRT, VanillaMaterials.GRASS,
        VanillaMaterials.MYCELIUM)) {
      return false;
    }
    byte radiusToCheck = initCheckRadius;
    for (int yy = y; yy < y + totalHeight + 2; yy++) {
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.