Search in sources :

Example 1 with GuiElementStatementSource

use of buildcraft.lib.gui.statement.GuiElementStatementSource in project BuildCraft by BuildCraft.

the class ElementTypeStatementSource method deserialize0.

@Override
public IGuiElement deserialize0(BuildCraftJsonGui gui, IGuiPosition parent, JsonGuiInfo info, JsonGuiElement json) {
    FunctionContext ctx = createContext(json);
    String source = json.properties.get("source");
    StatementContext<?> ctxSource = gui.properties.get(source, StatementContext.class);
    String side = json.properties.get("side");
    String style = json.properties.get("style");
    if (style == null || "flat".equals(style)) {
        return new GuiElementStatementSource<>(gui, !"right".equals(side), ctxSource);
    // } else if ("ledger.left".equals(layout) || "ledger.right".equals(layout)) {
    // TODO!
    } else {
        throw new JsonSyntaxException("Unknown style '" + style + "'");
    }
}
Also used : JsonSyntaxException(com.google.gson.JsonSyntaxException) GuiElementStatementSource(buildcraft.lib.gui.statement.GuiElementStatementSource) FunctionContext(buildcraft.lib.expression.FunctionContext)

Aggregations

FunctionContext (buildcraft.lib.expression.FunctionContext)1 GuiElementStatementSource (buildcraft.lib.gui.statement.GuiElementStatementSource)1 JsonSyntaxException (com.google.gson.JsonSyntaxException)1