Posted July 4, 20223 yr I've got a problem with schematics generation. So actually after reading .schematic file I'm getting two arrays of bytes (blockid and blockdata). The problem is I dont know how to obtain a BlockState for Level#setBlock (2nd parameter), because I dont know what kind of block I'm going to place, just id and data, and I see no static plug for this parameter (Like BlockState.WHATEVER). So how can I deal with it?
July 4, 20223 yr why do you work with .schematic file? From what I know are .schematic files a community creation and not used by vanilla you can take a look how they are written
July 4, 20223 yr Author actually .schematic file just contains a nbt compound, so why not? I just read it with NbtIo without any problems...
July 4, 20223 yr 17 minutes ago, scaroyder said: I just read it with NbtIo without any problems... how did you write them? Could you please provide more info to NbtIo, i could not find anything about it in www Edited July 4, 20223 yr by Luis_ST
July 4, 20223 yr net.minecraft.nbt.NbtIo - utilities for file <-> nbt Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
July 4, 20223 yr Author 2 minutes ago, Luis_ST said: how did you write them? Could you please provide more info to NbtIo, i could not find anything about it in www have a look at net.minecraft.nbt.NbtIo Im using it to load schematics from files or to send NBT data via packets between server/client. Well, I used to do so in 1.6.4, lol. In those times it was named CompressedStreamTools. The goal im trying to achive is to make schematics import much easier at the server side. I will be able to dl some schematic, put it into server subfolder, and then manipulate with it as I want (dynamically spawn the schematic for some event, or add it to custom worldgen, etc etc etc)
July 4, 20223 yr 49 minutes ago, scaroyder said: have a look at I kind of thought it was a library 1 hour ago, scaroyder said: actually .schematic file just contains a nbt compound, so why not? I just read it with NbtIo without any problems... how did you write the data into the NBT?
July 4, 20223 yr Author 48 minutes ago, Luis_ST said: how did you write the data into the NBT? public static Schematic get(File f) { CompoundTag nbtdata = NbtIo.readCompressed(f); short width = nbtdata.getShort("Width"); short height = nbtdata.getShort("Height"); short length = nbtdata.getShort("Length"); byte[] blocks = nbtdata.getByteArray("Blocks"); byte[] data = nbtdata.getByteArray("Data"); return new Schematic(width, height, length, blocks, data); } public Schematic(short width, short height, short length, byte[] blocks, byte[] data) { this.width = width; this.height = height; this.length = length; this.blocks = blocks; this.data = data; } and then I'm using Schematic instance to build schematic in world by calling Level#setBlock. Well, I supposed to be doing that, but I can't because I dont know where should I get BlockState. In 1.6.4 I were able to place a block in world just with coords, blockID and blockdata.
July 4, 20223 yr ServerLevel.setBlockAndUpdate(). You need the BlockState not the block. If it is standard minecraft format you can use NbtUtils.readBlockState(CompoundTag) If it is a BlockEntity then you also need to do Level.setBlockEntity() again if it is standard nbt you can use BlockEntity.loadStatic() Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
July 4, 20223 yr Author Yep I've digged further and it seems like that .schematic format is completely screwed in latest versions of mc. Need to use sponges .schem Thanks anyway!
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.