Package net.glowstone.entity.meta
Class MetadataMap
java.lang.Object
net.glowstone.entity.meta.MetadataMap
- All Implemented Interfaces:
DynamicallyTypedMap<MetadataIndex>,DynamicallyTypedMapWithFloats<MetadataIndex>
A map for entity metadata.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(MetadataIndex index) get(MetadataIndex index) booleangetBit(MetadataIndex index, int bit) Tests for the given bit mask in a bit field.booleangetBoolean(MetadataIndex index) Retrieves an entry as aboolean.bytegetByte(MetadataIndex index) getChat(MetadataIndex index) Returns a list containing copies of all the entries.floatgetFloat(MetadataIndex index) Retrieves an entry as afloat.intgetInt(MetadataIndex index) Retrieves an entry as anint.org.bukkit.inventory.ItemStackgetItem(MetadataIndex index) getNumber(MetadataIndex index) Returns the numeric value of a metadata field.getOptChat(MetadataIndex index) Gets the optional chat value for the given MetadataIndex.org.bukkit.util.BlockVectorgetOptPosition(MetadataIndex index) Gets the optional position value for the given MetadataIndex.getString(MetadataIndex index) Retrieves an entry as aString.voidvoidset(MetadataIndex index, Object value) Sets the value of a metadata field.voidset(MetadataIndex index, Object value, boolean force) Sets the value of a metadata field.voidsetBit(MetadataIndex index, int bit, boolean status) Sets or clears bits in a bit field.toString()
-
Constructor Details
-
MetadataMap
-
-
Method Details
-
containsKey
-
set
Sets the value of a metadata field.- Parameters:
index- the field to setvalue- the new value
-
set
Sets the value of a metadata field.- Parameters:
index- the field to setvalue- the new valueforce- if the value should be forced as a change regardless of equality
-
get
-
getBit
Tests for the given bit mask in a bit field.- Parameters:
index- the field to testbit- a mask of the bits to test
-
setBit
Sets or clears bits in a bit field.- Parameters:
index- the field to updatebit- a mask of the bits to set or clearstatus- true to set; false to clear
-
getNumber
Returns the numeric value of a metadata field.- Parameters:
index- the field to look up- Returns:
- the numeric value
- Throws:
IllegalArgumentException- if the value doesn't exist or isn't numeric
-
getBoolean
Description copied from interface:DynamicallyTypedMapRetrieves an entry as aboolean.- Specified by:
getBooleanin interfaceDynamicallyTypedMap<MetadataIndex>- Parameters:
index- the key to look up- Returns:
- the value as a boolean
-
getByte
-
getInt
Description copied from interface:DynamicallyTypedMapRetrieves an entry as anint.- Specified by:
getIntin interfaceDynamicallyTypedMap<MetadataIndex>- Parameters:
index- the key to look up- Returns:
- the value as an int
-
getFloat
Description copied from interface:DynamicallyTypedMapWithFloatsRetrieves an entry as afloat.- Specified by:
getFloatin interfaceDynamicallyTypedMapWithFloats<MetadataIndex>- Parameters:
index- the key to look up- Returns:
- the value as a
float
-
getString
Description copied from interface:DynamicallyTypedMapRetrieves an entry as aString.- Specified by:
getStringin interfaceDynamicallyTypedMap<MetadataIndex>- Parameters:
index- the key to look up- Returns:
- the value as a String
-
getItem
-
getOptPosition
Gets the optional position value for the given MetadataIndex.- Parameters:
index- the MetadataIndex of the optional position- Returns:
- the position value as a BlockVector, null if the value is not present
-
getChat
-
getOptChat
Gets the optional chat value for the given MetadataIndex.- Parameters:
index- the MetadataIndex of the optional chat- Returns:
- the chat value as a TextMessage, null if the value is not present
-
getEntryList
Returns a list containing copies of all the entries.- Returns:
- a list containing copies of all the entries
-
getChanges
-
resetChanges
public void resetChanges() -
toString
-