Exemplo n.º 1
0
 @Override
 public BranchFunction rotate() {
   BranchFunction rotatedBranch = new BranchFunction();
   rotatedBranch.x = z;
   rotatedBranch.y = y;
   rotatedBranch.z = -x;
   rotatedBranch.branches = branches;
   rotatedBranch.branchChances = branchChances;
   rotatedBranch.branchRotations = new ArrayList<Rotation>();
   for (Rotation rotation : branchRotations) {
     rotatedBranch.branchRotations.add(Rotation.next(rotation));
   }
   return rotatedBranch;
 }
Exemplo n.º 2
0
  @Override
  public void load(List<String> args) throws InvalidConfigException {
    assureSize(6, args);

    x = readInt(args.get(0), -32, 32);
    y = readInt(args.get(1), -64, 64);
    z = readInt(args.get(2), -32, 32);
    branches = new ArrayList<CustomObject>();
    branchRotations = new ArrayList<Rotation>();
    branchChances = new ArrayList<Integer>();
    for (int i = 3; i < args.size() - 2; i += 3) {
      CustomObject object = getHolder().otherObjectsInDirectory.get(args.get(i).toLowerCase());
      if (object == null) {
        throw new InvalidConfigException(
            "The branch "
                + args.get(i)
                + " was not found. Make sure to place it in the same directory.");
      }
      branches.add(object);
      branchRotations.add(Rotation.getRotation(args.get(i + 1)));
      branchChances.add(readInt(args.get(i + 2), 1, 100));
    }
  }