public class GroundScatterFunction extends GroundFindingFunction
RegionFunction onto random ground blocks.
This class can be used to generate a structure randomly over an area.
| Constructor and Description |
|---|
GroundScatterFunction(EditSession editSession,
RegionFunction function)
Create a new instance using a
RandomNoise as the noise generator. |
GroundScatterFunction(EditSession editSession,
RegionFunction function,
NoiseGenerator noiseGenerator)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
apply(Vector position,
BaseBlock block)
Apply the function to the given ground block.
|
double |
getDensity()
Get the density (0 <= density <= 1) which indicates the threshold that
must be met for the function to be applied to a column.
|
RegionFunction |
getFunction()
Get the function to apply.
|
NoiseGenerator |
getNoiseGenerator()
Get the noise generator.
|
void |
setDensity(double density)
Set the density (0 <= density <= 1) which indicates the threshold that
must be met for the function to be applied to a column.
|
void |
setFunction(RegionFunction function)
Set the function to apply.
|
void |
setNoiseGenerator(NoiseGenerator noiseGenerator)
Set the noise generator.
|
protected boolean |
shouldContinue(Vector2D pt)
Returns whether a search for the ground should be performed for the given
column.
|
apply, getLowerY, getUpperY, raiseCeiling, setRange, setRange, shouldPassThroughpublic GroundScatterFunction(EditSession editSession, RegionFunction function)
RandomNoise as the noise generator.editSession - the edit sessionfunction - the functionpublic GroundScatterFunction(EditSession editSession, RegionFunction function, NoiseGenerator noiseGenerator)
editSession - the edit sessionfunction - the functionpublic double getDensity()
public void setDensity(double density)
density - the densitypublic NoiseGenerator getNoiseGenerator()
public void setNoiseGenerator(NoiseGenerator noiseGenerator)
noiseGenerator - the noise generatorpublic RegionFunction getFunction()
public void setFunction(RegionFunction function)
function - the region functionprotected boolean shouldContinue(Vector2D pt)
GroundFindingFunctionshouldContinue in class GroundFindingFunctionpt - the pointprotected boolean apply(Vector position, BaseBlock block) throws WorldEditException
GroundFindingFunctionNaive implementations may provide flowers, tall grass, and other blocks not often considered to be the ground as the ground block.
apply in class GroundFindingFunctionposition - the positionblock - the blockWorldEditException - thrown on an errorCopyright © 2010-2014. All Rights Reserved.