Closed Masken8 closed 2 years ago
Can you provide the code you are using to generate that schematic please ?
It looks like the NBT data is wrong, can you please provide me with your version of NBT lib as well please.
import sys
import csv
from PIL import Image, ImageColor
from litemapy import Schematic, Region, BlockState
ColorToBlock = {}
with open("colortoblock.csv", "r") as file:
reader = csv.reader(file)
for row in reader:
rgbStringList = row[0].split(",", 2)
r, g, b = int(rgbStringList[0]), int(rgbStringList[1]), int(rgbStringList[2])
blockId = row[1]
colorTuple = ImageColor.getcolor(f"rgb({r},{g},{b})", "RGB")
ColorToBlock[colorTuple] = BlockState(f"minecraft:{blockId}")
input = sys.argv[1] # bmp
name = sys.argv[2] # litematic name
with Image.open(input) as im:
(width, height) = im.size
reg = Region(0,0,0,width, 1, height)
schem = reg.as_schematic(name="karta")
pix = im.load()
for y in range(0, height):
for x in range(0, width):
if not pix[x,y]:
break
reg.setblock(x, 0, y, ColorToBlock[pix[x,y]])
schem.save(f"{name}.litematic")
I think it's NBT lib 2.0.1
I think it's NBT lib 2.0.1
NBT lib 2.0+ is not backward compatible so it broke litemapy. Try updating litemapy to 0.4.0a0, that should solve it.
I got the same, but I used the example code without modifying.
Versions : Minecraft : 1.17.1 Litematica : 0.0.0-dev.20210906.183617 Litemapy : 0.4.0a0 nbtlib : 2.0.1
Updated, still broken. mapart.zip
After some digging, it seems to be coming down to this issue in NBT lib: https://github.com/vberlier/nbtlib/issues/153 . I will be waiting for them to fix it. In the mean time, installing nbtlib 1.12.1 and litemapy 0.3.1a0 works.
Fixed in f71f46b0b8d40bb981f4dea9fa97bb14ec631014 by forcing a newer version of nbtlib.
I have a script that makes a 128x1x128 plane of
minecraft:cobblestone
withsetblock
and it runs with no errors. When I try to load the .litematic file with Litematica in Minecraft 1.17.1 I get "Exception while trying to read schematic from file".Litematic.zip