Closed mfld-fr closed 5 years ago
Well, actually, I am not satisfied by this first change and I made more changes that I will push after more testing, so I put a WIP:
in the MR title to hold it and to get that upcoming changes reviewed.
Not only I have to fix the circular dependency as you said, but I also have to work on the right way to handle block identifiers in a generic manner: current MC version uses alpha identifiers, while old versions used numeric ones. So I am trying to make a comprehensive API with alpha identifiers, and to hide the old numeric ones in case we are reading an old version, with a switch on the "DataVersion" tag.
Stay tuned !
As expected, the Travis build failed because the test world is still an old version, and I have not yet put back the decoding of the legacy block data. Scheduled for a next commit.
I'm happy to accept anything that passes all tests, including a change to remove outdated tests ;) The chunk code is very old, and I've seen few (if any) issues on it last years, so I suspect that most people use the examples. Any change should not break other code such as Minecraft-Region-Fixer, but I'm fairly sure it does not use the chunk part.
But I'm very happy to see this code, as it may make the library more useful, so just let me know when you think it is ready, and I try to merge after a review.
A bit of clarification: this library is maintained for over 8 years now, and the core parts: nbt.nbt
and nbt.region
are fairly solid. I would write it differently if I were to write it today, but the code is fairly mature. nbt.world
and nbt.chunk
are nice, but have not matured that much. Some of it's functionality was gradually moved to examples, to note to users that that part was provided 'as is'.
I would be thrilled to see more functionality in the core, especially logic when it comes to undefined sections, as well as some helper functions for all the extra files (like scoreboard.dat). However, if you want to add a lot of very Minecraft-specific code, be sure to discuss it, to avoid adding maintenance code.
It's a pity the NBT format gained no traction outside the Minecraft world. I think it's fairly elegant. However, other 'dynamic binary data' file format have prevailed. The one am actively using at work is Google protobuf.
The latest commit fixes the regression in the map
unit test. Well... looks like we can now consider this latest version as a merge candidate. Here is the rendered McRegion test world:
The Travis build job 93.7 failed not because of the map unit test, but after the 10 mins timeout. See https://travis-ci.org/twoolie/NBT/jobs/493402436.
Again the same world, but after commenting out the block_ignore
array:
Hey, this project begins to be a real cheat tool :smirk: !
At first glance, this seems great. Of course, I was sold at seeing these pictures 👍
I particularly like how to seem to have simplified the math code in examples/anvil_blockdata.py
.
There are two (very) minor issues I see at first glance:
class AnvilSection:
. This is prefectly fine for Python 3, but for Python 2.7 this might be class AnvilSection(object):
. Frankly, I no longer use Python 2.7, and see no problems in bumping the minimum version to 3.4. However, let's see what Travis has to say.def __init__(self, nbt):
is changed to def __init__ (self, nbt):
. However, the PEP8 recommendation is not to have spaces after a opening or closing bracket (you can check with a tool like flake8
). Is there a reason to introduce a PEP8 deviation here?Errrm, I need sleep. Travis did pass. I guess the (object)
frase now really is redundant. Good, I learned something! With the small PEP8 changes, I would vote to merge this.
According to Python documentation, object
inheritance is required in 2.x only when using some modern class features (see https://docs.python.org/2.7/reference/datamodel.html#newstyle). As we should follow the life cycle of the official Python releases (today 2.7, 3.5, 3.6 and 3.7), we should keep that point in mind, even if the Travis build passed. So thanks for the tip, I was not aware of that.
There is no "good" reason to diverge from PEP8, beyond some personal habits, so I will push a corrective commit on the spacing. Sorry for the waste.
Fixed the spacing and object inheritance in the last commit.
Again a Travis failure in only one job (95.5), while downloading the sample file, without any link with the latest commit: https://travis-ci.org/twoolie/NBT/jobs/493852303
ERROR Download https://github.com/downloads/twoolie/NBT/Sample_World.tar.gz failed: [Errno 104] Connection reset by peer
No failure on my side with alltests
and Python 3.6.5.
@mfld-fr please report if you think your commits are good enough to push to master, and I'm happy to merge. I'm less responsive next four days. Feel free to ping using a '@macfreek' comment, and I'll pick it up within a few days.
@macfreek : yes, I think the proposed code is now in a good state after the last commit related to performance, and that you could merge.
Thanks for the merge !
anvil_blockdata
examplemap
example