2929import com .lambda .module .modules .player .InventoryMove ;
3030import com .lambda .module .modules .player .PacketMine ;
3131import com .lambda .util .WindowUtils ;
32+ import com .llamalad7 .mixinextras .expression .Definition ;
33+ import com .llamalad7 .mixinextras .expression .Expression ;
3234import com .llamalad7 .mixinextras .injector .ModifyExpressionValue ;
3335import com .llamalad7 .mixinextras .injector .v2 .WrapWithCondition ;
3436import com .llamalad7 .mixinextras .injector .wrapmethod .WrapMethod ;
4042import net .minecraft .client .network .ClientPlayerEntity ;
4143import net .minecraft .client .network .ClientPlayerInteractionManager ;
4244import net .minecraft .client .option .KeyBinding ;
43- import net .minecraft .client .render .WorldRenderer ;
4445import net .minecraft .client .sound .SoundManager ;
4546import net .minecraft .util .Hand ;
4647import net .minecraft .util .hit .HitResult ;
4950import org .objectweb .asm .Opcodes ;
5051import org .spongepowered .asm .mixin .Mixin ;
5152import org .spongepowered .asm .mixin .Shadow ;
52- import org .spongepowered .asm .mixin .Unique ;
5353import org .spongepowered .asm .mixin .injection .At ;
5454import org .spongepowered .asm .mixin .injection .Inject ;
5555import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
@@ -67,9 +67,6 @@ public class MinecraftClientMixin {
6767 @ Shadow
6868 public int itemUseCooldown ;
6969
70- @ Unique
71- private boolean lambda$inputHandledThisTick ;
72-
7370 @ Inject (method = "close" , at = @ At ("HEAD" ))
7471 void closeImGui (CallbackInfo ci ) {
7572 DearImGui .INSTANCE .destroy ();
@@ -84,8 +81,6 @@ void onLoopTick(boolean tick, Operation<Void> original) {
8481
8582 @ WrapMethod (method = "tick" )
8683 void onTick (Operation <Void > original ) {
87- this .lambda$inputHandledThisTick = false ;
88-
8984 EventFlow .post (TickEvent .Pre .INSTANCE );
9085 original .call ();
9186 EventFlow .post (TickEvent .Post .INSTANCE );
@@ -98,27 +93,23 @@ void onNetwork(ClientPlayerInteractionManager instance, Operation<Void> original
9893 EventFlow .post (TickEvent .Network .Post .INSTANCE );
9994 }
10095
96+ @ Definition (id = "overlay" , field = "Lnet/minecraft/client/MinecraftClient;overlay:Lnet/minecraft/client/gui/screen/Overlay;" )
97+ @ Expression ("this.overlay == null" )
98+ @ ModifyExpressionValue (method = "tick" , at = @ At ("MIXINEXTRAS:EXPRESSION" ))
99+ private boolean modifyCurrentScreenNullCheck (boolean original ) {
100+ if (!original || this .currentScreen != null ) {
101+ EventFlow .post (TickEvent .Input .Pre .INSTANCE );
102+ EventFlow .post (TickEvent .Input .Post .INSTANCE );
103+ }
104+ return original ;
105+ }
106+
101107 @ WrapOperation (method = "tick" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/MinecraftClient;handleInputEvents()V" ))
102108 void onInput (MinecraftClient instance , Operation <Void > original ) {
103109 EventFlow .post (TickEvent .Input .Pre .INSTANCE );
104110 original .call (instance );
105111 EventFlow .post (TickEvent .Input .Post .INSTANCE );
106-
107- this .lambda$inputHandledThisTick = true ;
108- }
109-
110- // @WrapOperation(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;tick()V"))
111- // void onWorldRenderer(WorldRenderer instance, Operation<Void> original) {
112- // if (!this.lambda$inputHandledThisTick) {
113- // EventFlow.post(TickEvent.Input.Pre.INSTANCE);
114- // EventFlow.post(TickEvent.Input.Post.INSTANCE);
115- // this.lambda$inputHandledThisTick = true;
116- // }
117- //
118- // EventFlow.post(TickEvent.WorldRender.Pre.INSTANCE);
119- // original.call(instance);
120- // EventFlow.post(TickEvent.WorldRender.Post.INSTANCE);
121- // }
112+ }
122113
123114 @ WrapOperation (method = "tick" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/sound/SoundManager;tick(Z)V" ))
124115 void onSound (SoundManager instance , boolean paused , Operation <Void > original ) {
0 commit comments