Skip to content

Commit

Permalink
new: Initial work for multiloader support
Browse files Browse the repository at this point in the history
  • Loading branch information
FlashyReese committed Apr 11, 2024
1 parent bdbd17b commit 7a52034
Show file tree
Hide file tree
Showing 50 changed files with 665 additions and 457 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ gradle-app.setting

# Common working directory
run/
neoforge/runs

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
130 changes: 0 additions & 130 deletions build.gradle

This file was deleted.

79 changes: 79 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@

plugins {
id("java")
}

val MINECRAFT_VERSION by extra { "1.20.4" }
val NEOFORGE_VERSION by extra { "20.4.219" }
val FABRIC_LOADER_VERSION by extra { "0.15.6" }
val FABRIC_API_VERSION by extra { "0.96.0+1.20.4" }

// https://semver.org/
val MOD_VERSION by extra { "2.0.0" }

allprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}

subprojects {
repositories {
maven(url = "https://maven.flashyreese.me/releases")
maven(url = "https://maven.flashyreese.me/snapshots")
}

apply(plugin = "maven-publish")

java.toolchain.languageVersion = JavaLanguageVersion.of(17)


fun createVersionString(): String {
val builder = StringBuilder()

val isReleaseBuild = project.hasProperty("build.release")
val buildId = System.getenv("GITHUB_RUN_NUMBER")

if (isReleaseBuild) {
builder.append(MOD_VERSION)
} else {
builder.append(MOD_VERSION.substringBefore('-'))
builder.append("-snapshot")
}

builder.append("+mc").append(MINECRAFT_VERSION)

if (!isReleaseBuild) {
if (buildId != null) {
builder.append("-build.${buildId}")
} else {
builder.append("-local")
}
}

return builder.toString()
}

tasks.processResources {
filesMatching("META-INF/mods.toml") {
expand(mapOf("version" to createVersionString()))
}
}

version = createVersionString()
group = "me.flashyreese.mods"

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(17)
}

// Disables Gradle's custom module metadata from being published to maven. The
// metadata includes mapped dependencies which are not reasonably consumable by
// other mod developers.
tasks.withType<GenerateModuleMetadata>().configureEach {
enabled = false
}
}
70 changes: 70 additions & 0 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import net.fabricmc.loom.task.AbstractRemapJarTask

plugins {
id("java")
id("idea")
id("fabric-loom") version "1.6.5"
}

val MINECRAFT_VERSION: String by rootProject.extra
val FABRIC_LOADER_VERSION: String by rootProject.extra
val FABRIC_API_VERSION: String by rootProject.extra

dependencies {
"minecraft"(group = "com.mojang", name = "minecraft", version = MINECRAFT_VERSION)
"mappings"(loom.officialMojangMappings())
compileOnly("io.github.llamalad7:mixinextras-common:0.3.5")
annotationProcessor("io.github.llamalad7:mixinextras-common:0.3.5")
compileOnly("net.fabricmc:sponge-mixin:0.13.2+mixin.0.8.5")

implementation(group = "net.caffeinemc.mods", name = "sodium-common-1.20.4", version = "0.6.0-snapshot+mc1.20.4-local")
modImplementation(group = "net.caffeinemc.mods", name = "sodium-common-1.20.4", version = "0.6.0-snapshot+mc1.20.4-local")
//modImplementation(group = "net.caffeinemc.mods", name = "sodium", version = "0.6.0-snapshot+mc1.20.4-local")
}

tasks.withType<AbstractRemapJarTask>().forEach {
it.targetNamespace = "named"
}


loom {
mixin {
defaultRefmapName = "reeses-sodium-options.refmap.json"
}

mods {
val main by creating { // to match the default mod generated for Forge
sourceSet("main")
}
}
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
}
}

repositories {
maven {
name = "FlashyReeseReleases"
url = uri("https://maven.flashyreese.me/releases")
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
maven {
name = "FlashyReeseSnapshots"
url = uri("https://maven.flashyreese.me/snapshots")
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
maven {
url = uri("file://" + System.getenv("local_maven"))
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.flashyreese.mods.reeses_sodium_options.client.gui;

import me.jellysquid.mods.sodium.client.util.Dim2i;
import net.caffeinemc.mods.sodium.client.util.Dim2i;

public interface Dim2iExtended {
void setPoint2i(Point2i point2i);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.flashyreese.mods.reeses_sodium_options.client.gui;

import me.jellysquid.mods.sodium.client.util.Dim2i;
import net.caffeinemc.mods.sodium.client.util.Dim2i;

public interface FlatButtonWidgetExtended {
boolean isLeftAligned();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.flashyreese.mods.reeses_sodium_options.client.gui;

import me.jellysquid.mods.sodium.client.util.Dim2i;
import net.caffeinemc.mods.sodium.client.util.Dim2i;

public interface OptionExtended {
boolean isHighlight();
Expand Down
Loading

0 comments on commit 7a52034

Please sign in to comment.