diff --git a/build.gradle b/build.gradle index bffd569..765acb8 100644 --- a/build.gradle +++ b/build.gradle @@ -2,9 +2,8 @@ plugins { id 'eclipse' id 'idea' id 'maven-publish' - id 'net.neoforged.gradle' version '[6.0.18,6.2)' - id 'org.spongepowered.mixin' version '0.7.+' - //id 'org.parchmentmc.librarian.forgegradle' version '1.+' + id 'net.minecraftforge.gradle' version '[6.0,6.2)' + id 'org.parchmentmc.librarian.forgegradle' version '1.+' } version = mod_version @@ -14,11 +13,6 @@ base { archivesName = mod_id } -java { - withSourcesJar() - withJavadocJar() -} - // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) @@ -67,7 +61,7 @@ minecraft { runs { // applies to all the run configs below configureEach { - workingDirectory project.file("run/${it.name}") + workingDirectory project.file('run') // Recommended logging data for a userdev environment // The markers can be added/remove as needed separated by commas. @@ -106,14 +100,13 @@ minecraft { } data { - // example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it - // workingDirectory project.file('run-data') + // example of overriding the workingDirectory set in configureEach above + workingDirectory project.file('run-data') // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } - } // Include resources generated by data generators. @@ -157,8 +150,7 @@ dependencies { // The "userdev" classifier will be requested and setup by ForgeGradle. // If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"], // then special handling is done to allow a setup of a vanilla dependency without the use of an external repository. - minecraft "net.neoforged:forge:${minecraft_version}-${neo_version}" - + minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation fg.deobf("dev.zontreck:LibZontreckMod:${libzontreck}") // Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings @@ -181,13 +173,13 @@ dependencies { // 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.withType(ProcessResources).configureEach { +tasks.named('processResources', ProcessResources).configure { var replaceProperties = [ - minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range, - neo_version : neo_version, neo_version_range: neo_version_range, + 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, pack_format_number: pack_format_number, + 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 @@ -196,7 +188,6 @@ tasks.withType(ProcessResources).configureEach { } } - // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar).configure { manifest { @@ -220,31 +211,20 @@ tasks.named('jar', Jar).configure { // dependsOn 'reobfJar' // } - -def MAVEN_PASSWORD_PROPERTY = "AriasCreationsMavenPassword" +// Example configuration to allow publishing using the maven-publish plugin publishing { publications { - mavenJava(MavenPublication) { + register('mavenJava', MavenPublication) { artifact jar - artifact sourcesJar - artifact javadocJar } } repositories { maven { - 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) - } - } + url "file://${project.projectDir}/mcmodsrepo" } } } - tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation } diff --git a/gradle.properties b/gradle.properties index a1ecdb3..e2e0ee1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,19 +3,21 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -libzontreck=1201.13.043024.0404 +libzontreck=1.10.011524.0045 ## Environment Properties # The Minecraft version must agree with the Forge version to get a valid artifact minecraft_version=1.20.1 - -minecraft_version_range=[1.20,1.21) -# The Neo version must agree with the Minecraft version to get a valid artifact -neo_version=47.1.65 -# The Neo version range can use any version of Neo as bounds or match the loader version range -neo_version_range=[47.1,) -# The loader version range can only use the major version of Neo/FML as bounds +# 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) +# The Forge version must agree with the Minecraft version to get a valid artifact +forge_version=47.2.0 +# The Forge version range can use any version of Forge as bounds or match the loader version range +forge_version_range=[47,) +# The loader version range can only use the major version of Forge/FML as bounds loader_version_range=[47,) # The mapping channel to use for mappings. # The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"]. @@ -31,11 +33,10 @@ loader_version_range=[47,) # # Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge. # Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started -mapping_channel=official +mapping_channel=parchment # The mapping version to query from the mapping channel. # This must match the format required by the mapping channel. -mapping_version=1.20.1 - +mapping_version=2023.09.03-1.20.1 ## Mod Properties @@ -48,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=1201.2.042324.1850 +mod_version=1.2.011524.0055 # 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 @@ -56,7 +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. - -# Pack version - this changes each minecraft release, in general. -pack_format_number=15 \ No newline at end of file +mod_description=Watches the durability tools, and or your hunger. \ No newline at end of file diff --git a/src/main/java/dev/zontreck/wmd/WatchMyDurability.java b/src/main/java/dev/zontreck/wmd/WatchMyDurability.java index b9dc0c6..1707751 100644 --- a/src/main/java/dev/zontreck/wmd/WatchMyDurability.java +++ b/src/main/java/dev/zontreck/wmd/WatchMyDurability.java @@ -17,7 +17,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.User; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.ModLoadingContext; @@ -96,6 +95,7 @@ public class WatchMyDurability //LOGGER.info("HELLO FROM CLIENT SETUP"); //LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName()); WatchMyDurability.CurrentUser = Minecraft.getInstance().getUser(); + DelayedExecutorService.setup(); //time.schedule(new CheckInventory(), @@ -111,7 +111,6 @@ public class WatchMyDurability @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT) public static class ClientEvents { - static int TICKS=0; @SubscribeEvent public static void onJoin(ClientPlayerNetworkEvent.LoggingIn event){ @@ -119,18 +118,11 @@ public class WatchMyDurability //LOGGER.info("PLAYER LOGGED IN"); LOGGER.info(": : : PLAYER LOGGED IN : : :"); WatchMyDurability.isInGame=true; - } + DelayedExecutorService.start(); - @SubscribeEvent - public static void onTick(TickEvent.ClientTickEvent ev) - { - if(ev.phase == TickEvent.Phase.END && TICKS >= 40 && isInGame) - { - TICKS=0; - CheckInventory.getInstance().run(); - CheckHealth.getInstance().run(); - CheckHunger.getInstance().run(); - }else TICKS++; + DelayedExecutorService.getInstance().scheduleRepeating(CheckInventory.getInstance(), WMDClientConfig.TimerVal.get()); + DelayedExecutorService.getInstance().scheduleRepeating(CheckHealth.getInstance(), WMDClientConfig.TimerVal.get()); + DelayedExecutorService.getInstance().scheduleRepeating(CheckHunger.getInstance(), WMDClientConfig.TimerVal.get()); } @SubscribeEvent @@ -139,6 +131,7 @@ public class WatchMyDurability LOGGER.info(": : : PLAYER LOGGED OUT : : :"); WatchMyDurability.isInGame=false; WatchMyDurability.WMD_SERVER_AVAILABLE=false; + DelayedExecutorService.stop(); } @SubscribeEvent diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 349391a..282f267 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -47,7 +47,7 @@ description='''${mod_description}''' # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency - versionRange="${neo_version_range}" #mandatory + 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 @@ -66,7 +66,7 @@ description='''${mod_description}''' [[dependencies.${mod_id}]] modId="libzontreck" mandatory=true - versionRange="[1201.13,1201.14)" + 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 diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 7bcc5b9..eca79ae 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -3,6 +3,6 @@ "description": { "text": "${mod_id} resources" }, - "pack_format": ${pack_format_number} + "pack_format": 15 } } \ No newline at end of file