fix: add palette tag during schematic serialization
This commit is contained in:
parent
7c61acbf01
commit
f28ad3c1ec
3 changed files with 13 additions and 3 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -5,4 +5,8 @@ build/
|
|||
*.ipr
|
||||
*.iws
|
||||
forge-*-changelog.txt
|
||||
out/
|
||||
out/
|
||||
bin/
|
||||
.classpath
|
||||
.project
|
||||
.settings
|
||||
|
|
|
@ -27,8 +27,8 @@ minecraft {
|
|||
runDir = "eclipse"
|
||||
}
|
||||
|
||||
targetCompatibility = '1.6'
|
||||
sourceCompatibility = '1.6'
|
||||
targetCompatibility = '1.8'
|
||||
sourceCompatibility = '1.8'
|
||||
|
||||
processResources
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -331,6 +332,11 @@ public class Schematic {
|
|||
short[] blockIds = new short[blocks.length];
|
||||
reduceToPalette(blocks, blockPalette, blockIds);
|
||||
|
||||
NBTTagList paletteNBT = new NBTTagList();
|
||||
blockPalette.stream().map(NBTTagString::new).forEach(paletteNBT::appendTag);
|
||||
|
||||
schematicTag.setTag("Palette", paletteNBT);
|
||||
|
||||
byte[] lowBits = new byte[blocks.length];
|
||||
byte[] highBits = new byte[(blocks.length >> 1) + (blocks.length & 1)];
|
||||
boolean hasExtendedIDs = encodeBlockIDs(blockIds, lowBits, highBits);
|
||||
|
|
Loading…
Reference in a new issue