From d9eacc688f113cfd44439b61d93d2e03600b8e79 Mon Sep 17 00:00:00 2001 From: limepotato Date: Thu, 12 Sep 2024 00:30:05 -0600 Subject: [PATCH] initial --- build.gradle | 56 +++++++------------ gradle.properties | 11 +++- gradle/libs.versions.toml | 22 -------- .../nelle/edible_blocks/EdibleBlocks.java | 11 +--- .../nelle/edible_blocks/mixin/ItemsMixin.java | 1 - src/main/resources/fabric.mod.json | 37 ++++++++++++ src/main/resources/quilt.mod.json | 40 ------------- 7 files changed, 69 insertions(+), 109 deletions(-) delete mode 100644 gradle/libs.versions.toml create mode 100644 src/main/resources/fabric.mod.json delete mode 100644 src/main/resources/quilt.mod.json diff --git a/build.gradle b/build.gradle index f63e43b..d216ab1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,13 @@ plugins { + id 'fabric-loom' version '1.2-SNAPSHOT' id 'maven-publish' - alias libs.plugins.quilt.loom } -base.archivesName = project.archives_base_name -version = "$project.version" +sourceCompatibility = JavaVersion.VERSION_17 +targetCompatibility = JavaVersion.VERSION_17 + +archivesBaseName = project.archives_base_name +version = project.mod_version group = project.maven_group repositories { @@ -15,62 +18,43 @@ repositories { // for more information about repositories. } -// All the dependencies are declared at gradle/libs.version.toml and referenced with "libs." -// See https://docs.gradle.org/current/userguide/platforms.html for information on how version catalogs work. dependencies { - minecraft libs.minecraft - mappings variantOf(libs.quilt.mappings) { classifier 'intermediary-v2' } - // Replace the above line with the block below if you want to use Mojang mappings as your primary mappings, falling back on QM for parameters and Javadocs - /* - mappings loom.layered { - mappings "org.quiltmc:quilt-mappings:${libs.versions.quilt.mappings.get()}:intermediary-v2" - officialMojangMappings() - } - */ - modImplementation libs.quilt.loader + // To change the versions see the gradle.properties file + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - // QSL is not a complete API; You will need Quilted Fabric API to fill in the gaps. - // Quilted Fabric API will automatically pull in the correct QSL version. - modImplementation libs.quilted.fabric.api - // modImplementation libs.bundles.quilted.fabric.api // If you wish to use Fabric API's deprecated modules, you can replace the above line with this one + // Fabric API. This is technically optional, but you probably want it anyway. + modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" } processResources { - inputs.property 'version', version + inputs.property "version", project.version - filesMatching('quilt.mod.json') { - expand 'version': version + filesMatching("fabric.mod.json") { + expand "version": project.version } } tasks.withType(JavaCompile).configureEach { - it.options.encoding = 'UTF-8' // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. it.options.release = 17 } java { - // Still required by IDEs such as Eclipse and Visual Studio Code - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - - // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task if it is present. + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task + // if it is present. // If you remove this line, sources will not be generated. withSourcesJar() - - // 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() } -// If you plan to use a different file for the license, don't forget to change the file name here! jar { - from('LICENSE') { - rename { "${it}_${base.archivesName.get()}" } + from("LICENSE") { + rename { "${it}_${project.archivesBaseName}"} } } -// Configure the maven publication +// configure the maven publication publishing { publications { mavenJava(MavenPublication) { diff --git a/gradle.properties b/gradle.properties index 558c076..ef282bb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,8 +3,15 @@ org.gradle.jvmargs = -Xmx1G org.gradle.parallel = true # Mod Properties -version = 0.2.0 +mod_version = 1.0.0 maven_group = observer.nelle archives_base_name = edible_blocks -# Dependencies are managed at gradle/libs.versions.toml +# Fabric Properties +# check these on https://fabricmc.net/develop +minecraft_version=1.19.3 +yarn_mappings=1.19.3+build.5 +loader_version=0.15.11 + +# Fabric API +fabric_version=0.76.1+1.19.3 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml deleted file mode 100644 index e8fb8ce..0000000 --- a/gradle/libs.versions.toml +++ /dev/null @@ -1,22 +0,0 @@ -[versions] -# The latest versions are available at https://quiltmc.org/en/usage/latest-versionsminecraft -minecraft = "1.20" -quilt_mappings = "1.20+build.4" -quilt_loom = "1.7.4" -quilt_loader = "0.26.3" -quilted_fabric_api = "7.0.1+0.83.0-1.20" - -[libraries] -minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } -quilt_mappings = { module = "org.quiltmc:quilt-mappings", version.ref = "quilt_mappings" } -quilt_loader = { module = "org.quiltmc:quilt-loader", version.ref = "quilt_loader" } - -quilted_fabric_api = { module = "org.quiltmc.quilted-fabric-api:quilted-fabric-api", version.ref = "quilted_fabric_api" } -quilted_fabric_api_deprecated = { module = "org.quiltmc.quilted-fabric-api:quilted-fabric-api-deprecated", version.ref = "quilted_fabric_api" } - -# If you have multiple similar dependencies, you can declare a dependency bundle and reference it on the build script with "libs.bundles.example". -[bundles] -quilted_fabric_api = ["quilted_fabric_api", "quilted_fabric_api_deprecated"] - -[plugins] -quilt_loom = { id = "org.quiltmc.loom", version = "1.2.+" } diff --git a/src/main/java/observer/nelle/edible_blocks/EdibleBlocks.java b/src/main/java/observer/nelle/edible_blocks/EdibleBlocks.java index 7f88fda..c433981 100644 --- a/src/main/java/observer/nelle/edible_blocks/EdibleBlocks.java +++ b/src/main/java/observer/nelle/edible_blocks/EdibleBlocks.java @@ -1,21 +1,16 @@ package observer.nelle.edible_blocks; -import org.quiltmc.loader.api.ModContainer; -import org.quiltmc.qsl.base.api.entrypoint.ModInitializer; +import net.fabricmc.api.ModInitializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class EdibleBlocks implements ModInitializer { public static final String MOD_ID = "edible_blocks"; - - // This logger is used to write text to the console and the log file. - // It is considered best practice to use your mod name as the logger's name. - // That way, it's clear which mod wrote info, warnings, and errors. public static final Logger LOGGER = LoggerFactory.getLogger("Edible Blocks"); @Override - public void onInitialize(ModContainer mod) { - LOGGER.info("Yo Dawg, heard you were hungry for blocks, so I gave you {}.", mod.metadata().name()); + public void onInitialize() { + LOGGER.info("Yo Dawg, heard you were hungry for blocks, so I gave you {}.", MOD_ID); } } diff --git a/src/main/java/observer/nelle/edible_blocks/mixin/ItemsMixin.java b/src/main/java/observer/nelle/edible_blocks/mixin/ItemsMixin.java index 1c71f20..6c0cebf 100644 --- a/src/main/java/observer/nelle/edible_blocks/mixin/ItemsMixin.java +++ b/src/main/java/observer/nelle/edible_blocks/mixin/ItemsMixin.java @@ -5,7 +5,6 @@ import net.minecraft.block.Blocks; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; import net.minecraft.item.FoodComponent; -import net.minecraft.item.FoodComponents; import net.minecraft.item.Item; import net.minecraft.item.Items; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..3b813e6 --- /dev/null +++ b/src/main/resources/fabric.mod.json @@ -0,0 +1,37 @@ +{ + "schemaVersion": 1, + "group": "observer.nelle", + "id": "edible_blocks", + "version": "${version}", + + "name": "Edible Blocks", + "description": "Every block can be consumed", + "authors": [ + "limepotato" + ], + "contact": { + "homepage": "https://modrinth.com/mod/edible-blocks", + "issues": "https://git.nullafati.xyz/limepotato/edibleBlocks/issues", + "sources": "https://git.nullafati.xyz/limepotato/edibleBlocks" + }, + + "license": "CC0-1.0", + "icon": "assets/edible_blocks/icon.png", + + "environment": "*", + "entrypoints": { + "init": [ + "observer.nelle.edible_blocks.EdibleBlocks" + ] + }, + "mixins": [ + "edible_blocks.mixins.json" + ], + + "depends": { + "fabricloader": ">=0.15.11", + "minecraft": [">=1.19.3", "<=1.21.1"], + "fabric": "*", + "java": ">=17" + } +} diff --git a/src/main/resources/quilt.mod.json b/src/main/resources/quilt.mod.json deleted file mode 100644 index b479c42..0000000 --- a/src/main/resources/quilt.mod.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "schema_version": 1, - "quilt_loader": { - "group": "observer.nelle", - "id": "edible_blocks", - "version": "${version}", - "metadata": { - "name": "Edible Blocks", - "description": "Every block can be consumed", - "contributors": { - "LimePotato": "conceptioneer" - }, - "contact": { - "homepage": "https://modrinth.com/mod/edible-blocks", - "issues": "https://git.nullafati.xyz/limepotato/edibleBlocks/issues", - "sources": "https://git.nullafati.xyz/limepotato/edibleBlocks" - }, - "icon": "assets/edible_blocks/icon.png" - }, - "intermediate_mappings": "net.fabricmc:intermediary", - "entrypoints": { - "init": "observer.nelle.edible_blocks.EdibleBlocks" - }, - "depends": [ - { - "id": "quilt_loader", - "versions": { "all": [">=0.26.3"] } - }, - { - "id": "quilted_fabric_api", - "versions": { "all": [">=7.0.1"] } - }, - { - "id": "minecraft", - "versions": { "all": ["1.20-1.20.2", "1.20.4", "1.20.6","1.21-1.21.1"] } - } - ] - }, - "mixin": "edible_blocks.mixins.json" -}