Interface IData
- All Superinterfaces:
Comparable<IData>,Iterable<IData>
- All Known Implementing Classes:
BoolData,ByteArrayData,ByteData,DoubleData,EmptyData,FloatData,IntArrayData,IntData,ListData,LongArrayData,LongData,MapData,ShortData,StringData
@ZenRegister(loaders={"crafttweaker","tags"})
public interface IData
extends Comparable<IData>, Iterable<IData>
- DocParam:
- this (1 as IData)
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumUsed to specify what "type" of IData this is. -
Method Summary
Modifier and TypeMethodDescription<T> Taccept(DataVisitor<T> visitor) default IDataAdds the given IData to this IData.default IDataApplies a bitwise AND (invalid input: '&') operation to this IData and the other IDatadefault booleanasBool()Casts this IData to a boolean.default @org.openzen.zencode.java.ZenCodeType.Unsigned byteasByte()Casts this IData to a byte.default byte[]Casts this IData to a byte array.default doubleasDouble()Casts this IData to a double.default floatasFloat()Casts this IData to a float.default intasInt()Casts this IData to an int.default int[]Casts this IData to an int array.asList()Casts this IData to a list.default longasLong()Casts this IData to a long.default long[]Casts this IData to a long array.asMap()Casts this IData to a map.default shortasShort()Casts this IData to a short.default StringasString()Gets an escaped string version of this IData, quotes are included in the outputdefault IDataConcatenates the given IData to this IData.default intCompares this IData to the other IDatadefault booleanChecks if this IData contains the other IDatadefault booleancontainsList(List<IData> dataValues) copy()default IDataDivides the given IData from this IData.default booleanChecks if this IData is equal to the other IData.default StringGets the literal string version of this IData.default IDatagetAt(int index) Gets the data at the given index.default IDataGets the data at the given key.default bytegetId()Gets the internal ID of this data.net.minecraft.nbt.TagGets the internal Tag stored in this IData.getKeys()Gets the keys of this IDatagetType()Gets the type of this IData.default booleanisEmpty()Checks if this data is empty.default booleanChecks if this data supports being cast to a list.default booleanChecks if this data supports being cast to a map.iterator()default intlength()Gets the length of this IData.static IDataCreates a collection of the given IData members.default IDataMaps this IData to another IData based on the given operation.default IDataMerges the given data with this data.default IDataApplies a modulo operation to this IData against the other IData.default IDataMultiplies the given IData to this IData.default IDataneg()Negates this IData.default IDatanot()Applies a NOT (!) operation to this IData.default IDataApplies a bitwise OR (|) operation to this IData and the other IDatadefault voidPuts the given value inside this IData at the given index.default voidremove(int index) Removes the stored data at the given index.default voidRemoves the stored data at the given key.default voidSets the given value inside this IData at the given index.default IDataApplies a SHL (invalid input: '<'invalid input: '<') operation to this data by the other datadefault IDataApplies a SHR (>>) operation to this data by the other datadefault IDataSubtracts the given IData from this IData.default IDataApplies a bitwise XOR (^) operation to this IData and the other IDataMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
listOf
Creates a collection of the given IData members.This attempts to give the most accurate type for the given members, for example, if all the members are bytes, then it returns a ByteArrayData. However if the types are mixed or do not have a *ArrayData version, then a ListData is returned.
- Parameters:
members- The members to put in the list.- Returns:
- A list of the given members.
- DocParam:
- members 1, 2, 3
-
add
Adds the given IData to this IData.- Parameters:
other- the other data to add.- Returns:
- A new IData after adding the other data.
- DocParam:
- other 2
-
sub
Subtracts the given IData from this IData.- Parameters:
other- the other data to remove.- Returns:
- A new IData after removing the other data.
- DocParam:
- other 2
-
mul
Multiplies the given IData to this IData.- Parameters:
other- the other data to multiply by.- Returns:
- A new IData after multiplying the other data.
- DocParam:
- other 2
-
div
Divides the given IData from this IData.- Parameters:
other- the other data to divide by.- Returns:
- A new IData after dividing the other data.
- DocParam:
- other 2
-
mod
Applies a modulo operation to this IData against the other IData.- Parameters:
other- the other data to modulo by.- Returns:
- A new IData after applying a modulo operation.
- DocParam:
- other 2
-
cat
Concatenates the given IData to this IData.- Parameters:
other- the other data to concatenate.- Returns:
- A new IData after concatenating the other data.
- DocParam:
- other 2
-
or
Applies a bitwise OR (|) operation to this IData and the other IData- Parameters:
other- the other data.- Returns:
- A new IData after applying a bitwise OR operation.
- DocParam:
- other 2
-
and
Applies a bitwise AND (invalid input: '&') operation to this IData and the other IData- Parameters:
other- the other data.- Returns:
- A new IData after applying a bitwise AND operation.
- DocParam:
- other 2
-
xor
Applies a bitwise XOR (^) operation to this IData and the other IData- Parameters:
other- the other data.- Returns:
- A new IData after applying a bitwise XOR operation.
- DocParam:
- other 2
-
neg
Negates this IData.- Returns:
- The negation of this IData.
-
not
Applies a NOT (!) operation to this IData.- Returns:
- The result of the NOT operation.
- DocParam:
- this true
-
put
Puts the given value inside this IData at the given index.- Parameters:
index- The key to store the data atvalue- The data to store.- DocParam:
- index "key", value "value", this new MapData()
-
getAt
Gets the data at the given index.- Parameters:
index- The index to get- Returns:
- The data at the index.
- DocParam:
- index 0, this [1, 2, 3] as IData
-
getAt
Gets the data at the given key.- Parameters:
key- The key to get- Returns:
- The data at the key.
- DocParam:
- index "key", this {key: "value"}
-
contains
Checks if this IData contains the other IDataFor most data types, this will check equality of the data, but for map data, it will check if the other data is a string, and then check if it contains a key with that name
- Parameters:
other- the other data to check- Returns:
- true if this data contains the other data.
-
compareTo
Compares this IData to the other IData- Specified by:
compareToin interfaceComparable<IData>- Parameters:
other- the data to be compared.- Returns:
- The comparison result.
- DocParam:
- other 5
-
remove
default void remove(int index) Removes the stored data at the given index.- Parameters:
index- The index to remove.- DocParam:
- index 0, this [1, 2, 3] as IData
-
remove
Removes the stored data at the given key.- Parameters:
key- The key to remove.- DocParam:
- key "key", this {key: "value"} as IData
-
setAt
Sets the given value inside this IData at the given index.- Parameters:
name- The key to store the data atdata- The data to store.- DocParam:
- index "key", value "value", this new MapData()
-
equalTo
Checks if this IData is equal to the other IData.- Parameters:
other- The data to check equality of.- Returns:
- True if equal, false otherwise.
-
shl
Applies a SHL (invalid input: '<'invalid input: '<') operation to this data by the other data- Parameters:
other- The data to SHL by.- Returns:
- The result of the SHL operation.
- DocParam:
- other 2
-
shr
Applies a SHR (>>) operation to this data by the other data- Parameters:
other- The data to SHR by.- Returns:
- The result of the SHR operation.
- DocParam:
- other 2
-
asBool
default boolean asBool()Casts this IData to a boolean.- Returns:
- this data as a bool
-
asByte
default @org.openzen.zencode.java.ZenCodeType.Unsigned byte asByte()Casts this IData to a byte.- Returns:
- this data as a byte
-
asShort
default short asShort()Casts this IData to a short.- Returns:
- this data as a short
-
asInt
default int asInt()Casts this IData to an int.- Returns:
- this data as an int
-
asLong
default long asLong()Casts this IData to a long.- Returns:
- this data as a long
-
asFloat
default float asFloat()Casts this IData to a float.- Returns:
- this data as a float
-
asDouble
default double asDouble()Casts this IData to a double.- Returns:
- this data as a double
-
asString
Gets an escaped string version of this IData, quotes are included in the outputE.G
println(("hello" as IData).asString())prints"hello"- Returns:
- The escaped string version of this IData.
-
getAsString
Gets the literal string version of this IData.E.G
println(("hello" as IData).getAsString())printshello- Returns:
- The literal string version of this IData.
-
asList
Casts this IData to a list.- Returns:
- this data as a list
-
asMap
Casts this IData to a map.- Returns:
- this data as a map
-
asByteArray
default byte[] asByteArray()Casts this IData to a byte array.- Returns:
- this data as a byte array
-
asIntArray
default int[] asIntArray()Casts this IData to an int array.- Returns:
- this data as an int array
-
asLongArray
default long[] asLongArray()Casts this IData to a long array.- Returns:
- this data as a long array
-
length
default int length()Gets the length of this IData.- Returns:
- The length of this IData.
-
getKeys
Gets the keys of this IData- Returns:
- The keys of this IData.
-
iterator
-
merge
Merges the given data with this data.- Parameters:
other- the data to merge- Returns:
- the result of merging the datas.
- DocParam:
- this {}
-
isEmpty
default boolean isEmpty()Checks if this data is empty.- Returns:
- True if empty.
-
getId
default byte getId()Gets the internal ID of this data.- Returns:
- the intenral ID of this data.
-
getInternal
net.minecraft.nbt.Tag getInternal()Gets the internal Tag stored in this IData.- Returns:
- the vanilla Tag that this IData represents.
-
copy
IData copy() -
copyInternal
IData copyInternal() -
accept
-
map
Maps this IData to another IData based on the given operation.- Parameters:
operation- The operation to apply to this IData- Returns:
- A new IData from the operation
- DocParam:
- operation (data) => 3
-
getType
IData.Type getType()Gets the type of this IData.- Returns:
- The type of this IData.
-
isListable
@Internal default boolean isListable()Checks if this data supports being cast to a list.- Returns:
- True if it can be cast to a list, false otherwise.
-
isMappable
@Internal default boolean isMappable()Checks if this data supports being cast to a map.- Returns:
- True if it can be cast to a map, false otherwise.
-
containsList
-