Skip to content

Commit

Permalink
Clever commit title
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Jozufozu committed Nov 4, 2024
1 parent 84e2786 commit d3c64df
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,24 @@
import org.spongepowered.asm.mixin.MixinEnvironment;

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;

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
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");
MixinEnvironment.getCurrentEnvironment()
.audit();

LOGGER.info("Ran mixin audit, stopping client.");
LOGGER.info("Stopping client");
client.stop();
});
}
Expand Down
2 changes: 1 addition & 1 deletion fabric/src/testMod/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"schemaVersion": 1,
"id": "${mod_id}-testmod",
"id" : "${mod_id}_testmod",
"name": "${mod_name} Test Mod",
"version": "1.0.0",
"environment": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@

@Mod("flywheel_testmod")
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() {
LOGGER.info("Starting Test Mod, on Dist: {}", FMLLoader.getDist());
LOGGER.info("Starting {} on Dist: {}", NAME, FMLLoader.getDist());

MinecraftForge.EVENT_BUS.addListener((TickEvent.ClientTickEvent e) -> {
if (e.phase == TickEvent.Phase.END) {
LOGGER.info("Running mixin audit");
MixinEnvironment.getCurrentEnvironment()
.audit();

LOGGER.info("Ran mixin audit, stopping client.");
LOGGER.info("Stopping client");
Minecraft.getInstance()
.stop();
}
Expand Down

0 comments on commit d3c64df

Please sign in to comment.