Search in sources :

Example 1 with InventorySlotHolder

use of buildcraft.lib.gui.json.InventorySlotHolder in project BuildCraft by BuildCraft.

the class GuiFiller method preLoad.

protected void preLoad(BuildCraftJsonGui json) {
    TypedKeyMap<String, Object> properties = json.properties;
    FunctionContext context = json.context;
    properties.put("filler.inventory", new InventorySlotHolder(container, container.tile.invResources));
    properties.put("statement.container", container.tile);
    properties.put("controllable", container.tile);
    properties.put("controllable.sprite", SPRITE_CONTROL_MODE);
    context.put_o("controllable.mode", Mode.class, container.tile::getControlMode);
    context.put_b("filler.is_finished", container.tile::isFinished);
    context.put_b("filler.is_locked", container.tile::isLocked);
    context.put_l("filler.to_break", container.tile::getCountToBreak);
    context.put_l("filler.to_place", container.tile::getCountToPlace);
    properties.put("filler.possible", FillerStatementContext.CONTEXT_ALL);
    properties.put("filler.pattern", container.getPatternStatementClient());
    properties.put("filler.pattern.sprite", SPRITE_PATTERN);
    context.put_b("filler.invert", container::isInverted);
    properties.put("filler.invert", IButtonBehaviour.TOGGLE);
    properties.put("filler.invert", container.isInverted());
    properties.put("filler.invert", (IButtonClickEventListener) (b, k) -> container.sendInverted(b.isButtonActive()));
    context.put_b("filler.excavate", container.tile::canExcavate);
    properties.put("filler.excavate", IButtonBehaviour.TOGGLE);
    properties.put("filler.excavate", container.tile.canExcavate());
    properties.put("filler.excavate", (IButtonClickEventListener) (b, k) -> container.tile.sendCanExcavate(b.isButtonActive()));
}
Also used : Mode(buildcraft.api.tiles.IControllable.Mode) InventorySlotHolder(buildcraft.lib.gui.json.InventorySlotHolder) SpriteDelegate(buildcraft.lib.gui.json.SpriteDelegate) IFillerPattern(buildcraft.api.filler.IFillerPattern) FunctionContext(buildcraft.lib.expression.FunctionContext) FillerStatementContext(buildcraft.builders.filler.FillerStatementContext) IButtonBehaviour(buildcraft.lib.gui.button.IButtonBehaviour) GuiBC8(buildcraft.lib.gui.GuiBC8) ResourceLocation(net.minecraft.util.ResourceLocation) IButtonClickEventListener(buildcraft.lib.gui.button.IButtonClickEventListener) BuildCraftJsonGui(buildcraft.lib.gui.json.BuildCraftJsonGui) BCCoreSprites(buildcraft.core.BCCoreSprites) ContainerFiller(buildcraft.builders.container.ContainerFiller) TypedKeyMap(buildcraft.lib.misc.collect.TypedKeyMap) FunctionContext(buildcraft.lib.expression.FunctionContext) InventorySlotHolder(buildcraft.lib.gui.json.InventorySlotHolder)

Aggregations

IFillerPattern (buildcraft.api.filler.IFillerPattern)1 Mode (buildcraft.api.tiles.IControllable.Mode)1 ContainerFiller (buildcraft.builders.container.ContainerFiller)1 FillerStatementContext (buildcraft.builders.filler.FillerStatementContext)1 BCCoreSprites (buildcraft.core.BCCoreSprites)1 FunctionContext (buildcraft.lib.expression.FunctionContext)1 GuiBC8 (buildcraft.lib.gui.GuiBC8)1 IButtonBehaviour (buildcraft.lib.gui.button.IButtonBehaviour)1 IButtonClickEventListener (buildcraft.lib.gui.button.IButtonClickEventListener)1 BuildCraftJsonGui (buildcraft.lib.gui.json.BuildCraftJsonGui)1 InventorySlotHolder (buildcraft.lib.gui.json.InventorySlotHolder)1 SpriteDelegate (buildcraft.lib.gui.json.SpriteDelegate)1 TypedKeyMap (buildcraft.lib.misc.collect.TypedKeyMap)1 ResourceLocation (net.minecraft.util.ResourceLocation)1