use of io.github.voidzombie.nhglib.data.models.serialization.AssetJson in project nhglib by VoidZombie.
the class ModelComponentJson method parse.
@Override
public void parse(JsonValue jsonValue) {
ModelComponent modelComponent = entities.createComponent(entity, ModelComponent.class);
String type = jsonValue.getString("graphicsType");
JsonValue asset = jsonValue.get("asset");
boolean enabled = jsonValue.getBoolean("enabled", true);
AssetJson assetJson = new AssetJson();
assetJson.parse(asset);
JsonValue materialsJson = jsonValue.get("materials");
if (materialsJson != null) {
for (JsonValue mat : materialsJson) {
PbrMaterialJson pbrMaterialJson = new PbrMaterialJson();
pbrMaterialJson.parse(mat);
modelComponent.pbrMaterials.add(pbrMaterialJson.get());
}
}
modelComponent.type = ModelComponent.Type.fromString(type);
modelComponent.asset = assetJson.get();
modelComponent.enabled = enabled;
output = modelComponent;
}
Aggregations