2021-05-17 12:34:45 +02:00
|
|
|
package net.minestom.server.tag;
|
|
|
|
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import org.jetbrains.annotations.Nullable;
|
2021-05-17 14:05:03 +02:00
|
|
|
import org.jglrxavpok.hephaistos.nbt.NBTCompound;
|
2021-05-17 12:34:45 +02:00
|
|
|
|
2021-05-17 14:02:14 +02:00
|
|
|
public interface TagWriter {
|
2021-05-17 12:34:45 +02:00
|
|
|
<T> void setTag(@NotNull Tag<T> tag, @Nullable T value);
|
2021-05-17 14:05:03 +02:00
|
|
|
|
|
|
|
static @NotNull TagWriter fromCompound(@NotNull NBTCompound compound) {
|
|
|
|
return new TagWriter() {
|
|
|
|
@Override
|
|
|
|
public <T> void setTag(@NotNull Tag<T> tag, @Nullable T value) {
|
|
|
|
tag.write(compound, value);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2021-05-17 12:34:45 +02:00
|
|
|
}
|