Clever commit title

- Change the Fabric mod ID to match Forge
- Move "Flywheel Test Mod" to static
- Cleanup start/stop messages
- Use the client start event on Fabric
This commit is contained in:
Jozufozu 2024-11-03 16:42:13 -08:00
parent 84e27867d3
commit d3c64df7be
3 changed files with 12 additions and 9 deletions

View File

@ -5,22 +5,24 @@ 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.ClientLifecycleEvents;
import net.fabricmc.loader.api.FabricLoader; 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"); public static final String NAME = "Flywheel Test Mod";
private static final Logger LOGGER = LoggerFactory.getLogger(NAME);
@Override @Override
public void onInitializeClient() { public void onInitializeClient() {
LOGGER.info("Starting Test Mod, on Env: {}", FabricLoader.getInstance().getEnvironmentType()); LOGGER.info("Starting {} on EnvType: {}", NAME, FabricLoader.getInstance()
.getEnvironmentType());
ClientTickEvents.END_CLIENT_TICK.register(client -> { ClientLifecycleEvents.CLIENT_STARTED.register(client -> {
LOGGER.info("Running mixin audit"); LOGGER.info("Running mixin audit");
MixinEnvironment.getCurrentEnvironment() MixinEnvironment.getCurrentEnvironment()
.audit(); .audit();
LOGGER.info("Ran mixin audit, stopping client."); LOGGER.info("Stopping client");
client.stop(); client.stop();
}); });
} }

View File

@ -1,6 +1,6 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"id": "${mod_id}-testmod", "id" : "${mod_id}_testmod",
"name": "${mod_name} Test Mod", "name": "${mod_name} Test Mod",
"version": "1.0.0", "version": "1.0.0",
"environment": "*", "environment": "*",

View File

@ -12,10 +12,11 @@ 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"); public static final String NAME = "Flywheel Test Mod";
private static final Logger LOGGER = LoggerFactory.getLogger(NAME);
public FlywheelTestModClient() { public FlywheelTestModClient() {
LOGGER.info("Starting Test Mod, on Dist: {}", FMLLoader.getDist()); LOGGER.info("Starting {} on Dist: {}", NAME, 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) {
@ -23,7 +24,7 @@ public class FlywheelTestModClient {
MixinEnvironment.getCurrentEnvironment() MixinEnvironment.getCurrentEnvironment()
.audit(); .audit();
LOGGER.info("Ran mixin audit, stopping client."); LOGGER.info("Stopping client");
Minecraft.getInstance() Minecraft.getInstance()
.stop(); .stop();
} }