Skip to content

Commit

Permalink
fabric port
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyvest committed Jan 1, 2025
1 parent f66d943 commit e37b1e7
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 32 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ mod.version=1.0.0
mod.group=org.polyfrost

# Configures the mod loader that we're developing for.
loom.platform=forge
loom.platform=fabric
# Configures the Minecraft version that we're developing for.
minecraft.version=1.8.9
18 changes: 9 additions & 9 deletions src/main/java/org/polyfrost/example/ExampleMod.java
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
package org.polyfrost.example;

import net.fabricmc.api.ClientModInitializer;
import org.polyfrost.example.command.ExampleCommand;
import org.polyfrost.example.config.ExampleConfig;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import org.polyfrost.oneconfig.api.commands.v1.CommandManager;

/**
* The entrypoint of the Example Mod which initializes it.
* This is what is run when the game is started and typically how your mod will set up its functionality.
*
* @see Mod
* @see ClientModInitializer
*/
@Mod(modid = ExampleMod.ID, name = ExampleMod.NAME, version = ExampleMod.VERSION)
public class ExampleMod {
public class ExampleMod implements ClientModInitializer {

// Sets the variables from `gradle.properties`. Depends on the `bloom` DGT plugin.
public static final String ID = "@MOD_ID@";
public static final String NAME = "@MOD_NAME@";
public static final String VERSION = "@MOD_VERSION@";

@Mod.Instance(ID)
public static ExampleMod INSTANCE; // Adds the instance of the mod, so we can access other variables.

private static ExampleConfig config;

public ExampleMod() {
INSTANCE = this;
}

// Register the config and commands.
@Mod.EventHandler
public void onInit(FMLInitializationEvent event) {
@Override
public void onInitializeClient() {
config = new ExampleConfig();
CommandManager.registerCommand(new ExampleCommand());
}

public static ExampleConfig getConfig() {
return config;
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.polyfrost.example.mixin;

import net.minecraft.client.Minecraft;
import net.minecraft.client.MinecraftClient;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -12,8 +12,8 @@
* @see Mixin
* @see Inject
*/
@Mixin(Minecraft.class)
public class MinecraftMixin {
@Mixin(MinecraftClient.class)
public class MinecraftClientMixin {

@Inject(method = "<init>", at = @At(value = "RETURN"))
private void examplemod$onStartGame(CallbackInfo ci) {
Expand Down
25 changes: 25 additions & 0 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"schemaVersion": 1,
"id": "${mod_id}",
"version": "${mod_version}",
"name": "${mod_name}",
"description": "${mod_description}",
"authors": [
"Polyfrost"
],
"environment": "*",
"entrypoints": {
"client": [
{
"value": "org.polyfrost.example.ExampleMod"
}
]
},
"mixins": [
"mixins.${mod_id}.json"
],
"depends": {
"minecraft": "~${minor_mc_version}",
"fabricloader": ">=0.15.11"
}
}
18 changes: 0 additions & 18 deletions src/main/resources/mcmod.info

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/resources/mixins.examplemod.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"maxShiftBy": 5
},
"client": [
"MinecraftMixin"
"MinecraftClientMixin"
],
"verbose": true
}

0 comments on commit e37b1e7

Please sign in to comment.