From 42557f438fb47331dddfcd837b6cea1d6d79b58b Mon Sep 17 00:00:00 2001 From: Miyu Nguyen Date: Tue, 13 Feb 2024 15:33:13 -0500 Subject: [PATCH] More comfort features --- common/build.gradle | 46 ++--- .../main/resources/architectury.common.json | 2 +- .../resources/assets/hexical/lang/en_us.json | 22 +-- .../main/resources/hexical-common.mixins.json | 24 +-- fabric/build.gradle | 175 ++++++------------ .../fabric/HexicalAbstractionsImpl.java | 19 +- .../hexical/fabric/HexicalClientFabric.java | 10 +- .../hexical/fabric/HexicalConfigFabric.java | 124 ++++++------- .../hexical/fabric/HexicalFabric.java | 18 +- fabric/src/main/resources/fabric.mod.json | 70 +++---- fabric/src/main/resources/hexical.mixins.json | 22 +-- forge/build.gradle | 52 +----- .../forge/HexicalAbstractionsImpl.java | 20 +- .../hexical/forge/HexicalClientForge.java | 11 +- .../hexical/forge/HexicalConfigForge.java | 97 +++++----- .../hexical/forge/HexicalForge.java | 19 +- forge/src/main/resources/hexical.mixins.json | 22 +-- forge/src/main/resources/pack.mcmeta | 8 +- 18 files changed, 313 insertions(+), 448 deletions(-) diff --git a/common/build.gradle b/common/build.gradle index 4d69ac8c2..a4cbeb974 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,44 +1,36 @@ plugins { - id 'org.jetbrains.kotlin.jvm' version '1.8.0' + id 'org.jetbrains.kotlin.jvm' version '1.8.0' } archivesBaseName = getArtifactId("common") architectury { - common(project.enabledPlatforms.split(",")) + common(project.enabledPlatforms.split(",")) } loom { - accessWidenerPath = file("src/main/resources/hexical.accesswidener") + accessWidenerPath = file("src/main/resources/hexical.accesswidener") } dependencies { - // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies - // Do NOT use other classes from fabric loader - modImplementation "net.fabricmc:fabric-loader:${project.fabricLoaderVersion}" - modApi "dev.architectury:architectury:${project.architecturyVersion}" - - implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' - implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2' // for @Nonnull - - modCompileOnly "at.petra-k.paucal:paucal-common-$minecraftVersion:$paucalVersion" - modCompileOnly "at.petra-k.hexcasting:hexcasting-fabric-$minecraftVersion:$hexcastingVersion" - modCompileOnly "vazkii.patchouli:Patchouli-xplat:$minecraftVersion-$patchouliVersion" + modImplementation "net.fabricmc:fabric-loader:${project.fabricLoaderVersion}" + modApi "dev.architectury:architectury:${project.architecturyVersion}" + implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' + implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2' // for @Nonnull + modCompileOnly "at.petra-k.paucal:paucal-common-$minecraftVersion:$paucalVersion" + modCompileOnly "at.petra-k.hexcasting:hexcasting-fabric-$minecraftVersion:$hexcastingVersion" + modCompileOnly "vazkii.patchouli:Patchouli-xplat:$minecraftVersion-$patchouliVersion" } publishing { - publications { - mavenCommon(MavenPublication) { - artifactId = project.archivesBaseName - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - // Add repositories to publish to here. - } + repositories {} + publications { + mavenCommon(MavenPublication) { + artifactId = project.archivesBaseName + from components.java + } + } } repositories { - mavenCentral() -} + mavenCentral() +} \ No newline at end of file diff --git a/common/src/main/resources/architectury.common.json b/common/src/main/resources/architectury.common.json index 7b752b468..99bf750f1 100644 --- a/common/src/main/resources/architectury.common.json +++ b/common/src/main/resources/architectury.common.json @@ -1,3 +1,3 @@ { - "accessWidener": "hexical.accesswidener" + "accessWidener": "hexical.accesswidener" } \ No newline at end of file diff --git a/common/src/main/resources/assets/hexical/lang/en_us.json b/common/src/main/resources/assets/hexical/lang/en_us.json index 09d928275..a9ad852c5 100644 --- a/common/src/main/resources/assets/hexical/lang/en_us.json +++ b/common/src/main/resources/assets/hexical/lang/en_us.json @@ -1,13 +1,13 @@ { - "item.hexical.dummy_item": "Dummy Item", - "hexcasting.spell.hexical:congrats": "Congrats", - "hexcasting.spell.hexical:signum": "Signum Purification", - "hexcasting.spell.book.hexical:congrats": "Dum. Spell Actn.", - "hexcasting.spell.book.hexical:signum": "Dum. Actn.", - "hexical.entry.dummy_spells": "Dummy Spells", - "hexical.entry.dummy_actions": "Dummy Actions", - "hexical.page.dummy_spells.congrats": "Accepts a player entity, tells them they are doing a good job.", - "hexical.page.dummy_actions.signum": "Accepts a $(l:casting/101)number/$, returns -1 if it is negative, 0 if 0, 1 if positive.", - "text.hexical.congrats": "Good job, %1$s!", - "text.hexical.congrats.player": "a Player" + "item.hexical.dummy_item": "Dummy Item", + "hexcasting.spell.hexical:congrats": "Congrats", + "hexcasting.spell.hexical:signum": "Signum Purification", + "hexcasting.spell.book.hexical:congrats": "Dum. Spell Actn.", + "hexcasting.spell.book.hexical:signum": "Dum. Actn.", + "hexical.entry.dummy_spells": "Dummy Spells", + "hexical.entry.dummy_actions": "Dummy Actions", + "hexical.page.dummy_spells.congrats": "Accepts a player entity, tells them they are doing a good job.", + "hexical.page.dummy_actions.signum": "Accepts a $(l:casting/101)number/$, returns -1 if it is negative, 0 if 0, 1 if positive.", + "text.hexical.congrats": "Good job, %1$s!", + "text.hexical.congrats.player": "a Player" } \ No newline at end of file diff --git a/common/src/main/resources/hexical-common.mixins.json b/common/src/main/resources/hexical-common.mixins.json index 32866002e..30b00c9ee 100644 --- a/common/src/main/resources/hexical-common.mixins.json +++ b/common/src/main/resources/hexical-common.mixins.json @@ -1,14 +1,14 @@ { - "required": true, - "package": "miyucomics.hexical.mixin", - "compatibilityLevel": "JAVA_17", - "minVersion": "0.8", - "client": [ - "HexicalMixin" - ], - "mixins": [ - ], - "injectors": { - "defaultRequire": 1 - } + "required": true, + "package": "miyucomics.hexical.mixin", + "compatibilityLevel": "JAVA_17", + "minVersion": "0.8", + "client": [ + "HexicalMixin" + ], + "mixins": [ + ], + "injectors": { + "defaultRequire": 1 + } } \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle index 7e53c778f..56ca8401c 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,153 +1,96 @@ plugins { - id "com.github.johnrengelman.shadow" version "7.1.2" - id "me.modmuss50.mod-publish-plugin" version "0.3.0" + id "com.github.johnrengelman.shadow" version "7.1.2" + id "me.modmuss50.mod-publish-plugin" version "0.3.0" } archivesBaseName = getArtifactId("fabric") architectury { - platformSetupLoomIde() - fabric() + platformSetupLoomIde() + fabric() } loom { - accessWidenerPath = project(":common").loom.accessWidenerPath + accessWidenerPath = project(":common").loom.accessWidenerPath } configurations { - common - shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files. - compileClasspath.extendsFrom common - runtimeClasspath.extendsFrom common - developmentFabric.extendsFrom common + common + shadowCommon + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common + developmentFabric.extendsFrom common } dependencies { - modCompileOnly(group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2') // for @Nonnull - - // Loaders and base APIs - modImplementation "net.fabricmc:fabric-loader:${project.fabricLoaderVersion}" - modApi "net.fabricmc.fabric-api:fabric-api:${fabricApiVersion}" - modImplementation("net.fabricmc:fabric-language-kotlin:${project.fabricKotlinVersion}") - modApi("dev.architectury:architectury-fabric:${architecturyVersion}") { - // Fix for the "two fabric loaders" loading crash - exclude group: "net.fabricmc", module: "fabric-loader" - } - - // Hex Casting stuff - modImplementation("at.petra-k.hexcasting:hexcasting-fabric-${minecraftVersion}:${hexcastingVersion}") { - // If not excluded here, calls a nonexistent method and crashes the dev client - exclude module: "phosphor" - } - - modImplementation "at.petra-k.paucal:paucal-fabric-${minecraftVersion}:${paucalVersion}" - modImplementation "vazkii.patchouli:Patchouli:${minecraftVersion}-${patchouliVersion}-FABRIC" - - modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-api:${cardinalComponentsVersion}" - - modImplementation "com.jamieswhiteshirt:reach-entity-attributes:${entityReachVersion}" - include "com.jamieswhiteshirt:reach-entity-attributes:${entityReachVersion}" - - modImplementation "io.github.tropheusj:serialization-hooks:${serializationHooksVersion}" - include "io.github.tropheusj:serialization-hooks:${serializationHooksVersion}" - - modImplementation "dev.emi:trinkets:${trinketsVersion}" - - common(project(path: ":common", configuration: "namedElements")) { transitive false } - shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } + modCompileOnly(group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2') + modImplementation "net.fabricmc:fabric-loader:${project.fabricLoaderVersion}" + modApi "net.fabricmc.fabric-api:fabric-api:${fabricApiVersion}" + modImplementation("net.fabricmc:fabric-language-kotlin:${project.fabricKotlinVersion}") + modApi("dev.architectury:architectury-fabric:${architecturyVersion}") { + exclude group: "net.fabricmc", module: "fabric-loader" + } + modImplementation("at.petra-k.hexcasting:hexcasting-fabric-${minecraftVersion}:${hexcastingVersion}") { + exclude module: "phosphor" + } + modImplementation "at.petra-k.paucal:paucal-fabric-${minecraftVersion}:${paucalVersion}" + modImplementation "vazkii.patchouli:Patchouli:${minecraftVersion}-${patchouliVersion}-FABRIC" + modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-api:${cardinalComponentsVersion}" + modImplementation "com.jamieswhiteshirt:reach-entity-attributes:${entityReachVersion}" + include "com.jamieswhiteshirt:reach-entity-attributes:${entityReachVersion}" + modImplementation "io.github.tropheusj:serialization-hooks:${serializationHooksVersion}" + include "io.github.tropheusj:serialization-hooks:${serializationHooksVersion}" + modImplementation "dev.emi:trinkets:${trinketsVersion}" + common(project(path: ":common", configuration: "namedElements")) { transitive false } + shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } } shadowJar { - exclude "architectury.common.json" - - configurations = [project.configurations.shadowCommon] - archiveClassifier.set "dev-shadow" + exclude "architectury.common.json" + configurations = [project.configurations.shadowCommon] + archiveClassifier.set "dev-shadow" } remapJar { - injectAccessWidener = true - input.set shadowJar.archiveFile - dependsOn shadowJar - archiveClassifier.set null + injectAccessWidener = true + input.set shadowJar.archiveFile + dependsOn shadowJar + archiveClassifier.set null } jar { - archiveClassifier.set "dev" + archiveClassifier.set "dev" } sourcesJar { - def commonSources = project(":common").sourcesJar - dependsOn commonSources - from commonSources.archiveFile.map { zipTree(it) } + def commonSources = project(":common").sourcesJar + dependsOn commonSources + from commonSources.archiveFile.map { zipTree(it) } } components.java { - withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { - skip() - } + withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { + skip() + } } publishing { - publications { - mavenFabric(MavenPublication) { - artifactId = project.archivesBaseName + "-" + project.name + "-fabric" - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - // Add repositories to publish to here. - } + repositories {} + publications { + mavenFabric(MavenPublication) { + artifactId = project.archivesBaseName + "-" + project.name + "-fabric" + from components.java + } + } } publishMods { - file = remapJar.archiveFile - additionalFiles.from(sourcesJar.archiveFile) - changelog = getLatestChangelog() - type = STABLE - modLoaders.add("fabric") - modLoaders.add("quilt") - - version = project.version + "-fabric" - displayName = "Hexical $project.version [Fabric]" - - // Uncomment your desired platform(s) -// curseforge { -// accessToken = project.curseforgeApiToken -// projectId = project.curseforgeId -// minecraftVersions.add(minecraftVersion) -// -// requires{ -// slug = "fabric-api" -// } -// requires { -// slug = "architectury-api" -// } -// requires { -// slug = "fabric-language-kotlin" -// } -// requires { -// slug = "hexcasting" -// } -// } -// -// modrinth { -// accessToken = project.modrinthApiToken -// projectId = project.modrinthId -// minecraftVersions.add("1.19.2") -// -// requires{ -// slug = "fabric-api" -// } -// requires { -// slug = "architectury-api" -// } -// requires { -// slug = "fabric-language-kotlin" -// } -// requires { -// slug = "hex-casting" -// } -// } + file = remapJar.archiveFile + additionalFiles.from(sourcesJar.archiveFile) + changelog = getLatestChangelog() + type = STABLE + modLoaders.add("fabric") + modLoaders.add("quilt") + version = project.version + "-fabric" + displayName = "Hexical $project.version [Fabric]" } diff --git a/fabric/src/main/java/miyucomics/hexical/fabric/HexicalAbstractionsImpl.java b/fabric/src/main/java/miyucomics/hexical/fabric/HexicalAbstractionsImpl.java index 5795c9a13..c3e61c48d 100644 --- a/fabric/src/main/java/miyucomics/hexical/fabric/HexicalAbstractionsImpl.java +++ b/fabric/src/main/java/miyucomics/hexical/fabric/HexicalAbstractionsImpl.java @@ -6,14 +6,11 @@ import java.nio.file.Path; public class HexicalAbstractionsImpl { - /** - * This is the actual implementation of {@link HexicalAbstractions#getConfigDirectory()}. - */ - public static Path getConfigDirectory() { - return FabricLoader.getInstance().getConfigDir(); - } - - public static void initPlatformSpecific() { - HexicalConfigFabric.init(); - } -} + public static Path getConfigDirectory() { + return FabricLoader.getInstance().getConfigDir(); + } + + public static void initPlatformSpecific() { + HexicalConfigFabric.init(); + } +} \ No newline at end of file diff --git a/fabric/src/main/java/miyucomics/hexical/fabric/HexicalClientFabric.java b/fabric/src/main/java/miyucomics/hexical/fabric/HexicalClientFabric.java index bb401e902..7464f23b4 100644 --- a/fabric/src/main/java/miyucomics/hexical/fabric/HexicalClientFabric.java +++ b/fabric/src/main/java/miyucomics/hexical/fabric/HexicalClientFabric.java @@ -7,8 +7,8 @@ * Fabric client loading entrypoint. */ public class HexicalClientFabric implements ClientModInitializer { - @Override - public void onInitializeClient() { - HexicalClient.init(); - } -} + @Override + public void onInitializeClient() { + HexicalClient.init(); + } +} \ No newline at end of file diff --git a/fabric/src/main/java/miyucomics/hexical/fabric/HexicalConfigFabric.java b/fabric/src/main/java/miyucomics/hexical/fabric/HexicalConfigFabric.java index 4af0615ea..58b960a30 100644 --- a/fabric/src/main/java/miyucomics/hexical/fabric/HexicalConfigFabric.java +++ b/fabric/src/main/java/miyucomics/hexical/fabric/HexicalConfigFabric.java @@ -15,66 +15,66 @@ @SuppressWarnings({"FieldCanBeLocal", "FieldMayBeFinal"}) @Config(name = Hexical.MOD_ID) public class HexicalConfigFabric extends PartitioningSerializer.GlobalData { - @ConfigEntry.Category("common") - @ConfigEntry.Gui.TransitiveObject - public final Common common = new Common(); - @ConfigEntry.Category("client") - @ConfigEntry.Gui.TransitiveObject - public final Client client = new Client(); - @ConfigEntry.Category("server") - @ConfigEntry.Gui.TransitiveObject - public final Server server = new Server(); - - public static void init() { - AutoConfig.register(HexicalConfigFabric.class, PartitioningSerializer.wrap(JanksonConfigSerializer::new)); - var instance = AutoConfig.getConfigHolder(HexicalConfigFabric.class).getConfig(); - - HexicalConfig.setCommon(instance.common); - - if (Platform.getEnv().equals(EnvType.CLIENT)) { - HexicalConfig.setClient(instance.client); - } - - // Needed for logical server in singleplayer, do not access server configs from client code - HexicalConfig.setServer(instance.server); - } - - - @Config(name = "common") - private static class Common implements ConfigData, HexicalConfig.CommonConfigAccess { - } - - @Config(name = "client") - private static class Client implements ConfigData, HexicalConfig.ClientConfigAccess { - } - - - @Config(name = "server") - private static class Server implements ConfigData, HexicalConfig.ServerConfigAccess { - - @ConfigEntry.Gui.CollapsibleObject - private Costs costs = new Costs(); - - @Override - public void validatePostLoad() throws ValidationException { - this.costs.signumCost = HexicalConfig.bound(this.costs.signumCost, DEF_MIN_COST, DEF_MAX_COST); - this.costs.congratsCost = HexicalConfig.bound(this.costs.congratsCost, DEF_MIN_COST, DEF_MAX_COST); - } - - @Override - public int getSignumCost() { - return (int) (costs.signumCost * MediaConstants.DUST_UNIT); - } - - @Override - public int getCongratsCost() { - return (int) (costs.congratsCost * MediaConstants.DUST_UNIT); - } - - static class Costs { - // costs of actions - double signumCost = DEFAULT_SIGNUM_COST; - double congratsCost = DEFAULT_CONGRATS_COST; - } - } + @ConfigEntry.Category("common") + @ConfigEntry.Gui.TransitiveObject + public final Common common = new Common(); + @ConfigEntry.Category("client") + @ConfigEntry.Gui.TransitiveObject + public final Client client = new Client(); + @ConfigEntry.Category("server") + @ConfigEntry.Gui.TransitiveObject + public final Server server = new Server(); + + public static void init() { + AutoConfig.register(HexicalConfigFabric.class, PartitioningSerializer.wrap(JanksonConfigSerializer::new)); + var instance = AutoConfig.getConfigHolder(HexicalConfigFabric.class).getConfig(); + + HexicalConfig.setCommon(instance.common); + + if (Platform.getEnv().equals(EnvType.CLIENT)) { + HexicalConfig.setClient(instance.client); + } + + // Needed for logical server in singleplayer, do not access server configs from client code + HexicalConfig.setServer(instance.server); + } + + + @Config(name = "common") + private static class Common implements ConfigData, HexicalConfig.CommonConfigAccess { + } + + @Config(name = "client") + private static class Client implements ConfigData, HexicalConfig.ClientConfigAccess { + } + + + @Config(name = "server") + private static class Server implements ConfigData, HexicalConfig.ServerConfigAccess { + + @ConfigEntry.Gui.CollapsibleObject + private Costs costs = new Costs(); + + @Override + public void validatePostLoad() throws ValidationException { + this.costs.signumCost = HexicalConfig.bound(this.costs.signumCost, DEF_MIN_COST, DEF_MAX_COST); + this.costs.congratsCost = HexicalConfig.bound(this.costs.congratsCost, DEF_MIN_COST, DEF_MAX_COST); + } + + @Override + public int getSignumCost() { + return (int) (costs.signumCost * MediaConstants.DUST_UNIT); + } + + @Override + public int getCongratsCost() { + return (int) (costs.congratsCost * MediaConstants.DUST_UNIT); + } + + static class Costs { + // costs of actions + double signumCost = DEFAULT_SIGNUM_COST; + double congratsCost = DEFAULT_CONGRATS_COST; + } + } } \ No newline at end of file diff --git a/fabric/src/main/java/miyucomics/hexical/fabric/HexicalFabric.java b/fabric/src/main/java/miyucomics/hexical/fabric/HexicalFabric.java index 48969d8b2..e9fbea3ef 100644 --- a/fabric/src/main/java/miyucomics/hexical/fabric/HexicalFabric.java +++ b/fabric/src/main/java/miyucomics/hexical/fabric/HexicalFabric.java @@ -3,17 +3,9 @@ import net.fabricmc.api.ModInitializer; import miyucomics.hexical.Hexical; -/** - * This is your loading entrypoint on fabric(-likes), in case you need to initialize - * something platform-specific. - *
- * Since quilt can load fabric mods, you develop for two platforms in one fell swoop. - * Feel free to check out the Architectury templates - * if you want to see how to add quilt-specific code. - */ public class HexicalFabric implements ModInitializer { - @Override - public void onInitialize() { - Hexical.init(); - } -} + @Override + public void onInitialize() { + Hexical.init(); + } +} \ No newline at end of file diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 724519a18..8d53d05d6 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -1,37 +1,37 @@ { - "schemaVersion": 1, - "id": "hexical", - "version": "${version}", - "name": "Hexical", - "description": "A kitchen sink addon for Hexcasting", - "authors": [ - "miyucomics" - ], - "contact": { - "homepage": "https://miyucomics.github.io/hexical", - "sources": "https://github.com/miyucomics/hexical" - }, - "license": "MIT", - "icon": "icon.png", - "environment": "*", - "entrypoints": { - "main": [ - "miyucomics.hexical.fabric.HexicalFabric" - ], - "client": [ - "miyucomics.hexical.fabric.HexicalClientFabric" - ] - }, - "mixins": [ - "hexical-common.mixins.json", - "hexical.mixins.json" - ], - "depends": { - "minecraft": ">=${minecraftVersion}", - "fabricloader": ">=${fabricLoaderVersion}", - "fabric-api": "*", - "fabric-language-kotlin": ">=${fabricKotlinVersion}", - "architectury": ">=${architecturyVersion}", - "hexcasting": ">=${hexcastingVersion}" - } + "schemaVersion": 1, + "id": "hexical", + "version": "${version}", + "name": "Hexical", + "description": "A kitchen sink addon for Hexcasting", + "authors": [ + "miyucomics" + ], + "contact": { + "homepage": "https://miyucomics.github.io/hexical", + "sources": "https://github.com/miyucomics/hexical" + }, + "license": "MIT", + "icon": "icon.png", + "environment": "*", + "entrypoints": { + "main": [ + "miyucomics.hexical.fabric.HexicalFabric" + ], + "client": [ + "miyucomics.hexical.fabric.HexicalClientFabric" + ] + }, + "mixins": [ + "hexical-common.mixins.json", + "hexical.mixins.json" + ], + "depends": { + "minecraft": ">=${minecraftVersion}", + "fabricloader": ">=${fabricLoaderVersion}", + "fabric-api": "*", + "fabric-language-kotlin": ">=${fabricKotlinVersion}", + "architectury": ">=${architecturyVersion}", + "hexcasting": ">=${hexcastingVersion}" + } } diff --git a/fabric/src/main/resources/hexical.mixins.json b/fabric/src/main/resources/hexical.mixins.json index 22d513ce0..6b5af0a26 100644 --- a/fabric/src/main/resources/hexical.mixins.json +++ b/fabric/src/main/resources/hexical.mixins.json @@ -1,13 +1,13 @@ { - "required": true, - "package": "miyucomics.hexical.fabric.mixin", - "compatibilityLevel": "JAVA_17", - "minVersion": "0.8", - "client": [ - ], - "mixins": [ - ], - "injectors": { - "defaultRequire": 1 - } + "required": true, + "package": "miyucomics.hexical.fabric.mixin", + "compatibilityLevel": "JAVA_17", + "minVersion": "0.8", + "client": [ + ], + "mixins": [ + ], + "injectors": { + "defaultRequire": 1 + } } \ No newline at end of file diff --git a/forge/build.gradle b/forge/build.gradle index 02493ec14..877229396 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -12,11 +12,9 @@ architectury { loom { accessWidenerPath = project(":common").loom.accessWidenerPath - forge { convertAccessWideners = true extraAccessWideners.add loom.accessWidenerPath.get().asFile.name - mixinConfig "hexical-common.mixins.json" mixinConfig "hexical.mixins.json" } @@ -24,7 +22,7 @@ loom { configurations { common - shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files. + shadowCommon compileClasspath.extendsFrom common runtimeClasspath.extendsFrom common developmentForge.extendsFrom common @@ -32,7 +30,6 @@ configurations { dependencies { modCompileOnly(group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2') // for @Nonnull - forge "net.minecraftforge:forge:${project.forgeVersion}" modApi "dev.architectury:architectury-forge:${project.architecturyVersion}" @@ -40,15 +37,11 @@ dependencies { transitive = false } - // // Hex Casting Dependencies modCompileOnly "at.petra-k.paucal:paucal-forge-${minecraftVersion}:${paucalVersion}" modCompileOnly "vazkii.patchouli:Patchouli:${minecraftVersion}-${patchouliVersion}" - modRuntimeOnly "at.petra-k.paucal:paucal-forge-${minecraftVersion}:${paucalVersion}" modRuntimeOnly "vazkii.patchouli:Patchouli:${minecraftVersion}-${patchouliVersion}" - runtimeOnly "thedarkcolour:kotlinforforge:$project.forgeKotlinVersion" - common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false } } @@ -56,7 +49,6 @@ dependencies { shadowJar { exclude "fabric.mod.json" exclude "architectury.common.json" - configurations = [project.configurations.shadowCommon] archiveClassifier.set "dev-shadow" } @@ -84,17 +76,13 @@ components.java { } publishing { + repositories {} publications { mavenForge(MavenPublication) { artifactId = project.archivesBaseName + "-" + project.name from components.java } } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - // Add repositories to publish to here. - } } publishMods { @@ -103,40 +91,6 @@ publishMods { changelog = getLatestChangelog() type = STABLE modLoaders.add("forge") - version = project.version + "-forge" displayName = "Hexical $project.version [Forge]" - - // Uncomment your desired platform(s) -// curseforge { -// accessToken = project.curseforgeApiToken -// projectId = project.curseforgeId -// minecraftVersions.add(minecraftVersion) -// -// requires { -// slug = "architectury-api" -// } -// requires { -// slug = "kotlin-for-forge" -// } -// requires { -// slug = "hexcasting" -// } -// } -// -// modrinth { -// accessToken = project.modrinthApiToken -// projectId = project.modrinthId -// minecraftVersions.add("1.19.2") -// -// requires { -// slug = "architectury-api" -// } -// requires { -// slug = "kotlin-for-forge" -// } -// requires { -// slug = "hex-casting" -// } -// } -} +} \ No newline at end of file diff --git a/forge/src/main/java/miyucomics/hexical/forge/HexicalAbstractionsImpl.java b/forge/src/main/java/miyucomics/hexical/forge/HexicalAbstractionsImpl.java index 018f6441d..0a2024e40 100644 --- a/forge/src/main/java/miyucomics/hexical/forge/HexicalAbstractionsImpl.java +++ b/forge/src/main/java/miyucomics/hexical/forge/HexicalAbstractionsImpl.java @@ -1,19 +1,15 @@ package miyucomics.hexical.forge; -import miyucomics.hexical.HexicalAbstractions; import net.minecraftforge.fml.loading.FMLPaths; import java.nio.file.Path; public class HexicalAbstractionsImpl { - /** - * This is the actual implementation of {@link HexicalAbstractions#getConfigDirectory()}. - */ - public static Path getConfigDirectory() { - return FMLPaths.CONFIGDIR.get(); - } - - public static void initPlatformSpecific() { - HexicalConfigForge.init(); - } -} + public static Path getConfigDirectory() { + return FMLPaths.CONFIGDIR.get(); + } + + public static void initPlatformSpecific() { + HexicalConfigForge.init(); + } +} \ No newline at end of file diff --git a/forge/src/main/java/miyucomics/hexical/forge/HexicalClientForge.java b/forge/src/main/java/miyucomics/hexical/forge/HexicalClientForge.java index 157ba79d8..db4f6607e 100644 --- a/forge/src/main/java/miyucomics/hexical/forge/HexicalClientForge.java +++ b/forge/src/main/java/miyucomics/hexical/forge/HexicalClientForge.java @@ -3,11 +3,8 @@ import miyucomics.hexical.HexicalClient; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -/** - * Forge client loading entrypoint. - */ public class HexicalClientForge { - public static void init(FMLClientSetupEvent event) { - HexicalClient.init(); - } -} + public static void init(FMLClientSetupEvent event) { + HexicalClient.init(); + } +} \ No newline at end of file diff --git a/forge/src/main/java/miyucomics/hexical/forge/HexicalConfigForge.java b/forge/src/main/java/miyucomics/hexical/forge/HexicalConfigForge.java index c663120e6..617c892fe 100644 --- a/forge/src/main/java/miyucomics/hexical/forge/HexicalConfigForge.java +++ b/forge/src/main/java/miyucomics/hexical/forge/HexicalConfigForge.java @@ -9,53 +9,52 @@ public class HexicalConfigForge { - public static void init() { - Pair config = (new ForgeConfigSpec.Builder()).configure(Common::new); - Pair clientConfig = (new ForgeConfigSpec.Builder()).configure(Client::new); - Pair serverConfig = (new ForgeConfigSpec.Builder()).configure(Server::new); - HexicalConfig.setCommon(config.getLeft()); - HexicalConfig.setClient(clientConfig.getLeft()); - HexicalConfig.setServer(serverConfig.getLeft()); - ModLoadingContext mlc = ModLoadingContext.get(); - mlc.registerConfig(ModConfig.Type.COMMON, config.getRight()); - mlc.registerConfig(ModConfig.Type.CLIENT, clientConfig.getRight()); - mlc.registerConfig(ModConfig.Type.SERVER, serverConfig.getRight()); - } - - public static class Common implements HexicalConfig.CommonConfigAccess { - public Common(ForgeConfigSpec.Builder builder) { - - } - } - - public static class Client implements HexicalConfig.ClientConfigAccess { - public Client(ForgeConfigSpec.Builder builder) { - - } - } - - public static class Server implements HexicalConfig.ServerConfigAccess { - // costs of actions - private static ForgeConfigSpec.DoubleValue congratsCost; - private static ForgeConfigSpec.DoubleValue signumCost; - - public Server(ForgeConfigSpec.Builder builder) { - builder.translation("text.autoconfig.hexical.option.server.costs").push("costs"); - - congratsCost = builder.translation("text.autoconfig.hexical.option.server.costs.congratsCost").defineInRange("congratsCost", DEFAULT_CONGRATS_COST, DEF_MIN_COST, DEF_MAX_COST); - signumCost = builder.translation("text.autoconfig.hexical.option.server.costs.signumCost").defineInRange("signumCost", DEFAULT_SIGNUM_COST, DEF_MIN_COST, DEF_MAX_COST); - - builder.pop(); - } - - @Override - public int getCongratsCost() { - return (int) (congratsCost.get() * MediaConstants.DUST_UNIT); - } - - @Override - public int getSignumCost() { - return (int) (signumCost.get() * MediaConstants.DUST_UNIT); - } - } + public static void init() { + Pair config = (new ForgeConfigSpec.Builder()).configure(Common::new); + Pair clientConfig = (new ForgeConfigSpec.Builder()).configure(Client::new); + Pair serverConfig = (new ForgeConfigSpec.Builder()).configure(Server::new); + HexicalConfig.setCommon(config.getLeft()); + HexicalConfig.setClient(clientConfig.getLeft()); + HexicalConfig.setServer(serverConfig.getLeft()); + ModLoadingContext mlc = ModLoadingContext.get(); + mlc.registerConfig(ModConfig.Type.COMMON, config.getRight()); + mlc.registerConfig(ModConfig.Type.CLIENT, clientConfig.getRight()); + mlc.registerConfig(ModConfig.Type.SERVER, serverConfig.getRight()); + } + + public static class Common implements HexicalConfig.CommonConfigAccess { + public Common(ForgeConfigSpec.Builder builder) { + + } + } + + public static class Client implements HexicalConfig.ClientConfigAccess { + public Client(ForgeConfigSpec.Builder builder) { + + } + } + + public static class Server implements HexicalConfig.ServerConfigAccess { + private static ForgeConfigSpec.DoubleValue congratsCost; + private static ForgeConfigSpec.DoubleValue signumCost; + + public Server(ForgeConfigSpec.Builder builder) { + builder.translation("text.autoconfig.hexical.option.server.costs").push("costs"); + + congratsCost = builder.translation("text.autoconfig.hexical.option.server.costs.congratsCost").defineInRange("congratsCost", DEFAULT_CONGRATS_COST, DEF_MIN_COST, DEF_MAX_COST); + signumCost = builder.translation("text.autoconfig.hexical.option.server.costs.signumCost").defineInRange("signumCost", DEFAULT_SIGNUM_COST, DEF_MIN_COST, DEF_MAX_COST); + + builder.pop(); + } + + @Override + public int getCongratsCost() { + return (int) (congratsCost.get() * MediaConstants.DUST_UNIT); + } + + @Override + public int getSignumCost() { + return (int) (signumCost.get() * MediaConstants.DUST_UNIT); + } + } } diff --git a/forge/src/main/java/miyucomics/hexical/forge/HexicalForge.java b/forge/src/main/java/miyucomics/hexical/forge/HexicalForge.java index 03d7b935c..48ad4ffe7 100644 --- a/forge/src/main/java/miyucomics/hexical/forge/HexicalForge.java +++ b/forge/src/main/java/miyucomics/hexical/forge/HexicalForge.java @@ -6,17 +6,12 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -/** - * This is your loading entrypoint on forge, in case you need to initialize - * something platform-specific. - */ @Mod(Hexical.MOD_ID) public class HexicalForge { - public HexicalForge() { - // Submit our event bus to let architectury register our content on the right time - IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); - EventBuses.registerModEventBus(Hexical.MOD_ID, bus); - bus.addListener(HexicalClientForge::init); - Hexical.init(); - } -} + public HexicalForge() { + IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); + EventBuses.registerModEventBus(Hexical.MOD_ID, bus); + bus.addListener(HexicalClientForge::init); + Hexical.init(); + } +} \ No newline at end of file diff --git a/forge/src/main/resources/hexical.mixins.json b/forge/src/main/resources/hexical.mixins.json index f1d137749..2debea576 100644 --- a/forge/src/main/resources/hexical.mixins.json +++ b/forge/src/main/resources/hexical.mixins.json @@ -1,13 +1,13 @@ { - "required": true, - "package": "miyucomics.hexical.forge.mixin", - "compatibilityLevel": "JAVA_17", - "minVersion": "0.8", - "client": [ - ], - "mixins": [ - ], - "injectors": { - "defaultRequire": 1 - } + "required": true, + "package": "miyucomics.hexical.forge.mixin", + "compatibilityLevel": "JAVA_17", + "minVersion": "0.8", + "client": [ + ], + "mixins": [ + ], + "injectors": { + "defaultRequire": 1 + } } \ No newline at end of file diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta index e768b4f93..b4da1f049 100644 --- a/forge/src/main/resources/pack.mcmeta +++ b/forge/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { - "pack": { - "description": "Hexical Resources", - "pack_format": 9 - } + "pack": { + "description": "Hexical Resources", + "pack_format": 9 + } }