aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/mixin
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-05-28 14:33:31 +0700
committerWyvest <45589059+Wyvest@users.noreply.github.com>2022-05-28 14:33:31 +0700
commitf5cd94bdac8c20e61bc6d7e898618ebf7ea2dc66 (patch)
tree967a96344046a0bf4e73cf041fc2b2d22aef4568 /src/main/java/cc/polyfrost/oneconfig/mixin
parent01e4c0dfb2a9726a9bf1c4d1a1fe28edbc3d094c (diff)
downloadOneConfig-f5cd94bdac8c20e61bc6d7e898618ebf7ea2dc66.tar.gz
OneConfig-f5cd94bdac8c20e61bc6d7e898618ebf7ea2dc66.tar.bz2
OneConfig-f5cd94bdac8c20e61bc6d7e898618ebf7ea2dc66.zip
javadocs for events + TimerUpdateEvent
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/mixin')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/mixin/MinecraftMixin.java16
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));
+ }
}