Created
March 28, 2019 15:15
-
-
Save 25A0/0363e8b7128b365cde65cec609ac6e55 to your computer and use it in GitHub Desktop.
mapcrafter naïve patch for new 1.14 chunk format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/mapcraftercore/mc/chunk.cpp b/src/mapcraftercore/mc/chunk.cpp | |
index 12f318b..6c78f41 100644 | |
--- a/src/mapcraftercore/mc/chunk.cpp | |
+++ b/src/mapcraftercore/mc/chunk.cpp | |
@@ -173,7 +173,7 @@ bool Chunk::readNBT(mc::BlockStateRegistry& block_registry, const char* data, si | |
const nbt::TagString& tag = level.findTag<nbt::TagString>("Status"); | |
// completely generated chunks in fresh 1.13 worlds usually have status 'fullchunk' or 'postprocessed' | |
// however, chunks of converted <1.13 worlds don't use these, but the state 'mobs_spawned' | |
- if (!(tag.payload == "fullchunk" || tag.payload == "postprocessed" || tag.payload == "mobs_spawned")) { | |
+ if (!(tag.payload == "fullchunk" || tag.payload == "full" || tag.payload == "postprocessed" || tag.payload == "mobs_spawned")) { | |
return true; | |
} | |
} | |
@@ -210,8 +210,6 @@ bool Chunk::readNBT(mc::BlockStateRegistry& block_registry, const char* data, si | |
if (!section_tag.hasTag<nbt::TagByte>("Y") | |
// || !section_tag.hasArray<nbt::TagByteArray>("Blocks", 4096) | |
// || !section_tag.hasArray<nbt::TagByteArray>("Data", 2048) | |
- || !section_tag.hasArray<nbt::TagByteArray>("BlockLight", 2048) | |
- || !section_tag.hasArray<nbt::TagByteArray>("SkyLight", 2048) | |
|| !section_tag.hasArray<nbt::TagLongArray>("BlockStates") | |
|| !section_tag.hasTag<nbt::TagList>("Palette")) | |
continue; | |
@@ -248,9 +246,6 @@ bool Chunk::readNBT(mc::BlockStateRegistry& block_registry, const char* data, si | |
palette_lookup[i] = block_registry.getBlockID(block); | |
} | |
- const nbt::TagByteArray& block_light = section_tag.findTag<nbt::TagByteArray>("BlockLight"); | |
- const nbt::TagByteArray& sky_light = section_tag.findTag<nbt::TagByteArray>("SkyLight"); | |
- | |
// create a ChunkSection-object | |
ChunkSection section; | |
section.y = y.payload; | |
@@ -273,8 +268,16 @@ bool Chunk::readNBT(mc::BlockStateRegistry& block_registry, const char* data, si | |
continue; | |
} | |
- std::copy(block_light.payload.begin(), block_light.payload.end(), section.block_light); | |
- std::copy(sky_light.payload.begin(), sky_light.payload.end(), section.sky_light); | |
+ if(section_tag.hasArray<nbt::TagByteArray>("BlockLight", 2048)) | |
+ { | |
+ const nbt::TagByteArray& block_light = section_tag.findTag<nbt::TagByteArray>("BlockLight"); | |
+ std::copy(block_light.payload.begin(), block_light.payload.end(), section.block_light); | |
+ } | |
+ if(section_tag.hasArray<nbt::TagByteArray>("SkyLight", 2048)) | |
+ { | |
+ const nbt::TagByteArray& sky_light = section_tag.findTag<nbt::TagByteArray>("SkyLight"); | |
+ std::copy(sky_light.payload.begin(), sky_light.payload.end(), section.sky_light); | |
+ } | |
// add this section to the section list | |
section_offsets[section.y] = sections.size(); |
It works well. Thank you :)
@ni5am You're welcome!
Note that this patch is now integrated into the 1.13 branch of Mapcrafter (thanks to @miclav). You should simply switch to that branch instead of applying this patch manually :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how do i use this lol