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

CyclopsMC / IntegratedDynamics / 15366166327

31 May 2025 05:58PM UTC coverage: 44.766% (-0.5%) from 45.303%
15366166327

push

github

rubensworks
Bump mod version

2565 of 8515 branches covered (30.12%)

Branch coverage included in aggregate %.

11734 of 23427 relevant lines covered (50.09%)

2.38 hits per line

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

0.0
/src/main/java/org/cyclops/integrateddynamics/core/logicprogrammer/RenderPattern.java
1
package org.cyclops.integrateddynamics.core.logicprogrammer;
2

3
import lombok.Getter;
4
import net.minecraft.client.gui.Font;
5
import net.minecraft.client.gui.GuiGraphics;
6
import net.minecraft.client.gui.screens.Screen;
7
import net.minecraft.client.renderer.texture.TextureManager;
8
import net.minecraft.resources.ResourceLocation;
9
import net.minecraft.world.inventory.AbstractContainerMenu;
10
import net.neoforged.api.distmarker.Dist;
11
import net.neoforged.api.distmarker.OnlyIn;
12
import org.apache.commons.lang3.tuple.Pair;
13
import org.cyclops.cyclopscore.helper.RenderHelpers;
14
import org.cyclops.integrateddynamics.Reference;
15
import org.cyclops.integrateddynamics.api.client.gui.subgui.IGuiInputElement;
16
import org.cyclops.integrateddynamics.api.client.gui.subgui.ISubGuiBox;
17
import org.cyclops.integrateddynamics.api.logicprogrammer.IConfigRenderPattern;
18
import org.cyclops.integrateddynamics.core.client.gui.subgui.SubGuiBox;
19

20
/**
21
 * Sub gui for rendering logic programmer elements.
22
 * @author rubensworks
23
 */
24
@OnlyIn(Dist.CLIENT)
25
public class RenderPattern<E extends IGuiInputElement, G extends Screen, C extends AbstractContainerMenu> extends SubGuiBox implements ISubGuiBox {
26

27
    @Getter
×
28
    protected final E element;
29
    private final int x, y;
30
    protected final G gui;
31
    protected final C container;
32
    protected ResourceLocation texture = ResourceLocation.fromNamespaceAndPath(Reference.MOD_ID, "textures/gui/logic_programmer.png");
×
33

34
    public RenderPattern(E element, int baseX, int baseY, int maxWidth, int maxHeight,
35
                         G gui, C container) {
36
        super(SubGuiBox.Box.LIGHT);
×
37
        this.element = element;
×
38
        IConfigRenderPattern configRenderPattern = element.getRenderPattern();
×
39
        this.x = RenderPatternCommon.calculateX(baseX, maxWidth, configRenderPattern);
×
40
        this.y = RenderPatternCommon.calculateY(baseY, maxHeight, configRenderPattern);
×
41
        this.gui = gui;
×
42
        this.container = container;
×
43
    }
×
44

45
    protected void drawSlot(GuiGraphics guiGraphics, int x, int y) {
46
        guiGraphics.blit(SubGuiBox.TEXTURE, x, y, 19, 0, 18, 18);
×
47
    }
×
48

49
    @Override
50
    public void init(int guiLeft, int guiTop) {
51
        super.init(guiLeft, guiTop);
×
52
    }
×
53

54
    @Override
55
    public void tick() {
56

57
    }
×
58

59
    protected boolean drawRenderPattern() {
60
        return true;
×
61
    }
62

63
    @Override
64
    public void renderBg(GuiGraphics guiGraphics, int guiLeft, int guiTop, TextureManager textureManager, Font fontRenderer, float partialTicks, int mouseX, int mouseY) {
65
        super.renderBg(guiGraphics, guiLeft, guiTop, textureManager, fontRenderer, partialTicks, mouseX, mouseY);
×
66
        if (drawRenderPattern()) {
×
67
            IConfigRenderPattern configRenderPattern = element.getRenderPattern();
×
68

69
            int baseX = getX() + guiLeft;
×
70
            int baseY = getY() + guiTop;
×
71

72
            for (Pair<Integer, Integer> slot : configRenderPattern.getSlotPositions()) {
×
73
                drawSlot(guiGraphics, baseX + slot.getLeft(), baseY + slot.getRight());
×
74
            }
75

76
            if (configRenderPattern.getSymbolPosition() != null) {
×
77
                RenderHelpers.drawScaledCenteredString(guiGraphics.pose(), guiGraphics.bufferSource(), fontRenderer, element.getSymbol(),
×
78
                        baseX + configRenderPattern.getSymbolPosition().getLeft(),
×
79
                        baseY + configRenderPattern.getSymbolPosition().getRight() + 8,
×
80
                        0, 1, 0, false, Font.DisplayMode.NORMAL);
81
            }
82
        }
83
    }
×
84

85
    @Override
86
    public int getX() {
87
        return this.x;
×
88
    }
89

90
    @Override
91
    public int getY() {
92
        return this.y;
×
93
    }
94

95
    @Override
96
    public int getWidth() {
97
        return element.getRenderPattern().getWidth();
×
98
    }
99

100
    @Override
101
    public int getHeight() {
102
        return element.getRenderPattern().getHeight();
×
103
    }
104

105
    public void sendValueToServer() {
106

107
    }
×
108

109
}
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

© 2026 Coveralls, Inc