public abstract class NamedObjectWithAttributes extends AbstractObject
WPObject.BlockVisitor
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 |
NamedObjectWithAttributes() |
protected |
NamedObjectWithAttributes(java.lang.String name) |
protected |
NamedObjectWithAttributes(java.lang.String name,
java.util.Map<java.lang.String,java.io.Serializable> attributes) |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.io.Serializable> |
getAttributes()
Get a live view of the object metadata.
|
java.lang.String |
getName()
Get the name of the object.
|
<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.
|
clone, getOffset, prepareForExport
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
dump, getAllMaterials, getAttribute, getDimensions, getEntities, getMask, getMaterial, getTileEntities, guessConnectBlocks, guessManageWaterlogged, guestimateOffset, hasAttribute, visitBlocks
protected NamedObjectWithAttributes()
protected NamedObjectWithAttributes(java.lang.String name)
protected NamedObjectWithAttributes(java.lang.String name, java.util.Map<java.lang.String,java.io.Serializable> attributes)
public java.lang.String getName()
WPObject
public void setName(java.lang.String name)
WPObject
name
- The new name of the object.public java.util.Map<java.lang.String,java.io.Serializable> getAttributes()
WPObject
null
.public void setAttributes(java.util.Map<java.lang.String,java.io.Serializable> attributes)
WPObject
attributes
- The external metadata to store.public <T extends java.io.Serializable> void setAttribute(org.pepsoft.util.AttributeKey<T> key, T value)
WPObject
null
will
delete the attribute from the store. If the store becomes empty it is
deleted entirely.T
- 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.