Comments (4)
The NBT library currently only features low-level NBT read and write functions, while the mid-level data-file functions are missing. The block_analysis indeed only works on the old file format. I hoped to find some code at Fenixin's projects, but couldn't find it right away.
My suggestion is to start with the mob_analysis.py code in the examples folder, and work from there.
For starters, print the contents of the chunk. Thus in the main() routine:
print("---------------")
for chunk in world.iter_nbt():
print(chunk["Level"]["Sections"].pretty_tree())
This prints a lot of information. Along with http://minecraft.gamepedia.com/Chunk_format you should be able to figure out what data you want.
You need the "Block" tags, and optionally the "Add" tag and "Data" tag, if you want to support non-standard blocks and block variants respectively. It really depends what you like to support.
from nbt.
Awesome, that helps a bunch. I saw the block_analysis code and would have spent a while trying to find something comparable for anvil maps.
Thanks.
from nbt.
The block_analysis contains a lot of code dealing with boundaries. If your boundaries align with your chunks, things are much easier.
The main issue is what to do with with undefined ("inconceived") chunks and sections. For (vertical) sections it is easy: you can assume that if they are not defined, it is all-air. For undefined chunks, it is up to you what to do with it.
By the way, if you manage to create a small script, we're happy to take that as a contribution as an example script. :)
from nbt.
Fortunately I'm only concerned with the distribution of blocks that exist, so I can just check every chunk and not worry about which ones aren't there.
If I get it working I'll be sure to put in a pull request.
Again, thanks for your help, really got me motivated.
from nbt.
Related Issues (20)
- NBT does not use UTF-8, it's MUTF-8. HOT 10
- README should show `nbt.nbt.NBTFile()` for usage instead of `nbt.NBTFile()` HOT 1
- Compound tags never named HOT 1
- How do you delete an NBT entry?
- A way to port to newer Minecraft versions? HOT 1
- get_region should limit the number of open files
- ImportError in Python 3.10: cannot import name 'MutableMapping' from 'collections' HOT 9
- [Question, Potential Bug Report]: _render_buffer recursion when trying to modify region files in entities folder HOT 1
- [Question] How to get block data from blockstates
- (Question) Trying to modify region binary to replace stuff in minecraft world using blockdata
- KeyError: Tag Level does not exist when using Minecraft 1.18.1 worlds. HOT 3
- Can someone add support for 1.18 world height. Chunk section range should support -4 to 19, not 0 to 15. Thanks!
- Error while creating data: "struct.error: int too large to convert" HOT 1
- Unable to set value for Compound HOT 1
- Writing a compound tag to a file HOT 1
- 'TAG_End' is not defined HOT 3
- Using the map example with a 1.8 world renders nothing but black. HOT 2
- Can't save .mca HOT 2
- Get uncompressed NBT data to variable
- SNBT parser in/out
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nbt.