Update to 1.21.3

This commit is contained in:
2025-06-14 20:29:35 +02:00
parent 67f979a051
commit d7c9759d27
5 changed files with 13 additions and 4 deletions

View File

@ -20,9 +20,9 @@
package de.steamwar.advancedscripts.mixin;
import de.steamwar.advancedscripts.KeyAction;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.minecraft.client.Keyboard;
import net.minecraft.client.MinecraftClient;
import net.minecraft.network.packet.c2s.common.CustomPayloadC2SPacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@ -34,7 +34,7 @@ public class KeyboardMixin {
public void sendKeyPress(long window, int key, int scancode, int action, int modifiers, CallbackInfo ci) {
MinecraftClient client = ((Keyboard) (Object)this).client;
if(client.currentScreen == null && action != 2) {
client.getNetworkHandler().sendPacket(new CustomPayloadC2SPacket(new KeyAction(key, (byte) action, modifiers)));
ClientPlayNetworking.send(new KeyAction(key, (byte) action, modifiers));
}
}
}