Search in sources :

Example 6 with ADatabase

use of org.asassecreations.engine.serializer.ADatabase in project Voxel_Game by ASasseCreations.

the class Inventory method save.

public void save() {
    final ADatabase database = new ADatabase("inventory");
    for (int i = 0; i < inventory.length; i++) {
        if (inventory[i] == null)
            continue;
        final AObject object = new AObject("SLOT" + i);
        object.addField(AField.Integer("id", inventory[i].item.id));
        object.addField(AField.Integer("amount", inventory[i].amount));
        database.addObject(object);
    }
    database.serializeToFile(Content.WORLD_FOLDER + "inventory.dat");
}
Also used : AObject(org.asassecreations.engine.serializer.AObject) ADatabase(org.asassecreations.engine.serializer.ADatabase)

Aggregations

ADatabase (org.asassecreations.engine.serializer.ADatabase)6 AObject (org.asassecreations.engine.serializer.AObject)6 File (java.io.File)2 ArrayList (java.util.ArrayList)2 Block (org.asassecreations.voxelgame.world.block.Block)2 BlockModeled (org.asassecreations.voxelgame.world.block.BlockModeled)2 Vector3f (org.lwjgl.util.vector.Vector3f)2 Random (java.util.Random)1 AField (org.asassecreations.engine.serializer.AField)1