Added almost all item tags

This commit is contained in:
themode 2021-04-03 17:14:00 +02:00
parent 89b35a0569
commit e4936b4a53

View File

@ -32,10 +32,66 @@ public class ItemTag<T> {
this.writeConsumer.accept(nbtCompound, value);
}
public static @NotNull ItemTag<Byte> Byte(@NotNull String key) {
return new ItemTag<>(key,
nbtCompound -> nbtCompound.getByte(key),
(nbtCompound, value) -> nbtCompound.setByte(key, value));
}
public static @NotNull ItemTag<Short> Short(@NotNull String key) {
return new ItemTag<>(key,
nbtCompound -> nbtCompound.getShort(key),
(nbtCompound, value) -> nbtCompound.setShort(key, value));
}
public static @NotNull ItemTag<Integer> Integer(@NotNull String key) {
return new ItemTag<>(key,
nbtCompound -> nbtCompound.getInt(key),
(nbtCompound, integer) -> nbtCompound.setInt(key, integer));
}
public static @NotNull ItemTag<Long> Long(@NotNull String key) {
return new ItemTag<>(key,
nbtCompound -> nbtCompound.getLong(key),
(nbtCompound, value) -> nbtCompound.setLong(key, value));
}
public static @NotNull ItemTag<Float> Float(@NotNull String key) {
return new ItemTag<>(key,
nbtCompound -> nbtCompound.getFloat(key),
(nbtCompound, value) -> nbtCompound.setFloat(key, value));
}
public static @NotNull ItemTag<Double> Double(@NotNull String key) {
return new ItemTag<>(key,
nbtCompound -> nbtCompound.getDouble(key),
(nbtCompound, value) -> nbtCompound.setDouble(key, value));
}
public static @NotNull ItemTag<byte[]> ByteArray(@NotNull String key) {
return new ItemTag<>(key,
nbtCompound -> nbtCompound.getByteArray(key),
(nbtCompound, value) -> nbtCompound.setByteArray(key, value));
}
public static @NotNull ItemTag<String> String(@NotNull String key) {
return new ItemTag<>(key,
nbtCompound -> nbtCompound.getString(key),
(nbtCompound, value) -> nbtCompound.setString(key, value));
}
// TODO List/Compound
public static @NotNull ItemTag<int[]> IntArray(@NotNull String key) {
return new ItemTag<>(key,
nbtCompound -> nbtCompound.getIntArray(key),
(nbtCompound, value) -> nbtCompound.setIntArray(key, value));
}
public static @NotNull ItemTag<long[]> LongArray(@NotNull String key) {
return new ItemTag<>(key,
nbtCompound -> nbtCompound.getLongArray(key),
(nbtCompound, value) -> nbtCompound.setLongArray(key, value));
}
}