Skip to content

Commit 39b703e

Browse files
committed
Merge branch 'multi-version' of https://github.com/Polyfrost/OneConfigExampleMod into multi-version
2 parents 3174026 + 00f8d82 commit 39b703e

16 files changed

+41
-126
lines changed

.github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ jobs:
1919

2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@v2
22+
uses: actions/checkout@v4
2323
with:
2424
fetch-depth: 10
2525

2626
- name: Set up JDK 17
27-
uses: actions/setup-java@v2
27+
uses: actions/setup-java@v4
2828
with:
29-
java-version: 17
29+
java-version: 21
3030
distribution: temurin
3131

32-
- uses: actions/cache@v2
32+
- uses: actions/cache@v4
3333
with:
3434
path: |
3535
~/.gradle/caches

README.md

+1-7
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,4 @@ Example mod implementing OneConfig.
1313
- **Remove the license named "LICENSE-TEMPLATE" and choose a new one.**
1414
- Refactor the template (specifically, the modid, version and name in the gradle.properties and most of the class names)
1515
to a different name.
16-
- Have fun modding! :D
17-
18-
## Need to update to a newer commit of this template?
19-
20-
Check out these update guides:
21-
- [Updating to commit `fd8e095`](update-to-fd8e095.md) (most recent update)
22-
- [Updating to commit `301a6ca`](update-to-301a6ca.md)
16+
- Have fun modding! :D

build.gradle.kts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@file:Suppress("UnstableApiUsage", "PropertyName")
22

33
import dev.deftu.gradle.utils.GameSide
4-
import dev.deftu.gradle.utils.MinecraftVersion
54

65
plugins {
76
java
@@ -17,8 +16,8 @@ plugins {
1716

1817
toolkitLoomHelper {
1918
useOneConfig {
20-
version = "1.0.0-alpha.47"
21-
loaderVersion = "1.1.0-alpha.34"
19+
version = "1.0.0-alpha.49"
20+
loaderVersion = "1.1.0-alpha.35"
2221

2322
usePolyMixin = true
2423
polyMixinVersion = "0.8.4+build.2"
@@ -29,6 +28,8 @@ toolkitLoomHelper {
2928
+module
3029
}
3130
}
31+
useDevAuth("1.2.1")
32+
useMixinExtras("0.4.1")
3233

3334
// Turns off the server-side run configs, as we're building a client-sided mod.
3435
disableRunConfigs(GameSide.SERVER)
@@ -45,7 +46,7 @@ toolkitLoomHelper {
4546
}
4647

4748
dependencies {
48-
// Add Fabric Language Kotlin and (Legacy) Fabric API as dependencies (these are both optional but are particularly useful).
49+
// Add (Legacy) Fabric API as dependencies (these are both optional but are particularly useful).
4950
if (mcData.isFabric) {
5051
if (mcData.isLegacyFabric) {
5152
// 1.8.9 - 1.13

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ mod.id=examplemod
1414
# Sets the version of your mod. Make sure to update this when you make changes according to the SemVer specification.
1515
mod.version=1.0.0
1616
# Sets the Maven group ID of your mod. This is effectively unused but is good practice to set regardless.
17-
mod.group=com.example
17+
mod.group=org.polyfrost

root.gradle.kts

+2
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,6 @@ preprocess {
3737
}
3838
}
3939
}
40+
41+
strictExtraMappings.set(true)
4042
}

settings.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ rootProject.buildFileName = "root.gradle.kts"
3838
// Adds all of our build target versions to the classpath if we need to add version-specific code.
3939
// Update this list if you want to remove/add a version and/or mod loader.
4040
// The format is: version-modloader (f.ex: 1.8.9-forge, 1.17.1-fabric, etc)
41-
// **REMEMBER TO ALSO UPDATE THE `root.gradle.kts` AND `build.gradle.kts` FILES WITH THE NEW VERSION(S).
41+
// **REMEMBER TO ALSO UPDATE THE `root.gradle.kts` FILE WITH THE NEW VERSION(S).
4242
listOf(
4343
"1.8.9-forge",
4444
"1.8.9-fabric",

src/main/java/org/polyfrost/example/ExampleEntrypoint.java

+18-6
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
//$$ import org.polyfrost.example.ExampleConstants;
3434
//$$
3535
//#if MC >= 1.16.5
36-
//$$ @Mod(ModTemplateConstants.ID)
36+
//$$ @Mod(ExampleConstants.ID)
3737
//#else
3838
//$$ @Mod(modid = ExampleConstants.ID, version = ExampleConstants.VERSION)
3939
//#endif
@@ -86,7 +86,13 @@ public void onInitializeClient(
8686
//#endif
8787
) {
8888
//#if FORGE && MC <= 1.12.2
89-
//$$ if (!event.side.isClient) {
89+
//$$ if (!event
90+
//#if MC <= 1.8.9
91+
//$$ .side.isClient
92+
//#else
93+
//$$ .getSide().isClient()
94+
//#endif
95+
//$$ ) {
9096
//$$ return;
9197
//$$ }
9298
//#endif
@@ -109,7 +115,13 @@ public void onInitializeServer(
109115
//#endif
110116
) {
111117
//#if FORGE && MC <= 1.12.2
112-
//$$ if (!event.side.isServer) {
118+
//$$ if (!event.
119+
//#if MC <= 1.8.9
120+
//$$ side.isServer
121+
//#else
122+
//$$ getSide().isServer()
123+
//#endif
124+
//$$ ) {
113125
//$$ return;
114126
//$$ }
115127
//#endif
@@ -119,9 +131,9 @@ public void onInitializeServer(
119131

120132
//#if FORGE-LIKE && MC >= 1.16.5
121133
//$$ private void setupForgeEvents(IEventBus modEventBus) {
122-
//$$ modEventBus.addListener(this::onInitialize)
123-
//$$ modEventBus.addListener(this::onInitializeClient)
124-
//$$ modEventBus.addListener(this::onInitializeServer)
134+
//$$ modEventBus.addListener(this::onInitialize);
135+
//$$ modEventBus.addListener(this::onInitializeClient);
136+
//$$ modEventBus.addListener(this::onInitializeServer);
125137
//$$ }
126138
//#endif
127139

src/main/java/org/polyfrost/example/client/ExampleClient.java

+1-9
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,9 @@ public class ExampleClient {
66

77
public static final ExampleClient INSTANCE = new ExampleClient();
88

9-
private ExampleConfig config;
10-
119
public void initialize() {
12-
System.out.println("Initializing Example Client");
13-
14-
config = new ExampleConfig();
10+
ExampleConfig.INSTANCE.preload();
1511
CommandManager.registerCommand(new ExampleCommand());
1612
}
1713

18-
public ExampleConfig getConfig() {
19-
return config;
20-
}
21-
2214
}

src/main/java/org/polyfrost/example/client/ExampleCommand.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class ExampleCommand {
1616

1717
@Command
1818
private void main() {
19-
ScreensKt.openUI(ExampleClient.INSTANCE.getConfig());
19+
ScreensKt.openUI(ExampleConfig.INSTANCE);
2020
}
2121

2222
}

src/main/java/org/polyfrost/example/client/ExampleConfig.java

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public class ExampleConfig extends Config {
2828
)
2929
public static int exampleDropdown = 1; // Default option (in this case "Option 2")
3030

31+
public static final ExampleConfig INSTANCE = new ExampleConfig(); // The instance of the Config.
32+
3133
public ExampleConfig() {
3234
super(ExampleConstants.ID + ".json", ExampleConstants.NAME, Category.OTHER); // TODO: Change your category here.
3335
}

src/main/java/org/polyfrost/example/client/mixin/MixinMinecraft_Example.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
@Mixin(Minecraft.class)
1616
public class MixinMinecraft_Example {
1717

18-
@Inject(method = "startGame", at = @At(value = "HEAD"))
18+
@Inject(method = "<init>", at = @At(value = "RETURN"))
1919
private void examplemod$onStartGame(CallbackInfo ci) {
2020
System.out.println("This is a message from the example mod!");
2121
}

src/main/java/org/polyfrost/oneconfig/test/TestMod_Test.java

-12
This file was deleted.

src/main/resources/fabric.mod.json

+3-7
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,22 @@
55
"name": "${mod_name}",
66
"description": "${mod_description}",
77
"authors": [
8-
"Polyfrost"
8+
"Your Name"
99
],
1010
"environment": "*",
1111
"entrypoints": {
1212
"main": [
1313
{
14-
"adapter": "kotlin",
1514
"value": "org.polyfrost.example.ExampleEntrypoint"
1615
}
1716
],
1817
"client": [
1918
{
20-
"adapter": "kotlin",
2119
"value": "org.polyfrost.example.ExampleEntrypoint"
2220
}
2321
],
2422
"server": [
2523
{
26-
"adapter": "kotlin",
2724
"value": "org.polyfrost.example.ExampleEntrypoint"
2825
}
2926
]
@@ -33,7 +30,6 @@
3330
],
3431
"depends": {
3532
"minecraft": "~${minor_mc_version}",
36-
"fabricloader": ">=0.15.11",
37-
"fabric-language-kotlin": "*"
33+
"fabricloader": ">=0.15.11"
3834
}
39-
}
35+
}

src/main/resources/mixins.examplemod.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compatibilityLevel": "${java_version}",
3-
"minVersion": "0.7",
3+
"minVersion": "0.8",
44
"package": "org.polyfrost.example.client.mixin",
55
"refmap": "mixins.${mod_id}.refmap.json",
66
"injectors": {

update-to-301a6ca.md

-51
This file was deleted.

update-to-fd8e095.md

-21
This file was deleted.

0 commit comments

Comments
 (0)