Why wait?

- Immediately audit on client tick
This commit is contained in:
Jozufozu 2024-10-25 13:13:05 -07:00
parent ed4379aa8f
commit 03f94fe88c
2 changed files with 14 additions and 28 deletions

View File

@ -1,33 +1,27 @@
package dev.engine_room.flywheel;
import net.fabricmc.loader.api.FabricLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongepowered.asm.mixin.MixinEnvironment;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.loader.api.FabricLoader;
public class FlywheelTestModClient implements ClientModInitializer {
private static final Logger LOGGER = LoggerFactory.getLogger("Flywheel Test Mod");
private int ticks = 0;
@Override
public void onInitializeClient() {
LOGGER.info("Starting Test Mod, on Env: {}", FabricLoader.getInstance().getEnvironmentType());
ClientTickEvents.END_CLIENT_TICK.register(client -> {
LOGGER.info("Tick Count: {}", ticks);
if (++ticks == 50) {
LOGGER.info("Running mixin audit");
MixinEnvironment.getCurrentEnvironment().audit();
MixinEnvironment.getCurrentEnvironment()
.audit();
LOGGER.info("Ran mixin audit, stopping client.");
client.stop();
}
});
}
}

View File

@ -1,39 +1,31 @@
package dev.engine_room.flywheel;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.loading.FMLLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongepowered.asm.mixin.MixinEnvironment;
import net.minecraft.client.Minecraft;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLLoader;
@Mod("flywheel_testmod")
public class FlywheelTestModClient {
private static final Logger LOGGER = LoggerFactory.getLogger("Flywheel Test Mod");
private int ticks = 0;
public FlywheelTestModClient() {
LOGGER.info("Starting Test Mod, on Dist: {}", FMLLoader.getDist());
MinecraftForge.EVENT_BUS.addListener((TickEvent.ClientTickEvent e) -> {
if (e.phase == TickEvent.Phase.END) {
LOGGER.info("Tick Count: {}", ticks);
if (++ticks == 50) {
LOGGER.info("Running mixin audit");
MixinEnvironment.getCurrentEnvironment().audit();
MixinEnvironment.getCurrentEnvironment()
.audit();
LOGGER.info("Ran mixin audit, stopping client.");
Minecraft.getInstance().stop();
}
Minecraft.getInstance()
.stop();
}
});
}