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

CyclopsMC / IntegratedDynamics / 20210191346

14 Dec 2025 03:32PM UTC coverage: 19.514% (-33.5%) from 53.061%
20210191346

push

github

rubensworks
Remove deprecations

663 of 8728 branches covered (7.6%)

Branch coverage included in aggregate %.

6786 of 29445 relevant lines covered (23.05%)

1.09 hits per line

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

0.0
/src/main/java/org/cyclops/integrateddynamics/client/render/valuetype/OperatorValueTypeWorldRenderer.java
1
package org.cyclops.integrateddynamics.client.render.valuetype;
2

3
import com.google.common.collect.Lists;
4
import com.mojang.blaze3d.vertex.PoseStack;
5
import net.minecraft.client.gui.Font;
6
import net.minecraft.client.renderer.SubmitNodeCollector;
7
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
8
import net.minecraft.core.Direction;
9
import net.minecraft.network.chat.Component;
10
import org.cyclops.cyclopscore.helper.IModHelpers;
11
import org.cyclops.integrateddynamics.api.client.render.valuetype.IValueTypeWorldRenderer;
12
import org.cyclops.integrateddynamics.api.evaluate.operator.IOperator;
13
import org.cyclops.integrateddynamics.api.evaluate.variable.IValue;
14
import org.cyclops.integrateddynamics.api.part.IPartContainer;
15
import org.cyclops.integrateddynamics.api.part.IPartType;
16
import org.cyclops.integrateddynamics.core.evaluate.variable.ValueTypeOperator;
17
import org.cyclops.integrateddynamics.core.evaluate.variable.ValueTypes;
18

19
import java.util.List;
20

21
/**
22
 * A text-based value type world renderer for operators.
23
 * @author rubensworks
24
 */
25
public class OperatorValueTypeWorldRenderer implements IValueTypeWorldRenderer {
×
26

27
    private static final int MAX_LINES = 30;
28
    private static final float MAX = 12.5F;
29
    private static final float MARGIN_FACTOR = 1.1F;
30

31
    @Override
32
    public void submitValue(BlockEntityRendererProvider.Context context, IPartContainer partContainer,
33
                            Direction direction, IPartType partType, IValue value, float partialTicks,
34
                            PoseStack matrixStack, SubmitNodeCollector nodeCollector,
35
                            int combinedLight, int combinedOverlay, float alpha) {
36
        Font fontRenderer = context.font();
×
37
        float maxWidth = 0;
×
38

39
        ValueTypeOperator.ValueOperator valueOperator = ((ValueTypeOperator.ValueOperator) value);
×
40
        IOperator operator = valueOperator.getRawValue();
×
41
        List<Component> lines = Lists.newLinkedList();
×
42
        lines.add(Component.literal(ValueTypes.OPERATOR.getName(valueOperator) + " ::"));
×
43
        lines.addAll(ValueTypeOperator.getSignatureLines(operator, true));
×
44
        for (Component line : lines) {
×
45
            float width = fontRenderer.width(line.getString()) - 1;
×
46
            maxWidth = Math.max(maxWidth, width);
×
47
        }
×
48

49
        float singleHeight = fontRenderer.lineHeight;
×
50
        float totalHeight = singleHeight * lines.size();
×
51

52
        matrixStack.pushPose();
×
53

54
        float scaleX = MAX / (maxWidth * MARGIN_FACTOR);
×
55
        float scaleY = MAX / (totalHeight * MARGIN_FACTOR);
×
56
        float scale = Math.min(scaleX, scaleY); // Maintain aspect ratio
×
57
        float newWidth = maxWidth * scale;
×
58
        float newHeight = totalHeight * scale;
×
59
        matrixStack.translate((MAX - newWidth) / 2, (MAX - newHeight) / 2, 0F);
×
60
        matrixStack.scale(scale, scale, 1F);
×
61

62
        int offset = 0;
×
63
        for(Component line : lines) {
×
64
            int color = IModHelpers.get().getBaseHelpers().addAlphaToColor(ValueTypes.OPERATOR.getDisplayColor(), alpha);
×
65
            nodeCollector.submitText(matrixStack, 0, offset, Component.literal(line.getString()).getVisualOrderText(),
×
66
                    false, Font.DisplayMode.NORMAL, combinedLight, color,
67
                    0, 0);
68
            offset += singleHeight;
×
69
        }
×
70

71
        matrixStack.popPose();
×
72
    }
×
73
}
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