Files
Binnie/src/main/java/binnie/extratrees/gen/WorldGenTilia.java
T

132 lines
4.3 KiB
Java

package binnie.extratrees.gen;
import forestry.api.arboriculture.ITree;
public class WorldGenTilia {
public static class Basswood extends WorldGenTree {
public Basswood(final ITree tree) {
super(tree);
}
@Override
public void generate() {
this.generateTreeTrunk(this.height, this.girth);
float leafSpawn = this.height + 1;
final float bottom = this.randBetween(2, 3);
final float width = this.height * this.randBetween(0.4f, 0.5f);
final float f = 0.0f;
final float h = leafSpawn;
leafSpawn = h - 1.0f;
this.generateCylinder(new Vector(f, h, 0.0f), 0.3f * width, 1, this.leaf, false);
final float f2 = 0.0f;
final float h2 = leafSpawn;
leafSpawn = h2 - 1.0f;
this.generateCylinder(new Vector(f2, h2, 0.0f), 0.8f * width, 1, this.leaf, false);
while (leafSpawn > bottom) {
final float f3 = 0.0f;
final float h3 = leafSpawn;
leafSpawn = h3 - 1.0f;
this.generateCylinder(new Vector(f3, h3, 0.0f), this.randBetween(0.95f, 1.05f) * width, 1, this.leaf, false);
}
final float f4 = 0.0f;
final float h4 = leafSpawn;
leafSpawn = h4 - 1.0f;
this.generateCylinder(new Vector(f4, h4, 0.0f), 0.7f * width, 1, this.leaf, false);
final float f5 = 0.0f;
final float h5 = leafSpawn;
leafSpawn = h5 - 1.0f;
this.generateCylinder(new Vector(f5, h5, 0.0f), 0.4f * width, 1, this.leaf, false);
}
@Override
public void preGenerate() {
this.height = this.determineHeight(6, 3);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class WhiteBasswood extends WorldGenTree {
public WhiteBasswood(final ITree tree) {
super(tree);
}
@Override
public void generate() {
this.generateTreeTrunk(this.height, this.girth);
float leafSpawn = this.height + 1;
final float bottom = this.randBetween(2, 3);
final float width = this.height * this.randBetween(0.4f, 0.5f);
final float f = 0.0f;
final float h = leafSpawn;
leafSpawn = h - 1.0f;
this.generateCylinder(new Vector(f, h, 0.0f), 0.3f * width, 1, this.leaf, false);
final float f2 = 0.0f;
final float h2 = leafSpawn;
leafSpawn = h2 - 1.0f;
this.generateCylinder(new Vector(f2, h2, 0.0f), 0.8f * width, 1, this.leaf, false);
while (leafSpawn > bottom) {
final float f3 = 0.0f;
final float h3 = leafSpawn;
leafSpawn = h3 - 1.0f;
this.generateCylinder(new Vector(f3, h3, 0.0f), this.randBetween(0.95f, 1.05f) * width, 1, this.leaf, false);
}
final float f4 = 0.0f;
final float h4 = leafSpawn;
leafSpawn = h4 - 1.0f;
this.generateCylinder(new Vector(f4, h4, 0.0f), 0.7f * width, 1, this.leaf, false);
final float f5 = 0.0f;
final float h5 = leafSpawn;
leafSpawn = h5 - 1.0f;
this.generateCylinder(new Vector(f5, h5, 0.0f), 0.4f * width, 1, this.leaf, false);
}
@Override
public void preGenerate() {
this.height = this.determineHeight(6, 3);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
public static class CommonLime extends WorldGenTree {
public CommonLime(final ITree tree) {
super(tree);
}
@Override
public void generate() {
this.generateTreeTrunk(this.height, this.girth);
float leafSpawn = this.height + 1;
final float bottom = this.randBetween(2, 3);
final float width = this.height * this.randBetween(0.45f, 0.55f);
final float f = 0.0f;
final float h = leafSpawn;
leafSpawn = h - 1.0f;
this.generateCylinder(new Vector(f, h, 0.0f), 0.3f * width, 1, this.leaf, false);
final float f2 = 0.0f;
final float h2 = leafSpawn;
leafSpawn = h2 - 1.0f;
this.generateCylinder(new Vector(f2, h2, 0.0f), 0.8f * width, 1, this.leaf, false);
while (leafSpawn > bottom) {
final float f3 = 0.0f;
final float h3 = leafSpawn;
leafSpawn = h3 - 1.0f;
this.generateCylinder(new Vector(f3, h3, 0.0f), this.randBetween(0.95f, 1.05f) * width, 1, this.leaf, false);
}
final float f4 = 0.0f;
final float h4 = leafSpawn;
leafSpawn = h4 - 1.0f;
this.generateCylinder(new Vector(f4, h4, 0.0f), 0.7f * width, 1, this.leaf, false);
final float f5 = 0.0f;
final float h5 = leafSpawn;
leafSpawn = h5 - 1.0f;
this.generateCylinder(new Vector(f5, h5, 0.0f), 0.4f * width, 1, this.leaf, false);
}
@Override
public void preGenerate() {
this.height = this.determineHeight(7, 4);
this.girth = this.determineGirth(this.treeGen.getGirth());
}
}
}