Skip to content

Commit 329081f

Browse files
committed
assorted code cleanup and bug fixes
1 parent 710d470 commit 329081f

File tree

13 files changed

+28
-16
lines changed

13 files changed

+28
-16
lines changed

src/main/java/meteordevelopment/meteorclient/commands/commands/InputCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
6767
}
6868

6969
for (KeyBinding keyBinding : mc.options.hotbarKeys) {
70-
builder.then(literal(keyBinding.getBoundKeyTranslationKey().substring(4))
70+
builder.then(literal(keyBinding.getId().substring(4))
7171
.executes(context -> {
7272
press(keyBinding);
7373
return SINGLE_SUCCESS;
@@ -91,7 +91,7 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
9191
info("Active keypress handlers: ");
9292
for (int i = 0; i < activeHandlers.size(); i++) {
9393
KeypressHandler handler = activeHandlers.get(i);
94-
info("(highlight)%d(default) - (highlight)%s %d(default) ticks left out of (highlight)%d(default).", i, I18n.translate(handler.key.getBoundKeyTranslationKey()), handler.ticks, handler.totalTicks);
94+
info("(highlight)%d(default) - (highlight)%s %d(default) ticks left out of (highlight)%d(default).", i, I18n.translate(handler.key.getId()), handler.ticks, handler.totalTicks);
9595
}
9696
}
9797
return SINGLE_SUCCESS;

src/main/java/meteordevelopment/meteorclient/commands/commands/SpectateCommand.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import meteordevelopment.meteorclient.commands.Command;
1111
import meteordevelopment.meteorclient.commands.arguments.PlayerArgumentType;
1212
import meteordevelopment.meteorclient.events.meteor.KeyEvent;
13+
import meteordevelopment.meteorclient.events.meteor.MouseButtonEvent;
1314
import meteordevelopment.meteorclient.utils.misc.input.Input;
1415
import meteordevelopment.orbit.EventHandler;
1516
import net.minecraft.command.CommandSource;
@@ -47,5 +48,14 @@ private void onKey(KeyEvent event) {
4748
MeteorClient.EVENT_BUS.unsubscribe(this);
4849
}
4950
}
51+
52+
@EventHandler
53+
private void onMouse(MouseButtonEvent event) {
54+
if (Input.isPressed(mc.options.sneakKey)) {
55+
mc.setCameraEntity(mc.player);
56+
event.cancel();
57+
MeteorClient.EVENT_BUS.unsubscribe(this);
58+
}
59+
}
5060
}
5161
}

src/main/java/meteordevelopment/meteorclient/gui/WidgetScreen.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ public void onClosed(Runnable action) {
118118
}
119119

120120
@Override
121-
// todo rename bl when appropriate
122-
public boolean mouseClicked(Click arg, boolean bl) {
121+
public boolean mouseClicked(Click arg, boolean doubled) {
123122
if (locked) return false;
124123

125124
double mouseX = arg.x();
@@ -129,7 +128,7 @@ public boolean mouseClicked(Click arg, boolean bl) {
129128
mouseX *= s;
130129
mouseY *= s;
131130

132-
return root.mouseClicked(mouseX, mouseY, arg.button(), bl);
131+
return root.mouseClicked(mouseX, mouseY, arg.button(), doubled);
133132
}
134133

135134
@Override

src/main/java/meteordevelopment/meteorclient/mixin/CapeFeatureRendererMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public abstract class CapeFeatureRendererMixin {
2424
private AssetInfo.TextureAsset modifyCapeTexture(AssetInfo.TextureAsset original, MatrixStack matrices, OrderedRenderCommandQueue entityRenderCommandQueue, int i, PlayerEntityRenderState state, float f, float g) {
2525
if (((IEntityRenderState) state).meteor$getEntity() instanceof PlayerEntity player) {
2626
Identifier id = Capes.get(player);
27-
return id == null ? original : new AssetInfo.TextureAssetInfo(id);
27+
return id == null ? original : new AssetInfo.TextureAssetInfo(id, id);
2828
}
2929

3030
return original;

src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private void onMouseDragged(Click arg, double d, double e, CallbackInfoReturnabl
102102

103103
// Middle click open
104104
@Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true)
105-
private void mouseClicked(Click arg, boolean bl, CallbackInfoReturnable<Boolean> cir) {
105+
private void mouseClicked(Click arg, boolean doubled, CallbackInfoReturnable<Boolean> cir) {
106106
BetterTooltips tooltips = Modules.get().get(BetterTooltips.class);
107107

108108
if (arg.button() == GLFW.GLFW_MOUSE_BUTTON_MIDDLE && focusedSlot != null && !focusedSlot.getStack().isEmpty() && getScreenHandler().getCursorStack().isEmpty() && tooltips.middleClickOpen()) {

src/main/java/meteordevelopment/meteorclient/mixin/KeyboardMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public abstract class KeyboardMixin {
3030
@Shadow @Final private MinecraftClient client;
3131

3232
@Inject(method = "onKey", at = @At("HEAD"), cancellable = true)
33-
public void onKey(long window, int action, KeyInput arg, CallbackInfo ci) { // todo verify this is correct when they update the mappings
33+
public void onKey(long window, int action, KeyInput arg, CallbackInfo ci) {
3434
int modifiers = arg.modifiers();
3535
if (arg.key() != GLFW.GLFW_KEY_UNKNOWN) {
3636
// on Linux/X11 the modifier is not active when the key is pressed and still active when the key is released

src/main/java/meteordevelopment/meteorclient/mixin/MapRendererMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private List<MapDecoration> getIconsProxy(List<MapDecoration> original) {
2828
}
2929

3030
@Inject(method = "draw", at = @At("HEAD"), cancellable = true)
31-
private void onDraw(MapRenderState state, MatrixStack matrices, OrderedRenderCommandQueue queue, boolean bl, int light, CallbackInfo ci) {
31+
private void onDraw(MapRenderState state, MatrixStack matrices, OrderedRenderCommandQueue queue, boolean skipRenderingDecorations, int light, CallbackInfo ci) {
3232
if (Modules.get().get(NoRender.class).noMapContents()) ci.cancel();
3333
}
3434
}

src/main/java/meteordevelopment/meteorclient/mixin/MultiplayerScreenMixin.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@ private void onInit(CallbackInfo info) {
6363
);
6464
}
6565

66-
//@Inject(method = "render", at = @At("TAIL"))
67-
private void onRender(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
66+
// todo this is probably an extremely bad way of doing it but it works for now
67+
@Override
68+
public void render(DrawContext context, int mouseX, int mouseY, float deltaTicks) {
69+
super.render(context, mouseX, mouseY, deltaTicks);
70+
6871
int x = 3;
6972
int y = 3;
7073

src/main/java/meteordevelopment/meteorclient/mixin/TitleScreenMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private void onRender(DrawContext context, int mouseX, int mouseY, float delta,
3131
}
3232

3333
@Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true)
34-
private void onMouseClicked(Click arg, boolean bl, CallbackInfoReturnable<Boolean> cir) {
34+
private void onMouseClicked(Click arg, boolean doubled, CallbackInfoReturnable<Boolean> cir) {
3535
if (Config.get().titleScreenCredits.get() && arg.button() == GLFW.GLFW_MOUSE_BUTTON_LEFT) {
3636
if (TitleScreenCredits.onClicked(arg.x(), arg.y())) cir.setReturnValue(true);
3737
}

src/main/java/meteordevelopment/meteorclient/systems/hud/screens/HudEditorScreen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public HudEditorScreen(GuiTheme theme) {
6767
public void initWidgets() {}
6868

6969
@Override
70-
public boolean mouseClicked(Click arg, boolean bl) {
70+
public boolean mouseClicked(Click arg, boolean doubled) {
7171
double s = mc.getWindow().getScaleFactor();
7272

7373
double mouseX = arg.x();

0 commit comments

Comments
 (0)