Deprecate array tags in profit of immutable nbt types

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-12-16 20:11:17 +01:00
parent f0104f7f1d
commit a93dac5c66

View File

@ -183,12 +183,6 @@ public class Tag<T> {
(nbtCompound, value) -> nbtCompound.setDouble(key, value));
}
public static @NotNull Tag<byte[]> ByteArray(@NotNull String key) {
return new Tag<>(key,
nbtCompound -> nbtCompound.getByteArray(key).copyArray(),
(nbtCompound, value) -> nbtCompound.setByteArray(key, value));
}
public static @NotNull Tag<String> String(@NotNull String key) {
return new Tag<>(key,
nbtCompound -> nbtCompound.getString(key),
@ -202,18 +196,6 @@ public class Tag<T> {
((nbt, value) -> nbt.set(key, value)));
}
public static @NotNull Tag<int[]> IntArray(@NotNull String key) {
return new Tag<>(key,
nbtCompound -> nbtCompound.getIntArray(key).copyArray(),
(nbtCompound, value) -> nbtCompound.setIntArray(key, value));
}
public static @NotNull Tag<long[]> LongArray(@NotNull String key) {
return new Tag<>(key,
nbtCompound -> nbtCompound.getLongArray(key).copyArray(),
(nbtCompound, value) -> nbtCompound.setLongArray(key, value));
}
/**
* Create a wrapper around a compound.
*
@ -243,6 +225,36 @@ public class Tag<T> {
(nbtCompound, value) -> serializer.write(TagWritable.fromCompound(nbtCompound), value));
}
/**
* @deprecated use {@link Tag#NBT(String)} with {@link NBT#ByteArray(byte...)}
*/
@Deprecated
public static @NotNull Tag<byte[]> ByteArray(@NotNull String key) {
return new Tag<>(key,
nbtCompound -> nbtCompound.getByteArray(key).copyArray(),
(nbtCompound, value) -> nbtCompound.setByteArray(key, value));
}
/**
* @deprecated use {@link Tag#NBT(String)} with {@link NBT#IntArray(int...)}
*/
@Deprecated
public static @NotNull Tag<int[]> IntArray(@NotNull String key) {
return new Tag<>(key,
nbtCompound -> nbtCompound.getIntArray(key).copyArray(),
(nbtCompound, value) -> nbtCompound.setIntArray(key, value));
}
/**
* @deprecated use {@link Tag#NBT(String)} with {@link NBT#LongArray(long...)}
*/
@Deprecated
public static @NotNull Tag<long[]> LongArray(@NotNull String key) {
return new Tag<>(key,
nbtCompound -> nbtCompound.getLongArray(key).copyArray(),
(nbtCompound, value) -> nbtCompound.setLongArray(key, value));
}
/**
* @deprecated use {@link #Structure(String, TagSerializer)} instead
*/