Search in sources :

Example 1 with Rect2i

use of net.minecraft.client.renderer.Rect2i in project Create by Creators-of-Create.

the class BlueprintScreen method init.

@Override
protected void init() {
    setWindowSize(background.width, background.height + 4 + PLAYER_INVENTORY.height);
    setWindowOffset(1, 0);
    super.init();
    int x = leftPos;
    int y = topPos;
    resetButton = new IconButton(x + background.width - 62, y + background.height - 24, AllIcons.I_TRASH);
    resetButton.withCallback(() -> {
        menu.clearContents();
        contentsCleared();
        menu.sendClearPacket();
    });
    confirmButton = new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
    confirmButton.withCallback(() -> {
        minecraft.player.closeContainer();
    });
    addRenderableWidget(resetButton);
    addRenderableWidget(confirmButton);
    extraAreas = ImmutableList.of(new Rect2i(x + background.width, y + background.height - 36, 56, 44));
}
Also used : Rect2i(net.minecraft.client.renderer.Rect2i) IconButton(com.simibubi.create.foundation.gui.widget.IconButton)

Example 2 with Rect2i

use of net.minecraft.client.renderer.Rect2i in project Create by Creators-of-Create.

the class LinkedControllerScreen method init.

@Override
protected void init() {
    setWindowSize(background.width, background.height + 4 + PLAYER_INVENTORY.height);
    setWindowOffset(1, 0);
    super.init();
    int x = leftPos;
    int y = topPos;
    resetButton = new IconButton(x + background.width - 62, y + background.height - 24, AllIcons.I_TRASH);
    resetButton.withCallback(() -> {
        menu.clearContents();
        menu.sendClearPacket();
    });
    confirmButton = new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
    confirmButton.withCallback(() -> {
        minecraft.player.closeContainer();
    });
    addRenderableWidget(resetButton);
    addRenderableWidget(confirmButton);
    extraAreas = ImmutableList.of(new Rect2i(x + background.width + 4, y + background.height - 44, 64, 56));
}
Also used : Rect2i(net.minecraft.client.renderer.Rect2i) IconButton(com.simibubi.create.foundation.gui.widget.IconButton)

Example 3 with Rect2i

use of net.minecraft.client.renderer.Rect2i in project Create by Creators-of-Create.

the class AbstractFilterScreen method init.

@Override
protected void init() {
    setWindowSize(Math.max(background.width, PLAYER_INVENTORY.width), background.height + 4 + PLAYER_INVENTORY.height);
    super.init();
    int x = leftPos;
    int y = topPos;
    resetButton = new IconButton(x + background.width - 62, y + background.height - 24, AllIcons.I_TRASH);
    resetButton.withCallback(() -> {
        menu.clearContents();
        contentsCleared();
        menu.sendClearPacket();
    });
    confirmButton = new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
    confirmButton.withCallback(() -> {
        minecraft.player.closeContainer();
    });
    addRenderableWidget(resetButton);
    addRenderableWidget(confirmButton);
    extraAreas = ImmutableList.of(new Rect2i(x + background.width, y + background.height - 40, 80, 48));
}
Also used : Rect2i(net.minecraft.client.renderer.Rect2i) IconButton(com.simibubi.create.foundation.gui.widget.IconButton)

Example 4 with Rect2i

use of net.minecraft.client.renderer.Rect2i in project Create by Creators-of-Create.

the class ToolboxScreen method init.

@Override
protected void init() {
    setWindowSize(30 + BG.width, BG.height + PLAYER.height - 24);
    setWindowOffset(-11, 0);
    super.init();
    color = menu.contentHolder.getColor();
    confirmButton = new IconButton(leftPos + 30 + BG.width - 33, topPos + BG.height - 24, AllIcons.I_CONFIRM);
    confirmButton.withCallback(() -> {
        minecraft.player.closeContainer();
    });
    addRenderableWidget(confirmButton);
    disposeButton = new IconButton(leftPos + 30 + 81, topPos + 69, AllIcons.I_TOOLBOX);
    disposeButton.withCallback(() -> {
        AllPackets.channel.sendToServer(new ToolboxDisposeAllPacket(menu.contentHolder.getBlockPos()));
    });
    disposeButton.setToolTip(Lang.translate("toolbox.depositBox"));
    addRenderableWidget(disposeButton);
    extraAreas = ImmutableList.of(new Rect2i(leftPos + 30 + BG.width, topPos + BG.height - 15 - 34 - 6, 72, 68));
}
Also used : Rect2i(net.minecraft.client.renderer.Rect2i) IconButton(com.simibubi.create.foundation.gui.widget.IconButton)

Example 5 with Rect2i

use of net.minecraft.client.renderer.Rect2i in project Create by Creators-of-Create.

the class SchematicTableScreen method init.

@Override
protected void init() {
    setWindowSize(background.width, background.height + 4 + AllGuiTextures.PLAYER_INVENTORY.height);
    setWindowOffset(-11, 8);
    super.init();
    CreateClient.SCHEMATIC_SENDER.refresh();
    List<Component> availableSchematics = CreateClient.SCHEMATIC_SENDER.getAvailableSchematics();
    int x = leftPos;
    int y = topPos;
    schematicsLabel = new Label(x + 49, y + 26, TextComponent.EMPTY).withShadow();
    schematicsLabel.text = TextComponent.EMPTY;
    if (!availableSchematics.isEmpty()) {
        schematicsArea = new SelectionScrollInput(x + 45, y + 21, 139, 18).forOptions(availableSchematics).titled(availableSchematicsTitle.plainCopy()).writingTo(schematicsLabel);
        addRenderableWidget(schematicsArea);
        addRenderableWidget(schematicsLabel);
    }
    confirmButton = new IconButton(x + 44, y + 56, AllIcons.I_CONFIRM);
    confirmButton.withCallback(() -> {
        if (menu.canWrite() && schematicsArea != null) {
            ClientSchematicLoader schematicSender = CreateClient.SCHEMATIC_SENDER;
            lastChasingProgress = chasingProgress = progress = 0;
            List<Component> availableSchematics1 = schematicSender.getAvailableSchematics();
            Component schematic = availableSchematics1.get(schematicsArea.getState());
            schematicSender.startNewUpload(schematic.getContents());
        }
    });
    folderButton = new IconButton(x + 21, y + 21, AllIcons.I_OPEN_FOLDER);
    folderButton.withCallback(() -> {
        Util.getPlatform().openFile(Paths.get("schematics/").toFile());
    });
    folderButton.setToolTip(folder);
    refreshButton = new IconButton(x + 207, y + 21, AllIcons.I_REFRESH);
    refreshButton.withCallback(() -> {
        ClientSchematicLoader schematicSender = CreateClient.SCHEMATIC_SENDER;
        schematicSender.refresh();
        List<Component> availableSchematics1 = schematicSender.getAvailableSchematics();
        removeWidget(schematicsArea);
        if (!availableSchematics1.isEmpty()) {
            schematicsArea = new SelectionScrollInput(leftPos + 45, topPos + 21, 139, 18).forOptions(availableSchematics1).titled(availableSchematicsTitle.plainCopy()).writingTo(schematicsLabel);
            schematicsArea.onChanged();
            addRenderableWidget(schematicsArea);
        } else {
            schematicsArea = null;
            schematicsLabel.text = TextComponent.EMPTY;
        }
    });
    refreshButton.setToolTip(refresh);
    addRenderableWidget(confirmButton);
    addRenderableWidget(folderButton);
    addRenderableWidget(refreshButton);
    extraAreas = ImmutableList.of(new Rect2i(x + background.width, y + background.height - 40, 48, 48), new Rect2i(refreshButton.x, refreshButton.y, refreshButton.getWidth(), refreshButton.getHeight()));
}
Also used : Rect2i(net.minecraft.client.renderer.Rect2i) IconButton(com.simibubi.create.foundation.gui.widget.IconButton) ClientSchematicLoader(com.simibubi.create.content.schematics.ClientSchematicLoader) Label(com.simibubi.create.foundation.gui.widget.Label) Component(net.minecraft.network.chat.Component) TextComponent(net.minecraft.network.chat.TextComponent) SelectionScrollInput(com.simibubi.create.foundation.gui.widget.SelectionScrollInput)

Aggregations

Rect2i (net.minecraft.client.renderer.Rect2i)22 IconButton (com.simibubi.create.foundation.gui.widget.IconButton)6 Point (appeng.client.Point)5 ArrayList (java.util.ArrayList)3 IFocusFactory (mezz.jei.api.recipe.IFocusFactory)3 IRecipesGui (mezz.jei.api.runtime.IRecipesGui)3 List (java.util.List)2 RecipeType (mezz.jei.api.recipe.RecipeType)2 Button (net.minecraft.client.gui.components.Button)2 Component (net.minecraft.network.chat.Component)2 TextComponent (net.minecraft.network.chat.TextComponent)2 ResourceLocation (net.minecraft.resources.ResourceLocation)2 Tuple (net.minecraft.util.Tuple)2 appeng.client.gui (appeng.client.gui)1 WidgetStyle (appeng.client.gui.style.WidgetStyle)1 GuiText (appeng.core.localization.GuiText)1 PoseStack (com.mojang.blaze3d.vertex.PoseStack)1 BaseScreen (com.refinedmods.refinedstorage.screen.BaseScreen)1 SideButton (com.refinedmods.refinedstorage.screen.widget.sidebutton.SideButton)1 ClientSchematicLoader (com.simibubi.create.content.schematics.ClientSchematicLoader)1