mirror of
https://github.com/Suiranoil/SkinRestorer.git
synced 2026-01-16 04:42:12 +00:00
architectury
This commit is contained in:
132
build.gradle
132
build.gradle
@@ -1,42 +1,66 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.7-SNAPSHOT'
|
id 'dev.architectury.loom' version '1.6-SNAPSHOT' apply false
|
||||||
id "com.modrinth.minotaur" version "2.+"
|
id 'architectury-plugin' version '3.4-SNAPSHOT'
|
||||||
id 'net.darkhax.curseforgegradle' version '1.1.15'
|
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
||||||
|
// id "com.modrinth.minotaur" version "2.+"
|
||||||
|
// id 'net.darkhax.curseforgegradle' version '1.1.15'
|
||||||
}
|
}
|
||||||
|
|
||||||
version = "${project.mod_version}+${project.minecraft_version}"
|
|
||||||
group = project.maven_group
|
|
||||||
|
|
||||||
ext.version_name = "${project.capitalized_name} ${project.mod_version}"
|
ext.version_name = "${project.capitalized_name} ${project.mod_version}"
|
||||||
ext.headTag = "git describe --tags --abbrev=0 HEAD".execute([], rootProject.projectDir).text.trim()
|
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()
|
ext.previousTag = "git describe --tags --abbrev=0 HEAD^".execute([], rootProject.projectDir).text.trim()
|
||||||
|
|
||||||
dependencies {
|
architectury {
|
||||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
minecraft = project.minecraft_version
|
||||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
|
||||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
allprojects {
|
||||||
inputs.property "version", project.version
|
version = "${project.mod_version}+${project.minecraft_version}"
|
||||||
|
group = project.maven_group
|
||||||
|
}
|
||||||
|
|
||||||
filesMatching("fabric.mod.json") {
|
subprojects {
|
||||||
expand "version": project.version
|
apply plugin: 'dev.architectury.loom'
|
||||||
|
apply plugin: 'architectury-plugin'
|
||||||
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
|
base {
|
||||||
|
// Set up a suffixed format for the mod jar names, e.g. `example-fabric`.
|
||||||
|
archivesName = "$rootProject.archives_name-$project.name"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
repositories {
|
||||||
it.options.encoding = "UTF-8"
|
// Add repositories to retrieve artifacts from in here.
|
||||||
|
// You should only use this when depending on other mods because
|
||||||
|
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
||||||
|
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
||||||
|
// for more information about repositories.
|
||||||
|
}
|
||||||
|
|
||||||
it.options.release.set(21)
|
dependencies {
|
||||||
}
|
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
|
||||||
|
mappings loom.layered {
|
||||||
|
it.mappings("net.fabricmc:yarn:$rootProject.yarn_mappings:v2")
|
||||||
|
it.mappings("dev.architectury:yarn-mappings-patch-neoforge:$rootProject.yarn_mappings_patch_neoforge_version")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
sourceCompatibility = JavaVersion.VERSION_21
|
||||||
from "LICENSE"
|
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
|
// Adapted from https://raw.githubusercontent.com/TerraformersMC/GradleScripts/2.7/ferry.gradle
|
||||||
@@ -79,36 +103,36 @@ tasks.register('assertNewVersion') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register('publish') {
|
//tasks.register('publish') {
|
||||||
group = 'publishing'
|
// group = 'publishing'
|
||||||
dependsOn 'assertNewVersion'
|
// dependsOn 'assertNewVersion'
|
||||||
dependsOn 'generateChangelog'
|
// dependsOn 'generateChangelog'
|
||||||
dependsOn 'modrinth'
|
// dependsOn 'modrinth'
|
||||||
// dependsOn 'curseforge'
|
//// dependsOn 'curseforge'
|
||||||
doFirst {
|
// doFirst {
|
||||||
println "Last version: $previousTag"
|
// println "Last version: $previousTag"
|
||||||
println "Current version: $headTag"
|
// println "Current version: $headTag"
|
||||||
println "Changelog:"
|
// println "Changelog:"
|
||||||
println generateChangelog.changelog
|
// println generateChangelog.changelog
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
modrinth {
|
//modrinth {
|
||||||
token = System.getenv('MODRINTH_TOKEN')
|
// token = System.getenv('MODRINTH_TOKEN')
|
||||||
projectId = project.modrinth_id
|
// projectId = project.modrinth_id
|
||||||
versionName = version_name
|
// versionName = version_name
|
||||||
versionType = "release"
|
// versionType = "release"
|
||||||
changelog = generateChangelog.changelog
|
// changelog = generateChangelog.changelog
|
||||||
uploadFile = remapJar
|
// uploadFile = remapJar
|
||||||
project.modrinth_game_versions.split(',').each {
|
// project.modrinth_game_versions.split(',').each {
|
||||||
gameVersions.add(it.trim())
|
// gameVersions.add(it.trim())
|
||||||
}
|
// }
|
||||||
project.modrinth_mod_loaders.split(',').each {
|
// project.modrinth_mod_loaders.split(',').each {
|
||||||
loaders.add(it.trim())
|
// loaders.add(it.trim())
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
tasks.modrinth.dependsOn('assertNewVersion')
|
//tasks.modrinth.dependsOn('assertNewVersion')
|
||||||
|
|
||||||
// cannot test it, returns 403 Forbidden. disabled for now
|
// cannot test it, returns 403 Forbidden. disabled for now
|
||||||
//import net.darkhax.curseforgegradle.TaskPublishCurseForge
|
//import net.darkhax.curseforgegradle.TaskPublishCurseForge
|
||||||
|
|||||||
10
common/build.gradle
Normal file
10
common/build.gradle
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
architectury {
|
||||||
|
common rootProject.enabled_platforms.split(',')
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// We depend on Fabric Loader here to use the Fabric @Environment annotations,
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
@@ -5,7 +5,6 @@ import com.google.gson.JsonObject;
|
|||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import it.unimi.dsi.fastutil.Pair;
|
import it.unimi.dsi.fastutil.Pair;
|
||||||
import net.fabricmc.api.DedicatedServerModInitializer;
|
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.network.packet.s2c.play.*;
|
import net.minecraft.network.packet.s2c.play.*;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
@@ -22,18 +21,19 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class SkinRestorer implements DedicatedServerModInitializer {
|
public class SkinRestorer {
|
||||||
|
|
||||||
private static SkinStorage skinStorage;
|
private static SkinStorage skinStorage;
|
||||||
|
|
||||||
|
public static final String MOD_ID = "skinrestorer";
|
||||||
|
|
||||||
public static final Logger LOGGER = LoggerFactory.getLogger("SkinRestorer");
|
public static final Logger LOGGER = LoggerFactory.getLogger("SkinRestorer");
|
||||||
|
|
||||||
public static SkinStorage getSkinStorage() {
|
public static SkinStorage getSkinStorage() {
|
||||||
return skinStorage;
|
return skinStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public static void onInitialize() {
|
||||||
public void onInitializeServer() {
|
|
||||||
skinStorage = new SkinStorage(new SkinIO(FabricLoader.getInstance().getConfigDir().resolve("skinrestorer")));
|
skinStorage = new SkinStorage(new SkinIO(FabricLoader.getInstance().getConfigDir().resolve("skinrestorer")));
|
||||||
}
|
}
|
||||||
|
|
||||||
49
fabric/build.gradle
Normal file
49
fabric/build.gradle
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.github.johnrengelman.shadow'
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
|
||||||
|
|
||||||
|
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
||||||
|
shadowBundle project(path: ':common', configuration: 'transformProductionFabric')
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
inputs.property 'version', project.version
|
||||||
|
|
||||||
|
filesMatching('fabric.mod.json') {
|
||||||
|
expand version: project.version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shadowJar {
|
||||||
|
configurations = [project.configurations.shadowBundle]
|
||||||
|
archiveClassifier = 'dev-shadow'
|
||||||
|
}
|
||||||
|
|
||||||
|
remapJar {
|
||||||
|
input.set shadowJar.archiveFile
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package net.lionarius.skinrestorer.fabric;
|
||||||
|
|
||||||
|
import net.fabricmc.api.DedicatedServerModInitializer;
|
||||||
|
import net.lionarius.skinrestorer.SkinRestorer;
|
||||||
|
|
||||||
|
public final class SkinRestorerFabric implements DedicatedServerModInitializer {
|
||||||
|
@Override
|
||||||
|
public void onInitializeServer() {
|
||||||
|
SkinRestorer.onInitialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
"environment": "server",
|
"environment": "server",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"server": [
|
"server": [
|
||||||
"net.lionarius.skinrestorer.SkinRestorer"
|
"net.lionarius.skinrestorer.fabric.SkinRestorer"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
@@ -24,6 +24,6 @@
|
|||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.15.10",
|
"fabricloader": ">=0.15.10",
|
||||||
"minecraft": "*"
|
"minecraft": ">=1.21"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,18 +2,25 @@
|
|||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx1G
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
|
||||||
# Fabric Properties
|
|
||||||
# check these on https://fabricmc.net/versions.html
|
|
||||||
minecraft_version=1.21
|
|
||||||
yarn_mappings=1.21+build.2
|
|
||||||
loader_version=0.15.11
|
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=1.2.6
|
mod_version=1.2.6
|
||||||
|
minecraft_version=1.21
|
||||||
|
enabled_platforms = fabric,neoforge
|
||||||
maven_group=net.lionarius
|
maven_group=net.lionarius
|
||||||
archive_name=skin-restorer
|
archives_name=skin-restorer
|
||||||
capitalized_name=SkinRestorer
|
capitalized_name=SkinRestorer
|
||||||
|
|
||||||
|
# Mappings
|
||||||
|
yarn_mappings=1.21+build.4
|
||||||
|
yarn_mappings_patch_neoforge_version = 1.21+build.4
|
||||||
|
|
||||||
|
# Fabric Properties
|
||||||
|
# check these on https://fabricmc.net/versions.html
|
||||||
|
fabric_loader_version=0.15.11
|
||||||
|
|
||||||
|
# NeoForge
|
||||||
|
neoforge_loader_version=21.0.0-beta
|
||||||
|
|
||||||
# Modrinth
|
# Modrinth
|
||||||
modrinth_id=ghrZDhGW
|
modrinth_id=ghrZDhGW
|
||||||
modrinth_game_versions=1.21
|
modrinth_game_versions=1.21
|
||||||
|
|||||||
56
neoforge/build.gradle
Normal file
56
neoforge/build.gradle
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.github.johnrengelman.shadow'
|
||||||
|
}
|
||||||
|
|
||||||
|
architectury {
|
||||||
|
platformSetupLoomIde()
|
||||||
|
neoForge()
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
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.
|
||||||
|
// Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files.
|
||||||
|
shadowBundle {
|
||||||
|
canBeResolved = true
|
||||||
|
canBeConsumed = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
neoforge/gradle.properties
Normal file
1
neoforge/gradle.properties
Normal file
@@ -0,0 +1 @@
|
|||||||
|
loom.platform = neoforge
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package net.lionarius.skinrestorer.neoforge;
|
||||||
|
|
||||||
|
import net.lionarius.skinrestorer.SkinRestorer;
|
||||||
|
import net.neoforged.fml.common.Mod;
|
||||||
|
|
||||||
|
@Mod(SkinRestorer.MOD_ID)
|
||||||
|
public final class SkinRestorerNeoForge {
|
||||||
|
|
||||||
|
public SkinRestorerNeoForge() {
|
||||||
|
SkinRestorer.onInitialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
31
neoforge/src/main/resources/META-INF/neoforge.mods.toml
Normal file
31
neoforge/src/main/resources/META-INF/neoforge.mods.toml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
modLoader = "javafml"
|
||||||
|
loaderVersion = "[2,)"
|
||||||
|
issueTrackerURL = "https://github.com/Suiranoil/SkinRestorer/issues"
|
||||||
|
license = "MIT"
|
||||||
|
|
||||||
|
[[mods]]
|
||||||
|
modId = "skinrestorer"
|
||||||
|
version = "${version}"
|
||||||
|
displayName = "Skin Restorer"
|
||||||
|
authors = "Lionarius"
|
||||||
|
displayURL = "https://modrinth.com/mod/skinrestorer"
|
||||||
|
description = '''
|
||||||
|
A server-side mod for restoring skins on offline servers.
|
||||||
|
'''
|
||||||
|
|
||||||
|
[[dependencies.skinrestorer]]
|
||||||
|
modId = "neoforge"
|
||||||
|
type = "required"
|
||||||
|
versionRange = "[21.0,)"
|
||||||
|
ordering = "NONE"
|
||||||
|
side = "SERVER"
|
||||||
|
|
||||||
|
[[dependencies.skinrestorer]]
|
||||||
|
modId = "minecraft"
|
||||||
|
type = "required"
|
||||||
|
versionRange = "[1.21,)"
|
||||||
|
ordering = "NONE"
|
||||||
|
side = "SERVER"
|
||||||
|
|
||||||
|
[[mixins]]
|
||||||
|
config = "skinrestorer.mixins.json"
|
||||||
@@ -1,12 +1,24 @@
|
|||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = 'Architectury'
|
||||||
|
url = 'https://maven.architectury.dev/'
|
||||||
|
}
|
||||||
maven {
|
maven {
|
||||||
name = 'Fabric'
|
name = 'Fabric'
|
||||||
url = 'https://maven.fabricmc.net/'
|
url = 'https://maven.fabricmc.net/'
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
name = 'Forge'
|
||||||
|
url = 'https://files.minecraftforge.net/maven/'
|
||||||
|
}
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.name = "skin-restorer"
|
rootProject.name = "skin-restorer"
|
||||||
|
|
||||||
|
include 'common'
|
||||||
|
include 'fabric'
|
||||||
|
include 'neoforge'
|
||||||
|
|||||||
Reference in New Issue
Block a user