From a9c89616b141c577c80d8494733224fddf2e38fe Mon Sep 17 00:00:00 2001 From: Pierre Maurice Schwang Date: Sun, 9 Jun 2024 19:03:46 +0200 Subject: [PATCH] fix: only write into palette once, write into data as varint --- .../extent/clipboard/io/FastSchematicWriterV3.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicWriterV3.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicWriterV3.java index 0299d8628..63c80331e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicWriterV3.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicWriterV3.java @@ -132,12 +132,16 @@ public class FastSchematicWriterV3 implements ClipboardWriter { char value = palette[ordinal]; if (value == Character.MIN_VALUE) { palette[ordinal] = value = (char) ++index; + // Write to palette + blocks.writeNamedTag(baseBlock.getAsString(), value); } - // Write to palette - blocks.writeNamedTag(baseBlock.getAsString(), value); // Write to cache for "Data" Tag - dataBuf.write(value); + + while ((value & -128) != 0) { + dataBuf.write(value & 127 | 128); + value >>>= 7; + } CompoundBinaryTag tag; if ((tag = baseBlock.getNbt()) != null) {