4343import org .jetbrains .annotations .Nullable ;
4444import org .spongepowered .asm .mixin .Mixin ;
4545import org .spongepowered .asm .mixin .Shadow ;
46+ import org .spongepowered .asm .mixin .Unique ;
4647import org .spongepowered .asm .mixin .injection .At ;
4748import org .spongepowered .asm .mixin .injection .Inject ;
4849import org .spongepowered .asm .mixin .injection .Redirect ;
@@ -61,6 +62,9 @@ public class MinecraftClientMixin {
6162 @ Shadow
6263 public int itemUseCooldown ;
6364
65+ @ Unique
66+ private boolean lambda$inputHandledThisTick ;
67+
6468 @ Inject (method = "close" , at = @ At ("HEAD" ))
6569 void closeImGui (CallbackInfo ci ) {
6670 DearImGui .INSTANCE .destroy ();
@@ -75,6 +79,8 @@ void onLoopTick(boolean tick, Operation<Void> original) {
7579
7680 @ WrapMethod (method = "tick" )
7781 void onTick (Operation <Void > original ) {
82+ this .lambda$inputHandledThisTick = false ;
83+
7884 EventFlow .post (TickEvent .Pre .INSTANCE );
7985 original .call ();
8086 EventFlow .post (TickEvent .Post .INSTANCE );
@@ -92,10 +98,18 @@ void onInput(MinecraftClient instance, Operation<Void> original) {
9298 EventFlow .post (TickEvent .Input .Pre .INSTANCE );
9399 original .call (instance );
94100 EventFlow .post (TickEvent .Input .Post .INSTANCE );
101+
102+ this .lambda$inputHandledThisTick = true ;
95103 }
96104
97105 @ WrapOperation (method = "tick" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/render/WorldRenderer;tick()V" ))
98106 void onWorldRenderer (WorldRenderer instance , Operation <Void > original ) {
107+ if (!this .lambda$inputHandledThisTick ) {
108+ EventFlow .post (TickEvent .Input .Pre .INSTANCE );
109+ EventFlow .post (TickEvent .Input .Post .INSTANCE );
110+ this .lambda$inputHandledThisTick = true ;
111+ }
112+
99113 EventFlow .post (TickEvent .WorldRender .Pre .INSTANCE );
100114 original .call (instance );
101115 EventFlow .post (TickEvent .WorldRender .Post .INSTANCE );
0 commit comments