0
Commit Graph

24 Commits

Author SHA1 Message Date
Nicolas F
a9fa06f019 nbt: small optimisation to list reading
Don't use .append(), we already know the final length. Instead,
have python initialise the list of a certain size and set the elements
in it.

Makes the function like 4% faster.
2019-12-26 17:28:51 +01:00
Nicolas F
d92e61e559 nbt: catch EOFError because of gzip streams
Might fix world listing for some corrupt worlds.

Fixes #1606.
2019-07-08 23:01:34 +02:00
Nicolas F
e348a548b6 Initial Python 3 port
Many things work, some don't. Notably, genPOI doesn't work, and
there's some signedness comparison stuff going on in the C extension.

This also completely drops support for Python 2, as maintaining a C
extension for both Python 2 and 3 is a pain and not worth it for the
9 months that Python 2 is still going to be supported upstream.

The documentation needs to be adjusted as well.

All of the few tests we have pass, and rendering a map works, both
with a configuration file and without. We can also use optimizeimages.

Concerns #1528.
2019-03-17 17:57:07 +01:00
Nicolas F
846b7ab8f8 nbt: code style fixes
We're ignoring E221 and E741 since I disagree with them; I think extra
whitespace around operators to align repeated operations can aid
readability and help spot bugs.

This was mostly whitespace issues, e.g. trailing whitespace and
a single space on blank lines.
2019-03-02 15:47:13 +01:00
Aaron Griffith
1e4cabe5d0 Merge branch 'master' into minecraft113 2019-02-19 14:28:34 -05:00
Andrew Chin
e76d364b1e NBT: Use a replacement strategy to deal with undecodable data.
The NBT spec requires that all strings are UTF-8 encoded.  However in
practice, non-UTF-8 data can get into a level.dat file (generally via
some weird user-supplied characters in signs.  This results in the
following error:

    CorruptNBTError: could not parse nbt: 'utf8' codec can't decode byte
    0xc0 in position 3: invalid start byte

This happens often enough that we should just ignore this error by using
the 'replace' strategy to replace the invalid data
2018-09-06 22:20:09 -04:00
gmcnew
a61131dc4f Allow new NBT type 12 (long array) to be read 2018-08-04 22:03:44 +00:00
Andrew Chin
3938d1889c Better error handling of errors when a world fails to open.
A common case is a corrupt (or empty) level.dat file.  This condition
wasn't properly caught, yielding a less-than-useful stack trace.  Even
more concerning is that this could happen when a user is just running
"overviewer.py" to get a world listing.

This has been fixed to improve the user experience
2016-12-19 10:50:01 -05:00
Aaron Griffith
32fbc1dea2 nbt array lengths are unsigned (see issue #1190) 2015-02-02 04:59:43 -05:00
Aaron Griffith
6e3556ab12 nbt timestamps are probably signed (like time_t)
Besides, we get overflow errors with utime on windows for large
unsigned 32-bit integers.
2013-05-06 18:11:45 -03:00
Andrew Brown
ff0f4fe46e fixed error handling code. Now more robust against corrupt chunks! 2012-03-18 13:52:59 -04:00
Andrew Brown
e9cf747513 Added better error handling for corrupt chunks 2012-03-17 22:56:33 -04:00
Andrew Brown
8206272fc8 Added a cache for open regionfile objects 2012-03-04 18:46:02 -05:00
Andrew Brown
d669034c4c corrected y to z in functions in nbt.py 2012-02-17 20:11:02 -05:00
Andrew Brown
6b449da966 added int array support to nbt.py
(untested) Also removed an extra import that I forgot about earlier.
2012-02-15 18:20:57 -05:00
Aaron Griffith
581ee0906a nbt.py now simply *reads files*, nothing more 2011-12-19 02:03:57 -05:00
Andrew Brown
cd360c3c60 comments adjustment in nbt.py 2011-11-20 10:52:04 -05:00
Andrew Brown
6e2d52ceee This should really raise an error if file not found 2011-11-06 20:35:11 -05:00
Aaron Griffith
8c4dd10824 Revert "small findSigns.py fix -- loading regions with north_direction pre-rotates"
This reverts commit 085d400337.
2011-09-16 14:27:03 -04:00
Aaron Griffith
085d400337 small findSigns.py fix -- loading regions with north_direction pre-rotates
What we want in findSigns.py is the raw map data.
2011-09-16 13:43:20 -04:00
Ryan Rector
02d2ae0e6a Fix tile updates for upper-left and lower-right rotations 2011-08-13 10:51:43 -06:00
Ryan Rector
4ee15e8f44 Code cleanup to simplify upstream merge 2011-08-04 12:49:49 -06:00
Ryan Rector
1b25f187ff Merge remote-tracking branch 'upstream/master' into configurable-north 2011-08-03 20:41:09 -06:00
Aaron Griffith
42596416d9 sdist and install now work
next step is using a custom data dir, and falling back on the package
data dir. Also, fixing --version.
2011-03-29 13:49:50 -04:00