Package org.spout.api.geo.cuboid

Examples of org.spout.api.geo.cuboid.Block


      generateLeaves(w, (int) (x + (randomOffset.getX() * 4f + 0.5f)), y + yy, (int) (z + (randomOffset.getY() * 4f + 0.5f)), (byte) 0);
      for (byte branchLengthCount = 0; branchLengthCount < branchLength; branchLengthCount++) {
        final int bx = (int) (randomOffset.getX() * branchLengthCount + 1.5f);
        final int by = -3 + branchLengthCount / 2;
        final int bz = (int) (randomOffset.getY() * branchLengthCount + 1.5f);
        final Block block = w.getBlock(x + bx, y + yy + by, z + bz);
        block.setMaterial(VanillaMaterials.LOG);
        block.setData(logMetadata);
        VanillaMaterials.LOG.setFacing(block, BlockFace.fromYaw(MathHelper.getLookAtYaw(new Vector3f(bx, by, bz))));
      }
    }
    for (byte yy = -1; yy < totalHeight - 1; yy++) {
      for (byte xx = 0; xx < 2; xx++) {
View Full Code Here


    box.setMinMax(2, 0, 1, 2, height, 1).fill();
    box.setMinMax(2, 0, 3, 2, height, 3).fill();
    // bridge gaps
    for (int xx = -1; xx <= 3; xx++) {
      for (int zz = 0; zz <= 4; zz++) {
        final Block block = getBlock(xx, -1, zz);
        if (block.isMaterial(VanillaMaterials.AIR)) {
          block.setMaterial(VanillaMaterials.PLANK);
        }
      }
    }
  }
View Full Code Here

    if (w.getBlockMaterial(x, y, z) != placeableOn) {
      return false;
    }
    for (int xx = x - 2; xx < x + 3; xx++) {
      for (int zz = z - 2; zz < z + 3; zz++) {
        final Block block = w.getBlock(xx, y - 1, zz);
        if (!overridable.contains(block.getMaterial())
            || !overridable.contains(block.translate(BlockFace.BOTTOM).getMaterial())) {
          return false;
        }
      }
    }
    return true;
View Full Code Here

          final Vector3f position = new Vector3f(x, y + yy + totalHeight - 5, z);
          for (BlockFace face : BlockFaces.NSEW) {
            if (random.nextInt(odd) != 0) {
              continue;
            }
            final Block block = w.getBlock(position.add(face.getOffset()));
            block.setMaterial(VanillaMaterials.COCOA_PLANT);
            VanillaMaterials.COCOA_PLANT.setAttachedFace(block, face.getOpposite(), null);
            VanillaMaterials.COCOA_PLANT.setGrowthStage(block, random.nextInt(3));
          }
        }
      }
View Full Code Here

      if (random.nextInt(faceOdd) != 0) {
        continue;
      }
      final BlockFace facing = face.getOpposite();
      for (byte yy = 0; yy < lenght; yy++) {
        final Block block = w.getBlock(face.getOffset().add(x, y - yy, z));
        if (block.isMaterial(VanillaMaterials.AIR)) {
          block.setMaterial(VanillaMaterials.VINES);
          VanillaMaterials.VINES.setFaceAttached(block, facing, true);
        } else {
          break;
        }
      }
View Full Code Here

        } else {
          facing = BlockFace.TOP;
        }
        final BlockIterator branch = new BlockIterator(base, group);
        while (branch.hasNext()) {
          final Block block = branch.next();
          block.setMaterial(VanillaMaterials.LOG, logMetadata);
          if (block.getX() != x || block.getZ() != z) {
            VanillaMaterials.LOG.setFacing(block, facing);
          }
        }
      }
    }
View Full Code Here

  public void onUpdate(BlockMaterial oldMaterial, Block block) {
    super.onUpdate(oldMaterial, block);
    RailsState state = this.getState(block);
    if (state.isSloped()) {
      // Check if the facing side is still supporting
      Block facing = block.translate(state.getDirections()[0]);
      BlockMaterial att = facing.getMaterial();
      if (att instanceof VanillaBlockMaterial) {
        if (((VanillaBlockMaterial) att).canSupport(this, BlockFace.TOP)) {
          return;
        }
      }
View Full Code Here

    return false;
  }

  @Override
  public boolean onDestroy(Block block, Cause<?> cause) {
    Block top = getCorrectHalf(block, true);
    Block bottom = getCorrectHalf(block, false);
    return top.setMaterial(VanillaMaterials.AIR, cause) && bottom.setMaterial(VanillaMaterials.AIR, cause);
  }
View Full Code Here

    doorHalf.setData(doorHalf.getBlockData() ^ 0x4);
  }

  @Override
  public BlockFace getFacing(Block doorHalf) {
    final Block block = getCorrectHalf(doorHalf, false);
    return BlockFaces.NESW.get(block.getDataField(0x3));
  }
View Full Code Here

    return BlockFaces.NESW.get(block.getDataField(0x3));
  }

  @Override
  public void setFacing(Block block, BlockFace facing) {
    final Block bottomHalf = getCorrectHalf(block, false);
    bottomHalf.setDataField(0x3, BlockFaces.NESW.indexOf(facing, 0));
  }
View Full Code Here

TOP

Related Classes of org.spout.api.geo.cuboid.Block

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.