public final class Schematic extends AbstractNBTItem implements WPObject, Bo2ObjectProvider
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
Constructor and Description |
---|
Schematic(java.lang.String name,
org.jnbt.CompoundTag tag,
java.util.Map<java.lang.String,java.io.Serializable> attributes) |
Modifier and Type | Method and Description |
---|---|
Schematic |
clone()
Create a clone of the object.
|
java.util.List<WPObject> |
getAllObjects()
Obtain a list of all different
WPObject s which this
object provider can return. |
java.util.Map<java.lang.String,java.io.Serializable> |
getAttributes()
Get a live view of the object metadata.
|
javax.vecmath.Point3i |
getDimensions()
Get the dimensions of the object.
|
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.
|
java.lang.String |
getName()
Get the name of the object.
|
WPObject |
getObject()
Obtain one
WPObject , which may be the same one every time, or a
different one from a random collection or sequence every time. |
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.
|
static Schematic |
load(java.io.File file)
Load a custom object in schematic format from a file.
|
static Schematic |
load(java.lang.String name,
java.io.File file)
Load a custom object in schematic format from a file.
|
static Schematic |
load(java.lang.String name,
java.io.InputStream stream)
Load a custom object in schematic format from an input stream.
|
void |
prepareForExport(Dimension dimension)
Make preparations, if necessary, for exporting 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.
|
void |
setSeed(long seed)
Sets the seed of the PRNG, for object providers which use one.
|
containsTag, containsTag, containsType, forEachTag, getAllTags, getAllTags, getBoolean, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getByte, getByteArray, getByteArray, getDouble, getDouble, getDouble, getDouble, getDoubleList, getDoubleList, getFloat, getFloat, getFloat, getFloat, getFloatList, getFloatList, getInt, getInt, getInt, getInt, getIntArray, getIntArray, getList, getList, getLong, getLong, getLong, getLong, getLongArray, getLongArray, getMap, getMap, getShort, getShort, getShort, getShort, getString, getString, getString, getString, getTag, getTag, removeTag, removeTag, setBoolean, setBoolean, setByte, setByte, setByteArray, setByteArray, setDouble, setDouble, setDoubleList, setDoubleList, setFloat, setFloat, setFloatList, setFloatList, setInt, setInt, setIntArray, setIntArray, setList, setList, setLong, setLong, setLongArray, setLongArray, setMap, setMap, setShort, setShort, setString, setString, setTag, setTag, toMultipleNBT, toNBT, toString
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
dump, getAllMaterials, getAttribute, guessConnectBlocks, guessManageWaterlogged, guestimateOffset, hasAttribute, visitBlocks
public Schematic(java.lang.String name, org.jnbt.CompoundTag tag, java.util.Map<java.lang.String,java.io.Serializable> attributes)
public javax.vecmath.Point3i getDimensions()
WPObject
getDimensions
in interface WPObject
public Material getMaterial(int x, int y, int z)
WPObject
WPObject.getMask(int, int, int)
returns true
. These coordinates are zero-based and must never be
negative.getMaterial
in interface WPObject
x
- The relative X coordinate.y
- The relative Y coordinate.z
- The relative Z coordinate.public boolean getMask(int x, int y, int z)
WPObject
public java.util.List<Entity> getEntities()
WPObject
getEntities
in interface WPObject
null
.public java.util.List<TileEntity> getTileEntities()
WPObject
getTileEntities
in interface WPObject
null
.public void prepareForExport(Dimension dimension)
WPObject
WPObject.getMask(int, int, int)
or
WPObject.getMaterial(int, int, int)
are invoked.prepareForExport
in interface WPObject
dimension
- The dimension for which the object is being exported.public java.lang.String getName()
WPObject
getName
in interface Bo2ObjectProvider
getName
in interface WPObject
public void setName(java.lang.String name)
WPObject
public WPObject getObject()
Bo2ObjectProvider
WPObject
, which may be the same one every time, or a
different one from a random collection or sequence every time.getObject
in interface Bo2ObjectProvider
WPObject
.public java.util.List<WPObject> getAllObjects()
Bo2ObjectProvider
WPObject
s which this
object provider can return. This is an optional operation which may
throw an UnsupportedOperationException
if this object provider
does not support it.getAllObjects
in interface Bo2ObjectProvider
public java.util.Map<java.lang.String,java.io.Serializable> getAttributes()
WPObject
getAttributes
in interface WPObject
null
.public void setAttributes(java.util.Map<java.lang.String,java.io.Serializable> attributes)
WPObject
setAttributes
in interface 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.setAttribute
in interface WPObject
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.public void setSeed(long seed)
Bo2ObjectProvider
setSeed
in interface Bo2ObjectProvider
seed
- The seed to set on the PRNG, if any.public javax.vecmath.Point3i getOffset()
WPObject
This is a convenience method which must return the same as invoking
getAttribute(ATTRIBUTE_OFFSET)
. See
WPObject.getAttribute(AttributeKey)
and WPObject.ATTRIBUTE_OFFSET
.
public Schematic clone()
WPObject
clone
in interface Bo2ObjectProvider
clone
in interface WPObject
clone
in class AbstractNBTItem
public static Schematic load(java.io.File file) throws java.io.IOException
file
- The file from which to load the object.Schematic
containing the contents of the
specified file.java.io.IOException
- If an I/O error occurred while reading the file.public static Schematic load(java.lang.String name, java.io.File file) throws java.io.IOException
name
- The name of the object.file
- The file from which to load the object.Schematic
containing the contents of the
specified file.java.io.IOException
- If an I/O error occurred while reading the file.public static Schematic load(java.lang.String name, java.io.InputStream stream) throws java.io.IOException
name
- The name of the object.stream
- The input stream from which to load the object.Schematic
containing the contents of the
specified stream.java.io.IOException
- If an I/O error occurred while reading the stream.