-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from UpcraftLP/multiloader
port to multiloader
- Loading branch information
Showing
31 changed files
with
688 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,32 @@ | ||
name: build | ||
|
||
on: [push, pull_request] | ||
on: | ||
push: | ||
branches: ["*"] | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
- name: set up JDK 21 | ||
uses: actions/setup-java@v3 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '21' | ||
- name: grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
- name: build with gradle | ||
cache: 'gradle' | ||
- name: Validate Gradle wrapper | ||
uses: gradle/actions/wrapper-validation@v4 | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x ./gradlew | ||
- name: Build with Gradle | ||
run: ./gradlew build | ||
- name: capture build artifacts | ||
uses: actions/upload-artifact@v3 | ||
- name: Upload build artifacts | ||
continue-on-error: true | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifacts | ||
path: build/libs/ | ||
name: ${{ github.event.repository.name }}-${{ github.sha }} | ||
path: | | ||
**/build/libs/*.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,115 +1,107 @@ | ||
plugins { | ||
id "fabric-loom" version "1.6+" | ||
id "com.github.johnrengelman.shadow" version "8.1+" | ||
id "maven-publish" | ||
id "me.modmuss50.mod-publish-plugin" version "0.5.2" | ||
id 'idea' | ||
id 'maven-publish' | ||
id 'me.modmuss50.mod-publish-plugin' version '0.7.4' apply false | ||
id 'net.neoforged.moddev' version '2.0.34-beta' apply false | ||
} | ||
|
||
version = project.mod_version | ||
version = "${project.mod_version}+mc${project.minecraft_version}" | ||
group = project.maven_group | ||
|
||
repositories { | ||
maven { url = "https://maven.quiltmc.org/repository/release/" } | ||
maven { url = "https://maven.terraformersmc.com/releases/" } | ||
maven { url = "https://repo.sleeping.town/" } | ||
} | ||
|
||
configurations { | ||
shadow | ||
api.extendsFrom shadow | ||
} | ||
|
||
dependencies { | ||
minecraft("com.mojang:minecraft:${project.minecraft_version}") | ||
mappings("org.quiltmc:quilt-mappings:${project.minecraft_version}+build.${project.quilt_mappings}:intermediary-v2") | ||
modImplementation("net.fabricmc:fabric-loader:${project.loader_version}") | ||
modImplementation("com.terraformersmc:modmenu:${project.modmenu_version}") | ||
|
||
implementation("folk.sisby:kaleido-config:${project.kaleido_config_version}") | ||
include("folk.sisby:kaleido-config:${project.kaleido_config_version}") | ||
|
||
modRuntimeOnly("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}") | ||
} | ||
|
||
processResources { | ||
inputs.property "version", project.version | ||
inputs.property "minecraft_version", project.minecraft_version | ||
inputs.property "loader_version", project.loader_version | ||
filteringCharset "UTF-8" | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand "version": project.version, | ||
"minecraft_version": project.minecraft_version, | ||
"loader_version": project.loader_version | ||
def targetJavaVersion = 21 | ||
|
||
subprojects { | ||
apply plugin: 'java-library' | ||
project.group = rootProject.group | ||
project.version = rootProject.version | ||
|
||
repositories { | ||
maven { url = 'https://maven.quiltmc.org/repository/release' } | ||
maven { url = 'https://maven.terraformersmc.com/releases' } | ||
maven { url = 'https://repo.sleeping.town' } | ||
maven { | ||
name = "ParchmentMC" | ||
url = "https://maven.parchmentmc.org" | ||
content { | ||
includeGroupAndSubgroups "org.parchmentmc" | ||
} | ||
} | ||
} | ||
} | ||
|
||
publishMods { | ||
displayName = "ramel ${project.version}" | ||
file = remapJar.archiveFile | ||
changelog = rootProject.file("CHANGELOG.md").getText() | ||
type = STABLE | ||
|
||
modLoaders.add("quilt") | ||
modLoaders.add("fabric") | ||
|
||
dryRun = !providers.environmentVariable("MODRINTH_TOKEN").isPresent() | ||
|| !providers.environmentVariable("CURSEFORGE_TOKEN").isPresent() | ||
|| property("pub.should_publish") == "false" | ||
dryRun = false | ||
|
||
var mcVersions = [project.minecraft_version] | ||
mcVersions.addAll(property("pub.additional_versions").toString().split(" ").findAll { !it.empty }) | ||
|
||
modrinth { | ||
projectId = "4Uw92C2y" | ||
accessToken = providers.environmentVariable("MODRINTH_TOKEN") | ||
mcVersions.forEach(minecraftVersions::add) | ||
java { | ||
withSourcesJar() | ||
def javaVersion = JavaVersion.toVersion(targetJavaVersion) | ||
if (JavaVersion.current() < javaVersion) { | ||
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) | ||
} | ||
} | ||
|
||
requires("fabric-api") | ||
optional("modmenu") | ||
tasks.withType(JavaCompile).configureEach { | ||
it.options.encoding = 'UTF-8' | ||
it.options.release = targetJavaVersion | ||
} | ||
|
||
curseforge { | ||
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN") | ||
projectId = "877074" | ||
mcVersions.forEach(minecraftVersions::add) | ||
javadoc { | ||
// need this so javadoc doesnt complain about mixin's @reason | ||
options.tags = ['reason'] | ||
} | ||
|
||
clientRequired = true | ||
serverRequired = false | ||
base { | ||
archivesName = "${rootProject.archives_base_name}-${project.name}" | ||
} | ||
|
||
requires("fabric-api") | ||
optional("modmenu") | ||
jar { | ||
from('LICENSE') { | ||
rename { "LICENSE_${rootProject.archives_base_name}"} | ||
} | ||
} | ||
} | ||
|
||
def targetJavaVersion = 17 | ||
tasks.withType(JavaCompile).configureEach { | ||
it.options.encoding = "UTF-8" | ||
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { | ||
it.options.release = targetJavaVersion | ||
sourcesJar { | ||
from('LICENSE') { | ||
rename { "LICENSE_${rootProject.archives_base_name}" } | ||
} | ||
} | ||
} | ||
|
||
java { | ||
def javaVersion = JavaVersion.toVersion(targetJavaVersion) | ||
if (JavaVersion.current() < javaVersion) { | ||
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) | ||
processResources { | ||
filteringCharset 'UTF-8' | ||
|
||
def expandProps = [ | ||
'version': version, | ||
'minecraft_version': project.minecraft_version, | ||
'mod_id': project.mod_id, | ||
'maven_group_id': project.maven_group, | ||
'website_url': project.website_url, | ||
'sources_url': project.sources_url, | ||
'issue_tracker_url': project.issue_tracker_url, | ||
'discord_url': project.discord_url, | ||
|
||
'fabric_loader_version': project.fabric_loader_version, | ||
'neoforge_version': project.neoforge_version, | ||
'java_version': targetJavaVersion | ||
] | ||
|
||
filesMatching(['pack.mcmeta', '*.mod.json', 'META-INF/*mods.toml', '*.mixins.json']) { | ||
expand expandProps | ||
} | ||
inputs.properties(expandProps) | ||
} | ||
archivesBaseName = project.archives_base_name | ||
} | ||
|
||
jar { | ||
from("LICENSE") { | ||
rename { "${it}_${project.archivesBaseName}"} | ||
publishing { | ||
publications { | ||
"mavenJava_${project.name}"(MavenPublication) { | ||
artifactId base.archivesName.get() | ||
from components.java | ||
} | ||
} | ||
} | ||
} | ||
|
||
// configure the maven publication | ||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
allprojects { | ||
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior. | ||
idea { | ||
module { | ||
downloadSources = true | ||
downloadJavadoc = true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
plugins { | ||
id 'net.neoforged.moddev' | ||
} | ||
|
||
dependencies { | ||
compileOnly("org.jetbrains:annotations:${project.jetbrains_annotations_version}") | ||
compileOnly("net.fabricmc:sponge-mixin:${project.mixin_version}") | ||
compileOnly("io.github.llamalad7:mixinextras-common:${project.mixin_extras_version}") | ||
annotationProcessor("io.github.llamalad7:mixinextras-common:${project.mixin_extras_version}") | ||
|
||
compileOnly("folk.sisby:kaleido-config:${project.kaleido_config_version}") | ||
} | ||
|
||
neoForge { | ||
neoFormVersion = project.neoform_version | ||
|
||
parchment { | ||
minecraftVersion = project.parchment_minecraft_version | ||
mappingsVersion = project.parchment_mappings_version | ||
} | ||
} |
12 changes: 4 additions & 8 deletions
12
src/main/java/io/ix0rai/ramel/Config.java → ...c/main/java/dev/rosebud/ramel/Config.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package dev.rosebud.ramel; | ||
|
||
public class Ramel { | ||
|
||
public static final String MODID = "ramel"; | ||
} |
49 changes: 49 additions & 0 deletions
49
common/src/main/java/dev/rosebud/ramel/client/RamelConfigScreen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package dev.rosebud.ramel.client; | ||
|
||
import com.mojang.serialization.Codec; | ||
import folk.sisby.kaleido.lib.quiltconfig.api.Constraint; | ||
import folk.sisby.kaleido.lib.quiltconfig.api.values.TrackedValue; | ||
import dev.rosebud.ramel.Config; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.OptionInstance; | ||
import net.minecraft.client.Options; | ||
import net.minecraft.client.gui.screens.Screen; | ||
import net.minecraft.client.gui.screens.options.OptionsSubScreen; | ||
import net.minecraft.network.chat.Component; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.stream.StreamSupport; | ||
|
||
public class RamelConfigScreen extends OptionsSubScreen { | ||
public RamelConfigScreen(@Nullable Screen parent) { | ||
super(parent, Minecraft.getInstance().options, Component.translatable("ramel.config.title")); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings({"unchecked", "DataFlowIssue"}) | ||
protected void addOptions() { | ||
this.list.addSmall(StreamSupport.stream(Config.INSTANCE.values().spliterator(), false) | ||
.map(value -> createOptional((TrackedValue<Float>) value)).toArray(OptionInstance[]::new)); | ||
} | ||
|
||
private static OptionInstance<Float> createOptional(TrackedValue<Float> trackedValue) { | ||
Constraint.Range<Float> range = null; | ||
|
||
for (Constraint<Float> c : trackedValue.constraints()) { | ||
if (c instanceof Constraint.Range<Float> constraintRange) { | ||
range = constraintRange; | ||
} | ||
} | ||
|
||
String stringValue = trackedValue.key().toString(); | ||
|
||
if (range == null) { | ||
throw new RuntimeException("value must have float range constraint: " + stringValue); | ||
} | ||
|
||
float min = range.min(); | ||
float max = range.max(); | ||
|
||
return new OptionInstance<>("ramel.config." + stringValue, OptionInstance.cachedConstantTooltip(Component.translatable("ramel.config.tooltip." + stringValue)), (text, value) -> Options.genericValueLabel(text, Component.translatable("ramel.config.value." + stringValue, value)), (new OptionInstance.IntRange((int) (min * 10), (int) (max * 10))).xmap((intValue) -> intValue / 10.0F, (doubleValue) -> (int) (doubleValue * 10.0D)), Codec.floatRange(min, max), trackedValue.value(), trackedValue::setValue); | ||
} | ||
} |
Oops, something went wrong.