Inventory serialization

Is there a way to serialize and deserialize an inventory?

I am currently trying this but it says “service does not implement org.spongepowered.api.data.DataSerializable”

SerializationService service = r.getGame().getServiceManager().provide(SerializationService.class).get(); service.getBuilder(Inventory.class).get().build(inv);

Inventory itself is not serializable. I think this other thread is similar to what you’re asking here.

My response:

“Store the data in some structure.”

I think the api should have a way to do this.

If you’d like to see something in the API just create an issue on GitHub and it will be considered.

1 Like