mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-11 10:58:46 +01:00
Use isView()
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
af43c977bd
commit
d25f791d59
@ -179,7 +179,7 @@ public class Tag<T> {
|
||||
|
||||
public @Nullable T read(@NotNull NBTCompoundLike nbt) {
|
||||
final String key = this.key;
|
||||
final NBT readable = key.isEmpty() ? nbt.toCompound() : nbt.get(key);
|
||||
final NBT readable = isView() ? nbt.toCompound() : nbt.get(key);
|
||||
final T result;
|
||||
try {
|
||||
if (readable == null || (result = entry.read().apply(readable)) == null)
|
||||
@ -194,10 +194,10 @@ public class Tag<T> {
|
||||
final String key = this.key;
|
||||
if (value != null) {
|
||||
final NBT nbt = entry.write().apply(value);
|
||||
if (key.isEmpty()) nbtCompound.copyFrom((NBTCompoundLike) nbt);
|
||||
if (isView()) nbtCompound.copyFrom((NBTCompoundLike) nbt);
|
||||
else nbtCompound.set(key, nbt);
|
||||
} else {
|
||||
if (key.isEmpty()) nbtCompound.clear();
|
||||
if (isView()) nbtCompound.clear();
|
||||
else nbtCompound.remove(key);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user