0
Commit Graph

1306 Commits

Author SHA1 Message Date
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
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
Nicolas F
0d10211d1b world: fix rendering of 1.13 worlds
Fixes #1563.
2019-04-30 19:41:35 +02:00
Nicolas F
0004540a57 world: only render fully formed and lit chunks
Minecraft notes various stages of fetal development that chunks are
in, with the complete ones being "full". Previously, we'd check
against a list of states that are not full to skip a chunk, which
is obviously not future proof, and broke as Mojang updated their
possible range of values for the status field. It's better to
just bail if the status is anything other than "full".

Additionally, a key called "isLightOn" is in the chunk now. This
seemingly determines whether a chunk has been lit. We're also going
to check for this, and bail if it's not. In my tests, I have not yet
seen a single "full" chunk that does not have "isLightOn" set.

Fixes #1558.
2019-04-28 13:41:17 +02:00
Nicolas F
3fc97d131e Add fletching, cartography and smithing tables 2019-04-28 12:55:14 +02:00
InrcedibleHolg
702e4e9e8b added new 1.14 slabs, referencing issue #1560 2019-04-28 10:48:57 +02:00
Nicolas F
e25557d257 textures: fix stone slabs for 1.14 2019-04-26 04:11:20 +02:00
Nicolas F
8760b040c6 world: ignore poi directory in world dir
This is a new directory added in 1.14 which contains .mca files too.

Since we scan for directories with .mca files to use as RegionSets,
and we don't know how to handle these, just skip them.

Fixes some warnings during rendering.
2019-04-23 14:03:25 +02:00
Nicolas F
bc322fa3e4 world: fix for chunk parsing for 1.14
If there's missing light data, just make up some with an empty array.
2019-04-23 14:03:25 +02:00
Nicolas F
6f680aa287 Revert "web: fix goToHash on layer change"
This reverts commit 2186d08c32.

Fixes #1553.
2019-04-21 18:02:19 +02:00
Ben Steadman
8bd731fde1 decode Popen stdout bytes to utf-8 2019-04-20 10:36:53 +01:00
Nicolas F
134d6063bf primitives: misc char -> short fixes 2019-04-07 20:25:53 +02:00
Nicolas F
6a1906445c world: space comments correctly 2019-04-07 20:23:32 +02:00
Nicolas F
bd40aeda3d textures: set prismarine slabs to transparent
This fixes upper slabs removing the block below them.
2019-04-07 20:21:45 +02:00
InrcedibleHolg
f1dd70bdec reorder code in world.py 2019-04-07 19:21:12 +02:00
InrcedibleHolg
abc4a858ff double slab fix 2019-04-07 19:21:12 +02:00
InrcedibleHolg
c34638d26d activated red_sandstone_slab, for only half implemented 2019-04-07 08:21:13 +02:00
InrcedibleHolg
8529cc90bd fix upper/lower slab issue for more slab types 2019-04-07 08:05:22 +02:00
InrcedibleHolg
5df95be17a added: prismarine_brick_stairs, prismarine_slab, dark_prismarine_slab, prismarine_brick_slab 2019-04-06 21:56:30 +02:00
Nicolas F
1ab66dddea fix prismarine stairs
Sorry for the noise in mc_id.h, but somebody decided they want DOS
line endings and I couldn't allow that to happen. When not doing that
put the whole thing into diff, I decided to just fix the indentation
too while I was at it.

Needed bugfixing of some overlooked unsigned char usages for block IDs,
as otherwise the lighting would be scuffed.

Concerns issue #1486.
2019-03-31 19:20:10 +02:00
aheadley
2186d08c32 web: fix goToHash on layer change
Fixes #1548.
2019-03-28 16:07:30 +01:00
Nicolas F
f93bc28230 world: fix stair orientations
Concerns issue #1486.

Inner/outer corners apparently have their data from ancil data instead
of Minecraft's stuff, so we might need to fix that in the future.
2019-03-28 16:02:53 +01:00
Nicolas F
79754b367c world: bandaid fix for double stone brick slabs
This code badly needs a rewrite, we're just altering code path and
data all over the place and this isn't okay.
2019-03-25 21:42:08 +01:00
InrcedibleHolg
37dd1bc56c added cut_red_sandstone and chiseled_red_sandstone 2019-03-24 20:12:24 +01:00
Nicolas F
dc7d1cd208 genPOI: replace optparse with argparse
Maybe one day we'll use actual subparsers but today is not that day.
2019-03-22 17:10:52 +01:00
Wunkolo
4b0b50f215 Implement style fixes 2019-03-18 14:04:36 -07:00
Nicolas F
11aa232141 genPOI: port to Python 3
There's some stuff left to do, like properly do the functools.partial
stuff, and check that the uuidcache is actually working. But hey,
player markers work at least, and so does --skip-scan.

Still needs a port to argparse though.
2019-03-18 19:45:22 +01:00
Wunkolo
62dcfab7a0 Fix block_class_is_subset linkage 2019-03-17 20:21:03 -07:00
Wunkolo
121b0d96ab Increment extension version 2019-03-17 18:48:06 -07:00
Wunkolo
26bd4d120a Fix implicit declaration 2019-03-17 18:46:45 -07:00
Wunkolo
1271772aa1 Collapse special case logic to block_class_is_subset
Thanks demorgan's law
2019-03-17 18:02:44 -07:00
Wunkolo
5ff6a6400e Convert case switch to block_class_is_subset 2019-03-17 17:57:18 -07:00