Files
Binnie/src/main/java/binnie/extratrees/worldgen/WorldGenCypress.java
T
kordum bc10e65feb Fix wrong tree generators
Refactoring and code improvement of tree generators
2017-07-04 11:47:52 +03:00

36 lines
989 B
Java

package binnie.extratrees.worldgen;
import forestry.api.world.ITreeGenData;
public class WorldGenCypress extends WorldGenTree {
public WorldGenCypress(ITreeGenData tree) {
super(tree);
}
@Override
public void generate() {
generateTreeTrunk(height, girth);
float leafSpawn = height + 2;
float bottom = 1.0f;
float width = height * randBetween(0.15f, 0.2f);
if (width > 7.0f) {
width = 7.0f;
}
float coneHeight = leafSpawn - bottom;
while (leafSpawn > bottom) {
float radius = (1.0f - (leafSpawn - bottom) / coneHeight) * (width - 1.0f) + 1;
generateCylinder(new Vector(0.0f, leafSpawn--, 0.0f), radius, 1, leaf, false);
}
generateCylinder(new Vector(0.0f, leafSpawn--, 0.0f), 0.7f * width, 1, leaf, false);
generateCylinder(new Vector(0.0f, leafSpawn, 0.0f), 0.4f * width, 1, leaf, false);
}
@Override
public void preGenerate() {
height = determineHeight(6, 2);
girth = determineGirth(treeGen.getGirth(world, startX, startY, startZ));
}
}