Skip to content

Commit e37b1e7

Browse files
committed
fabric port
1 parent f66d943 commit e37b1e7

File tree

6 files changed

+39
-32
lines changed

6 files changed

+39
-32
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ mod.version=1.0.0
1717
mod.group=org.polyfrost
1818

1919
# Configures the mod loader that we're developing for.
20-
loom.platform=forge
20+
loom.platform=fabric
2121
# Configures the Minecraft version that we're developing for.
2222
minecraft.version=1.8.9
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
package org.polyfrost.example;
22

3+
import net.fabricmc.api.ClientModInitializer;
34
import org.polyfrost.example.command.ExampleCommand;
45
import org.polyfrost.example.config.ExampleConfig;
5-
import net.minecraftforge.fml.common.Mod;
6-
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
76
import org.polyfrost.oneconfig.api.commands.v1.CommandManager;
87

98
/**
109
* The entrypoint of the Example Mod which initializes it.
1110
* This is what is run when the game is started and typically how your mod will set up its functionality.
1211
*
13-
* @see Mod
12+
* @see ClientModInitializer
1413
*/
15-
@Mod(modid = ExampleMod.ID, name = ExampleMod.NAME, version = ExampleMod.VERSION)
16-
public class ExampleMod {
14+
public class ExampleMod implements ClientModInitializer {
1715

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

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

2623
private static ExampleConfig config;
2724

25+
public ExampleMod() {
26+
INSTANCE = this;
27+
}
28+
2829
// Register the config and commands.
29-
@Mod.EventHandler
30-
public void onInit(FMLInitializationEvent event) {
30+
@Override
31+
public void onInitializeClient() {
3132
config = new ExampleConfig();
3233
CommandManager.registerCommand(new ExampleCommand());
3334
}
3435

3536
public static ExampleConfig getConfig() {
3637
return config;
3738
}
38-
3939
}

src/main/java/org/polyfrost/example/mixin/MinecraftMixin.java renamed to src/main/java/org/polyfrost/example/mixin/MinecraftClientMixin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.polyfrost.example.mixin;
22

3-
import net.minecraft.client.Minecraft;
3+
import net.minecraft.client.MinecraftClient;
44
import org.spongepowered.asm.mixin.Mixin;
55
import org.spongepowered.asm.mixin.injection.At;
66
import org.spongepowered.asm.mixin.injection.Inject;
@@ -12,8 +12,8 @@
1212
* @see Mixin
1313
* @see Inject
1414
*/
15-
@Mixin(Minecraft.class)
16-
public class MinecraftMixin {
15+
@Mixin(MinecraftClient.class)
16+
public class MinecraftClientMixin {
1717

1818
@Inject(method = "<init>", at = @At(value = "RETURN"))
1919
private void examplemod$onStartGame(CallbackInfo ci) {

src/main/resources/fabric.mod.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"schemaVersion": 1,
3+
"id": "${mod_id}",
4+
"version": "${mod_version}",
5+
"name": "${mod_name}",
6+
"description": "${mod_description}",
7+
"authors": [
8+
"Polyfrost"
9+
],
10+
"environment": "*",
11+
"entrypoints": {
12+
"client": [
13+
{
14+
"value": "org.polyfrost.example.ExampleMod"
15+
}
16+
]
17+
},
18+
"mixins": [
19+
"mixins.${mod_id}.json"
20+
],
21+
"depends": {
22+
"minecraft": "~${minor_mc_version}",
23+
"fabricloader": ">=0.15.11"
24+
}
25+
}

src/main/resources/mcmod.info

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/main/resources/mixins.examplemod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"maxShiftBy": 5
88
},
99
"client": [
10-
"MinecraftMixin"
10+
"MinecraftClientMixin"
1111
],
1212
"verbose": true
1313
}

0 commit comments

Comments
 (0)