use of buildcraft.lib.gui.statement.GuiElementStatementParam in project BuildCraft by BuildCraft.
the class ElementTypeStatementParam method deserialize0.
@Override
public IGuiElement deserialize0(BuildCraftJsonGui gui, IGuiPosition parent, JsonGuiInfo info, JsonGuiElement json) {
FunctionContext ctx = createContext(json);
if (!json.properties.containsKey("size[0]")) {
json.properties.put("size[0]", "18");
}
if (!json.properties.containsKey("size[1]")) {
json.properties.put("size[1]", "18");
}
inheritProperty(json, "pos[0]", "area[0]");
inheritProperty(json, "pos[1]", "area[1]");
inheritProperty(json, "size[0]", "area[2]");
inheritProperty(json, "size[1]", "area[3]");
IGuiArea area = resolveArea(json, "area", parent, ctx);
String source;
if (json.properties.containsKey("source")) {
source = json.properties.get("source");
} else {
source = resolveEquation(json, "source_expression", ctx);
if (source == null) {
throw new JsonSyntaxException("Expected either 'source' or 'source_expression' for " + NAME);
}
}
boolean draw = !"false".equals(json.properties.get("draw"));
int index = resolveEquationInt(json, "index", ctx);
FullStatement<?> fullStatement = gui.properties.get(source, FullStatement.class);
IStatementContainer statementContainer = gui.properties.get("statement.container", IStatementContainer.class);
return new GuiElementStatementParam(gui, area, statementContainer, fullStatement, index, draw);
}
Aggregations