Code Monkey home page Code Monkey logo

Comments (4)

macfreek avatar macfreek commented on July 28, 2024

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.

Watchful1 avatar Watchful1 commented on July 28, 2024

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.

macfreek avatar macfreek commented on July 28, 2024

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.

Watchful1 avatar Watchful1 commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.