3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-27 03:12:37 +01:00

Have upperY and lowerY on GroundFindingFunction be set via mutators.

Dieser Commit ist enthalten in:
sk89q 2014-03-01 12:03:10 -08:00
Ursprung 6f116cd564
Commit 504c7a5ff1
6 geänderte Dateien mit 28 neuen und 23 gelöschten Zeilen

Datei anzeigen

@ -2757,7 +2757,9 @@ public class EditSession {
double density, TreeGenerator treeGenerator)
throws WorldEditException {
ForestGenerator generator = new ForestGenerator(this, treeGenerator, lowerY, upperY);
ForestGenerator generator = new ForestGenerator(this, treeGenerator);
generator.setLowerY(lowerY);
generator.setUpperY(upperY);
generator.setDensity(density);
int affected = 0;

Datei anzeigen

@ -576,10 +576,9 @@ public class RegionCommands {
flatRegion = CuboidRegion.makeCuboid(region);
}
int upperY = flatRegion.getMaximumY();
int lowerY = flatRegion.getMinimumY();
FloraPlacer generator = new FloraPlacer(editSession, lowerY, upperY);
FloraPlacer generator = new FloraPlacer(editSession);
generator.setLowerY(flatRegion.getMinimumY());
generator.setUpperY(flatRegion.getMaximumY());
generator.setDensity(density);
int affected = 0;

Datei anzeigen

@ -44,11 +44,9 @@ public class FloraPlacer extends GroundGenerator {
* Create a new instance.
*
* @param editSession the edit session
* @param lowerY the lower Y
* @param upperY the upper Y (lowerY <= upperY)
*/
public FloraPlacer(EditSession editSession, int lowerY, int upperY) {
super(editSession, lowerY, upperY);
public FloraPlacer(EditSession editSession) {
super(editSession);
this.editSession = editSession;
}

Datei anzeigen

@ -40,11 +40,9 @@ public class ForestGenerator extends GroundGenerator {
*
* @param editSession the edit session
* @param treeGenerator a tree generator
* @param lowerY the lower Y boundary to end the ground search from
* @param upperY the upper Y boundary to start the ground search at
*/
public ForestGenerator(EditSession editSession, TreeGenerator treeGenerator, int lowerY, int upperY) {
super(editSession, lowerY, upperY);
public ForestGenerator(EditSession editSession, TreeGenerator treeGenerator) {
super(editSession);
this.editSession = editSession;
this.treeGenerator = treeGenerator;
}

Datei anzeigen

@ -34,11 +34,9 @@ public abstract class GroundGenerator extends GroundFindingFunction {
* Create a new instance.
*
* @param editSession the edit session
* @param lowerY the lower Y
* @param upperY the upper Y (lowerY <= upperY)
*/
protected GroundGenerator(EditSession editSession, int lowerY, int upperY) {
super(editSession, lowerY, upperY);
protected GroundGenerator(EditSession editSession) {
super(editSession);
}
/**

Datei anzeigen

@ -26,6 +26,13 @@ import com.sk89q.worldedit.blocks.BlockID;
/**
* An abstract implementation of {@link com.sk89q.worldedit.operation.FlatRegionFunction}
* that searches for the ground, which is considered to be any non-air block.
* <p>
* It functions by starting from the upperY in each column and traversing
* down the column until it finds the first non-air block, at which point
* {@link #apply(com.sk89q.worldedit.Vector, com.sk89q.worldedit.blocks.BaseBlock)}
* is called on that non-air block. {@link #shouldContinue(com.sk89q.worldedit.Vector2D)}
* is called before each column is traversed, which allows implementations
* to "skip" a column and avoid the ground search.
*/
public abstract class GroundFindingFunction implements FlatRegionFunction {
@ -37,13 +44,9 @@ public abstract class GroundFindingFunction implements FlatRegionFunction {
* Create a new instance.
*
* @param editSession the edit session
* @param lowerY the lower Y
* @param upperY the upper Y (lowerY <= upperY)
*/
protected GroundFindingFunction(EditSession editSession, int lowerY, int upperY) {
protected GroundFindingFunction(EditSession editSession) {
this.editSession = editSession;
this.lowerY = lowerY;
this.upperY = upperY;
checkYBounds();
}
@ -118,7 +121,8 @@ public abstract class GroundFindingFunction implements FlatRegionFunction {
}
/**
* Returns whether a search for the ground should be performed for the given point.
* Returns whether a search for the ground should be performed for the given
* column. Return false if the column is to be skipped.
*
* @param pt the point
* @return true if the search should begin
@ -129,6 +133,12 @@ public abstract class GroundFindingFunction implements FlatRegionFunction {
/**
* Apply the function to the given ground block.
* <p>
* The block above the given ground block may or may not be air, but it is
* a block that can be replaced. For example, this block may be a tall
* grass block or a flower. However, the ground block also could be
* the flower or grass block itself, depending on the configuration of the
* GroundFindingFunction.
*
* @param pt the position
* @param block the block