Skip to content

Commit 516ebca

Browse files
authored
Hotfix .input hold keybinds not actualy pressing the button (#5946)
Fixes .input attack 1 not hitting entities
1 parent ac05a1a commit 516ebca

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ public InputCommand() {
4848
public void build(LiteralArgumentBuilder<CommandSource> builder) {
4949
for (Pair<KeyBinding, String> keyBinding : holdKeys) {
5050
builder.then(literal(keyBinding.getSecond())
51+
.executes(context -> {
52+
activeHandlers.add(new KeypressHandler(keyBinding.getFirst(), 1));
53+
return SINGLE_SUCCESS;
54+
})
5155
.then(argument("ticks", IntegerArgumentType.integer(1))
5256
.executes(context -> {
5357
activeHandlers.add(new KeypressHandler(keyBinding.getFirst(), context.getArgument("ticks", Integer.class)));
@@ -129,8 +133,11 @@ public KeypressHandler(KeyBinding key, int ticks) {
129133

130134
@EventHandler
131135
private void onTick(TickEvent.Post event) {
132-
if (ticks-- > 0) key.setPressed(true);
133-
else {
136+
if (ticks == totalTicks) press(key);
137+
138+
if (ticks-- > 0) {
139+
key.setPressed(true);
140+
} else {
134141
key.setPressed(false);
135142
MeteorClient.EVENT_BUS.unsubscribe(this);
136143
activeHandlers.remove(this);

0 commit comments

Comments
 (0)