Skip to content

Commit

Permalink
More comfort features
Browse files Browse the repository at this point in the history
  • Loading branch information
miyucomics committed Feb 13, 2024
1 parent 8f078fc commit 42557f4
Show file tree
Hide file tree
Showing 18 changed files with 313 additions and 448 deletions.
46 changes: 19 additions & 27 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -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()
}
2 changes: 1 addition & 1 deletion common/src/main/resources/architectury.common.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"accessWidener": "hexical.accesswidener"
"accessWidener": "hexical.accesswidener"
}
22 changes: 11 additions & 11 deletions common/src/main/resources/assets/hexical/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -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"
}
24 changes: 12 additions & 12 deletions common/src/main/resources/hexical-common.mixins.json
Original file line number Diff line number Diff line change
@@ -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
}
}
175 changes: 59 additions & 116 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -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]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Loading

0 comments on commit 42557f4

Please sign in to comment.