Skip to content

Commit 0a31820

Browse files
committed
I know its not neat but we need the event when screen not null
1 parent 44c49ad commit 0a31820

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/main/java/com/lambda/mixin/MinecraftClientMixin.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import org.jetbrains.annotations.Nullable;
4444
import org.spongepowered.asm.mixin.Mixin;
4545
import org.spongepowered.asm.mixin.Shadow;
46+
import org.spongepowered.asm.mixin.Unique;
4647
import org.spongepowered.asm.mixin.injection.At;
4748
import org.spongepowered.asm.mixin.injection.Inject;
4849
import 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);

src/main/kotlin/com/lambda/util/item/ItemUtils.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import net.minecraft.item.Item
2323
import net.minecraft.item.Items
2424

2525
object ItemUtils {
26-
27-
2826
val pickaxes = setOf(
2927
Items.WOODEN_PICKAXE,
3028
Items.STONE_PICKAXE,

0 commit comments

Comments
 (0)