diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db54b04..62008db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,17 +19,17 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 10 - name: Set up JDK 17 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: - java-version: 17 + java-version: 21 distribution: temurin - - uses: actions/cache@v2 + - uses: actions/cache@v4 with: path: | ~/.gradle/caches diff --git a/README.md b/README.md index f5fd532..55e1a4e 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,4 @@ Example mod implementing OneConfig. - **Remove the license named "LICENSE-TEMPLATE" and choose a new one.** - Refactor the template (specifically, the modid, version and name in the gradle.properties and most of the class names) to a different name. -- Have fun modding! :D - -## Need to update to a newer commit of this template? - -Check out these update guides: -- [Updating to commit `fd8e095`](update-to-fd8e095.md) (most recent update) -- [Updating to commit `301a6ca`](update-to-301a6ca.md) \ No newline at end of file +- Have fun modding! :D \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 0b5413d..452d474 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,192 +1,45 @@ @file:Suppress("UnstableApiUsage", "PropertyName") -import org.polyfrost.gradle.util.noServerRunConfigs -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import dev.deftu.gradle.utils.GameSide -// Adds support for kotlin, and adds the Polyfrost Gradle Toolkit -// which we use to prepare the environment. plugins { - kotlin("jvm") - id("org.polyfrost.multi-version") - id("org.polyfrost.defaults.repo") - id("org.polyfrost.defaults.java") - id("org.polyfrost.defaults.loom") - id("com.github.johnrengelman.shadow") - id("net.kyori.blossom") version "1.3.2" - id("signing") java + kotlin("jvm") version("2.0.10") + val dgtVersion = "2.35.0" + id("dev.deftu.gradle.tools") version(dgtVersion) // Applies several configurations to things such as the Java version, project name/version, etc. + id("dev.deftu.gradle.tools.resources") version(dgtVersion) // Applies resource processing so that we can replace tokens, such as our mod name/version, in our resources. + id("dev.deftu.gradle.tools.bloom") version(dgtVersion) // Applies the Bloom plugin, which allows us to replace tokens in our source files, such as being able to use `@MOD_VERSION` in our source files. + id("dev.deftu.gradle.tools.shadow") version(dgtVersion) // Applies the Shadow plugin, which allows us to shade our dependencies into our mod JAR. This is NOT recommended for Fabric mods, but we have an *additional* configuration for those! + id("dev.deftu.gradle.tools.minecraft.loom") version(dgtVersion) // Applies the Loom plugin, which automagically configures Essential's Architectury Loom plugin for you. + id("dev.deftu.gradle.tools.minecraft.releases") version(dgtVersion) // Applies the Minecraft auto-releasing plugin, which allows you to automatically release your mod to CurseForge and Modrinth. } -// Gets the mod name, version and id from the `gradle.properties` file. -val mod_name: String by project -val mod_version: String by project -val mod_id: String by project -val mod_archives_name: String by project +toolkitLoomHelper { + useOneConfig { + version = "1.0.0-alpha.106" + loaderVersion = "1.1.0-alpha.46" -// Replaces the variables in `ExampleMod.java` to the ones specified in `gradle.properties`. -blossom { - replaceToken("@VER@", mod_version) - replaceToken("@NAME@", mod_name) - replaceToken("@ID@", mod_id) -} - -// Sets the mod version to the one specified in `gradle.properties`. Make sure to change this following semver! -version = mod_version -// Sets the group, make sure to change this to your own. It can be a website you own backwards or your GitHub username. -// e.g. com.github. or com. -group = "org.polyfrost" - -// Sets the name of the output jar (the one you put in your mods folder and send to other people) -// It outputs all versions of the mod into the `versions/{mcVersion}/build` directory. -base { - archivesName.set("$mod_archives_name-$platform") -} - -// Configures Polyfrost Loom, our plugin fork to easily set up the programming environment. -loom { - // Removes the server configs from IntelliJ IDEA, leaving only client runs. - noServerRunConfigs() - - // Adds the tweak class if we are building legacy version of forge as per the documentation (https://docs.polyfrost.org) - if (project.platform.isLegacyForge) { - runConfigs { - "client" { - programArgs("--tweakClass", "cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker") - property("mixin.debug.export", "true") // Outputs all mixin changes to `versions/{mcVersion}/run/.mixin.out/class` - } - } - } - // Configures the mixins if we are building for forge - if (project.platform.isForge) { - forge { - mixinConfig("mixins.${mod_id}.json") - } - } - // Configures the name of the mixin "refmap" - mixin.defaultRefmapName.set("mixins.${mod_id}.refmap.json") -} - -// Creates the shade/shadow configuration, so we can include libraries inside our mod, rather than having to add them separately. -val shade: Configuration by configurations.creating { - configurations.implementation.get().extendsFrom(this) -} -val modShade: Configuration by configurations.creating { - configurations.modImplementation.get().extendsFrom(this) -} - -// Configures the output directory for when building from the `src/resources` directory. -sourceSets { - main { - output.setResourcesDir(java.classesDirectory) - } -} - -// Adds the Polyfrost maven repository so that we can get the libraries necessary to develop the mod. -repositories { - maven("https://repo.polyfrost.org/releases") -} + usePolyMixin = true + polyMixinVersion = "0.8.4+build.2" -// Configures the libraries/dependencies for your mod. -dependencies { - // Adds the OneConfig library, so we can develop with it. - modCompileOnly("cc.polyfrost:oneconfig-$platform:0.2.2-alpha+") - - // Adds DevAuth, which we can use to log in to Minecraft in development. - modRuntimeOnly("me.djtheredstoner:DevAuth-${if (platform.isFabric) "fabric" else if (platform.isLegacyForge) "forge-legacy" else "forge-latest"}:1.2.0") - - // If we are building for legacy forge, includes the launch wrapper with `shade` as we configured earlier, as well as mixin 0.7.11 - if (platform.isLegacyForge) { - compileOnly("org.spongepowered:mixin:0.7.11-SNAPSHOT") - shade("cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-beta17") - } -} + applyLoaderTweaker = true -tasks { - // Processes the `src/resources/mcmod.info`, `fabric.mod.json`, or `mixins.${mod_id}.json` and replaces - // the mod id, name and version with the ones in `gradle.properties` - processResources { - inputs.property("id", mod_id) - inputs.property("name", mod_name) - val java = if (project.platform.mcMinor >= 18) { - 17 // If we are playing on version 1.18, set the java version to 17 - } else { - // Else if we are playing on version 1.17, use java 16. - if (project.platform.mcMinor == 17) - 16 - else - 8 // For all previous versions, we **need** java 8 (for Forge support). - } - val compatLevel = "JAVA_${java}" - inputs.property("java", java) - inputs.property("java_level", compatLevel) - inputs.property("version", mod_version) - inputs.property("mcVersionStr", project.platform.mcVersionStr) - filesMatching(listOf("mcmod.info", "mixins.${mod_id}.json", "mods.toml")) { - expand( - mapOf( - "id" to mod_id, - "name" to mod_name, - "java" to java, - "java_level" to compatLevel, - "version" to mod_version, - "mcVersionStr" to project.platform.mcVersionStr - ) - ) - } - filesMatching("fabric.mod.json") { - expand( - mapOf( - "id" to mod_id, - "name" to mod_name, - "java" to java, - "java_level" to compatLevel, - "version" to mod_version, - "mcVersionStr" to project.platform.mcVersionStr.substringBeforeLast(".") + ".x" - ) - ) + for (module in arrayOf("commands", "config", "config-impl", "events", "internal", "ui", "utils")) { + +module } } - // Configures the resources to include if we are building for forge or fabric. - withType(Jar::class.java) { - if (project.platform.isFabric) { - exclude("mcmod.info", "mods.toml") - } else { - exclude("fabric.mod.json") - if (project.platform.isLegacyForge) { - exclude("mods.toml") - } else { - exclude("mcmod.info") - } - } - } + useDevAuth("1.2.1") + useMixinExtras("0.4.1") - // Configures our shadow/shade configuration, so we can - // include some dependencies within our mod jar file. - named("shadowJar") { - archiveClassifier.set("dev") - configurations = listOf(shade, modShade) - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - } + // Turns off the server-side run configs, as we're building a client-sided mod. + disableRunConfigs(GameSide.SERVER) - remapJar { - inputFile.set(shadowJar.get().archiveFile) - archiveClassifier.set("") - } + // Defines the name of the Mixin refmap, which is used to map the Mixin classes to the obfuscated Minecraft classes. + useMixinRefMap(modData.id) - jar { - // Sets the jar manifest attributes. - if (platform.isLegacyForge) { - manifest.attributes += mapOf( - "ModSide" to "CLIENT", // We aren't developing a server-side mod - "ForceLoadAsMod" to true, // We want to load this jar as a mod, so we force Forge to do so. - "TweakOrder" to "0", // Makes sure that the OneConfig launch wrapper is loaded as soon as possible. - "MixinConfigs" to "mixins.${mod_id}.json", // We want to use our mixin configuration, so we specify it here. - "TweakClass" to "cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker" // Loads the OneConfig launch wrapper. - ) - } - dependsOn(shadowJar) - archiveClassifier.set("") - enabled = false + if (mcData.isForge) { + // Configures the Mixin tweaker if we are building for Forge. + useForgeMixin(modData.id) } } diff --git a/gradle.properties b/gradle.properties index f8f0b3b..7cf5e4f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,18 +1,23 @@ -# gradle.properties file -- CHANGE THE VALUES STARTING WITH `mod_*` AND REMOVE THIS COMMENT. - -# Sets the name of your mod. -mod_name=ExampleMod -# Sets the id of your mod that mod loaders use to recognize it. -mod_id=examplemod -# Sets the version of your mod. Make sure to update this when you make changes according to semver. -mod_version=1.0.0 -# Sets the name of the jar file that you put in your 'mods' folder. -mod_archives_name=ExampleMod - # Gradle Configuration -- DO NOT TOUCH THESE VALUES. -polyfrost.defaults.loom=3 org.gradle.daemon=true org.gradle.parallel=true org.gradle.configureoncommand=true org.gradle.parallel.threads=4 -org.gradle.jvmargs=-Xmx2G \ No newline at end of file +org.gradle.jvmargs=-Xmx2G +loom.ignoreDependencyLoomVersionValidation=true + +# gradle.properties file -- CHANGE THE VALUES STARTING WITH `mod.*` AND REMOVE THIS COMMENT. + +# Sets the name of your mod. +mod.name=ExampleMod +# Sets the ID of your mod that mod loaders use to recognize it. +mod.id=examplemod +# Sets the version of your mod. Make sure to update this when you make changes according to the SemVer specification. +mod.version=1.0.0 +# Sets the Maven group ID of your mod. This is effectively unused but is good practice to set regardless. +mod.group=org.polyfrost + +# Configures the mod loader that we're developing for. +loom.platform=forge +# Configures the Minecraft version that we're developing for. +minecraft.version=1.8.9 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a441313..e2847c8 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.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a4..b740cf1 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. diff --git a/root.gradle.kts b/root.gradle.kts deleted file mode 100644 index 5488cd7..0000000 --- a/root.gradle.kts +++ /dev/null @@ -1,11 +0,0 @@ -plugins { - kotlin("jvm") version "1.9.10" apply false - id("org.polyfrost.multi-version.root") - id("com.github.johnrengelman.shadow") version "8.1.1" apply false -} - -preprocess { - "1.12.2-forge"(11202, "srg") { - "1.8.9-forge"(10809, "srg") - } -} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 9e578e6..8c087b2 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,31 +1,30 @@ @file:Suppress("PropertyName") +import groovy.lang.MissingPropertyException + pluginManagement { repositories { + // Releases + maven("https://maven.deftu.dev/releases") + maven("https://maven.fabricmc.net") + maven("https://maven.architectury.dev/") + maven("https://maven.minecraftforge.net") + maven("https://repo.essential.gg/repository/maven-public") + maven("https://server.bbkr.space/artifactory/libs-release/") + maven("https://jitpack.io/") + + // Snapshots + maven("https://maven.deftu.dev/snapshots") + mavenLocal() + + // Default gradlePluginPortal() mavenCentral() - maven("https://repo.polyfrost.org/releases") // Adds the Polyfrost maven repository to get Polyfrost Gradle Toolkit - } - plugins { - val pgtVersion = "0.6.5" // Sets the default versions for Polyfrost Gradle Toolkit - id("org.polyfrost.multi-version.root") version pgtVersion } } -val mod_name: String by settings +val projectName: String = extra["mod.name"]?.toString() + ?: throw MissingPropertyException("mod.name has not been set.") // Configures the root project Gradle name based on the value in `gradle.properties` -rootProject.name = mod_name -rootProject.buildFileName = "root.gradle.kts" - -// Adds all of our build target versions to the classpath if we need to add version-specific code. -listOf( - "1.8.9-forge", // Update this if you want to remove/add a version, along with `build.gradle.kts` and `root.gradle.kts`. - //"1.12.2-forge" // uncomment if you want 1.12.2 support in your mod -).forEach { version -> - include(":$version") - project(":$version").apply { - projectDir = file("versions/$version") - buildFileName = "../../build.gradle.kts" - } -} +rootProject.name = projectName diff --git a/src/main/java/org/polyfrost/example/ExampleConstants.java b/src/main/java/org/polyfrost/example/ExampleConstants.java new file mode 100644 index 0000000..f8edd06 --- /dev/null +++ b/src/main/java/org/polyfrost/example/ExampleConstants.java @@ -0,0 +1,10 @@ +package org.polyfrost.example; + +public class ExampleConstants { + + // 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@"; + +} diff --git a/src/main/java/org/polyfrost/example/ExampleMod.java b/src/main/java/org/polyfrost/example/ExampleMod.java deleted file mode 100644 index 043a208..0000000 --- a/src/main/java/org/polyfrost/example/ExampleMod.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.polyfrost.example; - -import org.polyfrost.example.command.ExampleCommand; -import org.polyfrost.example.config.TestConfig; -import cc.polyfrost.oneconfig.events.event.InitializationEvent; -import net.minecraftforge.fml.common.Mod; -import cc.polyfrost.oneconfig.utils.commands.CommandManager; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; - -/** - * The entrypoint of the Example Mod that initializes it. - * - * @see Mod - * @see InitializationEvent - */ -@Mod(modid = ExampleMod.MODID, name = ExampleMod.NAME, version = ExampleMod.VERSION) -public class ExampleMod { - - // Sets the variables from `gradle.properties`. See the `blossom` config in `build.gradle.kts`. - public static final String MODID = "@ID@"; - public static final String NAME = "@NAME@"; - public static final String VERSION = "@VER@"; - @Mod.Instance(MODID) - public static ExampleMod INSTANCE; // Adds the instance of the mod, so we can access other variables. - public static TestConfig config; - - // Register the config and commands. - @Mod.EventHandler - public void onInit(FMLInitializationEvent event) { - config = new TestConfig(); - CommandManager.INSTANCE.registerCommand(new ExampleCommand()); - } -} diff --git a/src/main/java/org/polyfrost/example/client/ExampleClient.java b/src/main/java/org/polyfrost/example/client/ExampleClient.java new file mode 100644 index 0000000..8fd4254 --- /dev/null +++ b/src/main/java/org/polyfrost/example/client/ExampleClient.java @@ -0,0 +1,20 @@ +package org.polyfrost.example.client; + +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import org.polyfrost.example.ExampleConstants; +import org.polyfrost.oneconfig.api.commands.v1.CommandManager; + +@Mod(modid = ExampleConstants.ID, name = ExampleConstants.NAME, version = ExampleConstants.VERSION) +public class ExampleClient { + + @Mod.Instance(ExampleConstants.ID) + public static ExampleClient INSTANCE; + + @Mod.EventHandler + public void onInit(FMLInitializationEvent event) { + ExampleConfig.INSTANCE.preload(); + CommandManager.register(new ExampleCommand()); + } + +} diff --git a/src/main/java/org/polyfrost/example/client/ExampleCommand.java b/src/main/java/org/polyfrost/example/client/ExampleCommand.java new file mode 100644 index 0000000..acc67d5 --- /dev/null +++ b/src/main/java/org/polyfrost/example/client/ExampleCommand.java @@ -0,0 +1,22 @@ +package org.polyfrost.example.client; + +import org.polyfrost.example.ExampleConstants; +import org.polyfrost.oneconfig.api.commands.v1.factories.annotated.Command; +import org.polyfrost.oneconfig.utils.v1.dsl.ScreensKt; + +/** + * An example command implementing the Command api of OneConfig. + * Registered in ExampleMod.java with `CommandManager.INSTANCE.registerCommand(new ExampleCommand());` + * + * @see Command + * @see ExampleClient + */ +@Command(ExampleConstants.ID) +public class ExampleCommand { + + @Command + private void main() { + ScreensKt.openUI(ExampleConfig.INSTANCE); + } + +} diff --git a/src/main/java/org/polyfrost/example/client/ExampleConfig.java b/src/main/java/org/polyfrost/example/client/ExampleConfig.java new file mode 100644 index 0000000..f3acd55 --- /dev/null +++ b/src/main/java/org/polyfrost/example/client/ExampleConfig.java @@ -0,0 +1,38 @@ +package org.polyfrost.example.client; + +import org.polyfrost.example.ExampleConstants; +import org.polyfrost.oneconfig.api.config.v1.Config; +import org.polyfrost.oneconfig.api.config.v1.annotations.Dropdown; +import org.polyfrost.oneconfig.api.config.v1.annotations.Slider; +import org.polyfrost.oneconfig.api.config.v1.annotations.Switch; + +/** + * The main Config entrypoint that extends the Config type and initializes your config options. + * See this link for more config Options + */ +public class ExampleConfig extends Config { + + @Switch(title = "Example Switch") + public static boolean exampleSwitch = false; // The default value for the boolean Switch. + + @Slider( + title = "Example Slider", + min = 0f, max = 100f, // Minimum and maximum values for the slider. + step = 10 // The amount of steps that the slider should have. + ) + public static float exampleSlider = 50f; // The default value for the float Slider. + + @Dropdown( + title = "Example Dropdown", // Name of the Dropdown + options = {"Option 1", "Option 2", "Option 3", "Option 4"} // Options available. + ) + public static int exampleDropdown = 1; // Default option (in this case "Option 2") + + public static final ExampleConfig INSTANCE = new ExampleConfig(); // The instance of the config. + + public ExampleConfig() { + super(ExampleConstants.ID + ".json", ExampleConstants.NAME, Category.OTHER); // TODO: Change your category here. + } + +} + diff --git a/src/main/java/org/polyfrost/example/client/ExampleHud.java b/src/main/java/org/polyfrost/example/client/ExampleHud.java new file mode 100644 index 0000000..75f9ac3 --- /dev/null +++ b/src/main/java/org/polyfrost/example/client/ExampleHud.java @@ -0,0 +1,5 @@ +package org.polyfrost.example.client; + +// TODO: for nextdayy +public class ExampleHud { +} diff --git a/src/main/java/org/polyfrost/example/command/ExampleCommand.java b/src/main/java/org/polyfrost/example/command/ExampleCommand.java deleted file mode 100644 index b4373a3..0000000 --- a/src/main/java/org/polyfrost/example/command/ExampleCommand.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.polyfrost.example.command; - -import org.polyfrost.example.ExampleMod; -import cc.polyfrost.oneconfig.utils.commands.annotations.Command; -import cc.polyfrost.oneconfig.utils.commands.annotations.Main; - -/** - * An example command implementing the Command api of OneConfig. - * Registered in ExampleMod.java with `CommandManager.INSTANCE.registerCommand(new ExampleCommand());` - * - * @see Command - * @see Main - * @see ExampleMod - */ -@Command(value = ExampleMod.MODID, description = "Access the " + ExampleMod.NAME + " GUI.") -public class ExampleCommand { - @Main - private void handle() { - ExampleMod.INSTANCE.config.openGui(); - } -} \ No newline at end of file diff --git a/src/main/java/org/polyfrost/example/config/TestConfig.java b/src/main/java/org/polyfrost/example/config/TestConfig.java deleted file mode 100644 index a4cc343..0000000 --- a/src/main/java/org/polyfrost/example/config/TestConfig.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.polyfrost.example.config; - -import org.polyfrost.example.ExampleMod; -import org.polyfrost.example.hud.TestHud; -import cc.polyfrost.oneconfig.config.Config; -import cc.polyfrost.oneconfig.config.annotations.Dropdown; -import cc.polyfrost.oneconfig.config.annotations.HUD; -import cc.polyfrost.oneconfig.config.annotations.Slider; -import cc.polyfrost.oneconfig.config.annotations.Switch; -import cc.polyfrost.oneconfig.config.data.Mod; -import cc.polyfrost.oneconfig.config.data.ModType; -import cc.polyfrost.oneconfig.config.data.OptionSize; - -/** - * The main Config entrypoint that extends the Config type and inits the config options. - * See this link for more config Options - */ -public class TestConfig extends Config { - @HUD( - name = "Example HUD" - ) - public TestHud hud = new TestHud(); - - @Switch( - name = "Example Switch", - size = OptionSize.SINGLE // Optional - ) - public static boolean exampleSwitch = false; // The default value for the boolean Switch. - - @Slider( - name = "Example Slider", - min = 0f, max = 100f, // Minimum and maximum values for the slider. - step = 10 // The amount of steps that the slider should have. - ) - public static float exampleSlider = 50f; // The default value for the float Slider. - - @Dropdown( - name = "Example Dropdown", // Name of the Dropdown - options = {"Option 1", "Option 2", "Option 3", "Option 4"} // Options available. - ) - public static int exampleDropdown = 1; // Default option (in this case "Option 2") - - public TestConfig() { - super(new Mod(ExampleMod.NAME, ModType.UTIL_QOL), ExampleMod.MODID + ".json"); - initialize(); - } -} - diff --git a/src/main/java/org/polyfrost/example/hud/TestHud.java b/src/main/java/org/polyfrost/example/hud/TestHud.java deleted file mode 100644 index cd0dfa7..0000000 --- a/src/main/java/org/polyfrost/example/hud/TestHud.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.polyfrost.example.hud; - -import cc.polyfrost.oneconfig.hud.SingleTextHud; -import org.polyfrost.example.config.TestConfig; - -/** - * An example OneConfig HUD that is started in the config and displays text. - * - * @see TestConfig#hud - */ -public class TestHud extends SingleTextHud { - public TestHud() { - super("Test", true); - } - - @Override - public String getText(boolean example) { - return "I'm an example HUD"; - } -} diff --git a/src/main/java/org/polyfrost/example/mixin/MinecraftMixin.java b/src/main/java/org/polyfrost/example/mixin/MinecraftMixin.java index cc1304c..b109546 100644 --- a/src/main/java/org/polyfrost/example/mixin/MinecraftMixin.java +++ b/src/main/java/org/polyfrost/example/mixin/MinecraftMixin.java @@ -7,15 +7,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; /** - * An example mixin using SpongePowered's Mixin library + * An example Mixin using SpongePowered's Mixin library * - * @see Inject * @see Mixin + * @see Inject */ @Mixin(Minecraft.class) public class MinecraftMixin { - @Inject(method = "startGame", at = @At(value = "HEAD")) - private void onStartGame(CallbackInfo ci) { - System.out.println("This is a message from an example mod!"); + + @Inject(method = "", at = @At(value = "RETURN")) + private void examplemod$onStartGame(CallbackInfo ci) { + System.out.println("This is a message from the example mod!"); } + } diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 9028106..76001f3 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,10 +1,10 @@ [ { - "modid": "${id}", - "name": "${name}", + "modid": "${mod_id}", + "name": "${mod_name}", "description": "", - "version": "${version}", - "mcversion": "${mcVersionStr}", + "version": "${mod_version}", + "mcversion": "${mc_version}", "url": "", "updateUrl": "", "authorList": [ diff --git a/src/main/resources/mixins.examplemod.json b/src/main/resources/mixins.examplemod.json index c5a6f21..9f9d8c5 100644 --- a/src/main/resources/mixins.examplemod.json +++ b/src/main/resources/mixins.examplemod.json @@ -1,8 +1,8 @@ { - "compatibilityLevel": "JAVA_8", - "minVersion": "0.7", + "compatibilityLevel": "${java_version}", + "minVersion": "0.8", "package": "org.polyfrost.example.mixin", - "refmap": "mixins.${id}.refmap.json", + "refmap": "mixins.${mod_id}.refmap.json", "injectors": { "maxShiftBy": 5 }, diff --git a/update-to-301a6ca.md b/update-to-301a6ca.md deleted file mode 100644 index 74f3894..0000000 --- a/update-to-301a6ca.md +++ /dev/null @@ -1,51 +0,0 @@ -# Updating to commit [`301a6ca`](https://github.com/Polyfrost/OneConfigExampleMod/commit/301a6cae2fc9b62d00e968b05eb689f3175c5f79) - -If you don't care to check the commit and manually apply everything, here are all the changes we made in that commit: - -## build.gradle.kts - -![Screenshot 2024-06-17 at 5 24 13 AM](https://github.com/Polyfrost/OneConfigExampleMod/assets/45589059/830faef9-bb86-4279-86d5-b9b7f837d1af) - -Updates blossom to 1.3.2 (what this template uses to automatically replace mentions of mod_id, mod_ver, etc. with the values in `gradle.properties`. unofficial Polyfrost update fixing Kotlin 1.9.x support), and removes unnecessary preprocessor variable (it's already included by PGT) - -## gradle.properties - -![Screenshot 2024-06-17 at 5 27 35 AM](https://github.com/Polyfrost/OneConfigExampleMod/assets/45589059/a170663b-2449-4043-9be3-865e982387c9) - -Updates `polyfrost.defaults.loom` (PGT's "loom revision," aka what mappings the mod uses) to `3`. This won't really affect anyone outside of modern version users, but this is just good practice. - -## gradle/wrapper/gradle-wrapper.properties - -![Screenshot 2024-06-17 at 5 29 02 AM](https://github.com/Polyfrost/OneConfigExampleMod/assets/45589059/ff423c15-1339-47bc-8435-e05d15181b32) - -Updates Gradle to 8.8. - -### IMPORTANT!! - -This Gradle update is why some other gradle-related files in this project (`gradle-wrapper.jar`, `gradlew` and `gradlew.bat`) changed. Obviously, it would be a bit inconvenient to apply the changes to those files manually, so here's what you do to properly apply the new changes: - -1. Apply the rest of the changes in this document -2. Temporarily change `gradle/wrapper/gradle-wrapper.properties` to gradle 8.6 or 8.7. This is necessary because in order for Loom to function, 8.6 or higher is required. -3. Reload the Gradle project -4. Run `gradle wrapper --gradle-version 8.8` in Terminal or through your IDE (IntelliJ users can run this through the following method:) -![Screenshot 2024-06-17 at 5 33 24 AM](https://github.com/Polyfrost/OneConfigExampleMod/assets/45589059/8df43b0f-485d-4f4b-a288-f4db2c4521fe) -![Screenshot 2024-06-17 at 5 34 05 AM](https://github.com/Polyfrost/OneConfigExampleMod/assets/45589059/0d7b0598-d486-4fa4-af07-f72b2ab77966) -5. Done! - -## root.gradle.kts - -![Screenshot 2024-06-17 at 5 35 02 AM](https://github.com/Polyfrost/OneConfigExampleMod/assets/45589059/b4622399-6548-47ef-9724-cfe5f2785243) - -Updates shadow (what Gradle uses to shade dependencies) to 8.1.1. - -## settings.gradle.kts - -![Screenshot 2024-06-17 at 5 36 43 AM](https://github.com/Polyfrost/OneConfigExampleMod/assets/45589059/88252eb9-3aeb-48c4-b7f0-ec1553d999a3) - -Updates PGT to 0.6.2 (which updates loom), and comments out 1.12.2 support in case people don't want it. - -## src/resources/mcmod.info - -![Screenshot 2024-06-17 at 5 38 49 AM](https://github.com/Polyfrost/OneConfigExampleMod/assets/45589059/bb721a82-edd8-4a2e-8678-3b53f3741671) - -Makes sure the `mcversion` field in `mcmod.info` is updated to the actual Minecraft version (in this case, either 1.8.9 or 1.12.2) diff --git a/update-to-fd8e095.md b/update-to-fd8e095.md deleted file mode 100644 index cd1e766..0000000 --- a/update-to-fd8e095.md +++ /dev/null @@ -1,21 +0,0 @@ -# Updating to commit [`fd8e095`](https://github.com/Polyfrost/OneConfigExampleMod/commit/fd8e095b2964eb0264c59d573ee3b0ca0855847f) - -If you don't care to check the commit and manually apply everything, here are all the changes we made in that commit: - -## build.gradle.kts - -Screenshot 2024-07-06 at 9 19 02 PM - -Updates and forces OneConfig Wrapper (what is used to download and load OneConfig automatically) to 1.0.0-beta17 (fixes SSL / antivirus detections) - -## src/main/resources/mixins.examplemod.json - -Screenshot 2024-07-06 at 9 20 43 PM - -Fixes the mixin json refmap not reflecting the mod id that is set in `gradle.properties`. - -## settings.gradle.kts - -Screenshot 2024-07-14 at 8 30 40 PM - -Updates PGT and Loom to 0.6.5 diff --git a/versions/mainProject b/versions/mainProject deleted file mode 100644 index dd1433e..0000000 --- a/versions/mainProject +++ /dev/null @@ -1 +0,0 @@ -1.8.9-forge \ No newline at end of file