• 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/ValueTypeIngredientsLPElement.java
1
package org.cyclops.integrateddynamics.core.logicprogrammer;
2

3
import com.google.common.collect.Lists;
4
import com.google.common.collect.Maps;
5
import net.minecraft.client.Minecraft;
6
import net.minecraft.client.gui.Font;
7
import net.minecraft.client.gui.GuiGraphics;
8
import net.minecraft.client.gui.components.Button;
9
import net.minecraft.client.renderer.texture.TextureManager;
10
import net.minecraft.network.chat.Component;
11
import net.minecraft.world.item.ItemStack;
12
import net.neoforged.api.distmarker.Dist;
13
import net.neoforged.api.distmarker.OnlyIn;
14
import org.cyclops.commoncapabilities.api.ingredient.IMixedIngredients;
15
import org.cyclops.commoncapabilities.api.ingredient.IngredientComponent;
16
import org.cyclops.commoncapabilities.api.ingredient.MixedIngredients;
17
import org.cyclops.cyclopscore.client.gui.component.button.ButtonArrow;
18
import org.cyclops.cyclopscore.client.gui.component.button.ButtonText;
19
import org.cyclops.cyclopscore.client.gui.component.input.IInputListener;
20
import org.cyclops.cyclopscore.client.gui.component.input.WidgetArrowedListField;
21
import org.cyclops.cyclopscore.helper.Helpers;
22
import org.cyclops.cyclopscore.helper.L10NHelpers;
23
import org.cyclops.cyclopscore.helper.MinecraftHelpers;
24
import org.cyclops.cyclopscore.helper.RenderHelpers;
25
import org.cyclops.integrateddynamics.IntegratedDynamics;
26
import org.cyclops.integrateddynamics.api.client.gui.subgui.ISubGuiBox;
27
import org.cyclops.integrateddynamics.api.evaluate.variable.IValue;
28
import org.cyclops.integrateddynamics.api.evaluate.variable.IValueType;
29
import org.cyclops.integrateddynamics.api.evaluate.variable.ValueDeseralizationContext;
30
import org.cyclops.integrateddynamics.api.ingredient.IIngredientComponentHandler;
31
import org.cyclops.integrateddynamics.api.logicprogrammer.IConfigRenderPattern;
32
import org.cyclops.integrateddynamics.api.logicprogrammer.ILogicProgrammerElementType;
33
import org.cyclops.integrateddynamics.api.logicprogrammer.IValueTypeLogicProgrammerElement;
34
import org.cyclops.integrateddynamics.client.gui.container.ContainerScreenLogicProgrammerBase;
35
import org.cyclops.integrateddynamics.core.evaluate.variable.ValueObjectTypeIngredients;
36
import org.cyclops.integrateddynamics.core.evaluate.variable.ValueTypes;
37
import org.cyclops.integrateddynamics.core.helper.L10NValues;
38
import org.cyclops.integrateddynamics.core.ingredient.IngredientComponentHandlers;
39
import org.cyclops.integrateddynamics.inventory.container.ContainerLogicProgrammerBase;
40
import org.cyclops.integrateddynamics.network.packet.LogicProgrammerSetElementInventory;
41
import org.cyclops.integrateddynamics.network.packet.LogicProgrammerValueTypeIngredientsValueChangedPacket;
42

43
import java.util.List;
44
import java.util.Map;
45

46
/**
47
 * Element for the ingredients value type.
48
 *
49
 * @author rubensworks
50
 */
51
public class ValueTypeIngredientsLPElement extends ValueTypeLPElementBase {
52

53
    protected static final int OFFSET_X = 20;
54
    protected static final int OFFSET_Y = 21;
55

56
    private IngredientComponent currentType = IngredientComponent.ITEMSTACK;
×
57
    private Map<IngredientComponent, Integer> lengths = Maps.newHashMap();
×
58
    private Map<IngredientComponent, Map<Integer, IValueTypeLogicProgrammerElement>> subElements = Maps.newHashMap();
×
59
    private Map<IngredientComponent, Map<Integer, RenderPattern>> subElementGuis = Maps.newHashMap();
×
60
    private int activeElement = -1;
×
61
    @OnlyIn(Dist.CLIENT)
62
    private MasterSubGuiRenderPattern masterGui;
63

64
    private ValueObjectTypeIngredients.ValueIngredients serverValue = null;
×
65

66
    public ValueTypeIngredientsLPElement() {
67
        super(ValueTypes.OBJECT_INGREDIENTS);
×
68
    }
×
69

70
    public void setServerValue(ValueObjectTypeIngredients.ValueIngredients serverValue) {
71
        this.serverValue = serverValue;
×
72
    }
×
73

74
    @Override
75
    public ILogicProgrammerElementType getType() {
76
        return LogicProgrammerElementTypes.VALUETYPE;
×
77
    }
78

79
    @Override
80
    public IConfigRenderPattern getRenderPattern() {
81
        return IConfigRenderPattern.NONE_CANVAS_WIDE;
×
82
    }
83

84
    @Override
85
    public boolean canWriteElementPre() {
86
        return true;
×
87
    }
88

89
    protected IMixedIngredients constructValues() {
90
        Map<IngredientComponent<?, ?>, List<?>> lists = Maps.newIdentityHashMap();
×
91
        for (IngredientComponent<?, ?> component : IngredientComponentHandlers.REGISTRY.getComponents()) {
×
92
            List values = Lists.newArrayListWithExpectedSize(lengths.get(component));
×
93
            subElements.get(component).entrySet().forEach(entry -> {
×
94
                IIngredientComponentHandler componentHandler = IngredientComponentHandlers.REGISTRY.getComponentHandler(component);
×
95
                try {
96
                    values.add(componentHandler.toInstance(entry.getValue().getValue()));
×
97
                } catch (Exception e) {
×
98
                    values.add(component.getMatcher().getEmptyInstance());
×
99
                }
×
100
            });
×
101
            if (!values.isEmpty()) {
×
102
                lists.put(component, values);
×
103
            }
104
        }
×
105
        return new MixedIngredients(lists);
×
106
    }
107

108
    @Override
109
    public IValue getValue() {
110
        return MinecraftHelpers.isClientSideThread()
×
111
                ? ValueObjectTypeIngredients.ValueIngredients.of(constructValues()) : serverValue;
×
112
    }
113

114
    @Override
115
    public void setValue(IValue value) {
116
        ValueObjectTypeIngredients.ValueIngredients valueIngredients = (ValueObjectTypeIngredients.ValueIngredients) value;
×
117
        if (!MinecraftHelpers.isClientSideThread()) {
×
118
            setServerValue(valueIngredients);
×
119
        }
120

121
        valueIngredients.getRawValue().ifPresent(ingredients -> {
×
122
            // Select itemstack by default if it has instances
123
            if (ingredients.getComponents().contains(IngredientComponent.ITEMSTACK)) {
×
124
                currentType = IngredientComponent.ITEMSTACK;
×
125
            } else {
126
                currentType = null;
×
127
            }
128

129
            for (IngredientComponent<?, ?> ingredientComponent : ingredients.getComponents()) {
×
130
                IIngredientComponentHandler handler = IngredientComponentHandlers.REGISTRY.getComponentHandler(ingredientComponent);
×
131

132
                // If no itemstacks in ingredient, select any other
133
                if (currentType == null) {
×
134
                    currentType = ingredientComponent;
×
135
                }
136

137
                // Save length per ingredient component
138
                lengths.put(ingredientComponent, ingredients.getInstances(ingredientComponent).size());
×
139

140
                // Initialize LP elements for all instances of this ingredient component
141
                Map<Integer, IValueTypeLogicProgrammerElement> entries = Maps.newHashMap();
×
142
                List<?> instances = ingredients.getInstances(ingredientComponent);
×
143
                for (int i = 0; i < instances.size(); i++) {
×
144
                    initializeElementFromInstanceValue(entries, handler, instances.get(i), i);
×
145
                }
146
                subElements.put(ingredientComponent, entries);
×
147
            }
×
148
        });
×
149
    }
×
150

151
    protected <VT extends IValueType<V>, V extends IValue, T, M> void initializeElementFromInstanceValue(Map<Integer, IValueTypeLogicProgrammerElement> entries, IIngredientComponentHandler<VT, V, T, M> handler, T instance, int instanceIndex) {
152
        IValue instanceValue = handler.toValue(instance);
×
153
        IValueTypeLogicProgrammerElement lpElement = instanceValue.getType().createLogicProgrammerElement();
×
154
        lpElement.setValue(instanceValue);
×
155
        entries.put(instanceIndex, lpElement);
×
156
    }
×
157

158
    @Override
159
    @OnlyIn(Dist.CLIENT)
160
    public void setValueInGui(ISubGuiBox subGui) {
161
        if (!subElements.get(currentType).isEmpty()) {
×
162
            setActiveElement(0);
×
163
        }
164
    }
×
165

166
    @Override
167
    public void setValueInContainer(ContainerLogicProgrammerBase container) {
168
        if (!subElements.get(currentType).isEmpty()) {
×
169
            IValueTypeLogicProgrammerElement subElement = setActiveElement(0);
×
170
            int x = RenderPatternCommon.calculateX(ContainerLogicProgrammerBase.BASE_X, ContainerLogicProgrammerBase.MAX_WIDTH, subElement.getRenderPattern()) + ContainerLogicProgrammerBase.BASE_X - OFFSET_X;
×
171
            int y = RenderPatternCommon.calculateY(ContainerLogicProgrammerBase.BASE_Y, ContainerLogicProgrammerBase.MAX_HEIGHT, subElement.getRenderPattern()) + ContainerLogicProgrammerBase.BASE_Y - OFFSET_Y;
×
172
            container.setElementInventory(subElement, x, y);
×
173
            subElement.setValueInContainer(container);
×
174
        }
175
    }
×
176

177
    public int getLength() {
178
        return lengths.get(currentType);
×
179
    }
180

181
    public void setLength(int length) {
182
        lengths.put(currentType, length);
×
183
        setActiveElement(getLength() - 1);
×
184
    }
×
185

186
    public void setCurrentType(IngredientComponent currentType) {
187
        this.currentType = currentType;
×
188
        setActiveElement(subElements.get(currentType).size() - 1);
×
189
    }
×
190

191
    public IValueTypeLogicProgrammerElement setActiveElement(int index) {
192
        activeElement = index;
×
193
        IValueTypeLogicProgrammerElement subElement = null;
×
194
        if (index >= 0) {
×
195
            if (!subElements.get(currentType).containsKey(index)) {
×
196
                subElements.get(currentType).put(index, subElement = IngredientComponentHandlers.REGISTRY.getComponentHandler(currentType)
×
197
                        .getValueType().createLogicProgrammerElement());
×
198
            } else {
199
                subElement = subElements.get(currentType).get(index);
×
200
            }
201
        }
202
        if (MinecraftHelpers.isClientSideThread() && masterGui != null) {
×
203
            masterGui.setActiveElement(activeElement);
×
204
            masterGui.container.onDirty();
×
205
        }
206
        return subElement;
×
207
    }
208

209
    public void removeElement(int index) {
210
        Map<Integer, IValueTypeLogicProgrammerElement> oldSubElements = subElements.get(currentType);
×
211
        Map<Integer, RenderPattern> oldSubElementGuis = subElementGuis.get(currentType);
×
212
        subElements.put(currentType, Maps.newHashMap());
×
213
        subElementGuis.put(currentType, Maps.newHashMap());
×
214
        for (Map.Entry<Integer, IValueTypeLogicProgrammerElement> entry : oldSubElements.entrySet()) {
×
215
            int i = entry.getKey();
×
216
            if (i < index) {
×
217
                subElements.get(currentType).put(i, entry.getValue());
×
218
                subElementGuis.get(currentType).put(i, oldSubElementGuis.get(i));
×
219
            } else if (i > index) {
×
220
                subElements.get(currentType).put(i - 1, entry.getValue());
×
221
                subElementGuis.get(currentType).put(i - 1, oldSubElementGuis.get(i));
×
222
            }
223
        }
×
224
        setLength(getLength() - 1);
×
225
    }
×
226

227
    @Override
228
    public void activate() {
229
        for (IngredientComponent recipeComponent : IngredientComponentHandlers.REGISTRY.getComponents()) {
×
230
            subElements.put(recipeComponent, Maps.newHashMap());
×
231
            subElementGuis.put(recipeComponent, Maps.newHashMap());
×
232
            lengths.put(recipeComponent, 0);
×
233
        }
×
234
    }
×
235

236
    @Override
237
    public void deactivate() {
238

239
    }
×
240

241
    @Override
242
    public Component validate() {
243
        if (!MinecraftHelpers.isClientSideThread()) {
×
244
            return serverValue == null ? Component.literal("") : null;
×
245
        }
246
        if (MinecraftHelpers.isClientSideThread()) {
×
247
            IntegratedDynamics._instance.getPacketHandler().sendToServer(
×
248
                    new LogicProgrammerValueTypeIngredientsValueChangedPacket(ValueDeseralizationContext.ofClient(),
×
249
                            ValueObjectTypeIngredients.ValueIngredients.of(constructValues())));
×
250
        }
251
        for (Map<Integer, IValueTypeLogicProgrammerElement> componentValues : subElements.values()) {
×
252
            for (Map.Entry<Integer, IValueTypeLogicProgrammerElement> entry : componentValues.entrySet()) {
×
253
                Component error = entry.getValue().validate();
×
254
                if (error != null) {
×
255
                    return Component.translatable(L10NValues.VALUETYPE_ERROR_INVALIDLISTELEMENT, entry.getKey(), error);
×
256
                }
257
            }
×
258
        }
×
259
        return null;
×
260
    }
261

262
    @Override
263
    public boolean isItemValidForSlot(int slotId, ItemStack itemStack) {
264
        return (slotId == 0 && super.isItemValidForSlot(slotId, itemStack)) ||
×
265
                (activeElement >= 0 && subElements.get(currentType).containsKey(activeElement)
×
266
                        && subElements.get(currentType).get(activeElement).isItemValidForSlot(slotId, itemStack));
×
267
    }
268

269
    @Override
270
    @OnlyIn(Dist.CLIENT)
271
    public ISubGuiBox createSubGui(int baseX, int baseY, int maxWidth, int maxHeight,
272
                                   ContainerScreenLogicProgrammerBase gui, ContainerLogicProgrammerBase container) {
273
        return masterGui = new MasterSubGuiRenderPattern(this, baseX, baseY, maxWidth, maxHeight, gui, container);
×
274
    }
275

276
    /**
277
     * Sub gui that holds the list element value type panel and the panel for browsing through the elements.
278
     */
279
    @OnlyIn(Dist.CLIENT)
280
    protected static class MasterSubGuiRenderPattern extends RenderPattern<ValueTypeIngredientsLPElement, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase>
281
            implements IRenderPatternValueTypeTooltip {
282

283
        private final int baseX;
284
        private final int baseY;
285
        private final int maxWidth;
286
        private final int maxHeight;
287
        private final ContainerScreenLogicProgrammerBase gui;
288
        private final ContainerLogicProgrammerBase container;
289

290
        protected ListElementSubGui elementSubGui = null;
×
291
        protected int lastGuiLeft;
292
        protected int lastGuiTop;
293
        private boolean renderTooltip = true;
×
294

295
        public MasterSubGuiRenderPattern(ValueTypeIngredientsLPElement element, int baseX, int baseY, int maxWidth, int maxHeight,
296
                                         ContainerScreenLogicProgrammerBase gui, ContainerLogicProgrammerBase container) {
297
            super(element, baseX, baseY, maxWidth, maxHeight, gui, container);
×
298
            subGuiHolder.addSubGui(new SelectionSubGui(element, baseX, baseY, maxWidth, maxHeight, gui, container));
×
299
            this.baseX = baseX;
×
300
            this.baseY = baseY;
×
301
            this.maxWidth = maxWidth;
×
302
            this.maxHeight = maxHeight;
×
303
            this.gui = gui;
×
304
            this.container = container;
×
305
        }
×
306

307
        public void setActiveElement(int index) {
308
            if (elementSubGui != null) {
×
309
                subGuiHolder.removeSubGui(elementSubGui);
×
310
                ((ContainerLogicProgrammerBase) gui.getMenu()).setElementInventory(null, 0, 0);
×
311
            }
312
            if (index >= 0) {
×
313
                subGuiHolder.addSubGui(elementSubGui = new ListElementSubGui(element, baseX, baseY + (getHeight() / 4),
×
314
                        maxWidth, maxHeight, gui, container));
315
                elementSubGui.init(lastGuiLeft, lastGuiTop);
×
316
            }
317
        }
×
318

319
        @Override
320
        public void init(int guiLeft, int guiTop) {
321
            super.init(guiLeft, guiTop);
×
322
            lastGuiLeft = guiLeft;
×
323
            lastGuiTop = guiTop;
×
324
        }
×
325

326
        @Override
327
        public void drawGuiContainerForegroundLayer(GuiGraphics guiGraphics, int guiLeft, int guiTop, TextureManager textureManager, Font fontRenderer, int mouseX, int mouseY) {
328
            super.drawGuiContainerForegroundLayer(guiGraphics, guiLeft, guiTop, textureManager, fontRenderer, mouseX, mouseY);
×
329

330
            // Output type tooltip
331
            this.drawTooltipForeground(gui, guiGraphics, container, guiLeft, guiTop, mouseX, mouseY, element.getValueType());
×
332
        }
×
333

334
        @Override
335
        public boolean isRenderTooltip() {
336
            return this.renderTooltip;
×
337
        }
338

339
        @Override
340
        public void setRenderTooltip(boolean renderTooltip) {
341
            this.renderTooltip = renderTooltip;
×
342
        }
×
343
    }
344

345
    /**
346
     * Selection panel for the type.
347
     */
348
    @OnlyIn(Dist.CLIENT)
349
    protected static class SelectionSubGui extends RenderPattern<ValueTypeIngredientsLPElement, ContainerScreenLogicProgrammerBase, ContainerLogicProgrammerBase> implements IInputListener {
350

351
        private WidgetArrowedListField<IngredientComponent> valueTypeSelector = null;
×
352
        private Button arrowAdd;
353

354
        public SelectionSubGui(ValueTypeIngredientsLPElement element, int baseX, int baseY, int maxWidth, int maxHeight,
355
                               ContainerScreenLogicProgrammerBase gui, ContainerLogicProgrammerBase container) {
356
            super(element, baseX, baseY, maxWidth, maxHeight, gui, container);
×
357
        }
×
358

359
        @Override
360
        public int getHeight() {
361
            return super.getHeight() / 4;
×
362
        }
363

364
        protected static List<IngredientComponent> getValueTypes() {
365
            return Lists.newArrayList(IngredientComponentHandlers.REGISTRY.getComponents());
×
366
        }
367

368
        @Override
369
        public void init(int guiLeft, int guiTop) {
370
            super.init(guiLeft, guiTop);
×
371
            valueTypeSelector = new WidgetArrowedListField<IngredientComponent>(Minecraft.getInstance().font,
×
372
                    getX() + guiLeft + getWidth() / 2 - 50, getY() + guiTop + 2, 100, 15, true, Component.translatable("valuetype.integrateddynamics.value_type"), true, getValueTypes()) {
×
373
                @Override
374
                protected String activeElementToString(IngredientComponent element) {
375
                    return L10NHelpers.localize(element.getTranslationKey());
×
376
                }
377
            };
378
            valueTypeSelector.setListener(this);
×
379
            //onChanged();
380
            int x = guiLeft + getX();
×
381
            int y = guiTop + getY();
×
382
            buttonList.add(arrowAdd = new ButtonText(x + getWidth() - 13, y + getHeight() - 13, 12, 12, Component.translatable("gui.integrateddynamics.button.add"), Component.literal("+"), (b) -> {
×
383
            }, true));
×
384
        }
×
385

386
        @Override
387
        public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
388
            return super.mouseClicked(mouseX, mouseY, mouseButton) || valueTypeSelector.mouseClicked(mouseX, mouseY, mouseButton);
×
389
        }
390

391
        @Override
392
        protected void actionPerformed(Button guibutton) {
393
            super.actionPerformed(guibutton);
×
394
            if (guibutton == arrowAdd) {
×
395
                element.setLength(element.getLength() + 1);
×
396
            }
397
        }
×
398

399
        @Override
400
        public void renderBg(GuiGraphics guiGraphics, int guiLeft, int guiTop, TextureManager textureManager, Font fontRenderer, float partialTicks, int mouseX, int mouseY) {
401
            super.renderBg(guiGraphics, guiLeft, guiTop, textureManager, fontRenderer, partialTicks, mouseX, mouseY);
×
402
            valueTypeSelector.renderWidget(guiGraphics, mouseX, mouseY, partialTicks);
×
403
        }
×
404

405
        @Override
406
        public void onChanged() {
407
            element.setCurrentType(valueTypeSelector.getActiveElement());
×
408
        }
×
409
    }
410

411
    /**
412
     * Panel for browsing through the list elements and updating them.
413
     */
414
    @OnlyIn(Dist.CLIENT)
415
    protected static class ListElementSubGui extends RenderPattern<ValueTypeIngredientsLPElement, ContainerScreenLogicProgrammerBase<?>, ContainerLogicProgrammerBase> {
416

417
        private ButtonArrow arrowLeft;
418
        private ButtonArrow arrowRight;
419
        private Button arrowRemove;
420

421
        private RenderPattern subGui;
422
        private IValueTypeLogicProgrammerElement subElement;
423

424
        public ListElementSubGui(ValueTypeIngredientsLPElement element, int baseX, int baseY, int maxWidth, int maxHeight,
425
                                 ContainerScreenLogicProgrammerBase<?> gui, ContainerLogicProgrammerBase container) {
426
            super(element, baseX, baseY, maxWidth, maxHeight, gui, container);
×
427
            this.subGui = element.subElementGuis.get(element.currentType).get(element.activeElement);
×
428
            this.subElement = element.subElements.get(element.currentType).get(element.activeElement);
×
429
            if(subGui == null) {
×
430
                subGui = (RenderPattern) subElement.createSubGui(baseX, baseY, maxWidth,
×
431
                        maxHeight / 3 * 2, gui, container);
432
                element.subElementGuis.get(element.currentType).put(
×
433
                        element.activeElement,
×
434
                        subGui);
435
            }
436
            int x = getX() + baseX - OFFSET_X;
×
437
            int y = getY() + baseY - OFFSET_Y;
×
438
            gui.getMenu().setElementInventory(subElement, x, y);
×
439
            subGuiHolder.addSubGui(subGui);
×
440

441
            // Do the same thing server-side
442
            IntegratedDynamics._instance.getPacketHandler().sendToServer(
×
443
                    new LogicProgrammerSetElementInventory(
444
                            IngredientComponentHandlers.REGISTRY.getComponentHandler(element.currentType).getValueType(), x, y));
×
445
        }
×
446

447
        @Override
448
        public int getHeight() {
449
            return (super.getHeight() / 4) * 3;
×
450
        }
451

452
        @Override
453
        public void init(int guiLeft, int guiTop) {
454
            super.init(guiLeft, guiTop);
×
455
            int x = guiLeft + getX();
×
456
            int y = guiTop + getY();
×
457
            buttonList.add(arrowLeft = new ButtonArrow(x, y, Component.translatable("gui.cyclopscore.left"),
×
458
                    b -> element.setActiveElement(element.activeElement - 1), ButtonArrow.Direction.WEST));
×
459
            buttonList.add(arrowRight = new ButtonArrow(x + getWidth() - arrowLeft.getWidth() - 1, y, Component.translatable("gui.cyclopscore.right"),
×
460
                    b -> element.setActiveElement(element.activeElement + 1), ButtonArrow.Direction.EAST));
×
461
            buttonList.add(arrowRemove = new ButtonText(x + (getWidth() / 2) - (arrowLeft.getWidth() / 2), y + getHeight() - 13, 12, 12, Component.translatable("gui.integrateddynamics.button.remove"), Component.literal("-"),
×
462
                    b -> element.removeElement(element.activeElement), true));
×
463
            arrowLeft.active = element.activeElement > 0;
×
464
            arrowRight.active = element.activeElement < element.getLength() - 1;
×
465
            arrowRemove.active = element.getLength() > 0;
×
466
            subElement.setValueInGui(subGui);
×
467
            subElement.setValueInContainer(subGui.container);
×
468
        }
×
469

470
        @Override
471
        public void renderBg(GuiGraphics guiGraphics, int guiLeft, int guiTop, TextureManager textureManager, Font fontRenderer, float partialTicks, int mouseX, int mouseY) {
472
            super.renderBg(guiGraphics, guiLeft, guiTop, textureManager, fontRenderer, partialTicks, mouseX, mouseY);
×
473
            int x = guiLeft + getX() + (getWidth() / 2);
×
474
            int y = guiTop + getY() + 4;
×
475
            RenderHelpers.drawScaledCenteredString(guiGraphics.pose(), guiGraphics.bufferSource(), fontRenderer, String.valueOf(element.activeElement), x - 4, y + 2, 10, Helpers.RGBToInt(20, 20, 20), false, Font.DisplayMode.NORMAL);
×
476
        }
×
477
    }
478

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