Changed how customizable leaves radius works

This commit is contained in:
Adubbz 2016-01-20 13:24:28 +11:00
parent cf089c78d8
commit fbbdf44a4d
1 changed files with 9 additions and 9 deletions

View File

@ -34,10 +34,10 @@ public class GeneratorBasicTree extends GeneratorTreeBase
public static class Builder extends GeneratorTreeBase.InnerBuilder<Builder, GeneratorBasicTree> implements IGeneratorBuilder<GeneratorBasicTree>
{
protected int leafLayers;
protected int leafRadius;
protected int minLeavesRadius;
public Builder leafLayers(int a) {this.leafLayers = a; return this.self();}
public Builder leafRadius(int a) {this.leafRadius = a; return this.self();}
public Builder minLeavesRadius(int a) {this.minLeavesRadius = a; return this.self();}
public Builder()
{
@ -51,27 +51,27 @@ public class GeneratorBasicTree extends GeneratorTreeBase
this.minHeight = 4;
this.maxHeight = 7;
this.leafLayers = 4;
this.leafRadius = 2;
this.minLeavesRadius = 1;
}
@Override
public GeneratorBasicTree create()
{
return new GeneratorBasicTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.minHeight, this.maxHeight, false, this.leafLayers, this.leafRadius);
return new GeneratorBasicTree(this.amountPerChunk, this.placeOn, this.replace, this.log, this.leaves, this.vine, this.minHeight, this.maxHeight, false, this.leafLayers, this.minLeavesRadius);
}
}
private boolean updateNeighbours;
private int leafLayers;
private int leafRadius;
private int minLeavesRadius;
private final IBlockPosQuery placeVinesOn; //This shouldn't need to be configurable, however it can be if necessary
public GeneratorBasicTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight, boolean updateNeighbours, int leafLayers, int leafRadius)
public GeneratorBasicTree(float amountPerChunk, IBlockPosQuery placeOn, IBlockPosQuery replace, IBlockState log, IBlockState leaves, IBlockState vine, int minHeight, int maxHeight, boolean updateNeighbours, int leafLayers, int minLeavesRadius)
{
super(amountPerChunk, placeOn, replace, log, leaves, vine, minHeight, maxHeight);
this.updateNeighbours = updateNeighbours;
this.leafLayers = leafLayers;
this.leafRadius = leafRadius;
this.minLeavesRadius = minLeavesRadius;
this.placeVinesOn = BlockQueries.air;
}
@ -145,7 +145,7 @@ public class GeneratorBasicTree extends GeneratorTreeBase
int currentLayer = y - (pos.getY() + height);
//Uses integer division truncation (-3 / 2 = -1, -2 / 2 = -1) to reduce
//the radius closer to the top of the tree. (2, 2, 1, 1)
int leavesRadius = 1 - currentLayer / this.leafRadius;
int leavesRadius = this.minLeavesRadius - currentLayer / 2;
for (int x = pos.getX() - leavesRadius; x <= pos.getX() + leavesRadius; x++)
{
@ -209,7 +209,7 @@ public class GeneratorBasicTree extends GeneratorTreeBase
int currentLayer = y - (pos.getY() + height);
//Uses integer division truncation (-3 / 2 = -1, -2 / 2 = -1) to reduce
//the radius closer to the top of the tree. (3, 3, 2, 2)
int leavesRadius = 2 - currentLayer / this.leafRadius;
int leavesRadius = (this.minLeavesRadius + 1) - currentLayer / 2;
for (int x = pos.getX() - leavesRadius; x <= pos.getX() + leavesRadius; x++)
{