Package org.spout.vanilla.world.generator.normal.object

Examples of org.spout.vanilla.world.generator.normal.object.SugarCaneStackObject


  public void populate(Chunk chunk, Random random) {
    if (chunk.getY() != 4) {
      return;
    }
    final World world = chunk.getWorld();
    final SugarCaneStackObject canes = new SugarCaneStackObject();
    canes.setRandom(random);
    byte successfulClusterCount = 0;
    for (byte count = 0; count < clusterPlaceAttempts; count++) {
      final int x = chunk.getBlockX(random);
      final int z = chunk.getBlockZ(random);
      final int y = getHighestWorkableBlock(world, x, z);
      if (y == -1 || !canes.canPlaceObject(world, x, y, z)) {
        continue;
      }
      successfulClusterCount++;
      canes.randomize();
      canes.placeObject(world, x, y, z);
      for (byte placed = 1; placed < maxClusterSize; placed++) {
        final int xx = x - 3 + random.nextInt(7);
        final int zz = z - 3 + random.nextInt(7);
        canes.randomize();
        if (canes.canPlaceObject(world, xx, y, zz)) {
          canes.placeObject(world, xx, y, zz);
        }
      }
      if (successfulClusterCount >= numberOfClusters) {
        return;
      }
View Full Code Here

TOP

Related Classes of org.spout.vanilla.world.generator.normal.object.SugarCaneStackObject

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.