From 5b48903f5989e49907020ddffb0c95a67a603794 Mon Sep 17 00:00:00 2001 From: Daniel Orr Date: Sun, 4 Feb 2024 21:21:41 +0000 Subject: [PATCH] Update to 1.20.5 + groundwork --- build.gradle | 30 ++++--------------- gradle.properties | 16 +++++----- gradle/wrapper/gradle-wrapper.properties | 2 +- .../packmanager/mixin/ExampleMixin.java | 15 ---------- .../packmanager/mixin/ServerWorldMixin.java | 9 ++++++ .../net/mcbrawls/packmanager/PackManager.kt | 16 +++++----- .../packmanager/ResourcePackEnvironment.kt | 8 +++++ src/main/resources/fabric.mod.json | 19 ++++++++---- src/main/resources/packmanager.accesswidener | 1 + src/main/resources/packmanager.mixins.json | 2 +- 10 files changed, 53 insertions(+), 65 deletions(-) delete mode 100644 src/main/java/net/mcbrawls/packmanager/mixin/ExampleMixin.java create mode 100644 src/main/java/net/mcbrawls/packmanager/mixin/ServerWorldMixin.java create mode 100644 src/main/kotlin/net/mcbrawls/packmanager/ResourcePackEnvironment.kt create mode 100644 src/main/resources/packmanager.accesswidener diff --git a/build.gradle b/build.gradle index 9d2c6cc..d41e91d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ //file:noinspection All plugins { - id "fabric-loom" version "1.4-SNAPSHOT" + id "fabric-loom" version "1.5-SNAPSHOT" id "org.jetbrains.kotlin.jvm" id "maven-publish" } @@ -55,20 +55,16 @@ dependencies { modImplementation "net.fabricmc.fabric-api:fabric-api:$fabric_version" modImplementation "net.fabricmc:fabric-language-kotlin:$fabric_kotlin_version" - modImplementation "com.ptsmods:devlogin:$devlogin_version" - // test testImplementation sourceSets.main.output testImplementation "org.apache.logging.log4j:log4j-slf4j2-impl:2.21.1" - - testClientImplementation sourceSets.main.output - testClientImplementation sourceSets.client.output - testClientImplementation sourceSets.test.output } loom { runtimeOnlyLog4j = true + accessWidenerPath = file("src/main/resources/${mod_id}.accesswidener") + mods { mod_id { sourceSet sourceSets.main @@ -77,24 +73,8 @@ loom { } runs { - authenticatedClient { - client() - name("Minecraft Client (Authenticated)") - programArg("--msa") - } - - testClient { - client() - name("Minecraft Client (Test)") - source(sourceSets.testClient) - runDir("runtest") - } - - testClientAuthenticated { - inherit(testClient) - name("Minecraft Client (Test Authenticated)") - programArg("--msa") - runDir("runtest") + client { + ideConfigGenerated(false) } testServer { diff --git a/gradle.properties b/gradle.properties index 41f1a19..26a365e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,19 +4,17 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.20.3-pre2 -yarn_build=2 -loader_version=0.14.24 +minecraft_version=23w51b +yarn_build=4 +loader_version=0.15.6 -kotlin_version=1.9.20 -fabric_kotlin_version=1.10.13+kotlin.1.9.20 +# Dependencies +fabric_version=0.94.0+1.20.5 -devlogin_version=3.4.1 +kotlin_version=1.9.22 +fabric_kotlin_version=1.10.17+kotlin.1.9.22 # Mod Properties mod_version=1.0.0 maven_group=net.mcbrawls mod_id=packmanager - -# Dependencies -fabric_version=0.90.12+1.20.3 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3fa8f86..1af9e09 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/net/mcbrawls/packmanager/mixin/ExampleMixin.java b/src/main/java/net/mcbrawls/packmanager/mixin/ExampleMixin.java deleted file mode 100644 index 86fb888..0000000 --- a/src/main/java/net/mcbrawls/packmanager/mixin/ExampleMixin.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.mcbrawls.packmanager.mixin; - -import net.minecraft.server.MinecraftServer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(MinecraftServer.class) -public class ExampleMixin { - @Inject(at = @At("HEAD"), method = "loadWorld") - private void init(CallbackInfo info) { - // This code is injected into the start of MinecraftServer.loadWorld()V - } -} diff --git a/src/main/java/net/mcbrawls/packmanager/mixin/ServerWorldMixin.java b/src/main/java/net/mcbrawls/packmanager/mixin/ServerWorldMixin.java new file mode 100644 index 0000000..0811935 --- /dev/null +++ b/src/main/java/net/mcbrawls/packmanager/mixin/ServerWorldMixin.java @@ -0,0 +1,9 @@ +package net.mcbrawls.packmanager.mixin; + +import net.mcbrawls.packmanager.ResourcePackEnvironment; +import net.minecraft.server.world.ServerWorld; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(ServerWorld.class) +public class ServerWorldMixin implements ResourcePackEnvironment { +} diff --git a/src/main/kotlin/net/mcbrawls/packmanager/PackManager.kt b/src/main/kotlin/net/mcbrawls/packmanager/PackManager.kt index df4d081..804be23 100644 --- a/src/main/kotlin/net/mcbrawls/packmanager/PackManager.kt +++ b/src/main/kotlin/net/mcbrawls/packmanager/PackManager.kt @@ -1,15 +1,15 @@ package net.mcbrawls.packmanager -import net.fabricmc.api.ModInitializer +import net.fabricmc.api.DedicatedServerModInitializer import org.slf4j.LoggerFactory -object PackManager : ModInitializer { - private val logger = LoggerFactory.getLogger("packmanager") +object PackManager : DedicatedServerModInitializer { + const val MOD_ID = "packmanager" + const val MOD_NAME = "Pack Manager" - override fun onInitialize() { - // This code runs as soon as Minecraft is in a mod-load-ready state. - // However, some things (like resources) may still be uninitialized. - // Proceed with mild caution. - logger.info("Hello Fabric world!") + private val logger = LoggerFactory.getLogger(MOD_NAME) + + override fun onInitializeServer() { + logger.info("Initializing $MOD_NAME") } } diff --git a/src/main/kotlin/net/mcbrawls/packmanager/ResourcePackEnvironment.kt b/src/main/kotlin/net/mcbrawls/packmanager/ResourcePackEnvironment.kt new file mode 100644 index 0000000..a1ea32c --- /dev/null +++ b/src/main/kotlin/net/mcbrawls/packmanager/ResourcePackEnvironment.kt @@ -0,0 +1,8 @@ +package net.mcbrawls.packmanager + +/** + * An environment which can handle resource packs. + */ +interface ResourcePackEnvironment { + +} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index ff3d495..58e3228 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -3,19 +3,20 @@ "id": "packmanager", "version": "${version}", "name": "Pack Manager", - "description": "This is an example description! Tell everyone what your mod is about!", + "description": "A library for managing resource packs within contexts.", "authors": [ - "Me!" + "Andante" ], "contact": { - "homepage": "https://fabricmc.net/", - "sources": "https://github.com/FabricMC/fabric-example-mod" + "homepage": "https://github.com/mcbrawls/packmanager", + "sources": "https://github.com/mcbrawls/packmanager", + "issues": "https://github.com/mcbrawls/packmanager/issues" }, - "license": "CC0-1.0", + "license": "MIT", "icon": "assets/packmanager/icon.png", "environment": "*", "entrypoints": { - "main": [ + "server": [ { "value": "net.mcbrawls.packmanager.PackManager", "adapter": "kotlin" @@ -25,6 +26,12 @@ "mixins": [ "packmanager.mixins.json" ], + "accessWidener": "packmanager.accesswidener", + "custom": { + "loom:injected_interfaces": { + "net/minecraft/server/world/ServerWorld": [ "net/mcbrawls/packmanager/ResourcePackEnvironment" ] + } + }, "depends": { "fabricloader": ">=0.14.24", "minecraft": "~1.20.2", diff --git a/src/main/resources/packmanager.accesswidener b/src/main/resources/packmanager.accesswidener new file mode 100644 index 0000000..9ab2173 --- /dev/null +++ b/src/main/resources/packmanager.accesswidener @@ -0,0 +1 @@ +accessWidener v2 named diff --git a/src/main/resources/packmanager.mixins.json b/src/main/resources/packmanager.mixins.json index d759c28..5530f7c 100644 --- a/src/main/resources/packmanager.mixins.json +++ b/src/main/resources/packmanager.mixins.json @@ -3,7 +3,7 @@ "package": "net.mcbrawls.packmanager.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ - "ExampleMixin" + "ServerWorldMixin" ], "injectors": { "defaultRequire": 1