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

CyclopsMC / IntegratedDynamics / 18042102834

26 Sep 2025 03:25PM UTC coverage: 44.791% (-0.1%) from 44.905%
18042102834

push

github

rubensworks
Merge remote-tracking branch 'origin/master-1.20-lts' into master-1.21-lts

2572 of 8540 branches covered (30.12%)

Branch coverage included in aggregate %.

11761 of 23460 relevant lines covered (50.13%)

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
    public C getContainer() {
46
        return container;
×
47
    }
48

49
    protected void drawSlot(GuiGraphics guiGraphics, int x, int y) {
50
        guiGraphics.blit(SubGuiBox.TEXTURE, x, y, 19, 0, 18, 18);
×
51
    }
×
52

53
    @Override
54
    public void init(int guiLeft, int guiTop) {
55
        super.init(guiLeft, guiTop);
×
56
    }
×
57

58
    @Override
59
    public void tick() {
60

61
    }
×
62

63
    protected boolean drawRenderPattern() {
64
        return true;
×
65
    }
66

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

73
            int baseX = getX() + guiLeft;
×
74
            int baseY = getY() + guiTop;
×
75

76
            for (Pair<Integer, Integer> slot : configRenderPattern.getSlotPositions()) {
×
77
                drawSlot(guiGraphics, baseX + slot.getLeft(), baseY + slot.getRight());
×
78
            }
79

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

89
    @Override
90
    public int getX() {
91
        return this.x;
×
92
    }
93

94
    @Override
95
    public int getY() {
96
        return this.y;
×
97
    }
98

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

104
    @Override
105
    public int getHeight() {
106
        return element.getRenderPattern().getHeight();
×
107
    }
108

109
    public void sendValueToServer() {
110

111
    }
×
112

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