public abstract class Plant extends java.lang.Object implements WPObject
WPObject.BlockVisitor| Modifier and Type | Field and Description |
|---|---|
protected Category[] |
categories |
protected java.lang.String |
iconName |
protected Material |
material |
protected java.lang.String |
name |
ATTRIBUTE_COLLISION_MODE, ATTRIBUTE_CONNECT_BLOCKS, ATTRIBUTE_EXTEND_FOUNDATION, ATTRIBUTE_FILE, ATTRIBUTE_FREQUENCY, ATTRIBUTE_HEIGHT_MODE, ATTRIBUTE_LEAF_DECAY_MODE, ATTRIBUTE_MANAGE_WATERLOGGED, ATTRIBUTE_NEEDS_FOUNDATION, ATTRIBUTE_OFFSET, ATTRIBUTE_RANDOM_MIRRORING_ONLY, ATTRIBUTE_RANDOM_ROTATION, ATTRIBUTE_RANDOM_ROTATION_ONLY, ATTRIBUTE_REPLACE_WITH_AIR, ATTRIBUTE_REPLACE_WITH_AIR_MATERIAL, ATTRIBUTE_SPAWN_IN_LAVA, ATTRIBUTE_SPAWN_IN_WATER, ATTRIBUTE_SPAWN_ON_LAND, ATTRIBUTE_SPAWN_ON_LAVA, ATTRIBUTE_SPAWN_ON_WATER, ATTRIBUTE_SPAWN_ON_WATER_NO_COLLIDE, ATTRIBUTE_UNDERGROUND_MODE, ATTRIBUTE_VERTICAL_OFFSET, ATTRIBUTE_Y_VARIATION, COLLISION_MODE_ALL, COLLISION_MODE_NONE, COLLISION_MODE_SOLID, HEIGHT_MODE_FIXED, HEIGHT_MODE_TERRAIN, LEAF_DECAY_NO_CHANGE, LEAF_DECAY_OFF, LEAF_DECAY_ON| Modifier | Constructor and Description |
|---|---|
protected |
Plant(java.lang.String name,
Material material,
java.lang.String iconName,
Category... categories) |
| Modifier and Type | Method and Description |
|---|---|
WPObject |
clone()
Create a clone of the object.
|
java.util.Map<java.lang.String,java.io.Serializable> |
getAttributes()
Get a live view of the object metadata.
|
Category[] |
getCategories()
Get the categories of the plant.
|
int |
getDefaultGrowth()
The default growth stage to present to the user.
|
java.util.List<Entity> |
getEntities()
Get any entities contained in the object.
|
boolean |
getMask(int x,
int y,
int z)
Determine whether a block should be placed at the specified relative coordinates.
|
Material |
getMaterial(int x,
int y,
int z)
Get the material to place at the specified relative coordinates.
|
int |
getMaxGrowth()
Get the maximum growth stage of this plant, where 1 is the minimum growth
stage.
|
java.lang.String |
getName()
Get the name of the object.
|
javax.vecmath.Point3i |
getOffset()
Get the offset to apply to this object when placing it.
|
java.util.List<TileEntity> |
getTileEntities()
Get any tile entities contained in the object.
|
Category |
isValidFoundation(MinecraftWorld world,
int x,
int y,
int height,
boolean checkBlockBelow)
Determine whether the block at a particular location in a particular map is a valid foundation on which to place
this plant.
|
void |
prepareForExport(Dimension dimension)
Make preparations, if necessary, for exporting the object.
|
Plant |
realise(int growth,
Platform platform)
Obtain a version of the plant suitable for actually placing in a map.
|
<T extends java.io.Serializable> |
setAttribute(org.pepsoft.util.AttributeKey<T> key,
T value)
Convenience method for setting the value of an attribute stored in the
external metadata, if any.
|
void |
setAttributes(java.util.Map<java.lang.String,java.io.Serializable> attributes)
Store external metadata about the object.
|
void |
setName(java.lang.String name)
Set the name of the object.
|
java.lang.String |
toString() |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdump, getAllMaterials, getAttribute, getDimensions, guessConnectBlocks, guessManageWaterlogged, guestimateOffset, hasAttribute, visitBlocksprotected final java.lang.String name
protected final java.lang.String iconName
protected final Material material
protected final Category[] categories
public final Category[] getCategories()
public Category isValidFoundation(MinecraftWorld world, int x, int y, int height, boolean checkBlockBelow)
PlantLayerExporter before exporting a plant.world - The map in which to check the foundation.x - The X coordinate (in the WorldPainter coordinate system) to check.y - The Y coordinate (in the WorldPainter coordinate system) to check.height - The Z coordinate (in the WorldPainter coordinate system) to check.checkBlockBelow - Whether the block underneath the plant should be checked for validity.null
otherwise.public int getMaxGrowth()
public int getDefaultGrowth()
maxGrowth optionally being higher.public Plant realise(int growth, Platform platform)
PlantLayerExporter before
exporting a plant. It is meant for plants with varying growth stages and/
or which will return different materials for different platforms.
Implementations to which neither applies may simply return themselves.growth - The growth stage of the plant to export. Always 1 for
plants without growth stages.platform - The platform for which the plant is being exported.public java.lang.String getName()
WPObjectpublic void setName(java.lang.String name)
WPObjectpublic Material getMaterial(int x, int y, int z)
WPObjectWPObject.getMask(int, int, int) returns true. These coordinates are zero-based and must never be
negative.getMaterial in interface WPObjectx - The relative X coordinate.y - The relative Y coordinate.z - The relative Z coordinate.public boolean getMask(int x,
int y,
int z)
WPObjectpublic java.util.List<Entity> getEntities()
WPObjectgetEntities in interface WPObjectnull.public java.util.List<TileEntity> getTileEntities()
WPObjectgetTileEntities in interface WPObjectnull.public void prepareForExport(Dimension dimension)
WPObjectWPObject.getMask(int, int, int) or
WPObject.getMaterial(int, int, int) are invoked.prepareForExport in interface WPObjectdimension - The dimension for which the object is being exported.public java.util.Map<java.lang.String,java.io.Serializable> getAttributes()
WPObjectgetAttributes in interface WPObjectnull.public void setAttributes(java.util.Map<java.lang.String,java.io.Serializable> attributes)
WPObjectsetAttributes in interface WPObjectattributes - The external metadata to store.public <T extends java.io.Serializable> void setAttribute(org.pepsoft.util.AttributeKey<T> key,
T value)
WPObjectnull will
delete the attribute from the store. If the store becomes empty it is
deleted entirely.setAttribute in interface WPObjectT - The type of the attribute.key - The key of the attribute to set or delete.value - The value of the attribute to set, or null to
delete it.public javax.vecmath.Point3i getOffset()
WPObjectThis is a convenience method which must return the same as invoking
getAttribute(ATTRIBUTE_OFFSET). See
WPObject.getAttribute(AttributeKey) and WPObject.ATTRIBUTE_OFFSET.
public WPObject clone()
WPObjectpublic java.lang.String toString()
toString in class java.lang.Object