-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Need updated examples for block manipulation] How to operate on the data returned by mcpetool db get #26
Comments
Hmm. I haven't touched this in a while. I'm going to guess that the chunk format changed some...I heard that Minecraft now has no height limit, but I'm not sure if that applies to Bedrock or Anvil or both. I'm going to guess that the hight limit change which added a field in the chunk, and that McpeTool is now trying to read NBT from the wrong starting point, and it just happens to decode as a null string with a huge Unicode name. I'm on a long road trip right now, but I'll try to peek into this here and there when I get a chance. |
Oh, never mind! I'm looking at it now and starting to remember some things. The subchunk data is not in NBT format. My JSON converter is only NBT-JSON and JSON-NBT, so it's not valid to use it on the subchunk data. The "edit in a text editor" comment was for the NBT-encoded data. McpeTool is fairly dumb; it's meant as a low-level way to get at the LevelDB data. I used to have an example that would place blocks, but I guess it's outdated from when the format went from 64-block height to 256-block-height (or whatever it was from v0.9 to v1.0). There is some discussion about in-game block coordinates in #20 , and the "PowerShell" example is actually c# from lines 2-27 and then the PowerShell part calls the functions defined there. In both cases this was for the 256-high world format, so I don't know yet how that has changed, but I imagine the subchunk value needs a different calculation now. If I get some time, I'll try to make a better and current example on locating and placing blocks with the current Bedrock subchunk layout. |
Thanks for the quick reply, confirmed a lot of my vague suspicions :) Once I've read (removed) everything but the NBT data I get a clean palette of the expected size, so that's working nicely. I'm using the quick and dirty solution of nbt2json2struct:
But I will work on a nicer way of getting NBT data into structs later. I've started work on a high level API to get/set blocks/chunks by x/y/z coordinates. The relevant stuff is currently in the parse package but it's all called in terrain.NewSubChunk. The end goal is to do some funky stuff with automated world editing using go, and make a nice library to enable it. I'm copying a lot of the parsing stuff from the C# in papyrus-mc/papyruscs. |
Sounds cool. Is the repo private? I can't see it. I had forgotten that I had started to add Lua to this project last year. It literally does nothing useful yet, but I could have sworn I had a Javascript thing that would allow a web browser to view a bunch of stuff from the api, but I can't immediately find that. I don't think it would write anything, but it had some logic not reflected in the current branches. Edit: Ah, the Javascript attempts have tags for their last presence, but they're out of the current branches. All the efforts were pre-v1.0 Bedrock and much has been changed in my code. They might be good to refer to for our future projects...maybe. "abandoning-worlds-api" and "android" tags have the Javascript+html clients in them, in api/ and/or html/. |
Ah I'm not sure why I made the repo private, I made it public. Here's the code for parsing the sub chunk, the NBT function uses nbtToJSON. This is where that code is called. Here's the code for generating the sub chunk key. This is the entrypoint that calls the previous two to get some a sub chunk. |
Hi
I'm stuck on the finer details of changing parameters. I want to be able to determine the block type and state at a specific xyz coordinate then alter that block.
From the readme:
The output I get is below. I understand the nbt data contains a palette of block types/states that is reference by the actual block data. What is the large blob of utf-8 data?
I'm familiar with the bedrock level format docs. Can you provide any guidance on changing parameters?
(my actual use case is creating a high level API to read/write block data in Go but I'm starting here)
Thank you
The text was updated successfully, but these errors were encountered: