diff --git a/build.gradle b/build.gradle index 765acb8..23a8425 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ plugins { id 'eclipse' id 'idea' id 'maven-publish' - id 'net.minecraftforge.gradle' version '[6.0,6.2)' + id 'net.minecraftforge.gradle' version '5.1+' id 'org.parchmentmc.librarian.forgegradle' version '1.+' } @@ -16,6 +16,11 @@ base { // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) +java { + withSourcesJar() + withJavadocJar() +} + println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { // The mappings can be changed at any time and must be in the following format. @@ -41,7 +46,6 @@ minecraft { // This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game. // It is REQUIRED to be set to true for this template to function. // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html - copyIdeResources = true // When true, this property will add the folder name of all declared run configurations to generated IDE run configurations. // The folder name can be set on a run configuration using the "folderName" property. @@ -54,7 +58,7 @@ minecraft { // However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge. // This default location is a best practice to automatically put the file in the right place in the final jar. // See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information. - accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Default run configurations. // These can be tweaked, removed, or duplicated as needed. @@ -169,24 +173,6 @@ dependencies { // http://www.gradle.org/docs/current/userguide/dependency_management.html } -// This block of code expands all declared replace properties in the specified resource targets. -// A missing property will result in an error. Properties are expanded using ${} Groovy notation. -// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments. -// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html -tasks.named('processResources', ProcessResources).configure { - var replaceProperties = [ - minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range, - forge_version: forge_version, forge_version_range: forge_version_range, - loader_version_range: loader_version_range, - mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, - mod_authors: mod_authors, mod_description: mod_description, - ] - inputs.properties replaceProperties - - filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { - expand replaceProperties + [project: project] - } -} // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar).configure { @@ -211,16 +197,25 @@ tasks.named('jar', Jar).configure { // dependsOn 'reobfJar' // } -// Example configuration to allow publishing using the maven-publish plugin +def MAVEN_PASSWORD_PROPERTY = "AriasCreationsMavenPassword" publishing { publications { - register('mavenJava', MavenPublication) { + mavenJava(MavenPublication) { artifact jar + artifact sourcesJar + artifact javadocJar } } repositories { maven { - url "file://${project.projectDir}/mcmodsrepo" + url = "https://maven.zontreck.com/repository/zontreck" + name = "ariascreations" + if (project.findProperty(MAVEN_PASSWORD_PROPERTY) != null) { + credentials { + username = "admin" + password = project.findProperty(MAVEN_PASSWORD_PROPERTY) + } + } } } } diff --git a/gradle.properties b/gradle.properties index e2e0ee1..75c567e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,22 +3,22 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -libzontreck=1.10.011524.0045 +libzontreck=1.10.020624.2226 ## Environment Properties # The Minecraft version must agree with the Forge version to get a valid artifact -minecraft_version=1.20.1 +minecraft_version=1.19.2 # The Minecraft version range can use any release version of Minecraft as bounds. # Snapshots, pre-releases, and release candidates are not guaranteed to sort properly # as they do not follow standard versioning conventions. -minecraft_version_range=[1.20.1,1.21) +minecraft_version_range=[1.19,1.20) # The Forge version must agree with the Minecraft version to get a valid artifact -forge_version=47.2.0 +forge_version=43.3.0 # The Forge version range can use any version of Forge as bounds or match the loader version range -forge_version_range=[47,) +forge_version_range=[43,) # The loader version range can only use the major version of Forge/FML as bounds -loader_version_range=[47,) +loader_version_range=[43,) # The mapping channel to use for mappings. # The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"]. # Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin. @@ -36,7 +36,7 @@ loader_version_range=[47,) mapping_channel=parchment # The mapping version to query from the mapping channel. # This must match the format required by the mapping channel. -mapping_version=2023.09.03-1.20.1 +mapping_version=2022.11.27-1.19.2 ## Mod Properties @@ -49,7 +49,7 @@ mod_name=WatchMyDurability # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=GPLv3 # The mod version. See https://semver.org/ -mod_version=1.2.011524.0055 +mod_version=1.2.020724.0009 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html @@ -57,4 +57,4 @@ mod_group_id=dev.zontreck # The authors of the mod. This is a simple text string that is used for display purposes in the mod list. mod_authors=zontreck # The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. -mod_description=Watches the durability tools, and or your hunger. \ No newline at end of file +mod_description=Watches the durability of tools, and or your hunger. \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cb..249e583 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37aef8d..ae04661 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip -networkTimeout=10000 +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68..a69d9cb 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/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,11 +80,11 @@ do esac done -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,16 +143,12 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/gradlew.bat b/gradlew.bat index 6689b85..53a6b23 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -26,7 +26,6 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/settings.gradle b/settings.gradle index 4e8d059..7f4682f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -3,8 +3,4 @@ pluginManagement { gradlePluginPortal() maven { url = "https://maven.zontreck.com/repository/internal" } } -} - -plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' } \ No newline at end of file diff --git a/src/main/java/dev/zontreck/wmd/checkers/CheckHealth.java b/src/main/java/dev/zontreck/wmd/checkers/CheckHealth.java index 3578a62..2e99518 100644 --- a/src/main/java/dev/zontreck/wmd/checkers/CheckHealth.java +++ b/src/main/java/dev/zontreck/wmd/checkers/CheckHealth.java @@ -2,6 +2,7 @@ package dev.zontreck.wmd.checkers; import dev.zontreck.ariaslib.terminal.Task; import dev.zontreck.libzontreck.chat.ChatColor; +import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.wmd.types.Health; import dev.zontreck.wmd.WatchMyDurability; import dev.zontreck.wmd.configs.WMDClientConfig; @@ -40,10 +41,10 @@ public class CheckHealth extends Task if(current.shouldGiveAlert()) { String Msg = ChatColor.doColors("!Dark_Red!!bold!You need to eat!"); - Component chat = Component.literal(Msg); + Component chat = ChatHelpers.macro(Msg); Minecraft.getInstance().player.displayClientMessage(chat, false); - SoundEvent sv = SoundEvents.WARDEN_ROAR; // It sounds like a growling stomach + SoundEvent sv = SoundEvents.WARDEN_ROAR; Helpers.Soundify(sv); } diff --git a/src/main/java/dev/zontreck/wmd/checkers/CheckHunger.java b/src/main/java/dev/zontreck/wmd/checkers/CheckHunger.java index 58e2654..62407d2 100644 --- a/src/main/java/dev/zontreck/wmd/checkers/CheckHunger.java +++ b/src/main/java/dev/zontreck/wmd/checkers/CheckHunger.java @@ -2,6 +2,7 @@ package dev.zontreck.wmd.checkers; import dev.zontreck.ariaslib.terminal.Task; import dev.zontreck.libzontreck.chat.ChatColor; +import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.wmd.types.Hunger; import dev.zontreck.wmd.WatchMyDurability; import dev.zontreck.wmd.configs.WMDClientConfig; @@ -36,7 +37,7 @@ public class CheckHunger extends Task { String Msg = ChatColor.doColors("!Dark_Red!!bold!You need to eat!"); - Component chat = Component.literal(Msg); + Component chat = ChatHelpers.macro(Msg); Minecraft.getInstance().player.displayClientMessage(chat, false); SoundEvent sv = SoundEvents.WARDEN_ROAR; // It sounds like a growling stomach diff --git a/src/main/java/dev/zontreck/wmd/checkers/CheckInventory.java b/src/main/java/dev/zontreck/wmd/checkers/CheckInventory.java index fbb112a..3cc2b1b 100644 --- a/src/main/java/dev/zontreck/wmd/checkers/CheckInventory.java +++ b/src/main/java/dev/zontreck/wmd/checkers/CheckInventory.java @@ -106,7 +106,7 @@ public class CheckInventory extends Task { - MutableComponent X = Component.literal(replaced); + MutableComponent X = ChatHelpers.macro(replaced); HoverEvent he = HoverTip.getItem(is1); Style s = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(he); diff --git a/src/main/java/dev/zontreck/wmd/commands/impl/SettingsCommand.java b/src/main/java/dev/zontreck/wmd/commands/impl/SettingsCommand.java index c52215d..017ecd8 100644 --- a/src/main/java/dev/zontreck/wmd/commands/impl/SettingsCommand.java +++ b/src/main/java/dev/zontreck/wmd/commands/impl/SettingsCommand.java @@ -1,6 +1,7 @@ package dev.zontreck.wmd.commands.impl; import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.exceptions.CommandSyntaxException; import dev.zontreck.wmd.networking.ModMessages; import dev.zontreck.wmd.networking.packets.s2c.RequestClientConfig; import net.minecraft.commands.CommandSourceStack; @@ -15,7 +16,11 @@ public class SettingsCommand public static int settingsPrompt(CommandSourceStack sender) { - ModMessages.sendToPlayer(new RequestClientConfig(), sender.getPlayer()); + try { + ModMessages.sendToPlayer(new RequestClientConfig(), sender.getPlayerOrException()); + } catch (CommandSyntaxException e) { + throw new RuntimeException(e); + } return 0; } } diff --git a/src/main/java/dev/zontreck/wmd/networking/packets/s2c/S2CResetConfig.java b/src/main/java/dev/zontreck/wmd/networking/packets/s2c/S2CResetConfig.java index 6186ae4..31a5c03 100644 --- a/src/main/java/dev/zontreck/wmd/networking/packets/s2c/S2CResetConfig.java +++ b/src/main/java/dev/zontreck/wmd/networking/packets/s2c/S2CResetConfig.java @@ -29,16 +29,16 @@ public class S2CResetConfig ctx.enqueueWork(()-> { - WMDClientConfig.WMD_PREFIX.set(WMDClientConfig.WMD_PREFIX.getDefault()); + WMDClientConfig.WMD_PREFIX.set("!Dark_Gray![!Bold!!Dark_Green!WMD!Reset!!Dark_Gray!]!Reset!"); WMDClientConfig.WMD_PREFIX.save(); - WMDClientConfig.EnableHealthAlert.set(WMDClientConfig.EnableHealthAlert.getDefault()); + WMDClientConfig.EnableHealthAlert.set(false); WMDClientConfig.EnableHealthAlert.save(); - WMDClientConfig.EnableHungerAlert.set(WMDClientConfig.EnableHungerAlert.getDefault()); + WMDClientConfig.EnableHungerAlert.set(false); WMDClientConfig.EnableHealthAlert.save(); - WMDClientConfig.EnableToolWatcher.set(WMDClientConfig.EnableToolWatcher.getDefault()); + WMDClientConfig.EnableToolWatcher.set(true); WMDClientConfig.EnableToolWatcher.save(); }); } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 282f267..51e7343 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -6,71 +6,67 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +loaderVersion="[43,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. # The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. # Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. -license="${mod_license}" +license="GPLv2" # A URL to refer people to when problems occur with this mod -#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional +issueTrackerURL="https://github.com/zontreck/WatchMyDurability/issues" #optional # A list of mods - how many allowed here is determined by the individual mod loader [[mods]] #mandatory # The modid of the mod -modId="${mod_id}" #mandatory -# The version number of the mod -version="${mod_version}" #mandatory +modId="watchmydurability" #mandatory +# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it +# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata +# see the associated build.gradle script for how to populate this completely automatically during a build +version="${file.jarVersion}" #mandatory # A display name for the mod -displayName="${mod_name}" #mandatory -# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/ +displayName="WatchMyDurability" #mandatory +# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/ #updateJSONURL="https://change.me.example.invalid/updates.json" #optional # A URL for the "homepage" for this mod, displayed in the mod UI #displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional # A file name (in the root of the mod JAR) containing a logo for display -#logoFile="examplemod.png" #optional +#logoFile="logo.png" #optional # A text field displayed in the mod UI -#credits="" #optional +credits="zontreck, PossumTheWarrior" #optional # A text field displayed in the mod UI -authors="${mod_authors}" #optional +authors="zontreck" #optional # Display Test controls the display for your mod in the server connection screen # MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod. # IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod. # IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component. # NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value. # IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself. -#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional) +displayTest="IGNORE_ALL_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional) # The description text for the mod (multi line!) (#mandatory) -description='''${mod_description}''' +description=''' +Watches the durability of your tools, and your health! +''' # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. -[[dependencies.${mod_id}]] #optional - # the modid of the dependency - modId="forge" #mandatory - # Does this dependency have to exist - if not, ordering below must be specified - mandatory=true #mandatory - # The version range of the dependency - versionRange="${forge_version_range}" #mandatory - # An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory - # BEFORE - This mod is loaded BEFORE the dependency - # AFTER - This mod is loaded AFTER the dependency - ordering="NONE" - # Side this dependency is applied on - BOTH, CLIENT, or SERVER - side="BOTH" +[[dependencies.watchmydurability]] #optional +# the modid of the dependency +modId="forge" #mandatory +# Does this dependency have to exist - if not, ordering below must be specified +mandatory=true #mandatory +# The version range of the dependency +versionRange="[43,)" #mandatory +# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory +ordering="NONE" +# Side this dependency is applied on - BOTH, CLIENT or SERVER +side="BOTH" # Here's another dependency -[[dependencies.${mod_id}]] - modId="minecraft" - mandatory=true - # This version range declares a minimum of the current minecraft version up to but not including the next major version - versionRange="${minecraft_version_range}" - ordering="NONE" - side="BOTH" - -[[dependencies.${mod_id}]] - modId="libzontreck" - mandatory=true - versionRange="[1.10,1.11)" - ordering="NONE" - side="BOTH" -# Features are specific properties of the game environment, that you may want to declare you require. This example declares -# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't -# stop your mod loading on the server for example. -#[features.${mod_id}] -#openGLVersion="[3.2,)" \ No newline at end of file +[[dependencies.watchmydurability]] +modId="minecraft" +mandatory=true +# This version range declares a minimum of the current minecraft version up to but not including the next major version +versionRange="[1.19,1.20)" +ordering="NONE" +side="BOTH" +[[dependencies.watchmydurability]] +modId="libzontreck" +mandatory=true +versionRange="[1.10,1.11)" +ordering="NONE" +side="BOTH" \ No newline at end of file diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index eca79ae..07d64da 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,8 +1,8 @@ { "pack": { - "description": { - "text": "${mod_id} resources" - }, - "pack_format": 15 + "description": "WatchMyDurability resources", + "pack_format": 9, + "forge:resource_pack_format": 8, + "forge:data_pack_format": 9 } } \ No newline at end of file