Search in sources :

Example 1 with Ledger_Neptune

use of buildcraft.lib.gui.ledger.Ledger_Neptune in project BuildCraft by BuildCraft.

the class ElementTypeLedger method deserialize0.

@Override
public IGuiElement deserialize0(BuildCraftJsonGui gui, IGuiPosition parent, JsonGuiInfo info, JsonGuiElement json) {
    FunctionContext ctx = createContext(json);
    inheritProperty(json, "color", "colour");
    String side = json.properties.get("side");
    String title = json.properties.get("title");
    int colour = resolveEquationInt(json, "colour", ctx);
    boolean positive = "right".equalsIgnoreCase(side);
    Ledger_Neptune ledger = new Ledger_Neptune(gui, colour, positive);
    ledger.setTitle(title);
    addChildren(gui, ledger.positionLedgerIconStart, info, json, "closed", ledger.getClosedElements()::add);
    ledger.calculateMaxSize();
    ResourceLocation def = gui.jsonGuiDefinition;
    def = new ResourceLocation(def.getResourceDomain(), def.getResourcePath().replace(".json", ""));
    ledger.setOpenProperty(GuiConfigManager.getOrAddBoolean(def, json.name + ".is_open", false));
    return ledger;
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) FunctionContext(buildcraft.lib.expression.FunctionContext) Ledger_Neptune(buildcraft.lib.gui.ledger.Ledger_Neptune)

Aggregations

FunctionContext (buildcraft.lib.expression.FunctionContext)1 Ledger_Neptune (buildcraft.lib.gui.ledger.Ledger_Neptune)1 ResourceLocation (net.minecraft.util.ResourceLocation)1