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

Commit 97a636f

Browse files
committed
Tooltippable
1 parent d29c4fc commit 97a636f

File tree

7 files changed

+35
-44
lines changed

7 files changed

+35
-44
lines changed

src/main/java/io/github/moehreag/axolotlclient/config/options/Option.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import java.util.Objects;
88

9-
public interface Option {
9+
public interface Option extends Tooltippable {
1010

1111
OptionType getType();
1212

@@ -22,10 +22,4 @@ default Text getTranslatedName(){
2222

2323
JsonElement getJson();
2424

25-
default @Nullable Text getTooltip(){
26-
if(!Objects.equals(Text.translatable(getName() + ".tooltip").getString(), getName() + ".tooltip")) {
27-
return Text.translatable(getName() + ".tooltip");
28-
}
29-
return null;
30-
}
3125
}

src/main/java/io/github/moehreag/axolotlclient/config/options/OptionCategory.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import java.util.List;
99
import java.util.Objects;
1010

11-
public class OptionCategory {
11+
public class OptionCategory implements Tooltippable {
1212

1313
Identifier Id;
1414
String name;
@@ -47,11 +47,4 @@ public String getName() {
4747
}
4848

4949
public Text getTranslatedName(){return Text.translatable(name);}
50-
51-
public @Nullable Text getTooltip(){
52-
if(!Objects.equals(Text.translatable(getName() + ".tooltip").getString(), getName() + ".tooltip")) {
53-
return Text.translatable(getName() + ".tooltip");
54-
}
55-
return null;
56-
}
5750
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package io.github.moehreag.axolotlclient.config.options;
2+
3+
import net.minecraft.text.Text;
4+
import org.jetbrains.annotations.Nullable;
5+
6+
import java.util.Objects;
7+
8+
public interface Tooltippable {
9+
10+
String getName();
11+
12+
13+
default @Nullable Text getTooltip(){
14+
if(!Objects.equals(Text.translatable(getName() + ".tooltip").getString(), getName() + ".tooltip")) {
15+
return Text.translatable(getName()+ ".tooltip");
16+
}
17+
return null;
18+
}
19+
}

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import io.github.moehreag.axolotlclient.config.options.Option;
1717
import io.github.moehreag.axolotlclient.config.options.OptionCategory;
1818
import io.github.moehreag.axolotlclient.config.options.StringOption;
19+
import io.github.moehreag.axolotlclient.config.options.Tooltippable;
1920
import io.github.moehreag.axolotlclient.config.screen.widgets.BooleanWidget;
2021
import io.github.moehreag.axolotlclient.config.screen.widgets.CategoryWidget;
2122
import io.github.moehreag.axolotlclient.config.screen.widgets.ColorOptionWidget;
@@ -222,7 +223,7 @@ public void render(MatrixStack matrices, int index, int y, int x, int entryWidth
222223

223224
}
224225

225-
protected void renderTooltip(MatrixStack matrices, Option option, int x, int y){
226+
protected void renderTooltip(MatrixStack matrices, Tooltippable option, int x, int y){
226227
if(MinecraftClient.getInstance().currentScreen instanceof OptionsScreenBuilder &&
227228
AxolotlClient.CONFIG.showOptionTooltips.get() && option.getTooltip()!=null){
228229
GL11.glDisable(GL11.GL_SCISSOR_TEST);
@@ -231,15 +232,6 @@ protected void renderTooltip(MatrixStack matrices, Option option, int x, int y){
231232
}
232233
}
233234

234-
protected void renderTooltip(MatrixStack matrices, OptionCategory category, int x, int y){
235-
if(MinecraftClient.getInstance().currentScreen instanceof OptionsScreenBuilder &&
236-
AxolotlClient.CONFIG.showCategoryTooltips.get() && category.getTooltip()!=null){
237-
GL11.glDisable(GL11.GL_SCISSOR_TEST);
238-
((OptionsScreenBuilder) MinecraftClient.getInstance().currentScreen).renderTooltip(matrices, category, x, y);
239-
Util.applyScissor(new Rectangle(0, top, width, bottom-top));
240-
}
241-
}
242-
243235
@Override
244236
public boolean mouseClicked(double mouseX, double mouseY, int button) {
245237
if (this.left.isMouseOver(mouseX, mouseY)) {

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import io.github.moehreag.axolotlclient.config.options.ColorOption;
66
import io.github.moehreag.axolotlclient.config.options.Option;
77
import io.github.moehreag.axolotlclient.config.options.OptionCategory;
8+
import io.github.moehreag.axolotlclient.config.options.Tooltippable;
89
import io.github.moehreag.axolotlclient.config.screen.widgets.ColorSelectionWidget;
910
import io.github.moehreag.axolotlclient.modules.hud.util.DrawUtil;
1011
import net.minecraft.client.MinecraftClient;
@@ -111,16 +112,9 @@ public boolean charTyped(char chr, int modifiers) {
111112
return list.charTyped(chr, modifiers);
112113
}
113114

114-
public void renderTooltip(MatrixStack matrices, Option option, int x, int y){
115+
public void renderTooltip(MatrixStack matrices, Tooltippable option, int x, int y){
115116
List<Text> text = new ArrayList<>();
116-
String[] tooltip = Objects.requireNonNull(option.getTooltip()).getString().split("\n");
117-
for(String s:tooltip) text.add(Text.literal(s));
118-
this.renderTooltip(matrices, text, x, y);
119-
}
120-
121-
public void renderTooltip(MatrixStack matrices, OptionCategory category, int x, int y){
122-
List<Text> text = new ArrayList<>();
123-
String[] tooltip = Objects.requireNonNull(category.getTooltip()).getString().split("\n");
117+
String[] tooltip = Objects.requireNonNull(option.getTooltip()).getString().split("<br>");
124118
for(String s:tooltip) text.add(Text.literal(s));
125119
this.renderTooltip(matrices, text, x, y);
126120
}

src/main/java/io/github/moehreag/axolotlclient/modules/hud/util/ItemUtil.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,28 +146,27 @@ public static void renderGuiItemModel(MatrixStack matrices, ItemStack stack, flo
146146
RenderSystem.enableBlend();
147147
RenderSystem.blendFunc(GlStateManager.class_4535.SRC_ALPHA, GlStateManager.class_4534.ONE_MINUS_SRC_ALPHA);
148148
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
149-
MatrixStack matrixStack = RenderSystem.getModelViewStack();
150-
matrixStack.push();
151-
matrixStack.translate(x, y, 100.0F + MinecraftClient.getInstance().getItemRenderer().zOffset);
152-
matrixStack.translate(8.0, 8.0, 0.0);
153-
matrixStack.scale(1.0F, -1.0F, 1.0F);
154-
matrixStack.scale(16.0F, 16.0F, 16.0F);
149+
matrices.push();
150+
matrices.translate(x, y, (100.0F + client.getItemRenderer().zOffset));
151+
matrices.translate(8.0D, 8.0D, 0.0D);
152+
matrices.scale(1.0F, -1.0F, 1.0F);
153+
matrices.scale(16.0F, 16.0F, 16.0F);
155154
RenderSystem.applyModelViewMatrix();
156-
MatrixStack matrixStack2 = new MatrixStack();
157155
VertexConsumerProvider.Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
158156
boolean bl = !model.isSideLit();
159157
if (bl) {
160158
DiffuseLighting.setupFlatGuiLighting();
161159
}
162160

163-
MinecraftClient.getInstance().getItemRenderer().renderItem(stack, ModelTransformation.Mode.GUI, false, matrixStack2, immediate, 15728880, OverlayTexture.DEFAULT_UV, model);
161+
client.getItemRenderer().renderItem(stack, ModelTransformation.Mode.GUI, false, matrices, immediate, 15728880,
162+
OverlayTexture.DEFAULT_UV, model);
164163
immediate.draw();
165164
RenderSystem.enableDepthTest();
166165
if (bl) {
167166
DiffuseLighting.setup3DGuiLighting();
168167
}
169168

170-
matrixStack.pop();
169+
matrices.pop();
171170
RenderSystem.applyModelViewMatrix();
172171
}
173172

src/main/resources/assets/axolotlclient/lang/en_us.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"nightMode": "Night Mode",
1818
"nightMode.tooltip": "Reduces blue colors.",
1919
"quickToggles": "Quick Toggles",
20-
"quickToggles.tooltip": "Whether to show small switches on categories\ncontaining an 'enabled' option.",
20+
"quickToggles.tooltip": "Whether to show small switches on categories<br>containing an 'enabled' option.",
2121
"showOptionTooltips": "Show Option Tooltips",
2222
"showOptionTooltips.tooltip": "Whether to show Tooltips on Options in the menu.",
2323
"showCategoryTooltips": "Show Category Tooltips",

0 commit comments

Comments
 (0)