From 42d7419b4b37cfe5f11e8c93feec93580917a696 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 9 May 2020 13:56:41 +0100 Subject: [PATCH] Fixes #402 - Similar to previous commit. If the chunksection was empty, then __reserved__ was parsed to the clipboard, and then not correctly identified as air - Now assume all __reserved__ is air when writing to clipboards --- .../boydti/fawe/object/clipboard/CPUOptimizedClipboard.java | 6 +++++- .../fawe/object/clipboard/DiskOptimizedClipboard.java | 3 +++ .../fawe/object/clipboard/MemoryOptimizedClipboard.java | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/CPUOptimizedClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/CPUOptimizedClipboard.java index 671e4b351..0a1507828 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/CPUOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/CPUOptimizedClipboard.java @@ -184,7 +184,11 @@ public class CPUOptimizedClipboard extends LinearClipboard { @Override public > boolean setBlock(int index, B block) { - states[index] = block.getOrdinalChar(); + char ordinal = block.getOrdinalChar(); + if (ordinal == 0) { + ordinal = 1; + } + states[index] = ordinal; boolean hasNbt = block instanceof BaseBlock && block.hasNbtData(); if (hasNbt) { setTile(index, block.getNbtData()); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/DiskOptimizedClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/DiskOptimizedClipboard.java index 2b1c613fd..a66f9b84c 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/DiskOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/DiskOptimizedClipboard.java @@ -388,6 +388,9 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable try { int index = HEADER_SIZE + (getIndex(x, y, z) << 1); char ordinal = block.getOrdinalChar(); + if (ordinal == 0) { + ordinal = 1; + } byteBuffer.putChar(index, ordinal); boolean hasNbt = block instanceof BaseBlock && block.hasNbtData(); if (hasNbt) { diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/MemoryOptimizedClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/MemoryOptimizedClipboard.java index 825415310..7a30348e2 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/MemoryOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/MemoryOptimizedClipboard.java @@ -263,6 +263,9 @@ public class MemoryOptimizedClipboard extends LinearClipboard { @Override public > boolean setBlock(int index, B block) { int ordinal = block.getOrdinal(); + if (ordinal == 0) { + ordinal = 1; + } setOrdinal(index, ordinal); boolean hasNbt = block instanceof BaseBlock && block.hasNbtData(); if (hasNbt) {