use of com.builtbroken.mc.framework.block.BlockPropertyData in project Engine by VoltzEngine-Project.
the class JsonBlockProcessor method process.
@Override
public boolean process(JsonElement element, List<IJsonGenObject> objectList) {
debugPrinter.start("BlockProcessor", "Processing entry", Engine.runningAsDev);
//Get object and ensure minimal keys exist
JsonObject blockData = element.getAsJsonObject();
ensureValuesExist(blockData, "name", "id", "mod");
//Load default data
String mod = blockData.getAsJsonPrimitive("mod").getAsString();
String id = blockData.getAsJsonPrimitive("id").getAsString();
String name = blockData.get("name").getAsString();
debugPrinter.log("Name: " + name);
debugPrinter.log("Mod: " + mod);
debugPrinter.log("ID: " + id);
//Generate object
BlockPropertyData blockPropertyData = new BlockPropertyData(this, id, mod, name);
//Load blocks
BlockBase block;
//Meta data loading
if (blockData.has("subtypes")) {
blockPropertyData.localization += "." + BlockMeta.META_LOCAL_KEY;
block = new BlockMeta(blockPropertyData);
//Call to load metadata
readMeta((BlockMeta) block, blockData.get("subtypes").getAsJsonArray(), objectList);
} else //No meta data
{
block = new BlockBase(blockPropertyData);
}
processAdditionalKeys(blockPropertyData, blockData, block, objectList);
//Add block to object list
objectList.add(block);
debugPrinter.end("Done...");
return true;
}
Aggregations