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

Method drawHoveringText

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

Source from the content-addressed store, hash-verified

95 }
96
97 @Override
98 public void drawHoveringText(List<String> lines, int x, int y) {
99 if (!lines.isEmpty()) {
100 cjm.C();
101 bss.a();
102 GLUtil.disableLighting();
103 int maxWidth = 0;
104
105 for (String line : lines) {
106 int width = MinecraftFactory.getVars().getStringWidth(line);
107 if (width > maxWidth) {
108 maxWidth = width;
109 }
110 }
111
112 int x1 = x + 12;
113 int y1 = y - 12;
114 int height = 8;
115 if (lines.size() > 1) {
116 height += 2 + (lines.size() - 1) * 10;
117 }
118
119 if (x1 + maxWidth > getWidth()) {
120 x1 -= 28 + maxWidth;
121 }
122
123 if (y1 + height + 6 > getHeight()) {
124 y1 = getHeight() - height - 6;
125 }
126
127 this.a(x1 - 3, y1 - 4, x1 + maxWidth + 3, y1 - 3, -267386864, -267386864);
128 this.a(x1 - 3, y1 + height + 3, x1 + maxWidth + 3, y1 + height + 4, -267386864, -267386864);
129 this.a(x1 - 3, y1 - 3, x1 + maxWidth + 3, y1 + height + 3, -267386864, -267386864);
130 this.a(x1 - 4, y1 - 3, x1 - 3, y1 + height + 3, -267386864, -267386864);
131 this.a(x1 + maxWidth + 3, y1 - 3, x1 + maxWidth + 4, y1 + height + 3, -267386864, -267386864);
132 this.a(x1 - 3, y1 - 3 + 1, x1 - 3 + 1, y1 + height + 3 - 1, 1347420415, 1344798847);
133 this.a(x1 + maxWidth + 2, y1 - 3 + 1, x1 + maxWidth + 3, y1 + height + 3 - 1, 1347420415, 1344798847);
134 this.a(x1 - 3, y1 - 3, x1 + maxWidth + 3, y1 - 3 + 1, 1347420415, 1347420415);
135 this.a(x1 - 3, y1 + height + 2, x1 + maxWidth + 3, y1 + height + 3, 1344798847, 1344798847);
136
137 for (int i = 0; i < lines.size(); ++i) {
138 String line = lines.get(i);
139 MinecraftFactory.getVars().drawString(line, x1, y1, -1);
140 if (i == 0) {
141 y1 += 2;
142 }
143
144 y1 += 10;
145 }
146
147 bss.b();
148 cjm.B();
149 GLUtil.disableLighting();
150 }
151 }
152
153 public static void drawModalRectWithCustomSizedTexture(int x, int y, float u, float v, int width, int height, float textureWidth, float textureHeight) {
154 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