MCPcopy Create free account
hub / github.com/5zig/The-5zig-Mod / render

Method render

The 5zig Mod/src/eu/the5zig/mod/modules/Module.java:69–211  ·  view source on GitHub ↗
(DisplayRenderer renderer, int x, int y, boolean dummy)

Source from the content-addressed store, hash-verified

67 }
68
69 public void render(DisplayRenderer renderer, int x, int y, boolean dummy) {
70 if (getItemRenderCount(dummy) == 0) {
71 return;
72 }
73 int maxWidth = getMaxWidth(dummy);
74 int totalHeight = getTotalHeight(dummy) - (int) (6 * scale);
75 RenderLocation renderLocation;
76 if (location == ModuleLocation.TOP_LEFT || location == ModuleLocation.CENTER_LEFT || location == ModuleLocation.BOTTOM_LEFT) {
77 renderLocation = RenderLocation.LEFT;
78 } else if (location == ModuleLocation.TOP_RIGHT || location == ModuleLocation.CENTER_RIGHT || location == ModuleLocation.BOTTOM_RIGHT) {
79 renderLocation = RenderLocation.RIGHT;
80 } else {
81 renderLocation = anchorPoint.toRenderLocation();
82 }
83 x /= scale;
84 y /= scale;
85 totalHeight /= scale;
86 maxWidth /= scale;
87
88 if (scale != 1.0f) {
89 GLUtil.pushMatrix();
90 GLUtil.scale(scale, scale, scale);
91 DisplayRenderer.largeTextRenderer.setScaleModifyFactor(scale);
92 }
93 if (boxOpacity > 0) {
94 if (location == ModuleLocation.CUSTOM) {
95 if (anchorPoint == AnchorPoint.TOP_LEFT) {
96 Gui.drawRect(x, y, x + maxWidth, y + totalHeight, (int) (boxOpacity * 255) << 24);
97 } else if (anchorPoint == AnchorPoint.TOP_CENTER) {
98 Gui.drawRect(x - maxWidth / 2, y, x + maxWidth / 2, y + totalHeight, (int) (boxOpacity * 255) << 24);
99 } else if (anchorPoint == AnchorPoint.TOP_RIGHT) {
100 Gui.drawRect(x - maxWidth, y, x, y + totalHeight, (int) (boxOpacity * 255) << 24);
101 } else if (anchorPoint == AnchorPoint.CENTER_LEFT) {
102 Gui.drawRect(x, y - totalHeight / 2, x + maxWidth, y + totalHeight / 2, (int) (boxOpacity * 255) << 24);
103 } else if (anchorPoint == AnchorPoint.CENTER_CENTER) {
104 Gui.drawRect(x - maxWidth / 2, y - totalHeight / 2, x + maxWidth / 2, y + totalHeight / 2, (int) (boxOpacity * 255) << 24);
105 } else if (anchorPoint == AnchorPoint.CENTER_RIGHT) {
106 Gui.drawRect(x - maxWidth, y - totalHeight / 2, x, y + totalHeight / 2, (int) (boxOpacity * 255) << 24);
107 } else if (anchorPoint == AnchorPoint.BOTTOM_LEFT) {
108 Gui.drawRect(x, y - totalHeight, x + maxWidth, y, (int) (boxOpacity * 255) << 24);
109 } else if (anchorPoint == AnchorPoint.BOTTOM_CENTER) {
110 Gui.drawRect(x - maxWidth / 2, y - totalHeight, x + maxWidth / 2, y, (int) (boxOpacity * 255) << 24);
111 } else if (anchorPoint == AnchorPoint.BOTTOM_RIGHT) {
112 Gui.drawRect(x - maxWidth, y - totalHeight, x, y, (int) (boxOpacity * 255) << 24);
113 }
114 } else {
115 Gui.drawRect(x, y, x + maxWidth, y + totalHeight, (int) (boxOpacity * 255) << 24);
116 }
117 }
118
119 if (isShowLabel()) {
120 String displayName = getDisplayName();
121
122 int labelWidth = The5zigMod.getVars().getStringWidth(displayName);
123 if (location == ModuleLocation.CUSTOM) {
124 if (anchorPoint == AnchorPoint.TOP_LEFT) {
125 The5zigMod.getVars().drawString(displayName, x, y);
126 } else if (anchorPoint == AnchorPoint.TOP_CENTER) {

Callers 1

onRenderVignetteMethod · 0.45

Calls 15

getItemRenderCountMethod · 0.95
getMaxWidthMethod · 0.95
getTotalHeightMethod · 0.95
pushMatrixMethod · 0.95
scaleMethod · 0.95
drawRectMethod · 0.95
isShowLabelMethod · 0.95
getDisplayNameMethod · 0.95
getVarsMethod · 0.95
popMatrixMethod · 0.95
toRenderLocationMethod · 0.80
setScaleModifyFactorMethod · 0.80

Tested by

no test coverage detected