diff options
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/mixin')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/mixin/MinecraftMixin.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/mixin/MinecraftMixin.java b/src/main/java/cc/polyfrost/oneconfig/mixin/MinecraftMixin.java index 97b843a..1226244 100644 --- a/src/main/java/cc/polyfrost/oneconfig/mixin/MinecraftMixin.java +++ b/src/main/java/cc/polyfrost/oneconfig/mixin/MinecraftMixin.java @@ -1,14 +1,12 @@ package cc.polyfrost.oneconfig.mixin; import cc.polyfrost.oneconfig.events.EventManager; -import cc.polyfrost.oneconfig.events.event.RenderEvent; -import cc.polyfrost.oneconfig.events.event.ScreenOpenEvent; -import cc.polyfrost.oneconfig.events.event.Stage; -import cc.polyfrost.oneconfig.events.event.TickEvent; +import cc.polyfrost.oneconfig.events.event.*; import cc.polyfrost.oneconfig.libs.mixinextras.injector.ModifyExpressionValue; import net.minecraft.client.Minecraft; import net.minecraft.util.Timer; import net.minecraftforge.client.event.GuiOpenEvent; +import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -48,4 +46,14 @@ public class MinecraftMixin { } return screen; } + + @Inject(method = "runGameLoop", at = @At(value = "FIELD", target = "Lnet/minecraft/util/Timer;renderPartialTicks:F", opcode = Opcodes.PUTFIELD, shift = At.Shift.AFTER)) + private void onNonDeltaTickTimerUpdate(CallbackInfo ci) { + EventManager.INSTANCE.post(new TimerUpdateEvent(timer, false)); + } + + @Inject(method = "runGameLoop", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Timer;updateTimer()V", shift = At.Shift.AFTER, ordinal = 1)) + private void onDeltaTickTimerUpdate(CallbackInfo ci) { + EventManager.INSTANCE.post(new TimerUpdateEvent(timer, true)); + } } |