MapData
Link to mapdata
Importing the class
Link to importing-the-class
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport crafttweaker.api.data.MapData;
Implemented Interfaces
Link to implemented-interfaces
MapData implements the following interfaces. That means all methods defined in these interfaces are also available in MapData
Constructors
Link to constructors
No Description Provided
ZenScript Copynew MapData() as MapData
new MapData();
No Description Provided
ZenScript Copynew MapData(map as IData[string]) as MapData
Parameter | Type | Description |
---|---|---|
Parameter map | Type IData[string] | Description No Description Provided |
Casters
Link to casters
반환 자료형 | 암묵적 |
---|---|
반환 자료형 boolean | 암묵적 false |
반환 자료형 ICollectionData | 암묵적 false |
반환 자료형 IData[string] | 암묵적 true |
반환 자료형 INumberData | 암묵적 false |
Methods
Link to methods
Name: asBoolean
Return Type: boolean
ZenScript Copy// MapData.asBoolean() as boolean
{Hello : "World", Somewhere: "Over the rainbow"}.asBoolean();
Name: asCollection
Return Type: ICollectionData
ZenScript Copy// MapData.asCollection() as ICollectionData
{Hello : "World", Somewhere: "Over the rainbow"}.asCollection();
Name: asFormattedText
Return Type: MCTextComponent
ZenScript CopyMapData.asFormattedText(indentation as string, indentDepth as int) as MCTextComponent
Parameter | Type | Description |
---|---|---|
Parameter indentation | Type string | Description No Description Provided |
Parameter indentDepth | Type int | Description No Description Provided |
Name: asNumber
Return Type: INumberData
ZenScript Copy// MapData.asNumber() as INumberData
{Hello : "World", Somewhere: "Over the rainbow"}.asNumber();
Name: contains
Checks if the Map contains the given key.
Returns: True if the Map contains the key
Return Type: boolean
ZenScript Copy// MapData.contains(key as string) as boolean
{Hello : "World", Somewhere: "Over the rainbow"}.contains("Hello");
Parameter | Type | Description |
---|---|---|
Parameter key | Type string | Description The key to search for |
Name: getAt
Retrieves the value associated with the key
Returns: The value if present, null otherwise
Return Type: IData?
ZenScript Copy// MapData.getAt(key as string) as IData?
{Hello : "World", Somewhere: "Over the rainbow"}.getAt("Hello");
Parameter | Type | Description |
---|---|---|
Parameter key | Type string | Description The key to search for |
Name: getData
Return Type: T
ZenScript CopyMapData.getData<T : IData>(key as string) as T
Parameter | Type | Description |
---|---|---|
Parameter key | Type string | Description No Description Provided |
Parameter T | Type IData | Description No Description Provided |
Name: getId
Gets the ID of the internal NBT tag.
Used to determine what NBT type is stored (in a list for example)
Returns: ID of the NBT tag that this data represents.
Return Type: byte
ZenScript Copy// MapData.getId() as byte
{Hello : "World", Somewhere: "Over the rainbow"}.getId();
Name: getString
Gets the String representation of the internal INBT tag
Returns: String that represents the internal INBT of this IData.
Return Type: string
ZenScript Copy// MapData.getString() as string
{Hello : "World", Somewhere: "Over the rainbow"}.getString();
Name: 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.
Returns: This map, after the merge
Return Type: MapData
ZenScript Copy// MapData.merge(other as MapData) as MapData
{Hello : "World", Somewhere: "Over the rainbow"}.merge({Doodle: "Do"});
Parameter | Type | Description |
---|---|---|
Parameter other | Type MapData | Description The other map. |
Name: put
Adds sets the value for the given key or creates a new entry if it did not exist before.
Returns: The previous value if present, null otherwise
Return Type: IData?
ZenScript Copy// MapData.put(key as string, value as IData) as IData?
{Hello : "World", Somewhere: "Over the rainbow"}.put("Hello", "Goodbye");
Parameter | Type | Description |
---|---|---|
Parameter key | Type string | Description The key to set the value for. |
Parameter value | Type IData | Description The value to set. |
Name: putAll
Adds all entries from the given map into this one. Can override existing keys.
Return Type: void
ZenScript Copy// MapData.putAll(map as IData[string]) as void
{Hello : "World", Somewhere: "Over the rainbow"}.putAll({Hello: "Goodbye", Item: "Bedrock"});
Parameter | Type | Description |
---|---|---|
Parameter map | Type IData[string] | Description The other entries to be added to this map |
Name: remove
Removes the entry with the given key from the Map
Return Type: void
ZenScript Copy// MapData.remove(key as string) as void
{Hello : "World", Somewhere: "Over the rainbow"}.remove("Somewhere");
Parameter | Type | Description |
---|---|---|
Parameter key | Type string | Description The key of the entry to remove |
연산자
Link to 연산자
Name: ADD
Adds all entries from the given IData to this entry
ZenScript CopymyMapData + data as IData
Name: CONTAINS
Checks if the Map contains the given key.
ZenScript Copykey as string in myMapData
"Hello" in {Hello : "World", Somewhere: "Over the rainbow"}
Name: MEMBERGETTER
Retrieves the value associated with the key
ZenScript CopymyMapData.key as string
{Hello : "World", Somewhere: "Over the rainbow"}."Hello"
Name: MEMBERSETTER
Adds sets the value for the given key or creates a new entry if it did not exist before.
ZenScript CopymyMapData.key as string = value as IData
{Hello : "World", Somewhere: "Over the rainbow"}."Hello" = "Goodbye"
Properties
Link to properties
이름 | Type | Has Getter | Has Setter | Description |
---|---|---|---|---|
이름 isEmpty | Type boolean | Has Getter true | Has Setter false | Description No Description Provided |
이름 keySet | Type Set<string> | Has Getter true | Has Setter false | Description No Description Provided |
이름 size | Type int | Has Getter true | Has Setter false | Description No Description Provided |