Examples of StructurePiece


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

      temple.place();
    }
  }

  private StructurePiece getTemple(Biome biome) {
    final StructurePiece temple;
    if (biome == VanillaBiomes.DESERT || biome == VanillaBiomes.DESERT_HILLS) {
      temple = new DesertTemple(this);
    } else if (biome == VanillaBiomes.JUNGLE || biome == VanillaBiomes.JUNGLE_HILLS) {
      temple = new JungleTemple(this);
    } else {
View Full Code Here

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

  }

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

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

  @Override
  public List<StructurePiece> getNextPieces() {
    final List<StructurePiece> pieces = new ArrayList<StructurePiece>(3);
    final Random random = getRandom();
    if (random.nextBoolean()) {
      final StructurePiece front = getNextPiece();
      front.setPosition(position.add(rotate(0, 0, depth)));
      front.setRotation(rotation);
      front.randomize();
      pieces.add(front);
    }
    if (random.nextBoolean()) {
      final StructurePiece right = getNextPiece();
      right.setPosition(position.add(rotate(xStart, 0, depth / 2)));
      right.setRotation(Quaternionf.fromAngleDegAxis(-90, 0, 1, 0).mul(rotation));
      right.randomize();
      pieces.add(right);
    }
    if (random.nextBoolean()) {
      final StructurePiece left = getNextPiece();
      left.setPosition(position.add(rotate(xEnd, 0, depth / 2)));
      left.setRotation(Quaternionf.fromAngleDegAxis(90, 0, 1, 0).mul(rotation));
      left.randomize();
      pieces.add(left);
    }
    return pieces;
  }
View Full Code Here

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

  }

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

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

  public List<StructurePiece> getNextPieces() {
    final List<StructurePiece> pieces = new ArrayList<StructurePiece>(3);
    final boolean twoFloors = hasTwoFloors();
    final Random random = getRandom();
    if (random.nextBoolean()) {
      final StructurePiece bottomFront = getNextPiece();
      bottomFront.setPosition(position.add(rotate(0, 0, 5)));
      bottomFront.setRotation(rotation);
      bottomFront.randomize();
      pieces.add(bottomFront);
    }
    if (random.nextBoolean()) {
      final StructurePiece bottomRight = getNextPiece();
      bottomRight.setPosition(position.add(rotate(-1, 0, 1)));
      bottomRight.setRotation(Quaternionf.fromAngleDegAxis(-90, 0, 1, 0).mul(rotation));
      bottomRight.randomize();
      pieces.add(bottomRight);
    }
    if (random.nextBoolean()) {
      final StructurePiece bottomLeft = getNextPiece();
      bottomLeft.setPosition(position.add(rotate(4, 0, 3)));
      bottomLeft.setRotation(Quaternionf.fromAngleDegAxis(90, 0, 1, 0).mul(rotation));
      bottomLeft.randomize();
      pieces.add(bottomLeft);
    }
    if (twoFloors && random.nextBoolean()) {
      final StructurePiece topFront = getNextPiece();
      topFront.setPosition(position.add(rotate(0, 4, 5)));
      topFront.setRotation(rotation);
      topFront.randomize();
      pieces.add(topFront);
    }
    if (twoFloors && random.nextBoolean()) {
      final StructurePiece topRight = getNextPiece();
      topRight.setPosition(position.add(rotate(-1, 4, 1)));
      topRight.setRotation(Quaternionf.fromAngleDegAxis(-90, 0, 1, 0).mul(rotation));
      topRight.randomize();
      pieces.add(topRight);
    }
    if (twoFloors && random.nextBoolean()) {
      final StructurePiece topLeft = getNextPiece();
      topLeft.setPosition(position.add(rotate(4, 4, 3)));
      topLeft.setRotation(Quaternionf.fromAngleDegAxis(90, 0, 1, 0).mul(rotation));
      topLeft.randomize();
      pieces.add(topLeft);
    }
    if (twoFloors && random.nextBoolean()) {
      final StructurePiece topBack = getNextPiece();
      topBack.setPosition(position.add(rotate(2, 4, 0)));
      topBack.setRotation(Quaternionf.fromAngleDegAxis(180, 0, 1, 0).mul(rotation));
      topBack.randomize();
      pieces.add(topBack);
    }
    return pieces;
  }
View Full Code Here

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

  }

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

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

    corridor.randomize();
    activeBranches.add(corridor);
    final int size = 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) {
          final List<StructurePiece> ends = new ArrayList<StructurePiece>();
          final Iterator<StructurePiece> iterator = activeBranches.iterator();
          while (iterator.hasNext()) {
            final StructurePiece stop = iterator.next();
            final StructurePiece end = new FortressEnd(this);
            end.setPosition(stop.getPosition());
            end.setRotation(stop.getRotation());
            ends.add(end);
            iterator.remove();
          }
          activeBranches.addAll(ends);
        }
View Full Code Here

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

    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

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

  public void randomize() {
  }

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

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

  public void randomize() {
  }

  @Override
  public List<StructurePiece> getNextPieces() {
    final StructurePiece piece = getNextPiece();
    piece.setPosition(position.add(rotate(0, -6, 8)));
    piece.setRotation(rotation);
    piece.randomize();
    return Lists.newArrayList(piece);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.