Automatically save, load, and sync NBT data with a easy to use, easy to extend, annotation based API.
Simply annotate any fields that need to be saved with @Store
.
public class MyObject {
@Store
private String name;
@Store
private int counter;
}
The (de)serialization API is very simple, only a single line of code!
NBTTagCompound tag = new NBTTagCompound();
Writer.write(tag, object);
Reader.read(tag, object);
@Storable
public class StorableExample {
@Store
private String name;
}
public class Wrapper {
@Store
private StorableExample storable;
}
Writer.write(tag, new Wrapper()); // This will work!
Registry registry = new Registry();
registry.register(new HandleMyObject());
...
class Wrapper {
@Store
private MyObject myObject = new MyObject();
}
NBTTagCompound tag = new NBTTagCompound();
Writer.write(registry, tag, new Wrapper());
- Array types will automatically look for a handler for their component type
- Supported generic types will do the same (List, Map, etc. See Java)
- All primitive types (including boxed types)
- String
- Enum
- List (ArrayList)
- LinkedList
- Set (HashSet)
- Map (HashMap)
- EnumMap
- Enum2EnumMap (Not a class, but a special case of EnumMap where the data is packed more efficiently)
- BlockPos
- Block
- IBlockState
- Item
- ItemStack
- ResourceLocation
- Fluid
- FluidStack