Package org.spout.vanilla.world.generator.structure

Examples of org.spout.vanilla.world.generator.structure.StructurePiece$BoundingBox


  public void randomize() {
  }

  @Override
  public List<StructurePiece> getNextPieces() {
    final StructurePiece piece = getNextPiece();
    piece.setPosition(position.add(rotate(0, -7, 10)));
    piece.setRotation(rotation);
    piece.randomize();
    return Lists.newArrayList(piece);
  }
View Full Code Here


  @Override
  public List<StructurePiece> getNextPieces() {
    final List<StructurePiece> pieces = new ArrayList<StructurePiece>();
    if (startOfFortress) {
      final StructurePiece piece = new FortressEnd(parent);
      piece.setPosition(position.add(rotate(4, 0, -1)));
      piece.setRotation(Quaternionf.fromAngleDegAxis(180, 0, 1, 0).mul(rotation));
      piece.randomize();
      pieces.add(piece);
    }
    final StructurePiece piece = getNextPiece();
    piece.setPosition(position.add(rotate(0, 0, 5)));
    piece.setRotation(rotation);
    piece.randomize();
    pieces.add(piece);
    return pieces;
  }
View Full Code Here

  public void randomize() {
  }

  @Override
  public List<StructurePiece> getNextPieces() {
    final StructurePiece piece = getNextPiece();
    piece.setPosition(position.add(rotate(0, 0, 19)));
    piece.setRotation(rotation);
    piece.randomize();
    return Lists.newArrayList(piece);
  }
View Full Code Here

  }

  @Override
  public List<StructurePiece> getNextPieces() {
    final List<StructurePiece> pieces = new ArrayList<StructurePiece>(2);
    final StructurePiece lower = getNextPiece();
    lower.setPosition(position.add(rotate(0, 0, 13)));
    lower.setRotation(rotation);
    lower.randomize();
    pieces.add(lower);
    final StructurePiece upper = getNextPiece();
    upper.setPosition(position.add(rotate(0, 8, 13)));
    upper.setRotation(rotation);
    upper.randomize();
    pieces.add(upper);
    return pieces;
  }
View Full Code Here

  }

  @Override
  public List<StructurePiece> getNextPieces() {
    final List<StructurePiece> pieces = new ArrayList<StructurePiece>(3);
    final StructurePiece front = getNextPiece();
    front.setPosition(position.add(rotate(0, 0, 5)));
    front.setRotation(rotation);
    front.randomize();
    pieces.add(front);
    final StructurePiece right = getNextPiece();
    right.setPosition(position.add(rotate(-1, 0, 0)));
    right.setRotation(Quaternionf.fromAngleDegAxis(-90, 0, 1, 0).mul(rotation));
    right.randomize();
    pieces.add(right);
    final StructurePiece left = getNextPiece();
    left.setPosition(position.add(rotate(5, 0, 4)));
    left.setRotation(Quaternionf.fromAngleDegAxis(90, 0, 1, 0).mul(rotation));
    left.randomize();
    pieces.add(left);
    return pieces;
  }
View Full Code Here

  @Override
  public List<StructurePiece> getNextPieces() {
    if (getRandom().nextFloat() <= 0.1) {
      return Collections.emptyList();
    }
    final StructurePiece piece = getNextPiece();
    piece.setPosition(position.add(rotate(0, 0, sections * 5)));
    piece.setRotation(rotation);
    piece.randomize();
    return Lists.newArrayList(piece);
  }
View Full Code Here

  public final void randomize() {
  }

  @Override
  public List<StructurePiece> getNextPieces() {
    final StructurePiece piece = getNextPiece();
    piece.setPosition(position.add(rotate(0, -5, 8)));
    piece.setRotation(rotation);
    piece.randomize();
    return Lists.newArrayList(piece);
  }
View Full Code Here

    left = getRandom().nextBoolean();
  }

  @Override
  public List<StructurePiece> getNextPieces() {
    final StructurePiece piece = getNextPiece();
    if (left) {
      piece.setPosition(position.add(rotate(5, 0, 4)));
      piece.setRotation(Quaternionf.fromAngleDegAxis(90, 0, 1, 0).mul(rotation));
    } else {
      piece.setPosition(position.add(rotate(-1, 0, 0)));
      piece.setRotation(Quaternionf.fromAngleDegAxis(-90, 0, 1, 0).mul(rotation));
    }
    piece.randomize();
    return Lists.newArrayList(piece);
  }
View Full Code Here

    return true;
  }

  @Override
  public void placeObject(World w, int x, int y, int z) {
    final StructurePiece temple = getTemple(w.getBiome(x, y, z));
    if (temple == null) {
      return;
    }
    final BoundingBox boundingBox = temple.getBoundingBox();
    y = getAverageHeight(w, x, z, (int) boundingBox.getXSize(), (int) boundingBox.getZSize());
    temple.setPosition(new Point(w, x, y, z));
    temple.setRotation(Quaternionf.fromAngleDegAxis(random.nextInt(4) * 90, 0, 1, 0));
    if (temple.canPlace()) {
      temple.place();
    }
  }
View Full Code Here

    room.randomize();
    activeBranches.add(room);
    final byte size = (byte) (random.nextInt(MAX_SIZE_RAND + 1) + MAX_SIZE_BASE);
    byte count = 0;
    while (!activeBranches.isEmpty()) {
      final StructurePiece active = activeBranches.poll();
      final BoundingBox activeBox = active.getBoundingBox();
      if (!collides(activeBox, lastBoxes.remove(active), placed) && active.canPlace()
          && active.getPosition().getY() >= 10) {
        active.place();
        if (++count > size) {
          return;
        }
        placed.add(activeBox);
        final List<StructurePiece> next = active.getNextPieces();
        for (StructurePiece piece : next) {
          lastBoxes.put(piece, activeBox);
        }
        activeBranches.addAll(next);
      }
View Full Code Here

TOP

Related Classes of org.spout.vanilla.world.generator.structure.StructurePiece$BoundingBox

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.