Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

Commit

Permalink
Merge branch '1.15-2.0' into 1.16-2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Siphalor committed Mar 21, 2022
2 parents 7894dec + 8f9b211 commit a8c284d
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 51 deletions.
68 changes: 29 additions & 39 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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"
}
Expand All @@ -14,7 +14,7 @@ archivesBaseName = project.archives_base_name
version = "${project.mod_version}+mc${project.minecraft_version}"
group = project.maven_group

minecraft {
loom {
}

repositories {
Expand Down Expand Up @@ -50,7 +50,7 @@ dependencies {
transitive false
}

modRuntime("com.github.astei:lazydfu:master-SNAPSHOT")
modRuntimeOnly("com.github.astei:lazydfu:master-SNAPSHOT")

testmodImplementation sourceSets.main.output
}
Expand Down Expand Up @@ -92,21 +92,16 @@ task sourcesJar(type: Jar, dependsOn: classes) {

jar {
from "LICENSE"
archiveClassifier.set("")
}

// configure the maven publication
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 {
Expand Down Expand Up @@ -134,9 +129,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
Expand All @@ -158,36 +153,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<String>
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)
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.16.2+
mod_mc_versions = 1.16.2;1.16.3;1.16.4
mod_id = nbtcrafting
Expand Down
24 changes: 14 additions & 10 deletions src/main/java/de/siphalor/nbtcrafting/mixin/MixinIngredient.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,18 @@ public void matches(ItemStack stack, CallbackInfoReturnable<Boolean> 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);
// -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);
}
callbackInfo.cancel();
}
}

Expand Down Expand Up @@ -181,15 +183,17 @@ private static void ofStacks(ItemStack[] arr, CallbackInfoReturnable<Ingredient>
private static void fromPacket(PacketByteBuf buf, CallbackInfoReturnable<Ingredient> cir) {
if (NbtCrafting.isAdvancedIngredientSerializationEnabled()) {
int length = buf.readVarInt();
ArrayList<IngredientEntry> 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<IngredientEntry> 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()));
}
}

Expand Down

0 comments on commit a8c284d

Please sign in to comment.