• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CyclopsMC / IntegratedCrafting / #479011696

pending completion
#479011696

push

github-actions

rubensworks
Update to MC 1.20.1

19 of 19 new or added lines in 2 files covered. (100.0%)

706 of 2807 relevant lines covered (25.15%)

0.25 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/org/cyclops/integratedcrafting/client/gui/ContainerScreenPartInterfaceCrafting.java
1
package org.cyclops.integratedcrafting.client.gui;
2

3
import com.mojang.blaze3d.systems.RenderSystem;
4
import net.minecraft.client.gui.Font;
5
import net.minecraft.client.gui.GuiGraphics;
6
import net.minecraft.network.chat.Component;
7
import net.minecraft.resources.ResourceLocation;
8
import net.minecraft.world.entity.player.Inventory;
9
import org.cyclops.cyclopscore.client.gui.component.button.ButtonImage;
10
import org.cyclops.cyclopscore.client.gui.container.ContainerScreenExtended;
11
import org.cyclops.cyclopscore.client.gui.image.IImage;
12
import org.cyclops.cyclopscore.client.gui.image.Images;
13
import org.cyclops.cyclopscore.helper.GuiHelpers;
14
import org.cyclops.integratedcrafting.Reference;
15
import org.cyclops.integratedcrafting.inventory.container.ContainerPartInterfaceCrafting;
16
import org.cyclops.integrateddynamics.core.inventory.container.ContainerMultipartAspects;
17

18
import java.util.Collections;
19
import java.util.Optional;
20

21
/**
22
 * Gui for the crafting interface.
23
 * @author rubensworks
24
 */
25
public class ContainerScreenPartInterfaceCrafting extends ContainerScreenExtended<ContainerPartInterfaceCrafting> {
26

27
    public ContainerScreenPartInterfaceCrafting(ContainerPartInterfaceCrafting container, Inventory inventory, Component title) {
28
        super(container, inventory, title);
×
29
    }
×
30

31
    @Override
32
    public void init() {
33
        super.init();
×
34
        addRenderableWidget(new ButtonImage(this.leftPos + 155, this.topPos + 4, 15, 15,
×
35
                Component.translatable("gui.integrateddynamics.part_settings"),
×
36
                createServerPressable(ContainerMultipartAspects.BUTTON_SETTINGS, b -> {}), true,
×
37
                Images.CONFIG_BOARD, -2, -3));
38
    }
×
39

40
    @Override
41
    protected ResourceLocation constructGuiTexture() {
42
        return new ResourceLocation(Reference.MOD_ID, "textures/gui/part_interface_crafting.png");
×
43
    }
44

45
    @Override
46
    protected int getBaseXSize() {
47
        return 176;
×
48
    }
49

50
    @Override
51
    protected int getBaseYSize() {
52
        return 141;
×
53
    }
54

55
    @Override
56
    protected void renderBg(GuiGraphics guiGraphics, float partialTicks, int mouseX, int mouseY) {
57
        super.renderBg(guiGraphics, partialTicks, mouseX, mouseY);
×
58

59
        RenderSystem.setShaderColor(1, 1, 1, 1);
×
60
        int y = topPos + 42;
×
61
        for (int i = 0; i < getMenu().getContainerInventory().getContainerSize(); i++) {
×
62
            int x = leftPos + 10 + i * GuiHelpers.SLOT_SIZE;
×
63
            if (!getMenu().getContainerInventory().getItem(i).isEmpty()) {
×
64
                IImage image = container.isRecipeSlotValid(i) ? Images.OK : Images.ERROR;
×
65
                image.draw(guiGraphics, x, y);
×
66
            }
67
        }
68
    }
×
69

70
    @Override
71
    protected void renderLabels(GuiGraphics guiGraphics, int mouseX, int mouseY) {
72
        // super.drawGuiContainerForegroundLayer(matrixStack, mouseX, mouseY);
73
        this.font.drawInBatch(this.title, (float)this.titleLabelX, (float)this.titleLabelY, 4210752, false,
×
74
                guiGraphics.pose().last().pose(), guiGraphics.bufferSource(), Font.DisplayMode.NORMAL, 0, 15728880);
×
75

76
        int y = 42;
×
77
        for (int i = 0; i < getMenu().getContainerInventory().getContainerSize(); i++) {
×
78
            int x = 10 + i * GuiHelpers.SLOT_SIZE;
×
79
            int slot = i;
×
80
            GuiHelpers.renderTooltipOptional(this, guiGraphics.pose(), x, y, 14, 13, mouseX, mouseY,
×
81
                    () -> {
82
                        if (!getMenu().getItems().get(slot).isEmpty()) {
×
83
                            Component unlocalizedMessage = container.getRecipeSlotUnlocalizedMessage(slot);
×
84
                            if (unlocalizedMessage != null) {
×
85
                                return Optional.of(Collections.singletonList(unlocalizedMessage));
×
86
                            }
87
                        }
88
                        return Optional.empty();
×
89
                    });
90
        }
91
    }
×
92
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc