1
0
mirror of https://github.com/Suiranoil/SkinRestorer.git synced 2026-01-16 04:42:12 +00:00

architectury

This commit is contained in:
2024-06-27 17:04:51 +03:00
parent 59ecc5a56a
commit 07e3aaf60c
29 changed files with 280 additions and 67 deletions

View File

@@ -1,28 +1,59 @@
plugins {
id 'fabric-loom' version '1.7-SNAPSHOT'
id "com.modrinth.minotaur" version "2.+"
id 'net.darkhax.curseforgegradle' version '1.1.15'
id 'dev.architectury.loom' version '1.6-SNAPSHOT' apply false
id 'architectury-plugin' version '3.4-SNAPSHOT'
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.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
}
allprojects {
version = "${project.mod_version}+${project.minecraft_version}"
group = project.maven_group
}
subprojects {
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"
}
repositories {
// 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.
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
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")
}
}
processResources {
inputs.property "version", project.version
java {
withSourcesJar()
filesMatching("fabric.mod.json") {
expand "version": project.version
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
jar {
from "$rootProject.projectDir/LICENSE"
}
tasks.withType(JavaCompile).configureEach {
@@ -30,13 +61,6 @@ tasks.withType(JavaCompile).configureEach {
it.options.release.set(21)
}
java {
withSourcesJar()
}
jar {
from "LICENSE"
}
// Adapted from https://raw.githubusercontent.com/TerraformersMC/GradleScripts/2.7/ferry.gradle
@@ -79,36 +103,36 @@ tasks.register('assertNewVersion') {
}
}
tasks.register('publish') {
group = 'publishing'
dependsOn 'assertNewVersion'
dependsOn 'generateChangelog'
dependsOn 'modrinth'
// dependsOn 'curseforge'
doFirst {
println "Last version: $previousTag"
println "Current version: $headTag"
println "Changelog:"
println generateChangelog.changelog
}
}
modrinth {
token = System.getenv('MODRINTH_TOKEN')
projectId = project.modrinth_id
versionName = version_name
versionType = "release"
changelog = generateChangelog.changelog
uploadFile = remapJar
project.modrinth_game_versions.split(',').each {
gameVersions.add(it.trim())
}
project.modrinth_mod_loaders.split(',').each {
loaders.add(it.trim())
}
}
tasks.modrinth.dependsOn('assertNewVersion')
//tasks.register('publish') {
// group = 'publishing'
// dependsOn 'assertNewVersion'
// dependsOn 'generateChangelog'
// dependsOn 'modrinth'
//// dependsOn 'curseforge'
// doFirst {
// println "Last version: $previousTag"
// println "Current version: $headTag"
// println "Changelog:"
// println generateChangelog.changelog
// }
//}
//
//modrinth {
// token = System.getenv('MODRINTH_TOKEN')
// projectId = project.modrinth_id
// versionName = version_name
// versionType = "release"
// changelog = generateChangelog.changelog
// uploadFile = remapJar
// project.modrinth_game_versions.split(',').each {
// gameVersions.add(it.trim())
// }
// project.modrinth_mod_loaders.split(',').each {
// loaders.add(it.trim())
// }
//}
//
//tasks.modrinth.dependsOn('assertNewVersion')
// cannot test it, returns 403 Forbidden. disabled for now
//import net.darkhax.curseforgegradle.TaskPublishCurseForge

10
common/build.gradle Normal file
View 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"
}

View File

@@ -5,7 +5,6 @@ import com.google.gson.JsonObject;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import it.unimi.dsi.fastutil.Pair;
import net.fabricmc.api.DedicatedServerModInitializer;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.network.packet.s2c.play.*;
import net.minecraft.server.MinecraftServer;
@@ -22,18 +21,19 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
public class SkinRestorer implements DedicatedServerModInitializer {
public class SkinRestorer {
private static SkinStorage skinStorage;
public static final String MOD_ID = "skinrestorer";
public static final Logger LOGGER = LoggerFactory.getLogger("SkinRestorer");
public static SkinStorage getSkinStorage() {
return skinStorage;
}
@Override
public void onInitializeServer() {
public static void onInitialize() {
skinStorage = new SkinStorage(new SkinIO(FabricLoader.getInstance().getConfigDir().resolve("skinrestorer")));
}

49
fabric/build.gradle Normal file
View 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
}

View File

@@ -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();
}
}

View File

@@ -16,7 +16,7 @@
"environment": "server",
"entrypoints": {
"server": [
"net.lionarius.skinrestorer.SkinRestorer"
"net.lionarius.skinrestorer.fabric.SkinRestorer"
]
},
"mixins": [
@@ -24,6 +24,6 @@
],
"depends": {
"fabricloader": ">=0.15.10",
"minecraft": "*"
"minecraft": ">=1.21"
}
}

View File

@@ -2,18 +2,25 @@
org.gradle.jvmargs=-Xmx1G
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_version=1.2.6
minecraft_version=1.21
enabled_platforms = fabric,neoforge
maven_group=net.lionarius
archive_name=skin-restorer
archives_name=skin-restorer
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_id=ghrZDhGW
modrinth_game_versions=1.21

56
neoforge/build.gradle Normal file
View 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
}

View File

@@ -0,0 +1 @@
loom.platform = neoforge

View File

@@ -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();
}
}

View 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"

View File

@@ -1,12 +1,24 @@
pluginManagement {
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()
}
}
rootProject.name = "skin-restorer"
include 'common'
include 'fabric'
include 'neoforge'