Class NbtCompound
-
- All Implemented Interfaces:
-
java.lang.Comparable
,java.util.Map
,pers.neige.neigeitems.libs.bot.inker.bukkit.nbt.api.NbtComponentLike
,pers.neige.neigeitems.libs.bot.inker.bukkit.nbt.api.NbtLike
public class NbtCompound extends Nbt<NMS> implements NbtComponentLike
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
NbtCompound.Unsafe
-
Constructor Summary
Constructors Constructor Description NbtCompound()
-
Method Summary
Modifier and Type Method Description static NbtCompound
createUnsafe(Object delegate)
Set<String>
getAllKeys()
Nbt<out Object>
get(String key)
Nbt<out Object>
get(Object key)
boolean
containsKey(String key)
boolean
containsKey(Object key)
boolean
containsValue(Object value)
Nbt<out Object>
put(String key, Nbt<out Object> value)
Nbt<out Object>
remove(String key)
void
putAll(@NonNull() Map<out String, out Nbt<out Object>> m)
void
clear()
int
size()
Set<String>
keySet()
Collection<Nbt<out Object>>
values()
Set<Map.Entry<String, Nbt<out Object>>>
entrySet()
void
delete(String key)
void
set(String key, Nbt<out Object> value)
void
putByte(String key, byte value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例. void
putShort(String key, short value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例. void
putInt(String key, int value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例. void
putLong(String key, long value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例. void
putUUID(String key, UUID value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例. void
putFloat(String key, float value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例. void
putDouble(String key, double value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例. void
putString(String key, String value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例. void
putByteArray(String key, Array<byte> value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例. void
putByteArray(String key, List<Byte> value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例. void
putIntArray(String key, Array<int> value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例. void
putIntArray(String key, List<Integer> value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例. void
putLongArray(String key, Array<long> value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例. void
putLongArray(String key, List<Long> value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例. void
putBoolean(String key, boolean value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例. byte
getTagType(String key)
获取指定 NBT键 对应的 NBT值 的 NBT类型. boolean
contains(String key, int value)
检测指定 NBT键 对应的 NBT值 是否属于对应类型. byte
getByte(@NonNull() String key, byte def)
根据 NBT键 获取对应的 byte, 如果没有找到对应的 byte 则返回默认值. Byte
getByteOrNull(@NonNull() String key)
根据 NBT键 获取对应的 byte, 如果没有找到对应的 byte 则返回 null. short
getShort(@NonNull() String key, short def)
根据 NBT键 获取对应的 short, 如果没有找到对应的 short 则返回默认值. Short
getShortOrNull(@NonNull() String key)
根据 NBT键 获取对应的 short, 如果没有找到对应的 short 则返回 null. int
getInt(@NonNull() String key, int def)
根据 NBT键 获取对应的 int, 如果没有找到对应的 int 则返回默认值. Integer
getIntOrNull(@NonNull() String key)
根据 NBT键 获取对应的 int, 如果没有找到对应的 int 则返回 null. long
getLong(@NonNull() String key, long def)
根据 NBT键 获取对应的 long, 如果没有找到对应的 long 则返回默认值. Long
getLongOrNull(@NonNull() String key)
根据 NBT键 获取对应的 long, 如果没有找到对应的 long 则返回 null. UUID
getUUID(@NonNull() String key, @Nullable() UUID def)
根据 NBT键 获取对应的 UUID, 如果没有找到对应的 UUID 则返回默认值. float
getFloat(@NonNull() String key, float def)
根据 NBT键 获取对应的 float, 如果没有找到对应的 float 则返回默认值. Float
getFloatOrNull(@NonNull() String key)
根据 NBT键 获取对应的 float, 如果没有找到对应的 float 则返回 null. double
getDouble(@NonNull() String key, double def)
根据 NBT键 获取对应的 double, 如果没有找到对应的 double 则返回默认值. Double
getDoubleOrNull(@NonNull() String key)
根据 NBT键 获取对应的 double, 如果没有找到对应的 double 则返回 null. String
getString(@NonNull() String key, @Nullable() String def)
根据 NBT键 获取对应的 String, 如果没有找到对应的 String 则返回默认值. Array<byte>
getByteArray(@NonNull() String key, Array<byte> def)
根据 NBT键 获取对应的 byte[], 如果没有找到对应的 byte[] 则返回默认值. Array<int>
getIntArray(@NonNull() String key, Array<int> def)
根据 NBT键 获取对应的 int[], 如果没有找到对应的 int[] 则返回默认值. Array<long>
getLongArray(@NonNull() String key, Array<long> def)
根据 NBT键 获取对应的 long[], 如果没有找到对应的 long[] 则返回默认值. NbtCompound
getCompound(@NonNull() String key, @Nullable() NbtCompound def)
根据 NBT键 获取对应的 NbtCompound, 如果没有找到对应的 NbtCompound 则返回默认值. NbtCompound
getOrCreateCompound(@NonNull() String key)
根据 NBT键 获取对应的 NbtCompound, 如果没有找到对应的 NbtCompound 则设置并返回一个空 NbtCompound. NbtList
getList(String key, int elementType)
根据 NBT键 和 NBT类型 获取对应的 NbtList, 如果没有找到对应的 NbtList 或 类型不符 则返回 null. NbtList
getList(@NonNull() String key, @Nullable() NbtList def)
根据 NBT键 获取对应的 NbtList, 如果没有找到对应的 NbtList 则返回默认值. NbtList
getOrCreateList(@NonNull() String key)
根据 NBT键 获取对应的 NbtList, 如果没有找到对应的 NbtList 则设置并返回一个空 NbtList. boolean
getBoolean(@NonNull() String key, boolean def)
根据 NBT键 获取对应的 boolean, 如果没有找到对应的 boolean 则返回默认值. Boolean
getBooleanOrNull(@NonNull() String key)
根据 NBT键 获取对应的 boolean, 如果没有找到对应的 boolean 则返回 null. boolean
isEmpty()
NbtCompound
clone()
Nbt<out Object>
getDeep(@NonNull() String key, char separator, char escape)
根据 NBT键 获取对应的 Nbt, 如果没有找到对应的 Nbt 则返回 null. Nbt<out Object>
getDeep(@NonNull() String key)
根据 NBT键 获取对应的 Nbt, 如果没有找到对应的 Nbt 则返回 null. byte
getDeepByte(@NonNull() String key, byte def)
根据 NBT键 获取对应的 byte, 如果没有找到对应的 byte 则返回默认值. Byte
getDeepByteOrNull(@NonNull() String key)
根据 NBT键 获取对应的 byte, 如果没有找到对应的 byte 则返回 null. short
getDeepShort(@NonNull() String key, short def)
根据 NBT键 获取对应的 short, 如果没有找到对应的 short 则返回默认值. Short
getDeepShortOrNull(@NonNull() String key)
根据 NBT键 获取对应的 short, 如果没有找到对应的 short 则返回 null. int
getDeepInt(@NonNull() String key, int def)
根据 NBT键 获取对应的 int, 如果没有找到对应的 int 则返回默认值. Integer
getDeepIntOrNull(@NonNull() String key)
根据 NBT键 获取对应的 int, 如果没有找到对应的 int 则返回 null. long
getDeepLong(@NonNull() String key, long def)
根据 NBT键 获取对应的 long, 如果没有找到对应的 long 则返回默认值. Long
getDeepLongOrNull(@NonNull() String key)
根据 NBT键 获取对应的 long, 如果没有找到对应的 long 则返回 null. UUID
getDeepUUID(@NonNull() String key, @Nullable() UUID def)
根据 NBT键 获取对应的 UUID, 如果没有找到对应的 UUID 则返回默认值. float
getDeepFloat(@NonNull() String key, float def)
根据 NBT键 获取对应的 float, 如果没有找到对应的 float 则返回默认值. Float
getDeepFloatOrNull(@NonNull() String key)
根据 NBT键 获取对应的 float, 如果没有找到对应的 float 则返回 null. double
getDeepDouble(@NonNull() String key, double def)
根据 NBT键 获取对应的 double, 如果没有找到对应的 double 则返回默认值. Double
getDeepDoubleOrNull(@NonNull() String key)
根据 NBT键 获取对应的 double, 如果没有找到对应的 double 则返回 null. String
getDeepString(@NonNull() String key, @Nullable() String def)
根据 NBT键 获取对应的 String, 如果没有找到对应的 String 则返回默认值. Array<byte>
getDeepByteArray(@NonNull() String key, Array<byte> def)
根据 NBT键 获取对应的 byte[], 如果没有找到对应的 byte[] 则返回默认值. Array<int>
getDeepIntArray(@NonNull() String key, Array<int> def)
根据 NBT键 获取对应的 int[], 如果没有找到对应的 int[] 则返回默认值. Array<long>
getDeepLongArray(@NonNull() String key, Array<long> def)
根据 NBT键 获取对应的 long[], 如果没有找到对应的 long[] 则返回默认值. NbtCompound
getDeepCompound(@NonNull() String key, @Nullable() NbtCompound def)
根据 NBT键 获取对应的 NbtCompound, 如果没有找到对应的 NbtCompound 则返回默认值. NbtList
getDeepList(@NonNull() String key, @Nullable() NbtList def)
根据 NBT键 获取对应的 NbtList, 如果没有找到对应的 NbtList 则返回默认值. boolean
getDeepBoolean(@NonNull() String key, boolean def)
根据 NBT键 获取对应的 boolean, 如果没有找到对应的 boolean 则返回默认值. Boolean
getDeepBooleanOrNull(@NonNull() String key)
根据 NBT键 获取对应的 boolean, 如果没有找到对应的 boolean 则返回 null. void
putDeep(@NonNull() String key, @NonNull() Nbt<out Object> value, boolean force)
void
putDeepByteArray(@NonNull() String key, Array<byte> value, boolean force)
将指定的 NBT键 设置为给定值. void
putDeepByteArray(@NonNull() String key, @NonNull() List<Byte> value, boolean force)
将指定的 NBT键 设置为给定值. void
putDeepIntArray(@NonNull() String key, Array<int> value, boolean force)
将指定的 NBT键 设置为给定值. void
putDeepIntArray(@NonNull() String key, @NonNull() List<Integer> value, boolean force)
将指定的 NBT键 设置为给定值. void
putDeepLongArray(@NonNull() String key, Array<long> value, boolean force)
将指定的 NBT键 设置为给定值. void
putDeepLongArray(@NonNull() String key, @NonNull() List<Long> value, boolean force)
将指定的 NBT键 设置为给定值. void
saveTo(@NonNull() ItemStack itemStack)
将当前 NbtCompound 保存至对应的 ItemStack. NbtCompound
coverWith(@NonNull() NbtCompound overlayCompound)
使用给定的 NbtCompound 覆盖当前 NbtCompound. int
compareTo(@NonNull() Nbt<out Object> o)
-
Methods inherited from class pers.neige.neigeitems.libs.bot.inker.bukkit.nbt.Nbt
equals, getAsString, getId, hashCode, toString
-
Methods inherited from class pers.neige.neigeitems.libs.bot.inker.bukkit.nbt.api.NbtComponentLike
contains, contains, delete, getBoolean, getByte, getByteArray, getByteArrayOrNull, getCompound, getCompoundOrNull, getDeepBoolean, getDeepByte, getDeepByteArray, getDeepByteArrayOrNull, getDeepCompound, getDeepCompoundOrNull, getDeepDouble, getDeepFloat, getDeepInt, getDeepIntArray, getDeepIntArrayOrNull, getDeepList, getDeepListOrNull, getDeepLong, getDeepLongArray, getDeepLongArrayOrNull, getDeepShort, getDeepString, getDeepStringOrNull, getDeepUUID, getDeepUUIDOrNull, getDouble, getFloat, getInt, getIntArray, getIntArrayOrNull, getList, getListOrNull, getLong, getLongArray, getLongArrayOrNull, getShort, getString, getStringOrNull, getUUID, getUUIDOrNull, putDeep, putDeep, putDeepBoolean, putDeepBoolean, putDeepByte, putDeepByte, putDeepByteArray, putDeepByteArray, putDeepDouble, putDeepDouble, putDeepFloat, putDeepFloat, putDeepInt, putDeepInt, putDeepIntArray, putDeepIntArray, putDeepLong, putDeepLong, putDeepLongArray, putDeepLongArray, putDeepShort, putDeepShort, putDeepString, putDeepString, remove, removeDeep, removeDeep
-
Methods inherited from class pers.neige.neigeitems.libs.bot.inker.bukkit.nbt.api.NbtLike
clone
-
Methods inherited from class java.lang.Comparable
compareTo
-
Methods inherited from class java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, copyOf, entry, forEach, get, getOrDefault, merge, of, ofEntries, putIfAbsent, remove, remove, replace, replace, replaceAll
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
createUnsafe
static NbtCompound createUnsafe(Object delegate)
-
getAllKeys
Set<String> getAllKeys()
-
containsKey
boolean containsKey(String key)
-
containsKey
boolean containsKey(Object key)
-
containsValue
boolean containsValue(Object value)
-
clear
void clear()
-
size
int size()
-
values
@NonNull() Collection<Nbt<out Object>> values()
-
putByte
void putByte(String key, byte value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例.
-
putShort
void putShort(String key, short value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例.
-
putInt
void putInt(String key, int value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例.
-
putLong
void putLong(String key, long value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例.
-
putUUID
void putUUID(String key, UUID value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例.
-
putFloat
void putFloat(String key, float value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例.
-
putDouble
void putDouble(String key, double value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例.
-
putString
void putString(String key, String value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例.
-
putByteArray
void putByteArray(String key, Array<byte> value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例.
-
putByteArray
void putByteArray(String key, List<Byte> value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例.
-
putIntArray
void putIntArray(String key, Array<int> value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例.
-
putIntArray
void putIntArray(String key, List<Integer> value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例.
-
putLongArray
void putLongArray(String key, Array<long> value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例.
-
putLongArray
void putLongArray(String key, List<Long> value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例.
-
putBoolean
void putBoolean(String key, boolean value)
等价于 Map#put(Object, Object) 方法, 区别在于将 value 转换为了对应类型的 NBT实例.
-
getTagType
byte getTagType(String key)
获取指定 NBT键 对应的 NBT值 的 NBT类型.
- Parameters:
key
- 待检测的 NBT键.- Returns:
指定 NBT键 对应的 NBT值 的 NBT类型, 数字与类型的对应关系详见 pers.neige.neigeitems.libs.bot.inker.bukkit.nbt.NbtType 类所属的公有静态变量.
-
contains
boolean contains(String key, int value)
检测指定 NBT键 对应的 NBT值 是否属于对应类型.
- Parameters:
key
- 待检测的 NBT键.value
- NBT类型, 数字与类型的对应关系详见 pers.neige.neigeitems.libs.bot.inker.bukkit.nbt.NbtType 类所属的公有静态变量.- Returns:
指定 NBT键 对应的 NBT值 是否属于对应类型.
-
getByte
byte getByte(@NonNull() String key, byte def)
根据 NBT键 获取对应的 byte, 如果没有找到对应的 byte 则返回默认值.
- Parameters:
key
- 要获取 byte 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 数字, 则返回的默认值.- Returns:
待查找的 byte.
-
getByteOrNull
@Nullable() Byte getByteOrNull(@NonNull() String key)
根据 NBT键 获取对应的 byte, 如果没有找到对应的 byte 则返回 null.
- Parameters:
key
- 要获取 byte 的 NBT键.- Returns:
待查找的 byte.
-
getShort
short getShort(@NonNull() String key, short def)
根据 NBT键 获取对应的 short, 如果没有找到对应的 short 则返回默认值.
- Parameters:
key
- 要获取 short 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 数字, 则返回的默认值.- Returns:
待查找的 short.
-
getShortOrNull
@Nullable() Short getShortOrNull(@NonNull() String key)
根据 NBT键 获取对应的 short, 如果没有找到对应的 short 则返回 null.
- Parameters:
key
- 要获取 short 的 NBT键.- Returns:
待查找的 short.
-
getInt
int getInt(@NonNull() String key, int def)
根据 NBT键 获取对应的 int, 如果没有找到对应的 int 则返回默认值.
- Parameters:
key
- 要获取 int 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 数字, 则返回的默认值.- Returns:
待查找的 int.
-
getIntOrNull
@Nullable() Integer getIntOrNull(@NonNull() String key)
根据 NBT键 获取对应的 int, 如果没有找到对应的 int 则返回 null.
- Parameters:
key
- 要获取 int 的 NBT键.- Returns:
待查找的 int.
-
getLong
long getLong(@NonNull() String key, long def)
根据 NBT键 获取对应的 long, 如果没有找到对应的 long 则返回默认值.
- Parameters:
key
- 要获取 long 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 数字, 则返回的默认值.- Returns:
待查找的 long.
-
getLongOrNull
@Nullable() Long getLongOrNull(@NonNull() String key)
根据 NBT键 获取对应的 long, 如果没有找到对应的 long 则返回 null.
- Parameters:
key
- 要获取 long 的 NBT键.- Returns:
待查找的 long.
-
getUUID
@Contract(value = "_, !null -> !null")@Nullable() UUID getUUID(@NonNull() String key, @Nullable() UUID def)
根据 NBT键 获取对应的 UUID, 如果没有找到对应的 UUID 则返回默认值.
- Parameters:
key
- 要获取 UUID 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 UUID, 则返回的默认值.- Returns:
待查找的 UUID.
-
getFloat
float getFloat(@NonNull() String key, float def)
根据 NBT键 获取对应的 float, 如果没有找到对应的 float 则返回默认值.
- Parameters:
key
- 要获取 float 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 数字, 则返回的默认值.- Returns:
待查找的 float.
-
getFloatOrNull
@Nullable() Float getFloatOrNull(@NonNull() String key)
根据 NBT键 获取对应的 float, 如果没有找到对应的 float 则返回 null.
- Parameters:
key
- 要获取 float 的 NBT键.- Returns:
待查找的 float.
-
getDouble
double getDouble(@NonNull() String key, double def)
根据 NBT键 获取对应的 double, 如果没有找到对应的 double 则返回默认值.
- Parameters:
key
- 要获取 double 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 数字, 则返回的默认值.- Returns:
待查找的 double.
-
getDoubleOrNull
@Nullable() Double getDoubleOrNull(@NonNull() String key)
根据 NBT键 获取对应的 double, 如果没有找到对应的 double 则返回 null.
- Parameters:
key
- 要获取 double 的 NBT键.- Returns:
待查找的 double.
-
getString
@Contract(value = "_, !null -> !null")@Nullable() String getString(@NonNull() String key, @Nullable() String def)
根据 NBT键 获取对应的 String, 如果没有找到对应的 String 则返回默认值.
- Parameters:
key
- 要获取 String 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不存在, 则返回的默认值.- Returns:
待查找的 String.
-
getByteArray
@Contract(value = "_, !null -> !null") Array<byte> getByteArray(@NonNull() String key, Array<byte> def)
根据 NBT键 获取对应的 byte[], 如果没有找到对应的 byte[] 则返回默认值.
- Parameters:
key
- 要获取 byte[] 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 byte[], 则返回的默认值.- Returns:
待查找的 byte[].
-
getIntArray
@Contract(value = "_, !null -> !null") Array<int> getIntArray(@NonNull() String key, Array<int> def)
根据 NBT键 获取对应的 int[], 如果没有找到对应的 int[] 则返回默认值.
- Parameters:
key
- 要获取 int[] 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 int[], 则返回的默认值.- Returns:
待查找的 int[].
-
getLongArray
@Contract(value = "_, !null -> !null") Array<long> getLongArray(@NonNull() String key, Array<long> def)
根据 NBT键 获取对应的 long[], 如果没有找到对应的 long[] 则返回默认值.
- Parameters:
key
- 要获取 long[] 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 long[], 则返回的默认值.- Returns:
待查找的 long[].
-
getCompound
@Contract(value = "_, !null -> !null")@Nullable() NbtCompound getCompound(@NonNull() String key, @Nullable() NbtCompound def)
根据 NBT键 获取对应的 NbtCompound, 如果没有找到对应的 NbtCompound 则返回默认值.
- Parameters:
key
- 要获取 NbtCompound 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 NbtCompound, 则返回的默认值.- Returns:
待查找的 NbtCompound.
-
getOrCreateCompound
@NonNull() NbtCompound getOrCreateCompound(@NonNull() String key)
根据 NBT键 获取对应的 NbtCompound, 如果没有找到对应的 NbtCompound 则设置并返回一个空 NbtCompound.
- Parameters:
key
- 要获取 NbtCompound 的 NBT键.- Returns:
待查找的 NbtCompound.
-
getList
NbtList getList(String key, int elementType)
根据 NBT键 和 NBT类型 获取对应的 NbtList, 如果没有找到对应的 NbtList 或 类型不符 则返回 null.
- Parameters:
key
- 要获取 NbtList 的 NBT键.elementType
- NbtList 的 期望类型(可藉由 NbtType 类传入).- Returns:
待查找的 NbtList.
-
getList
@Contract(value = "_, !null -> !null")@Nullable() NbtList getList(@NonNull() String key, @Nullable() NbtList def)
根据 NBT键 获取对应的 NbtList, 如果没有找到对应的 NbtList 则返回默认值.
- Parameters:
key
- 要获取 NbtList 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 NbtList, 则返回的默认值.- Returns:
待查找的 NbtList.
-
getOrCreateList
@NonNull() NbtList getOrCreateList(@NonNull() String key)
根据 NBT键 获取对应的 NbtList, 如果没有找到对应的 NbtList 则设置并返回一个空 NbtList.
- Parameters:
key
- 要获取 NbtList 的 NBT键.- Returns:
待查找的 NbtList.
-
getBoolean
boolean getBoolean(@NonNull() String key, boolean def)
根据 NBT键 获取对应的 boolean, 如果没有找到对应的 boolean 则返回默认值.
- Parameters:
key
- 要获取 boolean 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 boolean, 则返回的默认值.- Returns:
待查找的 boolean.
-
getBooleanOrNull
@Nullable() Boolean getBooleanOrNull(@NonNull() String key)
根据 NBT键 获取对应的 boolean, 如果没有找到对应的 boolean 则返回 null.
- Parameters:
key
- 要获取 boolean 的 NBT键.- Returns:
待查找的 boolean.
-
isEmpty
boolean isEmpty()
-
clone
@NonNull() NbtCompound clone()
-
getDeep
@Nullable() Nbt<out Object> getDeep(@NonNull() String key, char separator, char escape)
根据 NBT键 获取对应的 Nbt, 如果没有找到对应的 Nbt 则返回 null. 例如 key 填写 "test.test\\.test", separator 填写 '.', escape 填写 '\\'. 最后将获取键为 "test" 的 NbtComponentLike 下键为 "test.test" 的 NbtLike 的值.
- Parameters:
key
- 要获取 Nbt 的 NBT键.separator
- 多级NBT键分隔符.escape
- 分隔符转义符.- Returns:
待查找的 Nbt.
-
getDeep
@Nullable() Nbt<out Object> getDeep(@NonNull() String key)
根据 NBT键 获取对应的 Nbt, 如果没有找到对应的 Nbt 则返回 null. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 Nbt 的 NBT键.- Returns:
待查找的 Nbt.
-
getDeepByte
byte getDeepByte(@NonNull() String key, byte def)
根据 NBT键 获取对应的 byte, 如果没有找到对应的 byte 则返回默认值. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 byte 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 数字, 则返回的默认值.- Returns:
待查找的 byte.
-
getDeepByteOrNull
@Nullable() Byte getDeepByteOrNull(@NonNull() String key)
根据 NBT键 获取对应的 byte, 如果没有找到对应的 byte 则返回 null. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 byte 的 NBT键.- Returns:
待查找的 byte.
-
getDeepShort
short getDeepShort(@NonNull() String key, short def)
根据 NBT键 获取对应的 short, 如果没有找到对应的 short 则返回默认值. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 short 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 数字, 则返回的默认值.- Returns:
待查找的 short.
-
getDeepShortOrNull
@Nullable() Short getDeepShortOrNull(@NonNull() String key)
根据 NBT键 获取对应的 short, 如果没有找到对应的 short 则返回 null. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 short 的 NBT键.- Returns:
待查找的 short.
-
getDeepInt
int getDeepInt(@NonNull() String key, int def)
根据 NBT键 获取对应的 int, 如果没有找到对应的 int 则返回默认值. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 int 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 数字, 则返回的默认值.- Returns:
待查找的 int.
-
getDeepIntOrNull
@Nullable() Integer getDeepIntOrNull(@NonNull() String key)
根据 NBT键 获取对应的 int, 如果没有找到对应的 int 则返回 null. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 int 的 NBT键.- Returns:
待查找的 int.
-
getDeepLong
long getDeepLong(@NonNull() String key, long def)
根据 NBT键 获取对应的 long, 如果没有找到对应的 long 则返回默认值. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 long 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 数字, 则返回的默认值.- Returns:
待查找的 long.
-
getDeepLongOrNull
@Nullable() Long getDeepLongOrNull(@NonNull() String key)
根据 NBT键 获取对应的 long, 如果没有找到对应的 long 则返回 null. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 long 的 NBT键.- Returns:
待查找的 long.
-
getDeepUUID
@Contract(value = "_, !null -> !null")@Nullable() UUID getDeepUUID(@NonNull() String key, @Nullable() UUID def)
根据 NBT键 获取对应的 UUID, 如果没有找到对应的 UUID 则返回默认值. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 UUID 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 UUID, 则返回的默认值.- Returns:
待查找的 UUID.
-
getDeepFloat
float getDeepFloat(@NonNull() String key, float def)
根据 NBT键 获取对应的 float, 如果没有找到对应的 float 则返回默认值. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 float 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 数字, 则返回的默认值.- Returns:
待查找的 float.
-
getDeepFloatOrNull
@Nullable() Float getDeepFloatOrNull(@NonNull() String key)
根据 NBT键 获取对应的 float, 如果没有找到对应的 float 则返回 null. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 float 的 NBT键.- Returns:
待查找的 float.
-
getDeepDouble
double getDeepDouble(@NonNull() String key, double def)
根据 NBT键 获取对应的 double, 如果没有找到对应的 double 则返回默认值. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 double 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 数字, 则返回的默认值.- Returns:
待查找的 double.
-
getDeepDoubleOrNull
@Nullable() Double getDeepDoubleOrNull(@NonNull() String key)
根据 NBT键 获取对应的 double, 如果没有找到对应的 double 则返回 null. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 double 的 NBT键.- Returns:
待查找的 double.
-
getDeepString
@Contract(value = "_, !null -> !null")@Nullable() String getDeepString(@NonNull() String key, @Nullable() String def)
根据 NBT键 获取对应的 String, 如果没有找到对应的 String 则返回默认值. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 String 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 String, 则返回的默认值.- Returns:
待查找的 String.
-
getDeepByteArray
@Contract(value = "_, !null -> !null") Array<byte> getDeepByteArray(@NonNull() String key, Array<byte> def)
根据 NBT键 获取对应的 byte[], 如果没有找到对应的 byte[] 则返回默认值. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 byte[] 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 byte[], 则返回的默认值.- Returns:
待查找的 byte[].
-
getDeepIntArray
@Contract(value = "_, !null -> !null") Array<int> getDeepIntArray(@NonNull() String key, Array<int> def)
根据 NBT键 获取对应的 int[], 如果没有找到对应的 int[] 则返回默认值. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 int[] 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 int[], 则返回的默认值.- Returns:
待查找的 int[].
-
getDeepLongArray
@Contract(value = "_, !null -> !null") Array<long> getDeepLongArray(@NonNull() String key, Array<long> def)
根据 NBT键 获取对应的 long[], 如果没有找到对应的 long[] 则返回默认值. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 long[] 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 long[], 则返回的默认值.- Returns:
待查找的 long[].
-
getDeepCompound
@Contract(value = "_, !null -> !null")@Nullable() NbtCompound getDeepCompound(@NonNull() String key, @Nullable() NbtCompound def)
根据 NBT键 获取对应的 NbtCompound, 如果没有找到对应的 NbtCompound 则返回默认值. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 NbtCompound 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 NbtCompound, 则返回的默认值.- Returns:
待查找的 NbtCompound.
-
getDeepList
@Contract(value = "_, !null -> !null")@Nullable() NbtList getDeepList(@NonNull() String key, @Nullable() NbtList def)
根据 NBT键 获取对应的 NbtList, 如果没有找到对应的 NbtList 则返回默认值. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 NbtList 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 NbtList, 则返回的默认值.- Returns:
待查找的 NbtList.
-
getDeepBoolean
boolean getDeepBoolean(@NonNull() String key, boolean def)
根据 NBT键 获取对应的 boolean, 如果没有找到对应的 boolean 则返回默认值. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 boolean 的 NBT键.def
- 如果找不到对应的 NBT 或对应的 NBT 不是 boolean, 则返回的默认值.- Returns:
待查找的 boolean.
-
getDeepBooleanOrNull
@Nullable() Boolean getDeepBooleanOrNull(@NonNull() String key)
根据 NBT键 获取对应的 boolean, 如果没有找到对应的 boolean 则返回 null. NBT键 以 . 做分隔符.
- Parameters:
key
- 要获取 boolean 的 NBT键.- Returns:
待查找的 boolean.
-
putDeepByteArray
void putDeepByteArray(@NonNull() String key, Array<byte> value, boolean force)
将指定的 NBT键 设置为给定值. 若 force 为 false 且对应的 key 无效, 则不进行设置. 若 force 为 true 且对应的 key 无效, 则进行强制设置. key 无效的例子: 你想要将 t1.t2.t3 设置为一个 1, 这需要 t1.t2 的值是 NbtCompound, 如果 t1.t2 的值不是 NbtCompound, 则 key 无效. 强制设置的例子: 你想要将 t1.t2.t3 设置为一个 1, t1.t2 的值不是 NbtCompound, 则强制将 t1.t2 的值设置为 new NbtCompound(). NBT键 以 . 做分隔符.
- Parameters:
key
- 待设置的 NBT键.value
- 待设置的 NBT键 的新值.force
- key 无效时是否强制设置.
-
putDeepByteArray
void putDeepByteArray(@NonNull() String key, @NonNull() List<Byte> value, boolean force)
将指定的 NBT键 设置为给定值. 若 force 为 false 且对应的 key 无效, 则不进行设置. 若 force 为 true 且对应的 key 无效, 则进行强制设置. key 无效的例子: 你想要将 t1.t2.t3 设置为一个 1, 这需要 t1.t2 的值是 NbtCompound, 如果 t1.t2 的值不是 NbtCompound, 则 key 无效. 强制设置的例子: 你想要将 t1.t2.t3 设置为一个 1, t1.t2 的值不是 NbtCompound, 则强制将 t1.t2 的值设置为 new NbtCompound(). NBT键 以 . 做分隔符.
- Parameters:
key
- 待设置的 NBT键.value
- 待设置的 NBT键 的新值.force
- key 无效时是否强制设置.
-
putDeepIntArray
void putDeepIntArray(@NonNull() String key, Array<int> value, boolean force)
将指定的 NBT键 设置为给定值. 若 force 为 false 且对应的 key 无效, 则不进行设置. 若 force 为 true 且对应的 key 无效, 则进行强制设置. key 无效的例子: 你想要将 t1.t2.t3 设置为一个 1, 这需要 t1.t2 的值是 NbtCompound, 如果 t1.t2 的值不是 NbtCompound, 则 key 无效. 强制设置的例子: 你想要将 t1.t2.t3 设置为一个 1, t1.t2 的值不是 NbtCompound, 则强制将 t1.t2 的值设置为 new NbtCompound(). NBT键 以 . 做分隔符.
- Parameters:
key
- 待设置的 NBT键.value
- 待设置的 NBT键 的新值.force
- key 无效时是否强制设置.
-
putDeepIntArray
void putDeepIntArray(@NonNull() String key, @NonNull() List<Integer> value, boolean force)
将指定的 NBT键 设置为给定值. 若 force 为 false 且对应的 key 无效, 则不进行设置. 若 force 为 true 且对应的 key 无效, 则进行强制设置. key 无效的例子: 你想要将 t1.t2.t3 设置为一个 1, 这需要 t1.t2 的值是 NbtCompound, 如果 t1.t2 的值不是 NbtCompound, 则 key 无效. 强制设置的例子: 你想要将 t1.t2.t3 设置为一个 1, t1.t2 的值不是 NbtCompound, 则强制将 t1.t2 的值设置为 new NbtCompound(). NBT键 以 . 做分隔符.
- Parameters:
key
- 待设置的 NBT键.value
- 待设置的 NBT键 的新值.force
- key 无效时是否强制设置.
-
putDeepLongArray
void putDeepLongArray(@NonNull() String key, Array<long> value, boolean force)
将指定的 NBT键 设置为给定值. 若 force 为 false 且对应的 key 无效, 则不进行设置. 若 force 为 true 且对应的 key 无效, 则进行强制设置. key 无效的例子: 你想要将 t1.t2.t3 设置为一个 1, 这需要 t1.t2 的值是 NbtCompound, 如果 t1.t2 的值不是 NbtCompound, 则 key 无效. 强制设置的例子: 你想要将 t1.t2.t3 设置为一个 1, t1.t2 的值不是 NbtCompound, 则强制将 t1.t2 的值设置为 new NbtCompound(). NBT键 以 . 做分隔符.
- Parameters:
key
- 待设置的 NBT键.value
- 待设置的 NBT键 的新值.force
- key 无效时是否强制设置.
-
putDeepLongArray
void putDeepLongArray(@NonNull() String key, @NonNull() List<Long> value, boolean force)
将指定的 NBT键 设置为给定值. 若 force 为 false 且对应的 key 无效, 则不进行设置. 若 force 为 true 且对应的 key 无效, 则进行强制设置. key 无效的例子: 你想要将 t1.t2.t3 设置为一个 1, 这需要 t1.t2 的值是 NbtCompound, 如果 t1.t2 的值不是 NbtCompound, 则 key 无效. 强制设置的例子: 你想要将 t1.t2.t3 设置为一个 1, t1.t2 的值不是 NbtCompound, 则强制将 t1.t2 的值设置为 new NbtCompound(). NBT键 以 . 做分隔符.
- Parameters:
key
- 待设置的 NBT键.value
- 待设置的 NBT键 的新值.force
- key 无效时是否强制设置.
-
saveTo
void saveTo(@NonNull() ItemStack itemStack)
将当前 NbtCompound 保存至对应的 ItemStack.
- Parameters:
itemStack
- 用于接收 NbtCompound 的 ItemStack.
-
coverWith
@NonNull() NbtCompound coverWith(@NonNull() NbtCompound overlayCompound)
使用给定的 NbtCompound 覆盖当前 NbtCompound.
- Parameters:
overlayCompound
- 用于提供覆盖值的 NbtCompound.- Returns:
this.
-
-
-
-