Skip to content

Commit

Permalink
1.20.1 port work has started...
Browse files Browse the repository at this point in the history
  • Loading branch information
KiriCattus committed Aug 10, 2023
1 parent 7d54341 commit 5c58b06
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 153 deletions.
85 changes: 35 additions & 50 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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")

Expand All @@ -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")}"
Expand All @@ -129,7 +117,7 @@ loom {
processResources {
def buildProps = project.properties.clone()

filesMatching(['quilt.mod.json', 'pack.mcmeta']) {
filesMatching(['fabric.mod.json']) {
expand buildProps
}
}
Expand All @@ -138,7 +126,7 @@ sourceSets {
main {
resources {
srcDirs += [
'src/main/generated'
'src/main/generated'
]
}
}
Expand All @@ -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 {
Expand Down Expand Up @@ -222,20 +210,20 @@ 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`
versionName = "${archivesBaseName}-${version}"
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
Expand All @@ -251,21 +239,18 @@ 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'
}

tasks.curseforge.dependsOn tasks.assemble

task publishToModHosts {
publishToModHosts.dependsOn tasks.modrinth
publishToModHosts.dependsOn tasks.curseforge
publishToModHosts.dependsOn modrinth
publishToModHosts.dependsOn curseforge
}
21 changes: 10 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,22 @@ 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.
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
Expand All @@ -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
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
34 changes: 12 additions & 22 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -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()
}
}
5 changes: 2 additions & 3 deletions src/main/java/dev/tophatcat/kirislib/KirisLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
}
}
24 changes: 12 additions & 12 deletions src/main/java/dev/tophatcat/kirislib/RegHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,31 +38,31 @@
public class RegHelpers {

public static <T extends Block> Supplier<T> createBlock(
ResourceLocation identifier, Supplier<T> block, Map<ResourceLocation, Supplier<T>> blockMap) {
Identifier identifier, Supplier<T> block, Map<Identifier, Supplier<T>> blockMap) {
var wrapped = Suppliers.memoize(block::get);
blockMap.put(identifier, wrapped);
return wrapped;
}

public static <T extends Block> Supplier<T> createBlockWithItem(
ResourceLocation identifier, Supplier<T> block, Map<ResourceLocation, Supplier<T>> blockMap,
Map<ResourceLocation, Supplier<Item>> itemMap) {
Identifier identifier, Supplier<T> block, Map<Identifier, Supplier<T>> blockMap,
Map<Identifier, Supplier<Item>> 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 <T extends Item> Supplier<T> createBasicItem(
ResourceLocation identifier, Supplier<T> item, Map<ResourceLocation, Supplier<T>> itemMap) {
Identifier identifier, Supplier<T> item, Map<Identifier, Supplier<T>> itemMap) {
var wrapped = Suppliers.memoize(item::get);
itemMap.put(identifier, wrapped);
return wrapped;
}

public static SoundEvent createSound(ResourceLocation identifier, Map<SoundEvent, ResourceLocation> soundMap) {
var soundEvent = SoundEvent.createVariableRangeEvent(identifier);
public static SoundEvent createSound(Identifier identifier, Map<SoundEvent, Identifier> soundMap) {
var soundEvent = SoundEvent.of(identifier);
soundMap.put(soundEvent, identifier);
return soundEvent;
}
Expand Down
39 changes: 39 additions & 0 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
6 changes: 0 additions & 6 deletions src/main/resources/pack.mcmeta

This file was deleted.

Loading

0 comments on commit 5c58b06

Please sign in to comment.