public class GenericTree extends Object implements TerrainObject
Modifier and Type | Field and Description |
---|---|
protected BlockStateDelegate |
delegate |
protected int |
height |
protected int |
leavesType |
protected int |
logType |
protected Collection<org.bukkit.Material> |
overridables |
PLANT_TYPES
Constructor and Description |
---|
GenericTree(Random random,
BlockStateDelegate delegate)
Initializes this tree with a random height, preparing it to attempt to generate.
|
Modifier and Type | Method and Description |
---|---|
protected org.bukkit.Material |
blockTypeAt(int x,
int y,
int z,
org.bukkit.World world)
Returns the block type at the given coordinates.
|
boolean |
canHeightFit(int baseHeight)
Checks whether this tree fits under the upper world limit.
|
protected boolean |
cannotGenerateAt(int baseX,
int baseY,
int baseZ,
org.bukkit.World world)
Returns whether any of
canHeightFit(int) , canPlace(int, int, int, World) or
canPlaceOn(BlockState) prevent this tree from generating. |
boolean |
canPlace(int baseX,
int baseY,
int baseZ,
org.bukkit.World world)
Checks whether this tree has enough space to grow.
|
boolean |
canPlaceOn(org.bukkit.block.BlockState soil)
Checks whether this tree can grow on top of the given block.
|
boolean |
generate(org.bukkit.Location loc)
Deprecated.
|
boolean |
generate(org.bukkit.World world,
Random random,
int blockX,
int blockY,
int blockZ)
Generates this feature.
|
protected void |
replaceIfAirOrLeaves(int x,
int y,
int z,
org.bukkit.Material newMaterial,
int data,
org.bukkit.World world)
Replaces the block at a location with the given new one, if it is air or leaves.
|
protected void |
setHeight(int height) |
protected void |
setOverridables(org.bukkit.Material... overridables) |
protected void |
setTypes(int logType,
int leavesType)
Sets the block data values for this tree's blocks.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
killPlantAbove
protected final BlockStateDelegate delegate
protected int height
protected int logType
protected int leavesType
protected Collection<org.bukkit.Material> overridables
public GenericTree(Random random, BlockStateDelegate delegate)
random
- the PRNGdelegate
- the BlockStateDelegate used to check for space and to fill in wood and leavesprotected final void setOverridables(org.bukkit.Material... overridables)
protected final void setHeight(int height)
protected final void setTypes(int logType, int leavesType)
logType
- the species portion of the data value for wood blocks.leavesType
- the species portion of the data value for leaf blocks.public boolean canHeightFit(int baseHeight)
baseHeight
- the height of the base of the trunkpublic boolean canPlaceOn(org.bukkit.block.BlockState soil)
soil
- the block we're growing onpublic boolean canPlace(int baseX, int baseY, int baseZ, org.bukkit.World world)
baseX
- the X coordinate of the base of the trunkbaseY
- the Y coordinate of the base of the trunkbaseZ
- the Z coordinate of the base of the trunkworld
- the world to grow in@Deprecated public boolean generate(org.bukkit.Location loc)
generate(World, Random, int, int, int)
BlockStateDelegate
is instructed to set blocks to wood and leaves.loc
- the base of the trunkpublic boolean generate(org.bukkit.World world, Random random, int blockX, int blockY, int blockZ)
TerrainObject
generate
in interface TerrainObject
world
- the world to generate inrandom
- the PRNG that will choose the size and a few details of the shapeblockX
- the base X coordinateblockY
- the base Y coordinateblockZ
- the base Z coordinateprotected boolean cannotGenerateAt(int baseX, int baseY, int baseZ, org.bukkit.World world)
canHeightFit(int)
, canPlace(int, int, int, World)
or
canPlaceOn(BlockState)
prevent this tree from generating.baseX
- the X coordinate of the base of the trunkbaseY
- the Y coordinate of the base of the trunkbaseZ
- the Z coordinate of the base of the trunkworld
- the world to grow inprotected void replaceIfAirOrLeaves(int x, int y, int z, org.bukkit.Material newMaterial, int data, org.bukkit.World world)
x
- the x coordinatey
- the y coordinatez
- the z coordinatenewMaterial
- the new block typedata
- the new block dataworld
- the world we are generating inprotected org.bukkit.Material blockTypeAt(int x, int y, int z, org.bukkit.World world)
x
- the x coordinatey
- the y coordinatez
- the z coordinateworld
- the world we are generating inCopyright © 2021. All rights reserved.