mcstructs-viafier/patch.patch
Nassim Jahnke 433c526e03
Init
2023-12-29 13:36:05 +01:00

127 lines
6.2 KiB
Diff

diff --git a/MCStructs-snbt/src/main/java/net/lenni0451/mcstructs/snbt/impl/v1_12/SNbtDeserializer_v1_12.java b/MCStructs-snbt/src/main/java/net/lenni0451/mcstructs/snbt/impl/v1_12/SNbtDeserializer_v1_12.java
index 8bec86c..3525056 100644
--- a/MCStructs-snbt/src/main/java/net/lenni0451/mcstructs/snbt/impl/v1_12/SNbtDeserializer_v1_12.java
+++ b/MCStructs-snbt/src/main/java/net/lenni0451/mcstructs/snbt/impl/v1_12/SNbtDeserializer_v1_12.java
@@ -95,10 +95,28 @@ public class SNbtDeserializer_v1_12 implements ISNbtDeserializer<CompoundTag> {
reader.read();
reader.skipWhitespaces();
if (!reader.canRead()) throw this.makeException(reader, "Expected value");
- else if (c == 'B') return new ByteArrayTag(this.readPrimitiveList(reader, ByteTag.class, ByteArrayTag.class));
- else if (c == 'L') return new LongArrayTag(this.readPrimitiveList(reader, LongTag.class, LongArrayTag.class));
- else if (c == 'I') return new IntArrayTag(this.readPrimitiveList(reader, IntTag.class, IntArrayTag.class));
- else throw new SNbtDeserializeException("Invalid array type '" + c + "' found");
+ else if (c == 'B') {
+ final ListTag tags = this.readPrimitiveList(reader, ByteTag.class, ByteArrayTag.class);
+ final byte[] array = new byte[tags.size()];
+ for (int i = 0; i < tags.size(); i++) {
+ array[i] = tags.get(i).value();
+ }
+ return new ByteArrayTag(array);
+ } else if (c == 'L') {
+ final ListTag tags = this.readPrimitiveList(reader, LongTag.class, LongArrayTag.class);
+ final long[] array = new long[tags.size()];
+ for (int i = 0; i < tags.size(); i++) {
+ array[i] = tags.get(i).value();
+ }
+ return new LongArrayTag(array);
+ } else if (c == 'I') {
+ final ListTag tags = this.readPrimitiveList(reader, IntTag.class, IntArrayTag.class);
+ final int[] array = new int[tags.size()];
+ for (int i = 0; i < tags.size(); i++) {
+ array[i] = tags.get(i).value();
+ }
+ return new IntArrayTag(array);
+ } else throw new SNbtDeserializeException("Invalid array type '" + c + "' found");
}
protected Tag readValue(final StringReader_v1_12 reader) throws SNbtDeserializeException {
diff --git a/MCStructs-text/src/test/java/net/lenni0451/mcstructs/text/serializer/TextComponentCodecTest.java b/MCStructs-text/src/test/java/net/lenni0451/mcstructs/text/serializer/TextComponentCodecTest.java
index 86e32ec..9eb184c 100644
--- a/MCStructs-text/src/test/java/net/lenni0451/mcstructs/text/serializer/TextComponentCodecTest.java
+++ b/MCStructs-text/src/test/java/net/lenni0451/mcstructs/text/serializer/TextComponentCodecTest.java
@@ -60,9 +60,9 @@ class TextComponentCodecTest {
@Test
void legacyItemDeserialization() throws SNbtSerializeException {
- CompoundTag legacyNbt = new CompoundTag()
- .put("id", "stone")
- .putByte("Count", (byte) 5);
+ CompoundTag legacyNbt = new CompoundTag();
+ legacyNbt.put("id", new StringTag("stone"));
+ legacyNbt.putByte("Count", (byte) 5);
ATextComponent legacyComponent = new StringComponent("test")
.setStyle(new Style()
.setHoverEvent(new TextHoverEvent(HoverEventAction.SHOW_ITEM, new StringComponent(SNbtSerializer.LATEST.serialize(legacyNbt))))
@@ -79,10 +79,10 @@ class TextComponentCodecTest {
@Test
void legacyEntityDeserialization() throws SNbtSerializeException {
UUID randomUUID = UUID.randomUUID();
- CompoundTag legacyNbt = new CompoundTag()
- .put("name", "{\"text\":\"test\"}")
- .put("type", "cow")
- .put("id", randomUUID.toString());
+ CompoundTag legacyNbt = new CompoundTag();
+ legacyNbt.put("name", new StringTag("{\"text\":\"test\"}"));
+ legacyNbt.put("type", new StringTag("cow"));
+ legacyNbt.put("id", new StringTag(randomUUID.toString()));
ATextComponent legacyComponent = new StringComponent("test")
.setStyle(new Style()
.setHoverEvent(new TextHoverEvent(HoverEventAction.SHOW_ENTITY, new StringComponent(SNbtSerializer.LATEST.serialize(legacyNbt))))
diff --git a/build.gradle b/build.gradle
index a8c4682..6929dc4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -48,17 +48,17 @@ subprojects {
publishing {
repositories {
maven {
- name = "reposilite"
- def releasesUrl = "https://maven.lenni0451.net/releases"
- def snapshotsUrl = "https://maven.lenni0451.net/snapshots"
- url = project.maven_version.endsWith("SNAPSHOT") ? snapshotsUrl : releasesUrl
-
- credentials(PasswordCredentials)
+ name = "Via"
+ url = uri("https://repo.viaversion.com/")
+ credentials {
+ username = System.getenv("via_username")
+ password = System.getenv("via_password")
+ }
authentication {
- basic(BasicAuthentication)
+ create(BasicAuthentication)
}
}
- maven {
+ /*maven {
name = "ossrh"
def releasesUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
@@ -68,7 +68,7 @@ subprojects {
authentication {
basic(BasicAuthentication)
}
- }
+ }*/
}
publications {
maven(MavenPublication) {
diff --git a/settings.gradle b/settings.gradle
index 678ff0b..dd6c9cc 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -7,13 +7,6 @@ pluginManagement {
rootProject.name = "MCStructs"
-include(":MCStructs-all")
-include(":MCStructs-data")
-include(":MCStructs-enchantments")
include(":MCStructs-core")
-include(":MCStructs-inventory")
-include(":MCStructs-items")
-include(":MCStructs-nbt")
-include(":MCStructs-recipes")
include(":MCStructs-snbt")
include(":MCStructs-text")