public interface Garden
The garden contains "seeds", which can be planted by a WorldPainter operation. Each seed has a germination time. The garden is ticked over, and when a seed's germination time is reached it tries to sprout. This may or may not succeed according to whether there is space in the world. Earlier sprouted seeds may prevent the seed from sprouting.
The garden keeps track of which blocks are already occupied by sprouted seeds, and by which category of seed they are occupied. When they sprout, seeds may mark an area as occupied.
If it does sprout, the seed can plant new seeds, which may or may not sprout according to whether there is room. In this way complex yet random structures may be built up while still following complex rules.
When the world is exported each sprouted seed is allowed to render itself to the map. This is done in two phases, so a seed may for instance render its exterior in phase one and its interior in phase two, which may help with keeping things realistic.
Modifier and Type | Method and Description |
---|---|
void |
clearLayer(int x,
int y,
Layer layer,
int radius)
Remove a layer from the world in a square area with a particular radius
around a particular location.
|
<T extends Seed> |
findSeeds(java.lang.Class<T> type,
int x,
int y,
int radius)
Find seeds of a particular type in a square area around a particular
location.
|
int |
getCategory(int x,
int y)
Get the category of seed, if any, which occupies a particular location.
|
float |
getHeight(int x,
int y)
Get the precise terrain height of a location.
|
int |
getIntHeight(int x,
int y)
Get the rounded terrain height of a location.
|
java.util.Set<Seed> |
getSeeds()
Get all the seeds in the garden.
|
boolean |
isLava(int x,
int y)
Determine whether a location is flooded with lava.
|
boolean |
isOccupied(int x,
int y)
Determine whether a location is already marked as occupied, or is
flooded.
|
boolean |
isWater(int x,
int y)
Determine whether a location is marked as occupied with water, or is
actually under water.
|
void |
neutralise()
Neutralise the garden by killing all seeds regardless of whether they
have germinated.
|
boolean |
plantSeed(Seed seed)
Plant a seed in the garden.
|
void |
removeSeed(Seed seed)
Remove a seed from the garden.
|
void |
setCategory(int x,
int y,
int category)
Mark a location as being occupied by a particular category of seed.
|
boolean |
tick()
Tick the garden over.
|
void clearLayer(int x, int y, Layer layer, int radius)
x
- The X coordinate of the location.y
- The Y coordinate of the location.layer
- The layer to remove.radius
- The radius of the square to remove.void setCategory(int x, int y, int category)
x
- The X coordinate to mark.y
- The Y coordinate to mark.category
- The category with which to mark the location as one
of the CATEGORY_*
constants in the
GardenCategory
class.int getCategory(int x, int y)
x
- The X coordinate to get.y
- The Y coordinate to get.CATEGORY_*
constants in the
GardenCategory
class, or 0 if it is unoccupied.java.util.Set<Seed> getSeeds()
<T extends Seed> java.util.List<T> findSeeds(java.lang.Class<T> type, int x, int y, int radius)
T
- The type of seed to locate.type
- The type of seed to locate.x
- The X coordinate of the location.y
- The Y coordinate of the location.radius
- The radius of the square.null
.boolean isOccupied(int x, int y)
x
- The X coordinate of the location.y
- The Y coordinate of the location.true
if the location is marked as occupied, or is
flooded.boolean isWater(int x, int y)
x
- The X coordinate of the location.y
- The Y coordinate of the location.true
if the location is marked as occupied with
water, or is actually under water.boolean isLava(int x, int y)
x
- The X coordinate of the location.y
- The Y coordinate of the location.true
if the location is flooded with lava.boolean plantSeed(Seed seed)
seed
- The seed to plant.true
if the seed was planted; false
if
it could not be planted for some reason.void removeSeed(Seed seed)
seed
- The seed to remove.float getHeight(int x, int y)
x
- The X coordinate of the location.y
- The Y coordinate of the location.int getIntHeight(int x, int y)
x
- The X coordinate of the location.y
- The Y coordinate of the location.boolean tick()
true
if all seeds have either sprouted or died,
meaning that the garden is in a steady state until new seeds are
planted, and does not need to be ticked over anymore.
false
if there are still living seeds and the garden
needs further ticking over.void neutralise()