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

Commit f3b2f57

Browse files
committed
(1.8.9) tweak KeystrokePositioningScreen
1 parent efd2716 commit f3b2f57

File tree

5 files changed

+36
-32
lines changed

5 files changed

+36
-32
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
package io.github.axolotlclient.modules.hud;
2424

25-
import java.awt.*;
2625
import java.util.List;
2726
import java.util.Optional;
2827

@@ -97,8 +96,8 @@ private void updateSnapState() {
9796
@Override
9897
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
9998
if (MinecraftClient.getInstance().world != null)
100-
fillGradient(matrices, 0, 0, width, height, new Color(0xB0100E0E, true).hashCode(),
101-
new Color(0x46212020, true).hashCode());
99+
fillGradient(matrices, 0, 0, width, height, 0xB0100E0E,
100+
0x46212020);
102101
else {
103102
renderBackgroundTexture(0);
104103
}

1.8.9/src/main/java/io/github/axolotlclient/modules/hud/HudEditScreen.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
package io.github.axolotlclient.modules.hud;
2424

25-
import java.awt.*;
2625
import java.util.List;
2726
import java.util.Optional;
2827

@@ -95,8 +94,8 @@ private void updateSnapState() {
9594
@Override
9695
public void render(int mouseX, int mouseY, float delta) {
9796
if (Minecraft.getInstance().world != null)
98-
fillGradient(0, 0, width, height, new Color(0xB0100E0E, true).hashCode(),
99-
new Color(0x46212020, true).hashCode());
97+
fillGradient(0, 0, width, height, 0xB0100E0E,
98+
0x46212020);
10099
else {
101100
renderBackground(0);
102101
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public void onPlayerDirectionChange(PlayerDirectionChangeEvent event) {
8585
@Override
8686
public void renderComponent(float delta) {
8787
GlStateManager.color4f(1, 1, 1, 1);
88+
GlStateManager.enableBlend();
8889
int spaceY = getRawY();
8990
int spaceX = getRawX();
9091

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

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import com.mojang.blaze3d.platform.GlStateManager;
3030
import io.github.axolotlclient.AxolotlClient;
3131
import io.github.axolotlclient.AxolotlClientConfig.api.util.Colors;
32-
import io.github.axolotlclient.AxolotlClientConfig.impl.ui.vanilla.widgets.VanillaButtonWidget;
3332
import io.github.axolotlclient.modules.hud.HudEditScreen;
3433
import io.github.axolotlclient.modules.hud.HudManager;
3534
import io.github.axolotlclient.modules.hud.gui.hud.KeystrokeHud;
@@ -39,16 +38,18 @@
3938
import io.github.axolotlclient.modules.hud.util.Rectangle;
4039
import io.github.axolotlclient.util.ClientColors;
4140
import net.minecraft.client.gui.screen.Screen;
41+
import net.minecraft.client.gui.widget.ButtonWidget;
4242
import net.minecraft.client.resource.language.I18n;
4343

44-
public class KeystrokePositioningScreen extends io.github.axolotlclient.AxolotlClientConfig.impl.ui.Screen {
44+
public class KeystrokePositioningScreen extends Screen {
45+
private static final String title = I18n.translate("keystrokes.stroke.move");
4546
private final Screen parent;
4647
private final KeystrokeHud hud;
4748
private KeystrokeHud.Keystroke focused;
4849
private final KeystrokeHud.Keystroke editing;
4950

5051
public KeystrokePositioningScreen(Screen parent, KeystrokeHud hud, KeystrokeHud.Keystroke focused) {
51-
super(I18n.translate("keystrokes.stroke.move"));
52+
super();
5253
this.parent = parent;
5354
this.hud = hud;
5455
this.editing = focused;
@@ -63,20 +64,27 @@ public KeystrokePositioningScreen(Screen parent, KeystrokeHud hud) {
6364
private boolean mouseDown;
6465
private SnappingHelper snap;
6566

67+
@Override
68+
protected void buttonClicked(ButtonWidget buttonWidget) {
69+
if (buttonWidget.id == 0) {
70+
closeScreen();
71+
} else if (buttonWidget.id == 1) {
72+
HudEditScreen.toggleSnapping();
73+
buttonWidget.message = I18n.translate("hud.snapping") + ": " +
74+
I18n.translate(HudEditScreen.isSnappingEnabled() ? "options.on" : "options.off");
75+
AxolotlClient.configManager.save();
76+
}
77+
}
78+
6679
@Override
6780
public void init() {
68-
addDrawableChild(new VanillaButtonWidget(width / 2 - 75, height - 50 + 22, 150, 20, I18n.translate("gui.back"), b -> closeScreen()));
69-
this.addDrawableChild(new VanillaButtonWidget(width / 2 - 50, height - 50, 100, 20, I18n.translate("hud.snapping") + ": "
70-
+ (I18n.translate(HudEditScreen.isSnappingEnabled() ? "options.on" : "options.off")),
71-
buttonWidget -> {
72-
HudEditScreen.toggleSnapping();
73-
buttonWidget.setMessage(I18n.translate("hud.snapping") + ": " +
74-
I18n.translate(HudEditScreen.isSnappingEnabled() ? "options.on" : "options.off"));
75-
AxolotlClient.configManager.save();
76-
}));
81+
buttons.add(new ButtonWidget(0, width / 2 - 75, height - 50 + 22, 150, 20, I18n.translate("gui.back")));
82+
buttons.add(new ButtonWidget(1, width / 2 - 50, height - 50, 100, 20, I18n.translate("hud.snapping") + ": "
83+
+ (I18n.translate(HudEditScreen.isSnappingEnabled() ? "options.on" : "options.off"))));
7784
}
7885

7986
private float partialTick;
87+
8088
@Override
8189
public void renderBackground() {
8290
GlStateManager.pushMatrix();
@@ -90,6 +98,7 @@ public void renderBackground() {
9098
@Override
9199
public void render(int mouseX, int mouseY, float partialTick) {
92100
this.partialTick = partialTick;
101+
renderBackground();
93102
super.render(mouseX, mouseY, partialTick);
94103
if (editing != null) {
95104
var rect = editing.getRenderPosition();
@@ -118,8 +127,8 @@ public void render(int mouseX, int mouseY, float partialTick) {
118127
}
119128

120129
@Override
121-
public boolean mouseClicked(double mouseX, double mouseY, int button) {
122-
var value = super.mouseClicked(mouseX, mouseY, button);
130+
public void mouseClicked(int mouseX, int mouseY, int button) {
131+
super.mouseClicked(mouseX, mouseY, button);
123132
if (button == 0) {
124133
Optional<KeystrokeHud.Keystroke> entry = Optional.empty();
125134
Optional<Rectangle> pos = Optional.empty();
@@ -141,15 +150,13 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) {
141150
focused = entry.get();
142151
mouseDown = true;
143152
var rect = pos.get();
144-
offset = new DrawPosition((int) Math.round(mouseX - rect.x()),
145-
(int) Math.round(mouseY - rect.y()));
153+
offset = new DrawPosition(mouseX - rect.x(),
154+
mouseY - rect.y());
146155
updateSnapState();
147-
return true;
148156
} else {
149157
focused = null;
150158
}
151159
}
152-
return value;
153160
}
154161

155162

@@ -159,21 +166,21 @@ public void closeScreen() {
159166
}
160167

161168
@Override
162-
public boolean mouseReleased(double mouseX, double mouseY, int button) {
169+
public void mouseReleased(int mouseX, int mouseY, int button) {
163170
if (focused != null) {
164171
hud.saveKeystrokes();
165172
}
166173
snap = null;
167174
mouseDown = false;
168175
focused = null;
169-
return super.mouseReleased(mouseX, mouseY, button);
176+
super.mouseReleased(mouseX, mouseY, button);
170177
}
171178

172179
@Override
173-
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
180+
public void mouseDragged(int mouseX, int mouseY, int button, long mouseLastClicked) {
174181
if (focused != null && mouseDown) {
175-
focused.setX((int) mouseX - offset.x());
176-
focused.setY((int) mouseY - offset.y());
182+
focused.setX(mouseX - offset.x());
183+
focused.setY(mouseY - offset.y());
177184
if (snap != null) {
178185
Integer snapX, snapY;
179186
var rect = focused.getRenderPosition();
@@ -185,9 +192,7 @@ public boolean mouseDragged(double mouseX, double mouseY, int button, double del
185192
focused.setY(snapY);
186193
}
187194
}
188-
return true;
189195
}
190-
return false;
191196
}
192197

193198
private List<Rectangle> getAllBounds() {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ org.gradle.parallel=true
66
axolotlclient.modules.all=true
77

88
# Mod Properties
9-
version=3.1.2-alpha.3
9+
version=3.1.2-alpha.4
1010

1111
maven_group=io.github.axolotlclient
1212

0 commit comments

Comments
 (0)