Class MapData
java.lang.Object
com.blamejared.crafttweaker.api.data.MapData
- All Implemented Interfaces:
IData
- DocParam:
- this {Hello : "World", Somewhere: "Over the rainbow"}
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.blamejared.crafttweaker.api.data.base.IData
IData.Type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Taccept(DataVisitor<T> visitor) asMap()Gets a Map<String, IData> representation of this IData, returns null on anything butMapData.booleanChecks if this IData contains another IData, mainly used in subclasses ofICollectionData, is the same as an equals check on other IData typesbooleanChecks if the Map contains the given key.copy()Makes a copy of this IData.Makes a copy of this IData with a copy of the internal INBT object.booleanRetrieves the value associated with the key<T extends IData>
TRetrieves the value associated with the key and returns it as the given type.net.minecraft.nbt.CompoundTagGets the internal INBT stored in this IData.intgetSize()getType()Gets the type of this IData.inthashCode()booleanisEmpty()Merges this map and the other map.Adds all entries from the given IData to this entryAdds sets the value for the given key or creates a new entry if it did not exist before.voidAdds all entries from the given map into this one.voidRemoves the entry with the given key from the Map
-
Constructor Details
-
MapData
public MapData(net.minecraft.nbt.CompoundTag internal) -
MapData
public MapData() -
MapData
-
MapData
-
-
Method Details
-
putAll
Adds all entries from the given map into this one. Can override existing keys.- Parameters:
map- The other entries to be added to this map- DocParam:
- map {Hello: "Goodbye", Item: "Bedrock"}
-
opAdd
Adds all entries from the given IData to this entry -
getKeySet
-
getSize
public int getSize() -
put
Adds sets the value for the given key or creates a new entry if it did not exist before.- Parameters:
key- The key to set the value for.value- The value to set.- Returns:
- The previous value if present, null otherwise
- DocParam:
- key "Hello", value "Goodbye"
-
getAt
Retrieves the value associated with the key- Parameters:
key- The key to search for- Returns:
- The value if present, null otherwise
- DocParam:
- key "Hello"
-
getData
Retrieves the value associated with the key and returns it as the given type.- Parameters:
key- The key to search for.- Returns:
- The value if present, null otherwise.
- DocParam:
- key "Hello"
-
contains
Checks if the Map contains the given key.- Parameters:
key- The key to search for- Returns:
- True if the Map contains the key
- DocParam:
- key "Hello"
-
remove
Removes the entry with the given key from the Map- Parameters:
key- The key of the entry to remove- DocParam:
- key "Somewhere"
-
isEmpty
public boolean isEmpty() -
merge
Merges this map and the other map. If entries from this map and the other map share the values are tried to be merged. If that does not work, then the value from the other map is used.- Parameters:
other- The other map.- Returns:
- This map, after the merge
- DocParam:
- other {Doodle: "Do"}
-
copy
Description copied from interface:IDataMakes a copy of this IData. IData is immutable by default, use this to create a proper copy of the object. -
copyInternal
Description copied from interface:IDataMakes a copy of this IData with a copy of the internal INBT object.- Specified by:
copyInternalin interfaceIData- Returns:
- a copy of this IData with a copy of the internal INBT object.
-
getInternal
public net.minecraft.nbt.CompoundTag getInternal()Description copied from interface:IDataGets the internal INBT stored in this IData.- Specified by:
getInternalin interfaceIData- Returns:
- the vanilla INBT tag that this IData represents.
-
asMap
Description copied from interface:IDataGets a Map<String, IData> representation of this IData, returns null on anything butMapData. -
contains
Description copied from interface:IDataChecks if this IData contains another IData, mainly used in subclasses ofICollectionData, is the same as an equals check on other IData types -
castToMap
-
getType
Description copied from interface:IDataGets the type of this IData. -
accept
-
equals
-
hashCode
public int hashCode() -
boolDataKeys
-