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

Method drawHoveringText

Minecraft-Utils/1.13/src/GuiHandle.java:117–171  ·  view source on GitHub ↗
(List<String> lines, int x, int y)

Source from the content-addressed store, hash-verified

115 }
116
117 @Override
118 public void drawHoveringText(List<String> lines, int x, int y) {
119 if (!lines.isEmpty()) {
120 ctp.E();
121 cfg.a();
122 GLUtil.disableLighting();
123 int maxWidth = 0;
124
125 for (String line : lines) {
126 int width = MinecraftFactory.getVars().getStringWidth(line);
127 if (width > maxWidth) {
128 maxWidth = width;
129 }
130 }
131
132 int x1 = x + 12;
133 int y1 = y - 12;
134 int height = 8;
135 if (lines.size() > 1) {
136 height += 2 + (lines.size() - 1) * 10;
137 }
138
139 if (x1 + maxWidth > getWidth()) {
140 x1 -= 28 + maxWidth;
141 }
142
143 if (y1 + height + 6 > getHeight()) {
144 y1 = getHeight() - height - 6;
145 }
146
147 this.a(x1 - 3, y1 - 4, x1 + maxWidth + 3, y1 - 3, -267386864, -267386864);
148 this.a(x1 - 3, y1 + height + 3, x1 + maxWidth + 3, y1 + height + 4, -267386864, -267386864);
149 this.a(x1 - 3, y1 - 3, x1 + maxWidth + 3, y1 + height + 3, -267386864, -267386864);
150 this.a(x1 - 4, y1 - 3, x1 - 3, y1 + height + 3, -267386864, -267386864);
151 this.a(x1 + maxWidth + 3, y1 - 3, x1 + maxWidth + 4, y1 + height + 3, -267386864, -267386864);
152 this.a(x1 - 3, y1 - 3 + 1, x1 - 3 + 1, y1 + height + 3 - 1, 1347420415, 1344798847);
153 this.a(x1 + maxWidth + 2, y1 - 3 + 1, x1 + maxWidth + 3, y1 + height + 3 - 1, 1347420415, 1344798847);
154 this.a(x1 - 3, y1 - 3, x1 + maxWidth + 3, y1 - 3 + 1, 1347420415, 1347420415);
155 this.a(x1 - 3, y1 + height + 2, x1 + maxWidth + 3, y1 + height + 3, 1344798847, 1344798847);
156
157 for (int i = 0; i < lines.size(); ++i) {
158 String line = lines.get(i);
159 MinecraftFactory.getVars().drawString(line, x1, y1, -1);
160 if (i == 0) {
161 y1 += 2;
162 }
163
164 y1 += 10;
165 }
166
167 cfg.b();
168 ctp.D();
169 GLUtil.disableLighting();
170 }
171 }
172
173 public static void drawModalRectWithCustomSizedTexture(int x, int y, float u, float v, int width, int height, float textureWidth, float textureHeight) {
174 a(x, y, u, v, width, height, textureWidth, textureHeight);

Callers

nothing calls this directly

Calls 11

aMethod · 0.95
disableLightingMethod · 0.95
getVarsMethod · 0.95
getWidthMethod · 0.95
getHeightMethod · 0.95
isEmptyMethod · 0.80
sizeMethod · 0.80
getStringWidthMethod · 0.65
getMethod · 0.65
drawStringMethod · 0.65
bMethod · 0.45

Tested by

no test coverage detected