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

CyclopsMC / IntegratedDynamics / 15366205963

31 May 2025 06:03PM UTC coverage: 45.019% (-0.5%) from 45.524%
15366205963

push

github

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

2555 of 8509 branches covered (30.03%)

Branch coverage included in aggregate %.

11885 of 23566 relevant lines covered (50.43%)

2.4 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.RenderType;
8
import net.minecraft.client.renderer.texture.TextureManager;
9
import net.minecraft.resources.ResourceLocation;
10
import net.minecraft.world.inventory.AbstractContainerMenu;
11
import net.neoforged.api.distmarker.Dist;
12
import net.neoforged.api.distmarker.OnlyIn;
13
import org.apache.commons.lang3.tuple.Pair;
14
import org.cyclops.cyclopscore.helper.IModHelpers;
15
import org.cyclops.integrateddynamics.Reference;
16
import org.cyclops.integrateddynamics.api.client.gui.subgui.IGuiInputElement;
17
import org.cyclops.integrateddynamics.api.client.gui.subgui.ISubGuiBox;
18
import org.cyclops.integrateddynamics.api.logicprogrammer.IConfigRenderPattern;
19
import org.cyclops.integrateddynamics.core.client.gui.subgui.SubGuiBox;
20

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

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

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

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

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

55
    @Override
56
    public void tick() {
57

58
    }
×
59

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

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

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

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

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

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

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

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

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

106
    public void sendValueToServer() {
107

108
    }
×
109

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