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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(MetadataIndex index) get
(MetadataIndex index) boolean
getBit
(MetadataIndex index, int bit) Tests for the given bit mask in a bit field.boolean
getBoolean
(MetadataIndex index) Retrieves an entry as aboolean
.byte
getByte
(MetadataIndex index) getChat
(MetadataIndex index) Returns a list containing copies of all the entries.float
getFloat
(MetadataIndex index) Retrieves an entry as afloat
.int
getInt
(MetadataIndex index) Retrieves an entry as anint
.org.bukkit.inventory.ItemStack
getItem
(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.BlockVector
getOptPosition
(MetadataIndex index) Gets the optional position value for the given MetadataIndex.getString
(MetadataIndex index) Retrieves an entry as aString
.void
void
set
(MetadataIndex index, Object value) Sets the value of a metadata field.void
set
(MetadataIndex index, Object value, boolean force) Sets the value of a metadata field.void
setBit
(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:DynamicallyTypedMap
Retrieves an entry as aboolean
.- Specified by:
getBoolean
in interfaceDynamicallyTypedMap<MetadataIndex>
- Parameters:
index
- the key to look up- Returns:
- the value as a boolean
-
getByte
-
getInt
Description copied from interface:DynamicallyTypedMap
Retrieves an entry as anint
.- Specified by:
getInt
in interfaceDynamicallyTypedMap<MetadataIndex>
- Parameters:
index
- the key to look up- Returns:
- the value as an int
-
getFloat
Description copied from interface:DynamicallyTypedMapWithFloats
Retrieves an entry as afloat
.- Specified by:
getFloat
in interfaceDynamicallyTypedMapWithFloats<MetadataIndex>
- Parameters:
index
- the key to look up- Returns:
- the value as a
float
-
getString
Description copied from interface:DynamicallyTypedMap
Retrieves an entry as aString
.- Specified by:
getString
in 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
-