• 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/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.IModHelpers;
22
import org.cyclops.integrateddynamics.IntegratedDynamics;
23
import org.cyclops.integrateddynamics.api.client.gui.subgui.ISubGuiBox;
24
import org.cyclops.integrateddynamics.api.evaluate.variable.IValue;
25
import org.cyclops.integrateddynamics.api.evaluate.variable.IValueType;
26
import org.cyclops.integrateddynamics.api.evaluate.variable.ValueDeseralizationContext;
27
import org.cyclops.integrateddynamics.api.ingredient.IIngredientComponentHandler;
28
import org.cyclops.integrateddynamics.api.logicprogrammer.IConfigRenderPattern;
29
import org.cyclops.integrateddynamics.api.logicprogrammer.ILogicProgrammerElementType;
30
import org.cyclops.integrateddynamics.api.logicprogrammer.IValueTypeLogicProgrammerElement;
31
import org.cyclops.integrateddynamics.client.gui.container.ContainerScreenLogicProgrammerBase;
32
import org.cyclops.integrateddynamics.core.evaluate.variable.ValueObjectTypeIngredients;
33
import org.cyclops.integrateddynamics.core.evaluate.variable.ValueTypes;
34
import org.cyclops.integrateddynamics.core.helper.L10NValues;
35
import org.cyclops.integrateddynamics.core.ingredient.IngredientComponentHandlers;
36
import org.cyclops.integrateddynamics.inventory.container.ContainerLogicProgrammerBase;
37
import org.cyclops.integrateddynamics.network.packet.LogicProgrammerSetElementInventory;
38
import org.cyclops.integrateddynamics.network.packet.LogicProgrammerValueTypeIngredientsValueChangedPacket;
39

40
import java.util.List;
41
import java.util.Map;
42

43
/**
44
 * Element for the ingredients value type.
45
 *
46
 * @author rubensworks
47
 */
48
public class ValueTypeIngredientsLPElement extends ValueTypeLPElementBase {
49

50
    protected static final int OFFSET_X = 20;
51
    protected static final int OFFSET_Y = 21;
52

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

61
    private ValueObjectTypeIngredients.ValueIngredients serverValue = null;
×
62

63
    public ValueTypeIngredientsLPElement() {
64
        super(ValueTypes.OBJECT_INGREDIENTS);
×
65
    }
×
66

67
    public void setServerValue(ValueObjectTypeIngredients.ValueIngredients serverValue) {
68
        this.serverValue = serverValue;
×
69
    }
×
70

71
    @Override
72
    public ILogicProgrammerElementType getType() {
73
        return LogicProgrammerElementTypes.VALUETYPE;
×
74
    }
75

76
    @Override
77
    public IConfigRenderPattern getRenderPattern() {
78
        return IConfigRenderPattern.NONE_CANVAS_WIDE;
×
79
    }
80

81
    @Override
82
    public boolean canWriteElementPre() {
83
        return true;
×
84
    }
85

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

105
    @Override
106
    public IValue getValue() {
107
        return IModHelpers.get().getMinecraftHelpers().isClientSideThread()
×
108
                ? ValueObjectTypeIngredients.ValueIngredients.of(constructValues()) : serverValue;
×
109
    }
110

111
    @Override
112
    public void setValue(IValue value) {
113
        ValueObjectTypeIngredients.ValueIngredients valueIngredients = (ValueObjectTypeIngredients.ValueIngredients) value;
×
114
        if (!IModHelpers.get().getMinecraftHelpers().isClientSideThread()) {
×
115
            setServerValue(valueIngredients);
×
116
        }
117

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

126
            for (IngredientComponent<?, ?> ingredientComponent : ingredients.getComponents()) {
×
127
                IIngredientComponentHandler handler = IngredientComponentHandlers.REGISTRY.getComponentHandler(ingredientComponent);
×
128

129
                // If no itemstacks in ingredient, select any other
130
                if (currentType == null) {
×
131
                    currentType = ingredientComponent;
×
132
                }
133

134
                // Save length per ingredient component
135
                lengths.put(ingredientComponent, ingredients.getInstances(ingredientComponent).size());
×
136

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

148
    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) {
149
        IValue instanceValue = handler.toValue(instance);
×
150
        IValueTypeLogicProgrammerElement lpElement = instanceValue.getType().createLogicProgrammerElement();
×
151
        lpElement.setValue(instanceValue);
×
152
        entries.put(instanceIndex, lpElement);
×
153
    }
×
154

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

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

174
    public int getLength() {
175
        return lengths.get(currentType);
×
176
    }
177

178
    public void setLength(int length) {
179
        lengths.put(currentType, length);
×
180
        setActiveElement(getLength() - 1);
×
181
    }
×
182

183
    public void setCurrentType(IngredientComponent currentType) {
184
        this.currentType = currentType;
×
185
        setActiveElement(subElements.get(currentType).size() - 1);
×
186
    }
×
187

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

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

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

233
    @Override
234
    public void deactivate() {
235

236
    }
×
237

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

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

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

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

280
        private final int baseX;
281
        private final int baseY;
282
        private final int maxWidth;
283
        private final int maxHeight;
284
        private final ContainerScreenLogicProgrammerBase gui;
285
        private final ContainerLogicProgrammerBase container;
286

287
        protected ListElementSubGui elementSubGui = null;
×
288
        protected int lastGuiLeft;
289
        protected int lastGuiTop;
290
        private boolean renderTooltip = true;
×
291

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

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

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

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

327
            // Output type tooltip
328
            this.drawTooltipForeground(gui, guiGraphics, container, guiLeft, guiTop, mouseX, mouseY, element.getValueType());
×
329
        }
×
330

331
        @Override
332
        public boolean isRenderTooltip() {
333
            return this.renderTooltip;
×
334
        }
335

336
        @Override
337
        public void setRenderTooltip(boolean renderTooltip) {
338
            this.renderTooltip = renderTooltip;
×
339
        }
×
340
    }
341

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

348
        private WidgetArrowedListField<IngredientComponent> valueTypeSelector = null;
×
349
        private Button arrowAdd;
350

351
        public SelectionSubGui(ValueTypeIngredientsLPElement element, int baseX, int baseY, int maxWidth, int maxHeight,
352
                               ContainerScreenLogicProgrammerBase gui, ContainerLogicProgrammerBase container) {
353
            super(element, baseX, baseY, maxWidth, maxHeight, gui, container);
×
354
        }
×
355

356
        @Override
357
        public int getHeight() {
358
            return super.getHeight() / 4;
×
359
        }
360

361
        protected static List<IngredientComponent> getValueTypes() {
362
            return Lists.newArrayList(IngredientComponentHandlers.REGISTRY.getComponents());
×
363
        }
364

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

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

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

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

402
        @Override
403
        public void onChanged() {
404
            element.setCurrentType(valueTypeSelector.getActiveElement());
×
405
        }
×
406
    }
407

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

414
        private ButtonArrow arrowLeft;
415
        private ButtonArrow arrowRight;
416
        private Button arrowRemove;
417

418
        private RenderPattern subGui;
419
        private IValueTypeLogicProgrammerElement subElement;
420

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

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

444
        @Override
445
        public int getHeight() {
446
            return (super.getHeight() / 4) * 3;
×
447
        }
448

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

467
        @Override
468
        public void renderBg(GuiGraphics guiGraphics, int guiLeft, int guiTop, TextureManager textureManager, Font fontRenderer, float partialTicks, int mouseX, int mouseY) {
469
            super.renderBg(guiGraphics, guiLeft, guiTop, textureManager, fontRenderer, partialTicks, mouseX, mouseY);
×
470
            int x = guiLeft + getX() + (getWidth() / 2);
×
471
            int y = guiTop + getY() + 4;
×
472
            IModHelpers.get().getRenderHelpers().drawScaledCenteredString(guiGraphics, fontRenderer, String.valueOf(element.activeElement), x - 4, y + 2, 10, IModHelpers.get().getBaseHelpers().RGBToInt(20, 20, 20), false, Font.DisplayMode.NORMAL);
×
473
        }
×
474
    }
475

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