From 5c58b0640471c1832c7441a2aba9a8da546ba831 Mon Sep 17 00:00:00 2001 From: KiriCattus Date: Thu, 10 Aug 2023 12:26:47 +0100 Subject: [PATCH] 1.20.1 port work has started... --- build.gradle | 85 ++++++++----------- gradle.properties | 21 +++-- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 34 +++----- .../java/dev/tophatcat/kirislib/KirisLib.java | 5 +- .../dev/tophatcat/kirislib/RegHelpers.java | 24 +++--- src/main/resources/fabric.mod.json | 39 +++++++++ src/main/resources/pack.mcmeta | 6 -- src/main/resources/quilt.mod.json | 48 ----------- 9 files changed, 111 insertions(+), 153 deletions(-) create mode 100644 src/main/resources/fabric.mod.json delete mode 100644 src/main/resources/pack.mcmeta delete mode 100644 src/main/resources/quilt.mod.json diff --git a/build.gradle b/build.gradle index 4d6843b..9ee2968 100644 --- a/build.gradle +++ b/build.gradle @@ -6,10 +6,10 @@ plugins { id 'idea' id 'eclipse' id 'maven-publish' - id 'org.quiltmc.loom' version '1.0.+' + id 'fabric-loom' version '1.3-SNAPSHOT' id 'com.modrinth.minotaur' version '2.+' id 'org.cadixdev.licenser' version '0.6.1' - id 'net.darkhax.curseforgegradle' version '1.0.11' + id 'net.darkhax.curseforgegradle' version '1.1.15' } archivesBaseName = mod_id @@ -29,7 +29,12 @@ repositories { maven { name "Forge Maven" - url 'https://maven.minecraftforge.net/' + url "https://maven.minecraftforge.net/" + } + + maven { + name "NeoForged Maven" + url "https://maven.neoforged.net/" } maven { @@ -58,40 +63,23 @@ repositories { dependencies { //The latest versions are available at https://lambdaurora.dev/tools/import_quilt.html minecraft "com.mojang:minecraft:${minecraft_version}" - //mappings "org.quiltmc:quilt-mappings:${minecraft_version}+build.${quilt_mappings}:intermediary-v2" - mappings loom.layered { - mappings "org.quiltmc:quilt-mappings:${minecraft_version}+build.${quilt_mappings}:intermediary-v2" - officialMojangMappings() - } - - //Quilt Loader - modImplementation "org.quiltmc:quilt-loader:${loader_version}" - - //QSL Library Core - modImplementation "org.quiltmc.qsl:core:${qsl_version}+${minecraft_version}" - - //QSL Module Resource Loader - modImplementation "org.quiltmc.qsl.core:resource_loader:${qsl_version}+${minecraft_version}" - - //Quilted Fabric API - modImplementation "org.quiltmc.quilted-fabric-api:quilted-fabric-api:${quilted_fabric_api_version}-${minecraft_version}" + mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" + modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader_version}" + modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" //Mod Menu dependency modApi "com.terraformersmc:modmenu:${modmenu_version}" - - //Kiri's Lib dependency - //modImplementation "maven.modrinth:kirislib:${kiris_lib_version}" } loom { - if (project.hasProperty('quilt_aws_enabled') && project.findProperty('quilt_aws_enabled').toBoolean()) { + if (project.hasProperty('fabric_aws_enabled') && project.findProperty('fabric_aws_enabled').toBoolean()) { accessWidenerPath = file("src/main/resources/${mod_id}.accessWidener") - project.logger.debug('Quilt Access Widener are enabled for this project!!!') + project.logger.debug('Fabric Access Widener are enabled for this project!!!') } runs { client { client() - setConfigName("Quilt Client") + setConfigName("Fabric Client") ideConfigGenerated(true) runDir("run") @@ -108,14 +96,14 @@ loom { server { server() - setConfigName("Quilt Server") + setConfigName("Fabric Server") ideConfigGenerated(true) runDir("runserver") programArgs('--singleplayer', "yes", '--nogui', "true") } datagenClient { - inherit client + inherit server name "Data Generation" vmArg "-Dfabric-api.datagen" vmArg "-Dfabric-api.datagen.output-dir=${file("src/main/generated")}" @@ -129,7 +117,7 @@ loom { processResources { def buildProps = project.properties.clone() - filesMatching(['quilt.mod.json', 'pack.mcmeta']) { + filesMatching(['fabric.mod.json']) { expand buildProps } } @@ -138,7 +126,7 @@ sourceSets { main { resources { srcDirs += [ - 'src/main/generated' + 'src/main/generated' ] } } @@ -161,19 +149,19 @@ java { // If this mod is going to be a library, then it should also generate Javadocs in order to aid with development. // Uncomment this line to generate them. - // withJavadocJar() + withJavadocJar() } var manifestAttributes = [ - "Specification-Title" : mod_name, - "Specification-Vendor" : mod_author, - "Specification-Version" : "1", // We are version 1 of ourselves - "Implementation-Title" : mod_name, - "Implementation-Version" : project.jar.archiveVersion, - "Implementation-Vendor" : mod_author, - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - "Built-On-Java" : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", - "Build-On-Minecraft" : minecraft_version + "Specification-Title" : mod_name, + "Specification-Vendor" : mod_author, + "Specification-Version" : "1", // We are version 1 of ourselves + "Implementation-Title" : mod_name, + "Implementation-Version" : project.jar.archiveVersion, + "Implementation-Vendor" : mod_author, + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), + "Built-On-Java" : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", + "Build-On-Minecraft" : minecraft_version ] jar { @@ -222,7 +210,7 @@ license { } modrinth { - token = project.MODRINTH_TOKEN ?: "Invalid/No Modrinth API key could be found!"// This is the default. + token = project.MODRINTH_TOKEN ?: "Invalid/No Modrinth API key could be found!" // This is the default. projectId = modrinth_project_id // This can be the project ID or the slug. Either will work! versionNumber = version // You don't need to set this manually. Will fail if Modrinth has this version already versionType = modrinth_release_type // This is the default -- can also be `beta` or `alpha` @@ -230,12 +218,12 @@ modrinth { changelog = rootProject.file("changelog.md").text uploadFile = remapJar // With Loom, this MUST be set to `remapJar` instead of `jar`! gameVersions = [minecraft_version] // Must be an array, even with only one version - loaders = ["quilt"] // Must also be an array - no need to specify this if you're using Loom or ForgeGradle + loaders = ["fabric", "quilt"] // Must also be an array - no need to specify this if you're using Loom or ForgeGradle dependencies { // A special DSL for creating dependencies // scope.type // The scope can be `required`, `optional`, `incompatible`, or `embedded` // The type can either be `project` or `version` - required.project "qsl" // Creates a new required dependency on Fabric API + required.project "fabric-api" // Creates a new required dependency on Fabric API optional.project "modmenu" } syncBodyFrom = rootProject.file("README.md").text @@ -251,14 +239,11 @@ task curseforge(type: TaskPublishCurseForge) { mainFile.displayName = "${archivesBaseName}-${version}" mainFile.releaseType = curseforge_release_type - mainFile.addModLoader("Quilt") + mainFile.addModLoader("Fabric") mainFile.addGameVersion(minecraft_version) mainFile.addJavaVersion(curseforge_java_version) - - //mainFile.addRequirement('fabric-api') //Fabric API slug - //mainFile.addEmbedded('cloth-config') //Cloth Config slug + mainFile.addRequirement('fabric-api') //Fabric API slug mainFile.addOptional('modmenu') - mainFile.addRequirement('kiris-lib') mainFile.changelog = rootProject.file("changelog.md").text mainFile.changelogType = 'text' } @@ -266,6 +251,6 @@ task curseforge(type: TaskPublishCurseForge) { tasks.curseforge.dependsOn tasks.assemble task publishToModHosts { - publishToModHosts.dependsOn tasks.modrinth - publishToModHosts.dependsOn tasks.curseforge + publishToModHosts.dependsOn modrinth + publishToModHosts.dependsOn curseforge } diff --git a/gradle.properties b/gradle.properties index ecb1af8..3f60189 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,8 @@ mod_id=kirislib mod_group=dev.tophatcat.kirislib mod_credits=KiriCattus mod_author=KiriCattus -mod_homepage=https://tophatcat.dev/mods/kiris-lib +mod_homepage=https://modrinth.com/mod/kirislib +mod_cf=https://www.curseforge.com/minecraft/mc-mods/kiris-lib mod_source=https://github.com/tophatcats-mods/kiris-lib mod_issue_tracker=https://github.com/tophatcats-mods/kiris-lib/issues mod_description=A library mod containing things that all my mods use to save time duplicating code that I already have. @@ -13,15 +14,13 @@ mod_license_id=LGPL-2.1 mod_license_long=GNU Lesser General Public License v2.1 mod_discord=https://discord.tophatcat.dev -# Quilt properties -quilt_aws_enabled=false -minecraft_version=1.19.4 -quilt_mappings=5 -loader_version=0.18.5 -# QSL version numer is shared between all the modules. -qsl_version=5.0.0-beta.1 -# Quilted Fabric API -quilted_fabric_api_version=6.0.0-beta.2+0.76.0 +# Fabric properties +fabric_aws_enabled=false +minecraft_version=1.20.1 +yarn_mappings=1.20.1+build.10 +fabric_loader_version=0.14.22 +# Fabric API version numer is shared between all the modules. +fabric_api_version=0.86.1+1.20.1 # Modrinth properties. modrinth_project_id=M6agkTxA @@ -39,4 +38,4 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=true # Dependencies are managed at gradle/libs.versions.toml -modmenu_version=6.1.0-rc.4 +modmenu_version=7.2.1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f398c33..a363877 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index 56e9fa7..71e3dcc 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,26 +1,16 @@ pluginManagement { - repositories { - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } + repositories { + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } - maven { - name = 'Sponge Snapshots' - url = 'https://repo.spongepowered.org/repository/maven-public/' - } + maven { + name = 'Sponge Snapshots' + url = 'https://repo.spongepowered.org/repository/maven-public/' + } - maven { - name = 'Quilt (Release)' - url = 'https://maven.quiltmc.org/repository/release' - } - - maven { - name = 'Quilt (Snapshot)' - url = 'https://maven.quiltmc.org/repository/snapshot' - } - - mavenCentral() - gradlePluginPortal() - } + mavenCentral() + gradlePluginPortal() + } } diff --git a/src/main/java/dev/tophatcat/kirislib/KirisLib.java b/src/main/java/dev/tophatcat/kirislib/KirisLib.java index 20e5790..db446f4 100644 --- a/src/main/java/dev/tophatcat/kirislib/KirisLib.java +++ b/src/main/java/dev/tophatcat/kirislib/KirisLib.java @@ -20,14 +20,13 @@ */ package dev.tophatcat.kirislib; -import org.quiltmc.loader.api.ModContainer; -import org.quiltmc.qsl.base.api.entrypoint.ModInitializer; +import net.fabricmc.api.ModInitializer; public class KirisLib implements ModInitializer { public static final String MOD_ID = "kirislib"; @Override - public void onInitialize(ModContainer mod) { + public void onInitialize() { } } diff --git a/src/main/java/dev/tophatcat/kirislib/RegHelpers.java b/src/main/java/dev/tophatcat/kirislib/RegHelpers.java index 2e2bc8d..464467e 100644 --- a/src/main/java/dev/tophatcat/kirislib/RegHelpers.java +++ b/src/main/java/dev/tophatcat/kirislib/RegHelpers.java @@ -21,11 +21,11 @@ package dev.tophatcat.kirislib; import com.google.common.base.Suppliers; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; +import net.minecraft.block.Block; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.sound.SoundEvent; +import net.minecraft.util.Identifier; import java.util.Map; import java.util.function.Supplier; @@ -38,31 +38,31 @@ public class RegHelpers { public static Supplier createBlock( - ResourceLocation identifier, Supplier block, Map> blockMap) { + Identifier identifier, Supplier block, Map> blockMap) { var wrapped = Suppliers.memoize(block::get); blockMap.put(identifier, wrapped); return wrapped; } public static Supplier createBlockWithItem( - ResourceLocation identifier, Supplier block, Map> blockMap, - Map> itemMap) { + Identifier identifier, Supplier block, Map> blockMap, + Map> itemMap) { var wrapped = Suppliers.memoize(block::get); blockMap.put(identifier, wrapped); createBasicItem(identifier, () -> new BlockItem(wrapped.get(), - new Item.Properties()), itemMap); + new Item.Settings()), itemMap); return wrapped; } public static Supplier createBasicItem( - ResourceLocation identifier, Supplier item, Map> itemMap) { + Identifier identifier, Supplier item, Map> itemMap) { var wrapped = Suppliers.memoize(item::get); itemMap.put(identifier, wrapped); return wrapped; } - public static SoundEvent createSound(ResourceLocation identifier, Map soundMap) { - var soundEvent = SoundEvent.createVariableRangeEvent(identifier); + public static SoundEvent createSound(Identifier identifier, Map soundMap) { + var soundEvent = SoundEvent.of(identifier); soundMap.put(soundEvent, identifier); return soundEvent; } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..5557e19 --- /dev/null +++ b/src/main/resources/fabric.mod.json @@ -0,0 +1,39 @@ +{ + "schemaVersion": 1, + "id": "${mod_id}", + "version": "${version}", + "name": "${mod_name}", + "description": "${mod_description}", + "authors": [ + "${mod_author}" + ], + "contact": { + "homepage": "${mod_homepage}", + "issues": "${mod_issue_tracker}", + "sources": "${mod_source}" + }, + "license": "${mod_license_id}", + "icon": "assets/${mod_id}/icon.png", + "environment": "*", + "entrypoints": { + "main": [ + "dev.tophatcat.kirislib.KirisLib" + ] + }, + "depends": { + "fabricloader": ">=${fabric_loader_version}", + "minecraft": "${minecraft_version}", + "java": ">=17", + "fabric-api": "${fabric_api_version}" + }, + "custom": { + "modmenu": { + "links": { + "modmenu.discord": "${mod_discord}", + "modmenu.modrinth": "${mod_homepage}", + "modmenu.curseforge": "${mod_cf}" + }, + "update_checker": true + } + } +} diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta deleted file mode 100644 index 190a19d..0000000 --- a/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "description": "${mod_description}", - "pack_format": 13 - } -} diff --git a/src/main/resources/quilt.mod.json b/src/main/resources/quilt.mod.json deleted file mode 100644 index 83315ac..0000000 --- a/src/main/resources/quilt.mod.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "schema_version": 1, - "quilt_loader": { - "group": "${group}", - "id": "${mod_id}", - "version": "${version}", - "metadata": { - "name": "${mod_name}", - "description": "${mod_description}", - "contributors": { - "${mod_author}": "Owner" - }, - "contact": { - "homepage": "${mod_homepage}", - "issues": "${mod_issue_tracker}", - "sources": "${mod_source}" - }, - "license": [ - { - "name": "${mod_license_long}", - "id": "${mod_license_id} (Code)", - "url": "${mod_source}/blob/dev/LICENSE.txt", - "description": "License for the code in this mod" - } - ], - "icon": "assets/${mod_id}/icon.png" - }, - "intermediate_mappings": "net.fabricmc:intermediary", - "entrypoints": { - "init": "dev.tophatcat.kirislib.KirisLib" - }, - "depends": [ - { - "id": "quilt_loader", - "versions": ">=${loader_version}" - }, - { - "id": "minecraft", - "versions": ">=${minecraft_version}" - } - ] - }, - "modmenu": { - "links": { - "modmenu.discord": "${mod_discord}" - } - } -}