Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit f9cf18f

Browse files
committed
tooltips show over everything else
1 parent ac8754d commit f9cf18f

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

src/main/java/io/github/axolotlclient/config/options/Tooltippable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ public interface Tooltippable {
99

1010
String getName();
1111

12-
1312
default String getTooltip(){
1413
return this.getTooltip(null);
1514
}
15+
1616
default @Nullable String getTooltip(String location){
1717
if(location!=null){
1818
if(!Objects.equals(I18n.translate(location + ".tooltip"), location + ".tooltip")) {

src/main/java/io/github/axolotlclient/config/screen/ButtonWidgetList.java

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,20 @@ public void render(int mouseX, int mouseY, float delta){
141141
}
142142
}
143143

144+
public void renderTooltips(int x, int y, int mouseX, int mouseY){
145+
int i = this.getEntryCount();
146+
147+
for(int j = 0; j < i; ++j) {
148+
Pair pair = entries.get(j);
149+
150+
int k = y + j * this.entryHeight + this.headerHeight;
151+
//int l = this.entryHeight - 4;
152+
//if (k > this.yEnd || k + l < this.yStart) {
153+
pair.renderTooltips(x, k, mouseX, mouseY);
154+
//}
155+
}
156+
}
157+
144158
@Override
145159
public int getRowWidth() {
146160
return 500;
@@ -150,7 +164,10 @@ public int getRowWidth() {
150164
protected void renderList(int x, int y, int mouseX, int mouseY) {
151165
Util.applyScissor(new Rectangle(0, yStart, this.width, yEnd-yStart));
152166
super.renderList(x, y, mouseX, mouseY);
167+
renderTooltips(x, y, mouseX, mouseY);
153168
GL11.glDisable(GL11.GL_SCISSOR_TEST);
169+
170+
154171
}
155172

156173
public void tick(){
@@ -215,6 +232,10 @@ public void render(int index, int x, int y, int rowWidth, int rowHeight, int mou
215232

216233
}
217234

235+
public void renderTooltips(int x, int y, int mouseX, int mouseY){
236+
237+
}
238+
218239
protected void renderTooltip(Tooltippable option, int x, int y){
219240
if(isMouseInList(y) && MinecraftClient.getInstance().currentScreen instanceof OptionsScreenBuilder &&
220241
AxolotlClient.CONFIG.showOptionTooltips.get() && option.getTooltip()!=null){
@@ -295,6 +316,10 @@ public CategoryPair(OptionCategory catLeft, CategoryWidget btnLeft, OptionCatego
295316
@Override
296317
public void render(int index, int x, int y, int rowWidth, int rowHeight, int mouseX, int mouseY, boolean hovered) {
297318
super.render(index, x, y, rowWidth, rowHeight, mouseX, mouseY, hovered);
319+
320+
}
321+
322+
public void renderTooltips(int x, int y, int mouseX, int mouseY){
298323
if(AxolotlClient.CONFIG.showCategoryTooltips.get()) {
299324
if (super.left != null && super.left.isMouseOver(client, mouseX, mouseY)) {
300325
renderTooltip(left, mouseX, mouseY);
@@ -324,11 +349,13 @@ public void render(int index, int x, int y, int rowWidth, int rowHeight, int mou
324349
left.y = y;
325350
left.render(client, mouseX, mouseY);
326351

352+
}
353+
354+
public void renderTooltips(int x, int y, int mouseX, int mouseY){
327355
if(AxolotlClient.CONFIG.showOptionTooltips.get() &&
328356
(mouseX>=x && mouseX<=left.x + left.getWidth() && mouseY>= y && mouseY<= y + 20)){
329357
renderTooltip(option, mouseX, mouseY);
330358
}
331-
332359
}
333360
}
334361

src/main/java/io/github/axolotlclient/config/screen/OptionsScreenBuilder.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import net.minecraft.client.MinecraftClient;
1414
import net.minecraft.client.gui.screen.Screen;
1515
import net.minecraft.client.gui.widget.ButtonWidget;
16+
import net.minecraft.client.render.DiffuseLighting;
1617
import net.minecraft.client.resource.language.I18n;
1718

1819
import java.util.Arrays;
@@ -46,12 +47,14 @@ public void render(int mouseX, int mouseY, float tickDelta) {
4647
DrawUtil.fill(0, height*5/6, width, height, 0xFF86007d);
4748
}
4849

49-
this.list.render(mouseX, mouseY, tickDelta);
50+
5051
drawCenteredString(textRenderer, cat.getTranslatedName(), width/2, 25, -1);
5152

5253

5354
super.render(mouseX, mouseY, tickDelta);
5455

56+
this.list.render(mouseX, mouseY, tickDelta);
57+
5558
if(picker!=null){
5659
GlStateManager.disableDepthTest();
5760
picker.render(MinecraftClient.getInstance(), mouseX, mouseY);
@@ -160,6 +163,5 @@ public boolean shouldPauseGame() {
160163
public void renderTooltip(Tooltippable tooltippable, int x, int y){
161164
String[] tooltip = Objects.requireNonNull(tooltippable.getTooltip()).split("<br>");
162165
this.renderTooltip(Arrays.asList(tooltip), x, y);
163-
GlStateManager.disableLighting();
164166
}
165167
}

0 commit comments

Comments
 (0)