MyImmutableMapInventoryData
Tue May 05 2020
public class MyImmutableMapInventoryData extends AbstractImmutableData<MyImmutableMapInventoryData, MyMapInventoryData> {
private Map<String, Map<Integer, ItemStack>> mapinventory;
public MyImmutableMapInventoryData(Map<String, Map<Integer, ItemStack>> mapinventory) {
this.mapinventory = mapinventory;
registerGetters();
}
@Override
protected void registerGetters() {
registerFieldGetter(ToolCore.MAPINVENTORY, () -> this.mapinventory);
registerKeyValue(ToolCore.MAPINVENTORY, this::mapinventory);
}
public ImmutableMapValue<String, Map<Integer, ItemStack>> mapinventory() {
return Sponge.getRegistry().getValueFactory().createMapValue(ToolCore.MAPINVENTORY, mapinventory).asImmutable();
}
@Override
public MyMapInventoryData asMutable() {
return new MyMapInventoryData(mapinventory);
}
@Override
public int getContentVersion() {
return 1;
}
@Override
public DataContainer toContainer() {
return super.toContainer().set(ToolCore.MAPINVENTORY.getQuery(), this.mapinventory);
}
}