mirror of
https://github.com/Suiranoil/SkinRestorer.git
synced 2026-01-16 04:42:12 +00:00
use multiloader template
This commit is contained in:
153
build.gradle
153
build.gradle
@@ -1,149 +1,8 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false
|
// see https://fabricmc.net/develop/ for new versions
|
||||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
id 'fabric-loom' version '1.7-SNAPSHOT' apply false
|
||||||
id "com.github.johnrengelman.shadow" version "8.1.1" apply false
|
// see https://projects.neoforged.net/neoforged/moddevgradle for new versions
|
||||||
id "io.github.pacifistmc.forgix" version "1.2.9"
|
id 'net.neoforged.moddev' version '2.0.1-beta' apply false
|
||||||
id "me.shedaniel.unified-publishing" version "0.1.+"
|
// see https://files.minecraftforge.net/net/minecraftforge/gradle/ForgeGradle/ for new versions
|
||||||
}
|
id 'net.minecraftforge.gradle' version '6.0.26' apply false
|
||||||
|
|
||||||
version = "${project.mod_version}+${project.minecraft_version}"
|
|
||||||
ext.version_name = "${project.capitalized_name} ${project.mod_version}"
|
|
||||||
ext.headTag = "git describe --tags --abbrev=0 HEAD".execute([], rootProject.projectDir).text.trim()
|
|
||||||
ext.previousTag = "git describe --tags --abbrev=0 HEAD^".execute([], rootProject.projectDir).text.trim()
|
|
||||||
|
|
||||||
architectury {
|
|
||||||
minecraft = project.minecraft_version
|
|
||||||
}
|
|
||||||
|
|
||||||
forgix {
|
|
||||||
group = "$project.maven_group.$project.mod_id"
|
|
||||||
// forgix does not append .jar extension for some reason
|
|
||||||
mergedJarName = "${project.archives_name}-${project.version}.jar"
|
|
||||||
outputDir = "build/libs/merged"
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
|
||||||
apply plugin: "java"
|
|
||||||
|
|
||||||
version = rootProject.version
|
|
||||||
group = project.maven_group
|
|
||||||
}
|
|
||||||
|
|
||||||
subprojects {
|
|
||||||
apply plugin: "dev.architectury.loom"
|
|
||||||
apply plugin: "architectury-plugin"
|
|
||||||
|
|
||||||
loom {
|
|
||||||
silentMojangMappingsLicense()
|
|
||||||
}
|
|
||||||
|
|
||||||
base {
|
|
||||||
archivesName = "$rootProject.archives_name-$project.name"
|
|
||||||
}
|
|
||||||
|
|
||||||
build.finalizedBy(mergeJars)
|
|
||||||
assemble.finalizedBy(mergeJars)
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
name = "ParchmentMC"
|
|
||||||
url = "https://maven.parchmentmc.org"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
|
|
||||||
mappings loom.layered {
|
|
||||||
officialMojangMappings()
|
|
||||||
parchment("org.parchmentmc.data:parchment-$rootProject.parchment_minecraft_version:$rootProject.parchment_mappings@zip")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
withSourcesJar()
|
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_21
|
|
||||||
targetCompatibility = JavaVersion.VERSION_21
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
from "$rootProject.projectDir/LICENSE"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
|
||||||
it.options.encoding = "UTF-8"
|
|
||||||
|
|
||||||
it.options.release.set(21)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adapted from https://raw.githubusercontent.com/TerraformersMC/GradleScripts/2.7/ferry.gradle
|
|
||||||
tasks.register("generateChangelog") {
|
|
||||||
ext.changelog = ""
|
|
||||||
|
|
||||||
def lastTag = previousTag
|
|
||||||
def currentTag = headTag
|
|
||||||
|
|
||||||
def changes = new StringBuilder()
|
|
||||||
def commits = "git log --max-count=${project.changelog_max_commit_search} --pretty=format:\"%b\" $lastTag..$currentTag".execute()
|
|
||||||
commits.in.eachLine { line -> // Loops over the lines the git log command returns
|
|
||||||
def processedLine = line.toString()
|
|
||||||
if (processedLine.startsWith("\"")) {
|
|
||||||
processedLine = processedLine.substring(1)
|
|
||||||
}
|
|
||||||
if (processedLine.endsWith("\"")) {
|
|
||||||
processedLine = processedLine.substring(0, processedLine.length() - 1)
|
|
||||||
}
|
|
||||||
if (processedLine.startsWith("- ")) {
|
|
||||||
if (changes.length() == 0) {
|
|
||||||
changes << processedLine
|
|
||||||
} else {
|
|
||||||
changes << "\n$processedLine"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
commits.err.eachLine { line -> println line }
|
|
||||||
commits.waitFor()
|
|
||||||
|
|
||||||
ext.changelog = changes.toString()
|
|
||||||
if (ext.changelog.isEmpty()) {
|
|
||||||
ext.changelog = "No Changelog Available"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register("assertNewVersion") {
|
|
||||||
if (headTag == previousTag) {
|
|
||||||
throw new GradleException("Current version $headTag is the same as previous. Please create a new version tag if you want to proceed.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.publishUnified.dependsOn("assertNewVersion", "build")
|
|
||||||
|
|
||||||
unifiedPublishing {
|
|
||||||
project {
|
|
||||||
displayName = version_name.toString()
|
|
||||||
version = project.version
|
|
||||||
changelog = generateChangelog.changelog
|
|
||||||
releaseType = "release"
|
|
||||||
gameVersions = List.of(project.game_versions.split(","))
|
|
||||||
gameLoaders = List.of(project.mod_loaders.split(","))
|
|
||||||
|
|
||||||
mainPublication.set(file("build/libs/merged/${project.archives_name}-${project.version}.jar"))
|
|
||||||
|
|
||||||
var cfToken = System.getenv("CF_TOKEN")
|
|
||||||
if (cfToken != null) {
|
|
||||||
curseforge {
|
|
||||||
token = cfToken
|
|
||||||
id = project.curseforge_id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var mrToken = System.getenv("MODRINTH_TOKEN")
|
|
||||||
if (mrToken != null) {
|
|
||||||
modrinth {
|
|
||||||
token = mrToken
|
|
||||||
id = project.modrinth_id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
3
buildSrc/build.gradle
Normal file
3
buildSrc/build.gradle
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
plugins {
|
||||||
|
id 'groovy-gradle-plugin'
|
||||||
|
}
|
||||||
104
buildSrc/src/main/groovy/multiloader-common.gradle
Normal file
104
buildSrc/src/main/groovy/multiloader-common.gradle
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java-library'
|
||||||
|
}
|
||||||
|
|
||||||
|
base {
|
||||||
|
archivesName = "${mod_id}-${project.name}"
|
||||||
|
version = "${version}+${minecraft_version}"
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain.languageVersion = JavaLanguageVersion.of(java_version)
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
// https://docs.gradle.org/current/userguide/declaring_repositories.html#declaring_content_exclusively_found_in_one_repository
|
||||||
|
exclusiveContent {
|
||||||
|
forRepository {
|
||||||
|
maven {
|
||||||
|
name = 'Sponge'
|
||||||
|
url = 'https://repo.spongepowered.org/repository/maven-public'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filter { includeGroupAndSubgroups('org.spongepowered') }
|
||||||
|
}
|
||||||
|
exclusiveContent {
|
||||||
|
forRepositories(
|
||||||
|
maven {
|
||||||
|
name = 'ParchmentMC'
|
||||||
|
url = 'https://maven.parchmentmc.org/'
|
||||||
|
},
|
||||||
|
maven {
|
||||||
|
name = "NeoForge"
|
||||||
|
url = 'https://maven.neoforged.net/releases'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
filter { includeGroup('org.parchmentmc.data') }
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = 'BlameJared'
|
||||||
|
url = 'https://maven.blamejared.com'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Declare capabilities on the outgoing configurations.
|
||||||
|
// Read more about capabilities here: https://docs.gradle.org/current/userguide/component_capabilities.html#sec:declaring-additional-capabilities-for-a-local-component
|
||||||
|
['apiElements', 'runtimeElements', 'sourcesElements'].each { variant ->
|
||||||
|
configurations."$variant".outgoing {
|
||||||
|
capability("$group:${base.archivesName.get()}:$version")
|
||||||
|
capability("$group:$mod_id-${project.name}:$version")
|
||||||
|
capability("$group:$mod_id:$version")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourcesJar {
|
||||||
|
from(rootProject.file('LICENSE')) {
|
||||||
|
rename { "${it}_${mod_name}" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
from(rootProject.file('LICENSE')) {
|
||||||
|
rename { "${it}_${mod_name}" }
|
||||||
|
}
|
||||||
|
|
||||||
|
manifest {
|
||||||
|
attributes([
|
||||||
|
'Specification-Title' : mod_name,
|
||||||
|
'Specification-Vendor' : mod_author,
|
||||||
|
'Specification-Version' : project.jar.archiveVersion,
|
||||||
|
'Implementation-Title' : project.name,
|
||||||
|
'Implementation-Version': project.jar.archiveVersion,
|
||||||
|
'Implementation-Vendor' : mod_author,
|
||||||
|
'Built-On-Minecraft' : minecraft_version
|
||||||
|
])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
def expandProps = [
|
||||||
|
'version' : version,
|
||||||
|
'group' : project.group, //Else we target the task's group.
|
||||||
|
'minecraft_version' : minecraft_version,
|
||||||
|
'minecraft_version_range' : minecraft_version_range,
|
||||||
|
'fabric_loader_version' : fabric_loader_version,
|
||||||
|
'mod_name' : mod_name,
|
||||||
|
'mod_author' : mod_author,
|
||||||
|
'mod_id' : mod_id,
|
||||||
|
'license' : license,
|
||||||
|
'description' : project.description,
|
||||||
|
'forge_version' : forge_version,
|
||||||
|
'forge_loader_version_range' : forge_loader_version_range,
|
||||||
|
'neoforge_version' : neoforge_version,
|
||||||
|
'neoforge_loader_version_range': neoforge_loader_version_range,
|
||||||
|
'credits' : credits,
|
||||||
|
'java_version' : java_version
|
||||||
|
]
|
||||||
|
|
||||||
|
filesMatching(['fabric.mod.json', 'META-INF/mods.toml', 'META-INF/neoforge.mods.toml', '*.mixins.json']) {
|
||||||
|
expand expandProps
|
||||||
|
}
|
||||||
|
inputs.properties(expandProps)
|
||||||
|
}
|
||||||
39
buildSrc/src/main/groovy/multiloader-loader.gradle
Normal file
39
buildSrc/src/main/groovy/multiloader-loader.gradle
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
plugins {
|
||||||
|
id 'multiloader-common'
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
commonJava{
|
||||||
|
canBeResolved = true
|
||||||
|
}
|
||||||
|
commonResources{
|
||||||
|
canBeResolved = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly(project(':common')) {
|
||||||
|
capabilities {
|
||||||
|
requireCapability "$group:$mod_id"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
commonJava project(path: ':common', configuration: 'commonJava')
|
||||||
|
commonResources project(path: ':common', configuration: 'commonResources')
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('compileJava', JavaCompile) {
|
||||||
|
dependsOn(configurations.commonJava)
|
||||||
|
source(configurations.commonJava)
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
dependsOn(configurations.commonResources)
|
||||||
|
from(configurations.commonResources)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('sourcesJar', Jar) {
|
||||||
|
dependsOn(configurations.commonJava)
|
||||||
|
from(configurations.commonJava)
|
||||||
|
dependsOn(configurations.commonResources)
|
||||||
|
from(configurations.commonResources)
|
||||||
|
}
|
||||||
@@ -1,10 +1,38 @@
|
|||||||
architectury {
|
plugins {
|
||||||
common rootProject.enabled_platforms.split(",")
|
id 'multiloader-common'
|
||||||
|
id 'net.neoforged.moddev'
|
||||||
|
}
|
||||||
|
|
||||||
|
neoForge {
|
||||||
|
neoFormVersion = neo_form_version
|
||||||
|
// Automatically enable AccessTransformers if the file exists
|
||||||
|
def at = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||||
|
if (at.exists()) {
|
||||||
|
accessTransformers.add(at.absolutePath)
|
||||||
|
}
|
||||||
|
|
||||||
|
parchment {
|
||||||
|
minecraftVersion = parchment_minecraft
|
||||||
|
mappingsVersion = parchment_version
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// We depend on Fabric Loader here to use the Fabric @Environment annotations,
|
compileOnly group: 'org.spongepowered', name: 'mixin', version: '0.8.5'
|
||||||
// which get remapped to the correct annotations on each platform.
|
}
|
||||||
// Do NOT use other classes from Fabric Loader.
|
|
||||||
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
|
configurations {
|
||||||
|
commonJava {
|
||||||
|
canBeResolved = false
|
||||||
|
canBeConsumed = true
|
||||||
|
}
|
||||||
|
commonResources {
|
||||||
|
canBeResolved = false
|
||||||
|
canBeConsumed = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
commonJava sourceSets.main.java.sourceDirectories.singleFile
|
||||||
|
commonResources sourceSets.main.resources.sourceDirectories.singleFile
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "net.lionarius.skinrestorer.mixin",
|
"package": "net.lionarius.skinrestorer.mixin",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
|
"refmap": "${mod_id}.refmap.json",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"PlayerListMixin",
|
"PlayerListMixin",
|
||||||
"ServerLoginPacketListenerImplMixin",
|
"ServerLoginPacketListenerImplMixin",
|
||||||
@@ -1,49 +1,37 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "com.github.johnrengelman.shadow"
|
id 'multiloader-loader'
|
||||||
|
id 'fabric-loom'
|
||||||
}
|
}
|
||||||
|
|
||||||
architectury {
|
|
||||||
platformSetupLoomIde()
|
|
||||||
fabric()
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
common {
|
|
||||||
canBeResolved = true
|
|
||||||
canBeConsumed = false
|
|
||||||
}
|
|
||||||
compileClasspath.extendsFrom common
|
|
||||||
runtimeClasspath.extendsFrom common
|
|
||||||
developmentFabric.extendsFrom common
|
|
||||||
|
|
||||||
// Files in this configuration will be bundled into your mod using the Shadow plugin.
|
|
||||||
// Don"t use the `shadow` configuration from the plugin itself as it"s meant for excluding files.
|
|
||||||
shadowBundle {
|
|
||||||
canBeResolved = true
|
|
||||||
canBeConsumed = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
|
minecraft "com.mojang:minecraft:${minecraft_version}"
|
||||||
|
mappings loom.layered {
|
||||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
officialMojangMappings()
|
||||||
shadowBundle project(path: ":common", configuration: "transformProductionFabric")
|
parchment("org.parchmentmc.data:parchment-${parchment_minecraft}:${parchment_version}@zip")
|
||||||
|
}
|
||||||
|
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
loom {
|
||||||
inputs.property "version", project.version
|
def aw = project(':common').file("src/main/resources/${mod_id}.accesswidener")
|
||||||
|
if (aw.exists()) {
|
||||||
|
accessWidenerPath.set(aw)
|
||||||
|
}
|
||||||
|
mixin {
|
||||||
|
defaultRefmapName.set("${mod_id}.refmap.json")
|
||||||
|
}
|
||||||
|
runs {
|
||||||
|
client {
|
||||||
|
client()
|
||||||
|
setConfigName('Fabric Client')
|
||||||
|
ideConfigGenerated(true)
|
||||||
|
runDir('../run/client')
|
||||||
|
}
|
||||||
|
|
||||||
filesMatching("fabric.mod.json") {
|
server {
|
||||||
expand version: project.version
|
server()
|
||||||
|
setConfigName('Fabric Server')
|
||||||
|
ideConfigGenerated(true)
|
||||||
|
runDir('../run/server')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
configurations = [project.configurations.shadowBundle]
|
|
||||||
archiveClassifier = "dev-shadow"
|
|
||||||
}
|
|
||||||
|
|
||||||
remapJar {
|
|
||||||
input.set shadowJar.archiveFile
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "skinrestorer",
|
"id": "${mod_id}",
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
"name": "SkinRestorer",
|
"name": "${mod_name}",
|
||||||
"description": "A server-side mod for restoring skins on offline servers.",
|
"description": "${description}",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Lionarius"
|
"${mod_author}"
|
||||||
],
|
],
|
||||||
"contact": {
|
"contact": {
|
||||||
"homepage": "https://modrinth.com/mod/skinrestorer",
|
"homepage": "https://www.curseforge.com/minecraft/mc-mods/skinrestorer",
|
||||||
"sources": "https://github.com/Suiranoil/SkinRestorer",
|
"sources": "https://github.com/Suiranoil/SkinRestorer",
|
||||||
"issues": "https://github.com/Suiranoil/SkinRestorer/issues"
|
"issues": "https://github.com/Suiranoil/SkinRestorer/issues"
|
||||||
},
|
},
|
||||||
"icon": "assets/skinrestorer/icon.png",
|
"icon": "assets/${mod_id}/icon.png",
|
||||||
"license": "MIT",
|
"license": "${license}",
|
||||||
"environment": "*",
|
"environment": "*",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"main": [
|
"main": [
|
||||||
@@ -21,11 +21,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"skinrestorer-common.mixins.json",
|
"${mod_id}.mixins.json",
|
||||||
"skinrestorer-fabric.mixins.json"
|
"${mod_id}.fabric.mixins.json"
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.15.10",
|
"fabricloader": ">=${fabric_loader_version}",
|
||||||
"minecraft": ">=1.21"
|
"minecraft": ">=${minecraft_version}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "net.lionarius.skinrestorer.fabric.mixin",
|
"package": "net.lionarius.skinrestorer.fabric.mixin",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
|
"refmap": "${mod_id}.refmap.json",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"CommandsMixin",
|
"CommandsMixin",
|
||||||
"MinecraftServerMixin"
|
"MinecraftServerMixin"
|
||||||
65
forge/build.gradle
Normal file
65
forge/build.gradle
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
plugins {
|
||||||
|
id 'multiloader-loader'
|
||||||
|
id 'idea'
|
||||||
|
id 'eclipse'
|
||||||
|
id 'net.minecraftforge.gradle'
|
||||||
|
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
|
||||||
|
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
||||||
|
}
|
||||||
|
|
||||||
|
mixin {
|
||||||
|
config("${mod_id}.mixins.json")
|
||||||
|
}
|
||||||
|
|
||||||
|
minecraft {
|
||||||
|
mappings channel: 'parchment', version: "${parchment_version}-${parchment_minecraft}"
|
||||||
|
|
||||||
|
copyIdeResources = true //Calls processResources when in dev
|
||||||
|
|
||||||
|
reobf = false // Forge 1.20.6+ uses official mappings at runtime, so we shouldn't reobf from official to SRG
|
||||||
|
|
||||||
|
// Automatically enable forge AccessTransformers if the file exists
|
||||||
|
// This location is hardcoded in Forge and can not be changed.
|
||||||
|
// https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123
|
||||||
|
def at = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||||
|
if (at.exists()) {
|
||||||
|
accessTransformer = at
|
||||||
|
}
|
||||||
|
|
||||||
|
runs {
|
||||||
|
client {
|
||||||
|
workingDirectory file('../run/client')
|
||||||
|
ideaModule "${rootProject.name}.${project.name}.main"
|
||||||
|
taskName 'Client'
|
||||||
|
mods {
|
||||||
|
modClientRun {
|
||||||
|
source sourceSets.main
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
workingDirectory file('../run/server')
|
||||||
|
ideaModule "${rootProject.name}.${project.name}.main"
|
||||||
|
taskName 'Server'
|
||||||
|
mods {
|
||||||
|
modServerRun {
|
||||||
|
source sourceSets.main
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||||
|
|
||||||
|
annotationProcessor('org.spongepowered:mixin:0.8.5-SNAPSHOT:processor')
|
||||||
|
implementation('net.sf.jopt-simple:jopt-simple:5.0.4') { version { strictly '5.0.4' } }
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets.each {
|
||||||
|
def dir = layout.buildDirectory.dir("sourcesSets/$it.name")
|
||||||
|
it.output.resourcesDir = dir
|
||||||
|
it.java.destinationDirectory = dir
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package net.lionarius.skinrestorer.forge;
|
||||||
|
|
||||||
|
import net.lionarius.skinrestorer.SkinRestorer;
|
||||||
|
import net.lionarius.skinrestorer.command.SkinCommand;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||||
|
import net.minecraftforge.event.server.ServerStartedEvent;
|
||||||
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.loading.FMLPaths;
|
||||||
|
|
||||||
|
@Mod(SkinRestorer.MOD_ID)
|
||||||
|
@Mod.EventBusSubscriber(modid = SkinRestorer.MOD_ID)
|
||||||
|
public final class SkinRestorerForge {
|
||||||
|
|
||||||
|
public SkinRestorerForge() {
|
||||||
|
MinecraftForge.EVENT_BUS.register(SkinRestorerForge.class);
|
||||||
|
|
||||||
|
SkinRestorer.onInitialize(FMLPaths.CONFIGDIR.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onCommandRegister(RegisterCommandsEvent event) {
|
||||||
|
SkinCommand.register(event.getDispatcher());
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onServerStarted(ServerStartedEvent event) {
|
||||||
|
SkinRestorer.onServerStarted(event.getServer());
|
||||||
|
}
|
||||||
|
}
|
||||||
27
forge/src/main/resources/META-INF/mods.toml
Normal file
27
forge/src/main/resources/META-INF/mods.toml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
modLoader = "javafml"
|
||||||
|
loaderVersion = "${forge_loader_version_range}"
|
||||||
|
license = "${license}"
|
||||||
|
issueTrackerURL = "https://github.com/Suiranoil/SkinRestorer/issues"
|
||||||
|
|
||||||
|
[[mods]]
|
||||||
|
modId = "${mod_id}"
|
||||||
|
version = "${version}"
|
||||||
|
displayName = "${mod_name}"
|
||||||
|
authors = "${mod_author}"
|
||||||
|
logoFile = "assets/${mod_id}/icon.png"
|
||||||
|
displayURL = "https://www.curseforge.com/minecraft/mc-mods/skinrestorer"
|
||||||
|
description = '''${description}'''
|
||||||
|
|
||||||
|
[[dependencies.${mod_id}]]
|
||||||
|
modId = "forge"
|
||||||
|
mandatory = true
|
||||||
|
versionRange = "[${forge_version},)"
|
||||||
|
ordering = "NONE"
|
||||||
|
side = "BOTH"
|
||||||
|
|
||||||
|
[[dependencies.${mod_id}]]
|
||||||
|
modId = "minecraft"
|
||||||
|
mandatory = true
|
||||||
|
versionRange = "${minecraft_version_range}"
|
||||||
|
ordering = "NONE"
|
||||||
|
side = "BOTH"
|
||||||
@@ -1,33 +1,38 @@
|
|||||||
# Done to increase the memory available to gradle.
|
# Important Notes:
|
||||||
org.gradle.jvmargs=-Xmx1G
|
# Every field you add must be added to the root build.gradle expandProps map.
|
||||||
org.gradle.parallel=true
|
|
||||||
|
|
||||||
# Mod Properties
|
# Project
|
||||||
mod_version=2.0.1
|
version=2.0.1
|
||||||
mod_id=skinrestorer
|
group=net.lionarius.skinrestorer
|
||||||
|
java_version=21
|
||||||
|
|
||||||
|
# Common
|
||||||
minecraft_version=1.21
|
minecraft_version=1.21
|
||||||
enabled_platforms=fabric,neoforge
|
mod_name=SkinRestorer
|
||||||
maven_group=net.lionarius
|
mod_author=Lionarius
|
||||||
archives_name=skin-restorer
|
mod_id=skinrestorer
|
||||||
capitalized_name=SkinRestorer
|
license=MIT
|
||||||
|
credits=
|
||||||
# Mappings
|
description=A server-side mod for managing skins.
|
||||||
#yarn_mappings=1.21+build.4
|
minecraft_version_range=[1.21, 1.22)
|
||||||
#yarn_mappings_patch_neoforge_version=1.21+build.4
|
## This is the version of minecraft that the 'common' project uses, you can find a list of all versions here
|
||||||
parchment_minecraft_version=1.21
|
## https://projects.neoforged.net/neoforged/neoform
|
||||||
parchment_mappings=2024.06.23
|
neo_form_version=1.21-20240613.152323
|
||||||
|
# The version of ParchmentMC that is used, see https://parchmentmc.org/docs/getting-started#choose-a-version for new versions
|
||||||
|
parchment_minecraft=1.21
|
||||||
|
parchment_version=2024.07.28
|
||||||
|
|
||||||
# Fabric
|
# Fabric
|
||||||
fabric_loader_version=0.15.11
|
fabric_loader_version=0.15.11
|
||||||
|
|
||||||
|
# Forge
|
||||||
|
forge_version=51.0.0
|
||||||
|
forge_loader_version_range=[51,)
|
||||||
|
|
||||||
# NeoForge
|
# NeoForge
|
||||||
neoforge_loader_version=21.0.0-beta
|
neoforge_version=21.0.0-beta
|
||||||
|
neoforge_loader_version_range=[4,)
|
||||||
|
|
||||||
# Publish
|
# Gradle
|
||||||
modrinth_id=ghrZDhGW
|
org.gradle.jvmargs=-Xmx3G
|
||||||
curseforge_id=443823
|
org.gradle.daemon=false
|
||||||
game_versions=1.21
|
|
||||||
mod_loaders=fabric,neoforge
|
|
||||||
|
|
||||||
# Changelog Options
|
|
||||||
changelog_max_commit_search=200
|
|
||||||
|
|||||||
@@ -1,56 +1,41 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "com.github.johnrengelman.shadow"
|
id 'multiloader-loader'
|
||||||
|
id 'net.neoforged.moddev'
|
||||||
}
|
}
|
||||||
|
|
||||||
architectury {
|
neoForge {
|
||||||
platformSetupLoomIde()
|
version = neoforge_version
|
||||||
neoForge()
|
// Automatically enable neoforge AccessTransformers if the file exists
|
||||||
}
|
def at = project(':common').file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||||
|
if (at.exists()) {
|
||||||
configurations {
|
accessTransformers.add(at.absolutePath)
|
||||||
common {
|
|
||||||
canBeResolved = true
|
|
||||||
canBeConsumed = false
|
|
||||||
}
|
}
|
||||||
compileClasspath.extendsFrom common
|
|
||||||
runtimeClasspath.extendsFrom common
|
|
||||||
developmentNeoForge.extendsFrom common
|
|
||||||
|
|
||||||
// Files in this configuration will be bundled into your mod using the Shadow plugin.
|
parchment {
|
||||||
// Don"t use the `shadow` configuration from the plugin itself as it"s meant for excluding files.
|
minecraftVersion = parchment_minecraft
|
||||||
shadowBundle {
|
mappingsVersion = parchment_version
|
||||||
canBeResolved = true
|
}
|
||||||
canBeConsumed = false
|
|
||||||
|
runs {
|
||||||
|
configureEach {
|
||||||
|
systemProperty('neoforge.enabledGameTestNamespaces', mod_id)
|
||||||
|
ideName = "NeoForge ${it.name.capitalize()} (${project.path})" // Unify the run config names with fabric
|
||||||
|
}
|
||||||
|
|
||||||
|
client {
|
||||||
|
client()
|
||||||
|
gameDirectory = file('../run/client')
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
server()
|
||||||
|
gameDirectory = file('../run/server')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mods {
|
||||||
|
"${mod_id}" {
|
||||||
|
sourceSet sourceSets.main
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
name = "NeoForged"
|
|
||||||
url = "https://maven.neoforged.net/releases"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
neoForge "net.neoforged:neoforge:$rootProject.neoforge_loader_version"
|
|
||||||
|
|
||||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
|
||||||
shadowBundle project(path: ":common", configuration: "transformProductionNeoForge")
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
inputs.property "version", project.version
|
|
||||||
|
|
||||||
filesMatching("META-INF/neoforge.mods.toml") {
|
|
||||||
expand version: project.version
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
configurations = [project.configurations.shadowBundle]
|
|
||||||
archiveClassifier = "dev-shadow"
|
|
||||||
}
|
|
||||||
|
|
||||||
remapJar {
|
|
||||||
input.set shadowJar.archiveFile
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
loom.platform = neoforge
|
|
||||||
@@ -1,32 +1,30 @@
|
|||||||
modLoader = "javafml"
|
modLoader = "javafml"
|
||||||
loaderVersion = "[2,)"
|
loaderVersion = "${neoforge_loader_version_range}"
|
||||||
|
license = "${license}"
|
||||||
issueTrackerURL = "https://github.com/Suiranoil/SkinRestorer/issues"
|
issueTrackerURL = "https://github.com/Suiranoil/SkinRestorer/issues"
|
||||||
license = "MIT"
|
|
||||||
|
|
||||||
[[mods]]
|
[[mods]]
|
||||||
modId = "skinrestorer"
|
modId = "${mod_id}"
|
||||||
version = "${version}"
|
version = "${version}"
|
||||||
displayName = "SkinRestorer"
|
displayName = "${mod_name}"
|
||||||
authors = "Lionarius"
|
authors = "${mod_author}"
|
||||||
logoFile = "assets/skinrestorer/icon.png"
|
logoFile = "assets/${mod_id}/icon.png"
|
||||||
displayURL = "https://modrinth.com/mod/skinrestorer"
|
displayURL = "https://www.curseforge.com/minecraft/mc-mods/skinrestorer"
|
||||||
description = '''
|
description = "${description}"
|
||||||
A server-side mod for restoring skins on offline servers.
|
|
||||||
'''
|
|
||||||
|
|
||||||
[[dependencies.skinrestorer]]
|
|
||||||
modId = "neoforge"
|
|
||||||
type = "required"
|
|
||||||
versionRange = "[21.0.0-beta,)"
|
|
||||||
ordering = "NONE"
|
|
||||||
side = "BOTH"
|
|
||||||
|
|
||||||
[[dependencies.skinrestorer]]
|
|
||||||
modId = "minecraft"
|
|
||||||
type = "required"
|
|
||||||
versionRange = "[1.21,)"
|
|
||||||
ordering = "NONE"
|
|
||||||
side = "BOTH"
|
|
||||||
|
|
||||||
[[mixins]]
|
[[mixins]]
|
||||||
config = "skinrestorer-common.mixins.json"
|
config = "${mod_id}.mixins.json"
|
||||||
|
|
||||||
|
[[dependencies.${mod_id}]]
|
||||||
|
modId = "neoforge"
|
||||||
|
type = "required"
|
||||||
|
versionRange = "[${neoforge_version},)"
|
||||||
|
ordering = "NONE"
|
||||||
|
side = "BOTH"
|
||||||
|
|
||||||
|
[[dependencies.${mod_id}]]
|
||||||
|
modId = "minecraft"
|
||||||
|
type = "required"
|
||||||
|
versionRange = "${minecraft_version_range}"
|
||||||
|
ordering = "NONE"
|
||||||
|
side = "BOTH"
|
||||||
|
|||||||
@@ -1,24 +1,62 @@
|
|||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
|
||||||
name = "Architectury"
|
|
||||||
url = "https://maven.architectury.dev/"
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name = "Fabric"
|
|
||||||
url = "https://maven.fabricmc.net/"
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name = "Forge"
|
|
||||||
url = "https://files.minecraftforge.net/maven/"
|
|
||||||
}
|
|
||||||
mavenCentral()
|
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
|
mavenCentral()
|
||||||
|
exclusiveContent {
|
||||||
|
forRepository {
|
||||||
|
maven {
|
||||||
|
name = 'Fabric'
|
||||||
|
url = uri('https://maven.fabricmc.net')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filter {
|
||||||
|
includeGroup('net.fabricmc')
|
||||||
|
includeGroup('fabric-loom')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exclusiveContent {
|
||||||
|
forRepository {
|
||||||
|
maven {
|
||||||
|
name = 'Forge'
|
||||||
|
url = uri("https://maven.minecraftforge.net")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filter {
|
||||||
|
includeGroupAndSubgroups("net.minecraftforge")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exclusiveContent {
|
||||||
|
forRepository {
|
||||||
|
maven {
|
||||||
|
name = 'Sponge Snapshots'
|
||||||
|
url = uri("https://repo.spongepowered.org/repository/maven-public")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filter {
|
||||||
|
includeGroupAndSubgroups("org.spongepowered")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exclusiveContent {
|
||||||
|
forRepository {
|
||||||
|
maven {
|
||||||
|
name = 'ParchmentMC'
|
||||||
|
url = uri("https://maven.parchmentmc.org")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filter {
|
||||||
|
includeGroupAndSubgroups("org.parchmentmc")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.name = "skin-restorer"
|
plugins {
|
||||||
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
|
||||||
|
}
|
||||||
|
|
||||||
include "common"
|
// This should match the folder name of the project, or else IDEA may complain (see https://youtrack.jetbrains.com/issue/IDEA-317606)
|
||||||
include "fabric"
|
rootProject.name = 'skin-restorer'
|
||||||
include "neoforge"
|
include('common')
|
||||||
|
include('fabric')
|
||||||
|
include('forge')
|
||||||
|
include('neoforge')
|
||||||
|
|||||||
Reference in New Issue
Block a user