mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-14 22:43:56 +01:00
Why wait?
- Immediately audit on client tick
This commit is contained in:
parent
ed4379aa8f
commit
03f94fe88c
@ -1,33 +1,27 @@
|
|||||||
package dev.engine_room.flywheel;
|
package dev.engine_room.flywheel;
|
||||||
|
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.spongepowered.asm.mixin.MixinEnvironment;
|
import org.spongepowered.asm.mixin.MixinEnvironment;
|
||||||
|
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||||
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
|
|
||||||
public class FlywheelTestModClient implements ClientModInitializer {
|
public class FlywheelTestModClient implements ClientModInitializer {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger("Flywheel Test Mod");
|
private static final Logger LOGGER = LoggerFactory.getLogger("Flywheel Test Mod");
|
||||||
|
|
||||||
private int ticks = 0;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
LOGGER.info("Starting Test Mod, on Env: {}", FabricLoader.getInstance().getEnvironmentType());
|
LOGGER.info("Starting Test Mod, on Env: {}", FabricLoader.getInstance().getEnvironmentType());
|
||||||
|
|
||||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||||
LOGGER.info("Tick Count: {}", ticks);
|
|
||||||
|
|
||||||
if (++ticks == 50) {
|
|
||||||
LOGGER.info("Running mixin audit");
|
LOGGER.info("Running mixin audit");
|
||||||
MixinEnvironment.getCurrentEnvironment().audit();
|
MixinEnvironment.getCurrentEnvironment()
|
||||||
|
.audit();
|
||||||
|
|
||||||
LOGGER.info("Ran mixin audit, stopping client.");
|
LOGGER.info("Ran mixin audit, stopping client.");
|
||||||
client.stop();
|
client.stop();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,39 +1,31 @@
|
|||||||
package dev.engine_room.flywheel;
|
package dev.engine_room.flywheel;
|
||||||
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
|
|
||||||
import net.minecraftforge.fml.loading.FMLLoader;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.spongepowered.asm.mixin.MixinEnvironment;
|
import org.spongepowered.asm.mixin.MixinEnvironment;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.TickEvent;
|
import net.minecraftforge.event.TickEvent;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.minecraftforge.fml.loading.FMLLoader;
|
||||||
|
|
||||||
@Mod("flywheel_testmod")
|
@Mod("flywheel_testmod")
|
||||||
public class FlywheelTestModClient {
|
public class FlywheelTestModClient {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger("Flywheel Test Mod");
|
private static final Logger LOGGER = LoggerFactory.getLogger("Flywheel Test Mod");
|
||||||
|
|
||||||
private int ticks = 0;
|
|
||||||
|
|
||||||
public FlywheelTestModClient() {
|
public FlywheelTestModClient() {
|
||||||
LOGGER.info("Starting Test Mod, on Dist: {}", FMLLoader.getDist());
|
LOGGER.info("Starting Test Mod, on Dist: {}", FMLLoader.getDist());
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.addListener((TickEvent.ClientTickEvent e) -> {
|
MinecraftForge.EVENT_BUS.addListener((TickEvent.ClientTickEvent e) -> {
|
||||||
if (e.phase == TickEvent.Phase.END) {
|
if (e.phase == TickEvent.Phase.END) {
|
||||||
LOGGER.info("Tick Count: {}", ticks);
|
|
||||||
|
|
||||||
if (++ticks == 50) {
|
|
||||||
LOGGER.info("Running mixin audit");
|
LOGGER.info("Running mixin audit");
|
||||||
MixinEnvironment.getCurrentEnvironment().audit();
|
MixinEnvironment.getCurrentEnvironment()
|
||||||
|
.audit();
|
||||||
|
|
||||||
LOGGER.info("Ran mixin audit, stopping client.");
|
LOGGER.info("Ran mixin audit, stopping client.");
|
||||||
Minecraft.getInstance().stop();
|
Minecraft.getInstance()
|
||||||
}
|
.stop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user