In order to sync displays over the network, or save to the disk for persistent displays across reloads. It is optional to register display serializers.
In a server plugin (Constructing Plugins), override registerDisplaySerializer
, from here, you may register your own serializer.
@Override
public void registerDisplaySerializer(DisplaySerializerRegistry registry) {
registry.register(MY_DISPLAY, new DisplaySerializer<MyDisplay>() {
@Override
public CompoundTag save(CompoundTag tag, MyDisplay display) {
// Manipulate the nbt tag
return tag;
}
@Override
public MyDisplay read(CompoundTag tag) {
// create the display
}
});
}