IData
Link to idata
The IData interface is a generic Interface for handling Data like NBT.
You can cast about all primitives (short, double, string, int, ...) as well as certain arrays to IData.
Remember that while they offer similar features, IData and their counterparts are NOT the same, which is why they will be referred to as DataTypes (e.g. DataBool).
Импорт пакета
Link to импорт-пакета
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.
import crafttweaker.data.IData;
Обзор
Link to обзор
Двоичные операторы | + | - | * | / | % | & | | | ^ | in | == | <, >, <=, >= |
---|---|---|---|---|---|---|---|---|---|---|---|
Двоичные операторы DataBool | + | - | * | / | % | & | | | ^ | in | == | <, >, <=, >= |
Двоичные операторы DataByte | + | - | * | / | % | & | | | ^ | in | == | <, >, <=, >= |
Двоичные операторы DataByte[] | + | - | * | / | % | & | | | ^ | in | == | <, >, <=, >= |
Двоичные операторы DataDouble | + | - | * | / | % | & | | | ^ | in | == | <, >, <=, >= |
Двоичные операторы DataFloat | + | - | * | / | % | & | | | ^ | in | == | <, >, <=, >= |
Двоичные операторы DataInt | + | - | * | / | % | & | | | ^ | in | == | <, >, <=, >= |
Двоичные операторы DataInt[] | + | - | * | / | % | & | | | ^ | in | == | <, >, <=, >= |
Двоичные операторы DataList | + | - | * | / | % | & | | | ^ | in | == | <, >, <=, >= |
Двоичные операторы DataLong | + | - | * | / | % | & | | | ^ | in | == | <, >, <=, >= |
Двоичные операторы DataMap | + | - | * | / | % | & | | | ^ | in | == | <, >, <=, >= |
Двоичные операторы DataShort | + | - | * | / | % | & | | | ^ | in | == | <, >, <=, >= |
Двоичные операторы DataString | + | - | * | / | % | & | | | ^ | in | == | <, >, <=, >= |
Одиночные операторы | - negate | ! not |
---|---|---|
Одиночные операторы DataBool | - negate | ! not |
Одиночные операторы DataByte | - negate | ! not |
Одиночные операторы DataByte[] | - negate | ! not |
Одиночные операторы DataDouble | - negate | ! not |
Одиночные операторы DataFloat | - negate | ! not |
Одиночные операторы DataInt | - negate | ! not |
Одиночные операторы DataInt[] | - negate | ! not |
Одиночные операторы DataList | - negate | ! not |
Одиночные операторы DataLong | - negate | ! not |
Одиночные операторы DataMap | - negate | ! not |
Одиночные операторы DataShort | - negate | ! not |
Одиночные операторы DataString | - negate | ! not |
Index and Members | [i] | [i]=v | .member | .member=v | .length | .immutable | .update(v) |
---|---|---|---|---|---|---|---|
Index and Members DataBool | [i] | [i]=v | .member | .member=v | .length 0 | .immutable | .update(v) |
Index and Members DataByte | [i] | [i]=v | .member | .member=v | .length 0 | .immutable | .update(v) |
Index and Members DataByte[] | [i] | [i]=v | .member | .member=v | .length | .immutable | .update(v) |
Index and Members DataDouble | [i] | [i]=v | .member | .member=v | .length 0 | .immutable | .update(v) |
Index and Members DataFloat | [i] | [i]=v | .member | .member=v | .length 0 | .immutable | .update(v) |
Index and Members DataInt | [i] | [i]=v | .member | .member=v | .length 0 | .immutable | .update(v) |
Index and Members DataInt[] | [i] | [i]=v | .member | .member=v | .length | .immutable | .update(v) |
Index and Members DataList | [i] | [i]=v | .member | .member=v | .length | .immutable | .update(v) |
Index and Members DataLong | [i] | [i]=v | .member | .member=v | .length 0 | .immutable | .update(v) |
Index and Members DataMap | [i] | [i]=v | .member | .member=v | .length | .immutable | .update(v) |
Index and Members DataShort | [i] | [i]=v | .member | .member=v | .length 0 | .immutable | .update(v) |
Index and Members DataString | [i] | [i]=v | .member | .member=v | .length | .immutable | .update(v) |
You can cast IData to a specific type using data.asType()
→ data.asInt();
You can also use the IData Interface to convert types: ("1" as IData).asInt();
Casts from ↓ to → | bool | byte | byte[] | double | float | int | int[] | list | long | Map | short | string |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Casts from ↓ to → DataBool | bool ≡ | byte ✔ | byte[] null | double ✔ | float ✔ | int ✔ | int[] null | list null | long ✔ | null | short ✔ | string ✔ |
Casts from ↓ to → DataByte | bool ✔ | byte ≡ | byte[] null | double ✔ | float ✔ | int ✔ | int[] null | list null | long ✔ | null | short ✔ | string ✔ |
Casts from ↓ to → DataByte[] | bool ✘ | byte ✘ | byte[] ≡ | double ✘ | float ✘ | int ✘ | int[] ✔ | list ✔ | long ✘ | null | short ✘ | string ✔ |
Casts from ↓ to → DataDouble | bool ✔ | byte ✔ | byte[] null | double ≡ | float ✔ | int ✔ | int[] null | list null | long ✔ | null | short ✔ | string ✔ |
Casts from ↓ to → DataFloat | bool ✔ | byte ✔ | byte[] null | double ✔ | float ≡ | int ✔ | int[] null | list null | long ✔ | null | short ✔ | string ✔ |
Casts from ↓ to → DataInt | bool ✔ | byte ✔ | byte[] null | double ✔ | float ✔ | int ≡ | int[] null | list null | long ✔ | null | short ✔ | string ✔ |
Casts from ↓ to → DataInt[] | bool ✘ | byte ✘ | byte[] ✔ | double ✘ | float ✘ | int ✘ | int[] ≡ | list ✔ | long ✘ | null | short ✘ | string ✔ |
Casts from ↓ to → DataList | bool ✘ | byte ✘ | byte[] ✔ | double ✘ | float ✘ | int ✘ | int[] ✔ | list ≡ | long ✘ | null | short ✘ | string ✔ |
Casts from ↓ to → DataLong | bool ✔ | byte ✔ | byte[] null | double ✔ | float ✔ | int ✔ | int[] null | list null | long ≡ | null | short ✔ | string ✔ |
Casts from ↓ to → DataMap | bool ✘ | byte ✘ | byte[] null | double ✘ | float ✘ | int ✘ | int[] null | list null | long ✘ | ≡ | short ✘ | string ✔ |
Casts from ↓ to → DataShort | bool ✔ | byte ✔ | byte[] null | double ✔ | float ✔ | int ✔ | int[] null | list null | long ✔ | null | short ≡ | string ✔ |
Casts from ↓ to → DataString | bool ✘ | byte ✔ | byte[] null | double ✔ | float ✔ | int ✔ | int[] null | list null | long ✔ | null | short ✔ | string ≡ |