mmb.engine.block.BlockEntityData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multimachinebuilder Show documentation
Show all versions of multimachinebuilder Show documentation
Dependency for the MultiMachineBuilder, a voxel game about building an industrial empire in a finite world.
THIS RELEASE IS NOT PLAYABLE. To play the game, donwload from >ITCH.IO LINK HERE< or >GH releases link here<
/**
*
*/
package mmb.engine.block;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import mmb.engine.debug.Debugger;
import mmb.engine.json.JsonTool;
/**
* @author oskar
*
*/
public abstract class BlockEntityData extends BlockEntity{
private static final Debugger debug = new Debugger("BLOCKS");
@Override
public final JsonNode save() {
ObjectNode data = JsonTool.newObjectNode();
data.put("blocktype", type().id());
try {
save0(data);
} catch (Exception e) {
debug.pstm(e, "Failed to write JSON data");
}
return data;
}
/**
* Save additional supported data
* @param node ObjectNode, to which data will be saved
*/
protected abstract void save0(ObjectNode node);
}