Package org.spout.api.material

Examples of org.spout.api.material.BlockMaterial


    for (byte px = 0; px < 16; px++) {
      for (byte pz = 0; pz < 16; pz++) {
        for (byte py = -1; py < 4; py++) {
          final Block block = world.getBlock(x + px, y + py, z + pz);
          if (block.isAtSurface()) {
            final BlockMaterial material = block.getMaterial();
            if (material == VanillaMaterials.DIRT) {
              final BlockMaterial top;
              final Biome biome = block.getBiomeType();
              if (biome instanceof GrassyBiome) {
                top = ((GrassyBiome) biome).getGroundCover()[0].getMaterial(true);
              } else {
                top = VanillaMaterials.GRASS;
View Full Code Here


    for (byte yy = (byte) -leavesGroupHeight; yy < 1; yy++) {
      final byte radius = (byte) (sizeIncrease - yy + 1);
      for (byte xx = (byte) -radius; xx < radius + 1; xx++) {
        for (byte zz = (byte) -radius; zz < radius + 1; zz++) {
          final short circle = (short) (xx * xx + zz * zz - 1);
          final BlockMaterial material = world.getBlockMaterial(x + xx, y + yy, z + zz);
          if (!(material instanceof Solid || material instanceof Liquid)
              && (xx > -1 || zz > -1 || circle < radius * radius)
              && ((xx < 1 && zz < 1) || circle < (radius + 1) * (radius + 1))
              && (random.nextInt(4) != 0 || circle < (radius - 1) * (radius - 1))) {
            world.setBlockMaterial(x + xx, y + yy, z + zz, VanillaMaterials.LEAVES, leavesMetadata, null);
View Full Code Here

      int z = rm.convertZ(message.getCoordinates()[i * 3 + 2] + baseZ);

      short type = message.getTypes()[i];
      byte data = message.getMetadata()[i];

      BlockMaterial material = (BlockMaterial) VanillaMaterials.getMaterial(type, data);
      world.getChunkFromBlock(x, y, z).getBlock(x, y, z).setMaterial(material);
    }

    //TODO: implement
    System.out.println(message.toString());
View Full Code Here

              dat = (byte) (data[i][(index / 2) + 4096] & 0xF);
            }
            index++;

            if (type > 0) {
              BlockMaterial material = (BlockMaterial) VanillaMaterials.getMaterial(type, dat);
              world.getChunkFromBlock(x, y, z).getBlock(x, y, z).setMaterial(material);
            }
          }
        }
      }
View Full Code Here

    randomize();
  }

  @Override
  public boolean canPlaceObject(World w, int x, int y, int z) {
    final BlockMaterial below = w.getBlockMaterial(x, y - 1, z);
    return (below.isMaterial(VanillaMaterials.SAND, VanillaMaterials.CACTUS))
        && w.getBlockMaterial(x, y, z).isMaterial(VanillaMaterials.AIR)
        && w.getBlockMaterial(x - 1, y, z).isMaterial(VanillaMaterials.AIR)
        && w.getBlockMaterial(x + 1, y, z).isMaterial(VanillaMaterials.AIR)
        && w.getBlockMaterial(x, y, z - 1).isMaterial(VanillaMaterials.AIR)
        && w.getBlockMaterial(x, y, z + 1).isMaterial(VanillaMaterials.AIR);
View Full Code Here

                dat = (byte) (data[i][(index / 2) + 4096] & 0xF);
              }
              index++;

              if (type > 0) {
                BlockMaterial material = (BlockMaterial) VanillaMaterials.getMaterial(type, dat);
                world.getChunkFromBlock(x, y, z).getBlock(x, y, z).setMaterial(material);
              }
            }
          }
        }
View Full Code Here

    for (byte yy = (byte) (totalHeight - leavesHeight); yy < totalHeight + 1; yy++) {
      final byte yRadius = (byte) (yy - totalHeight);
      final byte xzRadius = (byte) ((radiusIncrease + 1) - yRadius / 2);
      for (byte xx = (byte) -xzRadius; xx < xzRadius + 1; xx++) {
        for (byte zz = (byte) -xzRadius; zz < xzRadius + 1; zz++) {
          final BlockMaterial material = w.getBlockMaterial(x + xx, y + yy, z + zz);
          if (Math.abs(xx) != xzRadius || Math.abs(zz) != xzRadius
              || random.nextBoolean() && yRadius != 0
              && !(material instanceof Solid || material instanceof Liquid)) {
            w.setBlockMaterial(x + xx, y + yy, z + zz, VanillaMaterials.LEAVES, leavesMetadata, null);
          }
View Full Code Here

          for (int y = end.getFloorY() - 1; y >= start.getFloorY(); y--) {
            final double yOffset = (y + 0.5 - target.getY()) / verticalSize;
            if (yOffset > -0.7 && xOffset * xOffset + yOffset * yOffset + zOffset * zOffset < 1) {
              final int xx = chunk.getFloorX() + x;
              final int zz = chunk.getFloorZ() + z;
              final BlockMaterial material = blockData.get(xx, y, zz);
              if (material.equals(VanillaMaterials.STONE) || material.equals(VanillaMaterials.DIRT)
                  || material.equals(VanillaMaterials.GRASS)) {
                if (y < 10) {
                  blockData.set(xx, y, zz, VanillaMaterials.STATIONARY_LAVA);
                } else {
                  if (material.equals(VanillaMaterials.GRASS) && blockData.get(xx, y - 1, zz).equals(VanillaMaterials.DIRT)) {
                    blockData.set(xx, y - 1, zz, VanillaMaterials.GRASS);
                  }
                  blockData.set(xx, y, zz, VanillaMaterials.AIR);
                }
              }
View Full Code Here

    int z = rm.convertZ(message.getZ());

    short type = message.getType();
    int data = message.getMetadata();

    BlockMaterial material = (BlockMaterial) VanillaMaterials.getMaterial(type, (short) data);
    world.getChunkFromBlock(x, y, z).getBlock(x, y, z).setMaterial(material);
  }
View Full Code Here

      return;
    }
    if (random.nextInt(odd) != 0) {
      return;
    }
    BlockMaterial flower = VanillaMaterials.DANDELION;
    final World world = chunk.getWorld();
    final int amount = getAmount(random);
    for (byte count = 0; count < amount; count++) {
      final int x = chunk.getBlockX(random);
      final int z = chunk.getBlockZ(random);
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.