0
Commit Graph

1486 Commits

Author SHA1 Message Date
Nicolas F
c13d3aae3c rename configParser to config_parser
CamelCase does not bode well in Python land, so it's best we rename
these ill-named files before the Guidoists get us and throw us into
a damp dungeon.
2019-07-24 09:18:02 +02:00
Nicolas F
f314de1403 configParser: code style and string changes
It's now PEP8 compliant! Also we can remove an unused optparse
import (wtf?) and let logging.error do the string formatting lazily.
2019-07-24 05:35:40 +02:00
Nicolas F
7e2cb56c1b Implement some mossy blocks
This adds:
- mossy stone brick stairs
- mossy cobblestone stairs
- mossy stone brick walls

We also add another block class for walls, and while we're at it,
clean up the stairs texture function to not have a huge sprawling
elif mess for loading textures, but instead to a cheeky dictionary
lookup.

In case you're wondering, yes I am just as disgusted by this code as
you are.
2019-07-15 17:23:25 +02:00
Nicolas F
634e13c92c Merge branch 'workstations' of https://github.com/IncredibleHolg/Minecraft-Overviewer 2019-07-13 17:37:58 +02:00
Nicolas F
a422270666 Add force_writable argument to mirror_dir
Fixes #1611.
2019-07-12 23:37:35 +02:00
InrcedibleHolg
419889c1f1 add workstations: blastfurnace, smoker, lectern, loom, stonecutter and grindstone 2019-07-12 21:16:22 +02:00
Nicolas F
70c64cd4c5 overviewer_core/__init__: code style fixes 2019-07-12 17:55:30 +02:00
Nicolas F
f6937fe6a3 signals: whitespace fixes 2019-07-12 17:48:32 +02:00
Nicolas F
07cb05f4d8 observer: don't divide by zero in RConObserver
If no tiles needed to be updated, RConObserver would divide by zero,
which is less than ideal.

Fixes #1422.
2019-07-12 17:37:58 +02:00
Nicolas F
a9aabab790 util.js: actually run the ready queue
Fixes #1466 I hope.
2019-07-12 17:25:29 +02:00
Nicolas F
106d332136 Catch KeyboardInterrupt so we don't barf a trace
Concerns issue #1531.

Future work can actually try to save state in this case, but especially
with multiprocessing, that might become a bit hairy.
2019-07-12 17:15:51 +02:00
Nicolas F
402d35fefc util.js: remove some obsolete stuff
A few debug console.log statements got the axe too, because I
felt like it.
2019-07-12 16:55:47 +02:00
Nicolas F
4d27cf3dfc util.js: don't specify a map minzoom of 0
Who put this here? Why? Whatever.

Fixes #1590.
2019-07-12 16:43:05 +02:00
Nicolas F
4dc2c8a5b7 world: add __lt__ to RegionSetWrapper for genPOI
genPOI needs this for groupby, and since we can now throw cropped
regionsets into genPOI we definitely need this too.

Probably also fixes rotated regionsets with multiple genPOI filters.
2019-07-12 16:32:07 +02:00
Nicolas F
033d75b08e genPOI: respect crop option
Use CroppedRegionSets to generate markers, which should only affect
handleEntities. I have not yet checked whether this generates
dupicate players and manualpois for maps with multiple crop zones,
but that's a fire to put out for another day.

Fixes #1574.
2019-07-12 16:04:28 +02:00
Nicolas F
aeeaadd5bb Bump C extension version to 68 2019-07-12 15:27:42 +02:00
Wunkolo
4298aea569 Fix GCC signed-unsigned and pointer-warnings (#1608)
* Fix GCC signed-unsigned and pointer-warnings

A lot of the signed/unsigned issues are related to the fact that I converted
a lot of indexing values to use unsigned types, little did I know that a lot of
other values used when indexing actually come from the python-end. Python does
not have built-in unsigned types so all integers coming from Python are signed
implicitly so a lot of things like image-size and x, y coordiantes are specially
handling negative-integer cases.

Guess we'll just take our `int32_t i = 0; i < blah; ++i` and like it.

Code now compiles with no warnings or nagging.
2019-07-12 15:26:45 +02:00
Nicolas F
221b2c6805 Bump C extension version to 67 2019-07-10 18:37:38 +02:00
Nicolas F
4f3c7368ba Merge branch 'posix-types' of Wunkolo (#1598) 2019-07-10 18:36:32 +02:00
Nicolas F
6bdcd32a6f world: remove redundant stride 1 in iteration
IRC chairfarters are pedantic.
2019-07-09 18:11:29 +02:00
Nicolas F
8bbe034aad world: use numpy.empty instead of numpy.zeros
Some arrays get completely filled anyway, so we might as well not
use numpy.zeros, and instead choose numpy.empty.
2019-07-09 18:05:15 +02:00
Nicolas F
a5071663cd world: optimise bad block translation code
Makes Overviewer like 45% faster lol
2019-07-09 17:59:40 +02:00
Nicolas F
e0e33a9acb textures: fix texturepath option not being used
If the first texture loaded was not in the pack, i.e. we fell back
on system textures, then the pack was ignored altogether for the
remainder of the render.

Here we fix this by using an OrderedDict instead of the split jars
and jarpath nonsense, and then always checking the custom textures
first and opening them if they are not already open, and putting
the jar file handle at the start of the OrderedDict.

We also switch around some logic to avoid unnecessary isdir calls
when we're using a resource pack.
2019-07-09 14:20:31 +02:00
Nicolas F
19042a7669 rcon: fix for python 3
We need to encode the payload since rcon is a binary protocol.

Also, add some more error checking.

Fixes #1605.
2019-07-09 13:44:43 +02: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
a6bcc0f957 textures: implement proper fallback loading
Sometimes a texture pack is not complete, but system textures are
available to make up the difference. In that case, we should load
those.

Current caveat is that we might not notice texture names changing
with newer minecraft clients because we have old ones installed.

I'll have to think some more about that one.
2019-07-06 23:36:47 +02:00
Nicolas F
6b0ccc1513 src/primitives/base: don't try to free nullpointer
If loading the grass and foliage biome colour fails, Overviewer doesn't
necessarily crash, it just renders everything gray, apart from one small
issue: in trying to call base_finish, it'd crash trying to decrease the
reference of a null pointer.
2019-07-06 23:15:55 +02:00
Nicolas F
0b4ad361c3 world: fix those pesky poi warnings 2019-07-06 21:24:58 +02:00
Nicolas F
204bcd0310 Add "center" config option
This option allows you to specify your own initial center for a
tileset, which is useful if your map is extremely asymmetric or
you don't really care about what's around the spawn.

Future work needs to be done on the JS side in order to fix the
fromWorldToLatLng and friends, as they're currently off by -24 in X
and +24 in Z direction.

Closes #1350.
2019-07-06 19:06:15 +02:00
Nicolas F
5b0430f94b textures: greatly simplify find_file and friends
find_file contained a lot of code for searching textures in ways that
haven't been relevant for years. For example, it had workarounds for
MCPatcher, a tool that hasn't been updated since 2015.

Instead of searching in multiple paths that will never succeed in a
resource pack and Minecraft version that actually work, just look
for the filename that the block functions ask for.

Also, if we already have a manually specified resource pack open,
we shouldn't repeatedly re-open it. Furthermore, it's best if
the very first thing find_file does is try to find the file in
the resource pack or client jar we've already opened previously.

We can now also remove chest.png, ender.png, foliage.png, grass.png
and normal_double.png because Minecraft ships them, so we don't
need to ship them ourselves too. Us shipping them actually hid the
whole find_file garbagefire.

Concerns issue #1604.
2019-07-04 18:24:57 +02:00
Nicolas F
864be71667 textures: cache when a texture couldn't be found
Previously, textures that couldn't be found the first time around
would not have this fact cached, so we'd run through the whole
slow path of find_file with each blockid and data entry.

This is what caused the chests texture generation function to take
almost 12 seconds on my system, as it is looking for "normal.png"
that hasn't existed in Minecraft textures for ages.

Shoving the exception, if one is encountered, into the cache, and
then re-raising it if we load it from the texture cache brings this
number down to about 2 seconds. That's six times as fast!

Concerns issue #1604.
2019-07-04 16:40:11 +02:00
Nicolas F
1e8735328e textures: try more than the most recent Minecraft
We can try each jar in descending order of versions until we actually
find one that works. This fixes #1328.

Future work might move the "if self.jar is not None" higher up in the
function so that we don't keep re-checking the overviewer dir and texture
path for files that we will then not use at all for some reason.
2019-07-04 15:27:58 +02:00
Nicolas F
7d1a04b0fe genPOI: hopefully fix binary string nonsense
Somebody reported that genPOI was throwing an exception in two
different places related to trying to read bytes as a string.

I personally could not reproduce (possibly needs some special player
names or something?) but I think this change should fix it either way.
2019-06-28 13:24:48 +02:00
Wunkolo
22840d5a97 Implement straggler standard integer types 2019-06-26 10:29:10 -07:00
Wunkolo
5b212dc585 Implement standard C boolean type 2019-06-25 14:19:12 -07:00
Wunkolo
d738c21852 Propagate block, bool, standard integer types across codebase
Posix type integer pass

Propagate block, bool, integer types across codebase

Add standard integer types to prototypes
2019-06-25 11:56:11 -07:00
Nicolas F
b6a3c18b65 web_assets: update leaflet to 1.5.1 2019-06-25 19:40:42 +02:00
Nicolas F
c34be9ca67 world: add __lt__ method to RegionSet
So turns out genPOI wants to use sorted() so it can use itertools.groupby.

Python 2 somehow just... sorted objects so that groupby (which is basically
the UNIX uniq) could group them properly. Python 3 no longer does this,
so as comparison method let's just compare regiondir strings since that
gives us the desired result.

Fixes #1597.
2019-06-25 19:19:28 +02:00
Nicolas F
b20705e46a observer: use bytes fp for JSObserver
Unbuffered I/O requires a bytes fp, so I guess we now just send
utf-8 encoded strings into that instead.

Fixes #1596.
2019-06-25 18:17:45 +02:00
Wunkolo
8162f3f877 Add .clang_format
Also applies clang-format to the current code base, using command:
`find . -regex '.*\.\(c\|h\)' -exec clang-format -style=file -i {} \;`
2019-06-23 18:43:32 -07:00
Aaron Griffith
676bf32af9 another version bump, to test out new builder 2019-06-23 14:35:37 -04:00
Aaron Griffith
ec13bc03cf bump extension version 2019-06-23 13:54:26 -04:00
Andrew Chin
5e19ad0c6d Fixes for WindowsOutputStream 2019-06-23 12:47:05 -04:00
Andrew Chin
c78b17f6a7 Fix for reading worlds from local dir 2019-06-21 23:35:33 -04:00
Aaron Griffith
9a52a02f13 Bumped extension version. 2019-06-21 22:10:01 -04:00
Aaron Griffith
248ea42dd2 Merge branch 'master' into python3-fun-times 2019-06-21 22:08:58 -04:00
mircokroon
2dc8ebd4d9 Ensure coordinates are properly converted when changing views (#1571)
* Ensure coordinates are properly converted when changing views
2019-05-19 11:54:01 +02:00
Nicolas F
f1c7ab93f1 world: remove lit chunk check
Apparently not even chunks of that data version can be relied upon
to have that flag mean anything at all, as the --forceUpgrade and
--eraseCache switches result in a world where chunks are flagged
as not being lit but seemingly do have SkyLight and BlockLight keys.

Concerns #1570.
2019-05-05 15:17:43 +02:00
Nicolas F
9479ac59b4 world: make the chunk populated code even uglier
Fixes #1568.
Fixes #1566.
2019-05-03 15:13:18 +02:00
Nicolas F
c77fcc5fb3 world: fix snowy grass check
pro tip: 'false' == True.
2019-04-30 21:08:00 +02:00