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

Commit ce5f873

Browse files
committed
fix PotionsHud effect levels
1 parent 246d841 commit ce5f873

File tree

11 files changed

+28
-55
lines changed

11 files changed

+28
-55
lines changed

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/PotionsHud.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private void renderPotion(MatrixStack matrices, StatusEffectInstance effect, int
158158
DrawableHelper.drawSprite(matrices, x, y, 0, 18, 18, sprite);
159159
if (!iconsOnly.get()) {
160160
if (showEffectName.get()) {
161-
Text string = new TranslatableText(effect.getTranslationKey()).append(" ").append(Util.toRoman(effect.getAmplifier()));
161+
Text string = new TranslatableText(effect.getTranslationKey()).append(" ").append(Util.toRoman(effect.getAmplifier()+1));
162162

163163
drawText(matrices, string, (float) (x + 19), (float) (y + 1), textColor.get().toInt(), shadow.get());
164164
String duration = StatusEffectUtil.durationToString(effect, 1);

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/hud/gui/keystrokes/ConfigureKeyBindScreen.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,15 @@ public class ConfigureKeyBindScreen extends io.github.axolotlclient.AxolotlClien
4646
private final IntegerOption width;
4747
private final IntegerOption height;
4848
private final boolean isAddScreen;
49-
private ButtonWidget addButton, synchronizeButton;
50-
private AbstractButtonWidget currentKey;
5149

5250
public ConfigureKeyBindScreen(Screen parent, KeystrokeHud hud, KeystrokeHud.Keystroke stroke, boolean isAddScreen) {
5351
super("keystrokes.stroke.configure_stroke");
5452
this.parent = parent;
5553
this.hud = hud;
5654
this.stroke = stroke;
5755

58-
width = new IntegerOption("", stroke.getBounds().width(), v -> {
59-
stroke.getBounds().width(v);
60-
}, 1, 100);
61-
height = new IntegerOption("", stroke.getBounds().height(), v -> {
62-
stroke.getBounds().height(v);
63-
}, 1, 100);
56+
width = new IntegerOption("", stroke.getBounds().width(), v -> stroke.getBounds().width(v), 10, 100);
57+
height = new IntegerOption("", stroke.getBounds().height(), v -> stroke.getBounds().height(v), 10, 100);
6458
this.isAddScreen = isAddScreen;
6559
}
6660

@@ -91,7 +85,7 @@ public void renderButton(MatrixStack guiGraphics, int mouseX, int mouseY, float
9185
leftColY += 48;
9286
rightColY += 48;
9387

94-
currentKey = addDrawableChild(textWidget(0, rightColY, super.width, 9, LiteralText.EMPTY, textRenderer));
88+
AbstractButtonWidget currentKey = addDrawableChild(textWidget(0, rightColY, super.width, 9, LiteralText.EMPTY, textRenderer));
9589
if (stroke.getKey() != null) {
9690
currentKey.setMessage(new TranslatableText("keystrokes.stroke.key", stroke.getKey().getBoundKeyLocalizedText()));
9791
} else {
@@ -111,7 +105,7 @@ public void renderButton(MatrixStack guiGraphics, int mouseX, int mouseY, float
111105
label.setChangedListener(stroke::setLabel);
112106
if (supportsSynchronization) {
113107
var s = (KeystrokeHud.LabelKeystroke) stroke;
114-
synchronizeButton = addDrawableChild(new ButtonWidget(rightColX + 75 + 2, rightColY, 73, 20,
108+
ButtonWidget synchronizeButton = addDrawableChild(new ButtonWidget(rightColX + 75 + 2, rightColY, 73, 20,
115109
new TranslatableText("keystrokes.stroke.label.synchronize_with_key", s.isSynchronizeLabel() ? ScreenTexts.ON : ScreenTexts.OFF), b -> {
116110
s.setSynchronizeLabel(!s.isSynchronizeLabel());
117111
b.setMessage(new TranslatableText("keystrokes.stroke.label.synchronize_with_key", s.isSynchronizeLabel() ? ScreenTexts.ON : ScreenTexts.OFF));
@@ -146,7 +140,7 @@ public void renderButton(MatrixStack guiGraphics, int mouseX, int mouseY, float
146140

147141

148142
if (isAddScreen) {
149-
addButton = addDrawableChild(new ButtonWidget(super.width / 2 - 150 - 4, super.height - 33 / 2 - 10, 150, 20,
143+
ButtonWidget addButton = addDrawableChild(new ButtonWidget(super.width / 2 - 150 - 4, super.height - 33 / 2 - 10, 150, 20,
150144
new TranslatableText("keystrokes.stroke.add"), b -> {
151145
hud.keystrokes.add(stroke);
152146
onClose();

1.20/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/PotionsHud.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ private void renderPotion(GuiGraphics graphics, StatusEffectInstance effect, int
154154
graphics.drawSprite(x, y, 0, 18, 18, sprite);
155155
if (!iconsOnly.get()) {
156156
if (showEffectName.get()) {
157-
Text string = Text.translatable(effect.getTranslationKey()).append(" ").append(Util.toRoman(effect.getAmplifier()));
157+
Text string = Text.translatable(effect.getTranslationKey()).append(" ").append(Util.toRoman(effect.getAmplifier()+1));
158158

159159
graphics.drawText(client.textRenderer, string, x + 19, y + 1, textColor.get().toInt(), shadow.get());
160160
Text duration = StatusEffectUtil.durationToString(effect, 1);

1.20/src/main/java/io/github/axolotlclient/modules/hud/gui/keystrokes/ConfigureKeyBindScreen.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,15 @@ public class ConfigureKeyBindScreen extends Screen {
4545
private final IntegerOption width;
4646
private final IntegerOption height;
4747
private final boolean isAddScreen;
48-
private ButtonWidget addButton, synchronizeButton;
49-
private TextWidget currentKey;
5048

5149
public ConfigureKeyBindScreen(Screen parent, KeystrokeHud hud, KeystrokeHud.Keystroke stroke, boolean isAddScreen) {
5250
super(Text.translatable("keystrokes.stroke.configure_stroke"));
5351
this.parent = parent;
5452
this.hud = hud;
5553
this.stroke = stroke;
5654

57-
width = new IntegerOption("", stroke.getBounds().width(), v -> {
58-
stroke.getBounds().width(v);
59-
}, 1, 100);
60-
height = new IntegerOption("", stroke.getBounds().height(), v -> {
61-
stroke.getBounds().height(v);
62-
}, 1, 100);
55+
width = new IntegerOption("", stroke.getBounds().width(), v -> stroke.getBounds().width(v), 10, 100);
56+
height = new IntegerOption("", stroke.getBounds().height(), v -> stroke.getBounds().height(v), 10, 100);
6357
this.isAddScreen = isAddScreen;
6458
}
6559

@@ -94,7 +88,7 @@ protected void updateNarration(NarrationMessageBuilder narrationElementOutput) {
9488
leftColY += 48;
9589
rightColY += 48;
9690

97-
currentKey = addDrawable(new TextWidget(0, rightColY, super.width, 9, Text.empty(), textRenderer));
91+
TextWidget currentKey = addDrawable(new TextWidget(0, rightColY, super.width, 9, Text.empty(), textRenderer));
9892
if (stroke.getKey() != null) {
9993
currentKey.setMessage(Text.translatable("keystrokes.stroke.key", stroke.getKey().getKeyName()));
10094
} else {
@@ -114,7 +108,7 @@ protected void updateNarration(NarrationMessageBuilder narrationElementOutput) {
114108
label.setChangedListener(stroke::setLabel);
115109
if (supportsSynchronization) {
116110
var s = (KeystrokeHud.LabelKeystroke) stroke;
117-
synchronizeButton = addDrawableChild(ButtonWidget.builder(Text.translatable("keystrokes.stroke.label.synchronize_with_key", s.isSynchronizeLabel() ? CommonTexts.ON : CommonTexts.OFF), b -> {
111+
ButtonWidget synchronizeButton = addDrawableChild(ButtonWidget.builder(Text.translatable("keystrokes.stroke.label.synchronize_with_key", s.isSynchronizeLabel() ? CommonTexts.ON : CommonTexts.OFF), b -> {
118112
s.setSynchronizeLabel(!s.isSynchronizeLabel());
119113
b.setMessage(Text.translatable("keystrokes.stroke.label.synchronize_with_key", s.isSynchronizeLabel() ? CommonTexts.ON : CommonTexts.OFF));
120114
label.setEditable(!s.isSynchronizeLabel());
@@ -146,7 +140,7 @@ protected void updateNarration(NarrationMessageBuilder narrationElementOutput) {
146140

147141

148142
if (isAddScreen) {
149-
addButton = addDrawableChild(ButtonWidget.builder(Text.translatable("keystrokes.stroke.add"), b -> {
143+
ButtonWidget addButton = addDrawableChild(ButtonWidget.builder(Text.translatable("keystrokes.stroke.add"), b -> {
150144
hud.keystrokes.add(stroke);
151145
closeScreen();
152146
}).positionAndSize(super.width / 2 - 150 - 4, super.height - 33 / 2 - 10, 150, 20).build());

1.21.4/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/PotionsHud.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import net.minecraft.client.renderer.RenderType;
4242
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
4343
import net.minecraft.core.Holder;
44+
import net.minecraft.network.chat.CommonComponents;
4445
import net.minecraft.network.chat.Component;
4546
import net.minecraft.resources.ResourceLocation;
4647
import net.minecraft.world.effect.MobEffect;
@@ -106,7 +107,7 @@ private void renderEffects(GuiGraphics graphics, List<MobEffectInstance> effects
106107
if (direction.isXAxis()) {
107108
renderPotion(graphics, effect, x + lastPos + 1, y + 1, tickDelta);
108109
lastPos += (iconsOnly.get() ? 20 : (showEffectName.get() ? 20 + client.font.width(
109-
Component.translatable(effect.getDescriptionId()).append(" ")
110+
effect.getEffect().value().getDisplayName().copy().append(CommonComponents.SPACE)
110111
.append(Util.toRoman(effect.getAmplifier() + 1))) : 50));
111112
} else {
112113
renderPotion(graphics, effect, x + 1, y + 1 + lastPos, tickDelta);
@@ -154,8 +155,8 @@ private void renderPotion(GuiGraphics graphics, MobEffectInstance effect, int x,
154155
if (!iconsOnly.get()) {
155156
float tickrate = client.level != null ? client.level.tickRateManager().tickrate() : 1;
156157
if (showEffectName.get()) {
157-
Component string = Component.translatable(effect.getDescriptionId()).append(" ")
158-
.append(Util.toRoman(effect.getAmplifier()));
158+
Component string = effect.getEffect().value().getDisplayName().copy().append(CommonComponents.SPACE)
159+
.append(Util.toRoman(effect.getAmplifier()+1));
159160

160161
graphics.drawString(client.font, string, x + 19, y + 1, textColor.get().toInt(), shadow.get());
161162
Component duration = MobEffectUtil.formatDuration(effect, 1, tickrate);

1.21.4/src/main/java/io/github/axolotlclient/modules/hud/gui/keystrokes/ConfigureKeyBindScreen.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,8 @@ public ConfigureKeyBindScreen(Screen parent, KeystrokeHud hud, KeystrokeHud.Keys
5858
this.hud = hud;
5959
this.stroke = stroke;
6060

61-
width = new IntegerOption("", stroke.getBounds().width(), v -> {
62-
stroke.getBounds().width(v);
63-
}, 1, 100);
64-
height = new IntegerOption("", stroke.getBounds().height(), v -> {
65-
stroke.getBounds().height(v);
66-
}, 1, 100);
61+
width = new IntegerOption("", stroke.getBounds().width(), v -> stroke.getBounds().width(v), 10, 100);
62+
height = new IntegerOption("", stroke.getBounds().height(), v -> stroke.getBounds().height(v), 10, 100);
6763
this.isAddScreen = isAddScreen;
6864
}
6965

@@ -81,7 +77,7 @@ protected void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, flo
8177
var rect = stroke.getRenderPosition();
8278
guiGraphics.pose().pushPose();
8379
guiGraphics.pose().translate(getX(), getY(), 0);
84-
float scale = Math.min( (float) getHeight() / rect.height(), (float) getWidth() / rect.width());
80+
float scale = Math.min((float) getHeight() / rect.height(), (float) getWidth() / rect.width());
8581
guiGraphics.pose().translate(getWidth()/2f - (rect.width()*scale) /2f, 0, 0);
8682
guiGraphics.pose().scale(scale, scale, 1);
8783
guiGraphics.pose().translate(-rect.x(), -rect.y(), 0);

1.21/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/PotionsHud.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ private void renderPotion(GuiGraphics graphics, StatusEffectInstance effect, int
156156
if (!iconsOnly.get()) {
157157
float tickrate = client.world != null ? client.world.getTickManager().getTickRate() : 1;
158158
if (showEffectName.get()) {
159-
Text string = Text.translatable(effect.getTranslationKey()).append(" ").append(Util.toRoman(effect.getAmplifier()));
159+
Text string = Text.translatable(effect.getTranslationKey()).append(" ").append(Util.toRoman(effect.getAmplifier()+1));
160160

161161
graphics.drawText(client.textRenderer, string, x + 19, y + 1, textColor.get().toInt(), shadow.get());
162162
Text duration = StatusEffectUtil.durationToString(effect, 1, tickrate);

1.21/src/main/java/io/github/axolotlclient/modules/hud/gui/keystrokes/ConfigureKeyBindScreen.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,8 @@ public ConfigureKeyBindScreen(Screen parent, KeystrokeHud hud, KeystrokeHud.Keys
5858
this.hud = hud;
5959
this.stroke = stroke;
6060

61-
width = new IntegerOption("", stroke.getBounds().width(), v -> {
62-
stroke.getBounds().width(v);
63-
}, 1, 100);
64-
height = new IntegerOption("", stroke.getBounds().height(), v -> {
65-
stroke.getBounds().height(v);
66-
}, 1, 100);
61+
width = new IntegerOption("", stroke.getBounds().width(), v -> stroke.getBounds().width(v), 10, 100);
62+
height = new IntegerOption("", stroke.getBounds().height(), v -> stroke.getBounds().height(v), 10, 100);
6763
this.isAddScreen = isAddScreen;
6864
}
6965

1.8.9/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/PotionsHud.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private void renderPotion(StatusEffectInstance effect, int x, int y) {
158158
this.drawTexture(x, y, m % 8 * 18, 198 + m / 8 * 18, 18, 18);
159159
if (!iconsOnly.get()) {
160160
if (showEffectName.get()) {
161-
String string = I18n.translate(effect.getName()) + " " + Util.toRoman(effect.getAmplifier());
161+
String string = I18n.translate(effect.getName()) + " " + Util.toRoman(effect.getAmplifier()+1);
162162

163163
drawString(string, (float) (x + 19), (float) (y + 1), textColor.get().toInt(), shadow.get());
164164
String duration = StatusEffect.getDurationString(effect);

1.8.9/src/main/java/io/github/axolotlclient/modules/hud/gui/keystrokes/ConfigureKeyBindScreen.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,15 @@ public class ConfigureKeyBindScreen extends io.github.axolotlclient.AxolotlClien
4545
private final IntegerOption width;
4646
private final IntegerOption height;
4747
private final boolean isAddScreen;
48-
private ButtonWidget addButton, synchronizeButton;
49-
private ClickableWidget currentKey;
5048

5149
public ConfigureKeyBindScreen(Screen parent, KeystrokeHud hud, KeystrokeHud.Keystroke stroke, boolean isAddScreen) {
5250
super(I18n.translate("keystrokes.stroke.configure_stroke"));
5351
this.parent = parent;
5452
this.hud = hud;
5553
this.stroke = stroke;
5654

57-
width = new IntegerOption("", stroke.getBounds().width(), v -> {
58-
stroke.getBounds().width(v);
59-
}, 1, 100);
60-
height = new IntegerOption("", stroke.getBounds().height(), v -> {
61-
stroke.getBounds().height(v);
62-
}, 1, 100);
55+
width = new IntegerOption("", stroke.getBounds().width(), v -> stroke.getBounds().width(v), 10, 100);
56+
height = new IntegerOption("", stroke.getBounds().height(), v -> stroke.getBounds().height(v), 10, 100);
6357
this.isAddScreen = isAddScreen;
6458
}
6559

@@ -89,7 +83,7 @@ protected void drawWidget(int mouseX, int mouseY, float partialTick) {
8983
leftColY += 48;
9084
rightColY += 48;
9185

92-
currentKey = addDrawable(textWidget(0, rightColY, super.width, 9, "", textRenderer));
86+
ClickableWidget currentKey = addDrawable(textWidget(0, rightColY, super.width, 9, "", textRenderer));
9387
if (stroke.getKey() != null) {
9488
currentKey.setMessage(I18n.translate("keystrokes.stroke.key", GameOptions.getKeyName(stroke.getKey().getKeyCode())));
9589
} else {
@@ -109,7 +103,7 @@ protected void drawWidget(int mouseX, int mouseY, float partialTick) {
109103
label.setChangedListener(stroke::setLabel);
110104
if (supportsSynchronization) {
111105
var s = (KeystrokeHud.LabelKeystroke) stroke;
112-
synchronizeButton = addDrawableChild(new VanillaButtonWidget(rightColX + 75 + 2, rightColY, 73, 20, I18n.translate("keystrokes.stroke.label.synchronize_with_key", s.isSynchronizeLabel() ? I18n.translate("options.on") : I18n.translate("options.off")), b -> {
106+
ButtonWidget synchronizeButton = addDrawableChild(new VanillaButtonWidget(rightColX + 75 + 2, rightColY, 73, 20, I18n.translate("keystrokes.stroke.label.synchronize_with_key", s.isSynchronizeLabel() ? I18n.translate("options.on") : I18n.translate("options.off")), b -> {
113107
s.setSynchronizeLabel(!s.isSynchronizeLabel());
114108
b.setMessage(I18n.translate("keystrokes.stroke.label.synchronize_with_key", s.isSynchronizeLabel() ? I18n.translate("options.on") : I18n.translate("options.off")));
115109
label.setEditable(!s.isSynchronizeLabel());
@@ -141,7 +135,7 @@ protected void drawWidget(int mouseX, int mouseY, float partialTick) {
141135

142136

143137
if (isAddScreen) {
144-
addButton = addDrawableChild(new VanillaButtonWidget(super.width / 2 - 150 - 4, super.height - 33 / 2 - 10, 150, 20, I18n.translate("keystrokes.stroke.add"), b -> {
138+
ButtonWidget addButton = addDrawableChild(new VanillaButtonWidget(super.width / 2 - 150 - 4, super.height - 33 / 2 - 10, 150, 20, I18n.translate("keystrokes.stroke.add"), b -> {
145139
hud.keystrokes.add(stroke);
146140
closeScreen();
147141
}));

0 commit comments

Comments
 (0)