From 81f9ba7fa1847e0a2f51950008ab47137df60dd1 Mon Sep 17 00:00:00 2001 From: Siphalor Date: Mon, 21 Mar 2022 12:26:02 +0100 Subject: [PATCH 1/5] Some build script improvements --- build.gradle | 67 +++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 38 deletions(-) diff --git a/build.gradle b/build.gradle index 04e111fc..47180d26 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ plugins { - id 'fabric-loom' version '0.9-SNAPSHOT' + id 'fabric-loom' version '0.11-SNAPSHOT' id 'maven-publish' id 'com.matthewprenger.cursegradle' version '1.4.0' - id 'com.modrinth.minotaur' version '1.2.1' + id 'com.modrinth.minotaur' version '2.1.1' id 'org.cadixdev.licenser' version '0.6.1' id "com.github.breadmoirai.github-release" version "2.2.12" } @@ -14,7 +14,7 @@ archivesBaseName = project.archives_base_name version = "${project.mod_version}+mc${project.minecraft_version}" group = project.maven_group -minecraft { +loom { } repositories { @@ -48,7 +48,7 @@ dependencies { transitive false } - modRuntime("com.github.astei:lazydfu:master-SNAPSHOT") + modRuntimeOnly("com.github.astei:lazydfu:master-SNAPSHOT") testmodImplementation sourceSets.main.output } @@ -96,13 +96,9 @@ publishing { publications { mavenJava(MavenPublication) { artifactId = "${project.archives_base_name}-${project.minecraft_major_version}" - // add all the jars that should be included when publishing to maven - artifact(remapJar) { - builtBy remapJar - } - artifact(sourcesJar) { - builtBy remapSourcesJar - } + + from components.java + java.withSourcesJar() } } repositories { @@ -130,9 +126,9 @@ task uploadToModSites { group = "upload" } -if (project.hasProperty("siphalorCurseForgeApi")) { +if (project.hasProperty("curseforgeToken")) { curseforge { - apiKey project.siphalorCurseForgeApi + apiKey project.curseforgeToken project { id = "314633" releaseType = project.mod_release @@ -154,36 +150,31 @@ if (project.hasProperty("siphalorCurseForgeApi")) { uploadToModSites.finalizedBy(tasks.curseforge) } -import com.modrinth.minotaur.TaskModrinthUpload -if (project.hasProperty("siphalorModrinthApi")) { - task modrinth (type: TaskModrinthUpload) { - group = "upload" - dependsOn(build) - - token = project.siphalorModrinthApi - projectId = "18ztUZP5" - versionNumber = version - versionName = "[${project.mod_mc_version_specifier}] ${project.mod_version}" - changelog = getChangelog() - uploadFile = remapJar - versionType = project.mod_release - for (version in ((String) project.mod_mc_versions).split(";")) { - addGameVersion(version) - } - addLoader("fabric") +modrinth { + if (project.hasProperty("modrinthToken")) { + token = project.modrinthToken + uploadToModSites.finalizedBy(tasks.modrinth) } - uploadToModSites.finalizedBy(tasks.modrinth) + + projectId = "18ztUZP5" + versionName = "[$project.mod_mc_version_specifier] $project.mod_version" + versionType = project.mod_release + changelog = project.getChangelog() + uploadFile = remapJar + gameVersions = project.mod_mc_versions.split(";") as List + loaders = ["fabric"] } +tasks.modrinth.group = "upload" -if (project.hasProperty("siphalorGitHubToken")) { +if (project.hasProperty("githubToken")) { githubRelease { - token siphalorGitHubToken - targetCommitish.set("$minecraft_major_version-2.0") - releaseName.set("Version $mod_version") - body.set(getChangelog()) + token githubToken + targetCommitish = "$minecraft_major_version-2.0" + releaseName = "Version $mod_version" + body = getChangelog() releaseAssets remapJar.getArchiveFile() - prerelease.set(mod_release != "release") - overwrite.set(true) + prerelease = mod_release != "release" + overwrite = true } uploadToModSites.finalizedBy(tasks.githubRelease) } From 95dee884710197c82787fff0346617c645c6825e Mon Sep 17 00:00:00 2001 From: Siphalor Date: Mon, 21 Mar 2022 12:57:38 +0100 Subject: [PATCH 2/5] Fix important issue with recipes not being synced correctly - Recipes where only correctly synced when they declared nbt data everywhere or none whats-o-ever --- .../nbtcrafting/mixin/MixinIngredient.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/de/siphalor/nbtcrafting/mixin/MixinIngredient.java b/src/main/java/de/siphalor/nbtcrafting/mixin/MixinIngredient.java index 22318e31..5e3af71d 100644 --- a/src/main/java/de/siphalor/nbtcrafting/mixin/MixinIngredient.java +++ b/src/main/java/de/siphalor/nbtcrafting/mixin/MixinIngredient.java @@ -116,16 +116,16 @@ public void matches(ItemStack stack, CallbackInfoReturnable callbackInf @Inject(method = "write", at = @At("HEAD"), cancellable = true) public void write(PacketByteBuf buf, CallbackInfo callbackInfo) { if (NbtCrafting.isAdvancedIngredientSerializationEnabled()) { - if (advancedEntries != null) { + if (advancedEntries != null && advancedEntries.length != 0) { buf.writeVarInt(advancedEntries.length); for (IngredientEntry entry : advancedEntries) { buf.writeBoolean(entry instanceof IngredientMultiStackEntry); entry.write(buf); } + callbackInfo.cancel(); } else { buf.writeVarInt(0); } - callbackInfo.cancel(); } } @@ -181,15 +181,17 @@ private static void ofStacks(ItemStack[] arr, CallbackInfoReturnable private static void fromPacket(PacketByteBuf buf, CallbackInfoReturnable cir) { if (NbtCrafting.isAdvancedIngredientSerializationEnabled()) { int length = buf.readVarInt(); - ArrayList entries = new ArrayList<>(length); - for (int i = 0; i < length; i++) { - if (buf.readBoolean()) { - entries.add(IngredientMultiStackEntry.read(buf)); - } else { - entries.add(IngredientStackEntry.read(buf)); + if (length != 0) { + ArrayList entries = new ArrayList<>(length); + for (int i = 0; i < length; i++) { + if (buf.readBoolean()) { + entries.add(IngredientMultiStackEntry.read(buf)); + } else { + entries.add(IngredientStackEntry.read(buf)); + } } + cir.setReturnValue(ofAdvancedEntries(entries.stream())); } - cir.setReturnValue(ofAdvancedEntries(entries.stream())); } } From 75a44cb3802aee5d6a555c1168ea34aa69a75e8c Mon Sep 17 00:00:00 2001 From: Siphalor Date: Mon, 21 Mar 2022 13:34:33 +0100 Subject: [PATCH 3/5] Restore network compatibility with before last commit --- .../java/de/siphalor/nbtcrafting/mixin/MixinIngredient.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/siphalor/nbtcrafting/mixin/MixinIngredient.java b/src/main/java/de/siphalor/nbtcrafting/mixin/MixinIngredient.java index 5e3af71d..279b029c 100644 --- a/src/main/java/de/siphalor/nbtcrafting/mixin/MixinIngredient.java +++ b/src/main/java/de/siphalor/nbtcrafting/mixin/MixinIngredient.java @@ -124,7 +124,9 @@ public void write(PacketByteBuf buf, CallbackInfo callbackInfo) { } callbackInfo.cancel(); } else { - buf.writeVarInt(0); + // -1 is used to keep network compatibility with lower versions of Nbt Crafting, + // that used 0 to just indicate no advanced ingredients + buf.writeVarInt(-1); } } } @@ -181,7 +183,7 @@ private static void ofStacks(ItemStack[] arr, CallbackInfoReturnable private static void fromPacket(PacketByteBuf buf, CallbackInfoReturnable cir) { if (NbtCrafting.isAdvancedIngredientSerializationEnabled()) { int length = buf.readVarInt(); - if (length != 0) { + if (length >= 0) { ArrayList entries = new ArrayList<>(length); for (int i = 0; i < length; i++) { if (buf.readBoolean()) { From bf020c9fe5a5c650b6347b76534b54865fe3208e Mon Sep 17 00:00:00 2001 From: Siphalor Date: Mon, 21 Mar 2022 13:41:12 +0100 Subject: [PATCH 4/5] Version 2.1.3 This version brings a single but visually important bug fix: - Fixes a bug where recipes with some ingredients, that have associated NBT data and some that don't, weren't synchronized to the logical client correctly. You'll notice that the recipe book and REI should now be a bit more accurate. --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9edb387c..e6701aad 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,8 +10,8 @@ org.gradle.jvmargs=-Xmx1G loader_version=0.11.6 # Mod Properties - mod_version = 2.1.2 - mod_release = alpha + mod_version = 2.1.3 + mod_release = release mod_mc_version_specifier = 1.15.x mod_mc_versions = 1.15;1.15.1;1.15.2 mod_id = nbtcrafting From 8f9b21121323c102d58d1c99fe5fc38d3e1d5fcc Mon Sep 17 00:00:00 2001 From: Siphalor Date: Mon, 21 Mar 2022 13:44:43 +0100 Subject: [PATCH 5/5] Fix jar artifact --- build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/build.gradle b/build.gradle index 47180d26..1d87ec87 100644 --- a/build.gradle +++ b/build.gradle @@ -88,7 +88,6 @@ task sourcesJar(type: Jar, dependsOn: classes) { jar { from "LICENSE" - archiveClassifier.set("") } // configure the maven publication