This commit is contained in:
nelle 2024-09-12 00:30:05 -06:00
parent d639d725f0
commit d9eacc688f
7 changed files with 69 additions and 109 deletions

View file

@ -1,10 +1,13 @@
plugins { plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
alias libs.plugins.quilt.loom
} }
base.archivesName = project.archives_base_name sourceCompatibility = JavaVersion.VERSION_17
version = "$project.version" targetCompatibility = JavaVersion.VERSION_17
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group group = project.maven_group
repositories { repositories {
@ -15,62 +18,43 @@ repositories {
// for more information about repositories. // for more information about repositories.
} }
// All the dependencies are declared at gradle/libs.version.toml and referenced with "libs.<id>"
// See https://docs.gradle.org/current/userguide/platforms.html for information on how version catalogs work.
dependencies { dependencies {
minecraft libs.minecraft // To change the versions see the gradle.properties file
mappings variantOf(libs.quilt.mappings) { classifier 'intermediary-v2' } minecraft "com.mojang:minecraft:${project.minecraft_version}"
// 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 "net.fabricmc:yarn:${project.yarn_mappings}:v2"
/* modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
mappings loom.layered {
mappings "org.quiltmc:quilt-mappings:${libs.versions.quilt.mappings.get()}:intermediary-v2"
officialMojangMappings()
}
*/
modImplementation libs.quilt.loader
// QSL is not a complete API; You will need Quilted Fabric API to fill in the gaps. // Fabric API. This is technically optional, but you probably want it anyway.
// Quilted Fabric API will automatically pull in the correct QSL version. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_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
} }
processResources { processResources {
inputs.property 'version', version inputs.property "version", project.version
filesMatching('quilt.mod.json') { filesMatching("fabric.mod.json") {
expand 'version': version expand "version": project.version
} }
} }
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17. // Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17 it.options.release = 17
} }
java { java {
// Still required by IDEs such as Eclipse and Visual Studio Code // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
sourceCompatibility = JavaVersion.VERSION_17 // if it is present.
targetCompatibility = JavaVersion.VERSION_17
// 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. // If you remove this line, sources will not be generated.
withSourcesJar() 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 { jar {
from('LICENSE') { from("LICENSE") {
rename { "${it}_${base.archivesName.get()}" } rename { "${it}_${project.archivesBaseName}"}
} }
} }
// Configure the maven publication // configure the maven publication
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {

View file

@ -3,8 +3,15 @@ org.gradle.jvmargs = -Xmx1G
org.gradle.parallel = true org.gradle.parallel = true
# Mod Properties # Mod Properties
version = 0.2.0 mod_version = 1.0.0
maven_group = observer.nelle maven_group = observer.nelle
archives_base_name = edible_blocks 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

View file

@ -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.+" }

View file

@ -1,21 +1,16 @@
package observer.nelle.edible_blocks; package observer.nelle.edible_blocks;
import org.quiltmc.loader.api.ModContainer; import net.fabricmc.api.ModInitializer;
import org.quiltmc.qsl.base.api.entrypoint.ModInitializer;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class EdibleBlocks implements ModInitializer { public class EdibleBlocks implements ModInitializer {
public static final String MOD_ID = "edible_blocks"; 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"); public static final Logger LOGGER = LoggerFactory.getLogger("Edible Blocks");
@Override @Override
public void onInitialize(ModContainer mod) { public void onInitialize() {
LOGGER.info("Yo Dawg, heard you were hungry for blocks, so I gave you {}.", mod.metadata().name()); LOGGER.info("Yo Dawg, heard you were hungry for blocks, so I gave you {}.", MOD_ID);
} }
} }

View file

@ -5,7 +5,6 @@ import net.minecraft.block.Blocks;
import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects; import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.FoodComponent; import net.minecraft.item.FoodComponent;
import net.minecraft.item.FoodComponents;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;

View file

@ -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"
}
}

View file

@ -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"
}