twoolie / NBT

Python Parser/Writer for the NBT file format, and it's container the RegionFile.
MIT License
361 stars 74 forks source link

Adding set_block() #141

Closed TugdualKerjan closed 1 month ago

TugdualKerjan commented 4 years ago

Hi, Looking through the code it occurred to me that there seemed to be partial implementation of features to write chunks (In region with write_chunk(x, y, data)) I was wondering why implementation of functions such as chunk.set_block() weren't integrated, so as to be able to edit the .mca blockdata?

My plan right now is to just write my own method that:

  1. From a chunk NBTFile, and a given block, x, y and z sets the BlockStates / Palette of the section of the chunk, returning the new NBTFile
  2. Calls write_chunk(x, y, nbtfile)

P.S. This is my first issue! I'm new to the game of opensource :^)

ETO-QSH commented 1 month ago

Although it has been a long time, have you made any progress. I'm working on a project right now that has very similar ideas to yours.

TugdualKerjan commented 1 month ago

Hey @ETO-QSH, unfortunately I don't quite remember what I did concerning this issue - I would recomment you checkout my project linked to this as it might give some insight when looking at the code: https://github.com/TugdualKerjan/MinecraftChunkVisualiser

ETO-QSH commented 1 month ago

Hello @TugdualKerjan. I am very glad to receive your reply. Before I asked and after I saw your answer, I looked through your project. Actually your work is on 'get_block()', not on 'set_block()' as mentioned in this issue, and I made some progress here, which I think is pretty bad - I read all the blocks in the chunk and created a new chunk to rewrite it, which I have to say is very inefficient. I also found a problem in principle that I could only edit blocks that were already loaded, which also posed a challenge for me. If you are no longer interested in this, you do not need to offer me any more help, I will continue to try to solve these problems.Thank you for your help, wish you a happy life!

TugdualKerjan commented 1 month ago

Very cool ! I do admit I won’t take the time to look into this deeper but good luck and have a good life too :)

On 15 Jul 2024, at 19:14, ETO @.***> wrote:

Hello @TugdualKerjan https://github.com/TugdualKerjan. I am very glad to receive your reply. Before I asked and after I saw your answer, I looked through your project. Actually your work is on 'get_block()', not on 'set_block()' as mentioned in this issue, and I made some progress here, which I think is pretty bad - I read all the blocks in the chunk and created a new chunk to rewrite it, which I have to say is very inefficient. I also found a problem in principle that I could only edit blocks that were already loaded, which also posed a challenge for me. If you are no longer interested in this, you do not need to offer me any more help, I will continue to try to solve these problems.Thank you for your help, wish you a happy life!

— Reply to this email directly, view it on GitHub https://github.com/twoolie/NBT/issues/141#issuecomment-2229003706, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALMIQGCAUFAMA3MTCUCGEN3ZMP7PHAVCNFSM6AAAAABKXHCKZOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRZGAYDGNZQGY. You are receiving this because you were mentioned.