From e071ed83fa19a3f8c8e1bfd0982db77bdba98d86 Mon Sep 17 00:00:00 2001 From: "Blue (Lukas Rieger)" Date: Mon, 5 Oct 2020 17:09:28 +0200 Subject: [PATCH] Allow reading chunk-sections that have an integer y tag instead of a byte --- .../de/bluecolored/bluemap/core/mca/ChunkAnvil112.java | 3 ++- .../de/bluecolored/bluemap/core/mca/ChunkAnvil113.java | 9 ++------- .../de/bluecolored/bluemap/core/mca/ChunkAnvil115.java | 9 ++------- .../de/bluecolored/bluemap/core/mca/ChunkAnvil116.java | 9 ++------- 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil112.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil112.java index 6be78d15..6432f0f3 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil112.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil112.java @@ -35,6 +35,7 @@ import de.bluecolored.bluemap.core.world.LightData; import net.querz.nbt.CompoundTag; import net.querz.nbt.ListTag; +import net.querz.nbt.NumberTag; import net.querz.nbt.mca.MCAUtil; public class ChunkAnvil112 extends Chunk { @@ -134,7 +135,7 @@ private class Section { private byte[] data; public Section(CompoundTag sectionData) { - this.sectionY = sectionData.getByte("Y"); + this.sectionY = sectionData.get("Y", NumberTag.class).asInt(); this.blocks = sectionData.getByteArray("Blocks"); this.add = sectionData.getByteArray("Add"); this.blockLight = sectionData.getByteArray("BlockLight"); diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil113.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil113.java index bb20ee98..9937eaf7 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil113.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil113.java @@ -36,12 +36,7 @@ import de.bluecolored.bluemap.core.world.Biome; import de.bluecolored.bluemap.core.world.BlockState; import de.bluecolored.bluemap.core.world.LightData; -import net.querz.nbt.ByteArrayTag; -import net.querz.nbt.CompoundTag; -import net.querz.nbt.IntArrayTag; -import net.querz.nbt.ListTag; -import net.querz.nbt.StringTag; -import net.querz.nbt.Tag; +import net.querz.nbt.*; import net.querz.nbt.mca.MCAUtil; public class ChunkAnvil113 extends Chunk { @@ -147,7 +142,7 @@ private class Section { @SuppressWarnings("unchecked") public Section(CompoundTag sectionData) { - this.sectionY = sectionData.getByte("Y"); + this.sectionY = sectionData.get("Y", NumberTag.class).asInt(); this.blockLight = sectionData.getByteArray("BlockLight"); this.skyLight = sectionData.getByteArray("SkyLight"); this.blocks = sectionData.getLongArray("BlockStates"); diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil115.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil115.java index 5d0605ac..57e2d44f 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil115.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil115.java @@ -36,12 +36,7 @@ import de.bluecolored.bluemap.core.world.Biome; import de.bluecolored.bluemap.core.world.BlockState; import de.bluecolored.bluemap.core.world.LightData; -import net.querz.nbt.ByteArrayTag; -import net.querz.nbt.CompoundTag; -import net.querz.nbt.IntArrayTag; -import net.querz.nbt.ListTag; -import net.querz.nbt.StringTag; -import net.querz.nbt.Tag; +import net.querz.nbt.*; import net.querz.nbt.mca.MCAUtil; public class ChunkAnvil115 extends Chunk { @@ -148,7 +143,7 @@ private class Section { @SuppressWarnings("unchecked") public Section(CompoundTag sectionData) { - this.sectionY = sectionData.getByte("Y"); + this.sectionY = sectionData.get("Y", NumberTag.class).asInt(); this.blockLight = sectionData.getByteArray("BlockLight"); this.skyLight = sectionData.getByteArray("SkyLight"); this.blocks = sectionData.getLongArray("BlockStates"); diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil116.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil116.java index f3031763..f16bb66f 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil116.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil116.java @@ -36,12 +36,7 @@ import de.bluecolored.bluemap.core.world.Biome; import de.bluecolored.bluemap.core.world.BlockState; import de.bluecolored.bluemap.core.world.LightData; -import net.querz.nbt.ByteArrayTag; -import net.querz.nbt.CompoundTag; -import net.querz.nbt.IntArrayTag; -import net.querz.nbt.ListTag; -import net.querz.nbt.StringTag; -import net.querz.nbt.Tag; +import net.querz.nbt.*; import net.querz.nbt.mca.MCAUtil; public class ChunkAnvil116 extends Chunk { @@ -148,7 +143,7 @@ private class Section { @SuppressWarnings("unchecked") public Section(CompoundTag sectionData) { - this.sectionY = sectionData.getByte("Y"); + this.sectionY = sectionData.get("Y", NumberTag.class).asInt(); this.blockLight = sectionData.getByteArray("BlockLight"); this.skyLight = sectionData.getByteArray("SkyLight"); this.blocks = sectionData.getLongArray("BlockStates");