905 Commits

Author SHA1 Message Date
David Vierra
3e1520ee02 Import level classes where they're needed instead of in mclevelbase.py. This lets us run each file individually, e.g. for doctests. 2011-12-22 11:55:49 -10:00
David Vierra
56a9d56679 fix extractLightMap's return value 2011-12-17 06:08:13 -10:00
David Vierra
8a30875609 getChunkSlices takes a shortcut and enumerates all of the level's chunks whenever the requested box is the level's bounds 2011-12-16 14:42:45 -10:00
David Vierra
73a4954055 rewrite extractLightMap to use argmax on a reversed array instead of nonzero. this is about 3x faster. a new method extractHeights contains the new code and can be reused e.g. for topsoil methods 2011-12-16 14:01:07 -10:00
David Vierra
529e36c880 pkg_resources isn't always available, so fall back on PYMCLEVEL_YAML_ROOT and then cwd 2011-12-16 01:57:00 -10:00
David Vierra
b599e0d0b3 Parse ~item groups from items.txt 2011-12-12 19:09:38 -10:00
David Vierra
b3c5574a0f add FloatBox to default imports 2011-12-12 19:07:45 -10:00
David Vierra
f1a8bf76fc Set HeightMap to all zeros in the Nether to match what the game does. Otherwise, Nether Wart won't plant in low light. 2011-12-12 19:07:26 -10:00
David Vierra
0f52c0e655 addYamlBlocksFromFile now uses pkg_resources to find the requested YAML file instead of guessing wildly 2011-12-06 18:47:38 -10:00
David Vierra
05d2e39739 remove the __del__ from MCInfdevOldLevel so the gc can resolve the circular reference between a level and its dimensions. move it to RegionFile which might actually have filehandles to close if I ever turn "holdFileOpen" back on... 2011-12-05 04:30:42 -10:00
David Vierra
3d1d76d04b Revert "use weakrefs to break reference cycles between a world and its dimensions, and a world and its chunks."
Weakrefs are the wrong solution, we need to remove the __del__ from MCInfdevOldLevel

This reverts commit 12a5982b1693def30d74f9e656d87984e50fd8b1.
2011-12-05 04:27:10 -10:00
David Vierra
768d88ca33 extractAnySchematic calls extractZipSchematic whenever the box has more chunks than a threshold (currently the decompressed chunk limit) 2011-12-05 00:08:21 -10:00
David Vierra
12a5982b16 use weakrefs to break reference cycles between a world and its dimensions, and a world and its chunks. 2011-12-04 22:42:27 -10:00
David Vierra
9c94191073 pocket levels fill the DirtyColumns array with 255 to tell the MCPE server that the chunk is dirty. 2011-12-04 13:25:19 -10:00
David Vierra
413111477c add lists of entity IDs 2011-12-02 16:06:49 -10:00
David Vierra
0a64c23f5c added DirtyColumns array to pocket edition chunks. 2011-12-02 16:06:08 -10:00
David Vierra
c2f7b930a9 add TAG_Compound.saveGzipped and change load_ctx to use size_t for pointer offsets 2011-11-30 14:03:38 -10:00
David Vierra
8eaa43fe70 popen doesn't accept a unicode for its cwd parameter (doesn't use wchar api?), so encode it. fixes generator failure when startingDir has non-ascii chars 2011-11-29 19:58:44 -10:00
David Vierra
11ed48ce58 set MCAlphaDimension.parentWorld before calling MCInfdevOldLevel.__init__ to make sure the root_tag property has parentWorld set 2011-11-29 14:53:41 -10:00
David Vierra
065550a68b in generateChunkInLevel, use a set for chunks instead of recreating the list after each pass. 2011-11-29 13:00:55 -10:00
David Vierra
0b403cab02 remove the sys.modules nonsense from addYamlBlocksFromFile. It now searches YAML_ROOT, the current directory, and sys.path in that order. 2011-11-29 12:58:21 -10:00
David Vierra
3703015f86 add setup_nbt.py and setupnbt64.bat. try to import _nbt without using ImportError, in case it was built using setup_nbt.py 2011-11-29 03:39:25 -10:00
David Vierra
6ba1634796 for infinite worlds, don't share the default players list from level.py. instead, only add "Player" to the players list when the player is found in level.dat. 2011-11-29 03:37:33 -10:00
David Vierra
e71e159461 add float variant for bounding box 2011-11-26 01:32:04 -10:00
David Vierra
f31b81cfe9 rename playerOrientation to getPlayerOrientation 2011-11-26 01:31:49 -10:00
David Vierra
c50a73fb2b cacheNewVersion now has an allowDuplicate flag, used by checkForUpdates to avoid making extras of the same version 2011-11-25 17:15:47 -10:00
David Vierra
3253a5e0ec added test for createLevel() 2011-11-25 16:43:09 -10:00
David Vierra
67cb6daa30 MCServerChunkGenerator.createLevel() creates a new level by running the server on it directly.
added option to simulate the world by running the server a bit longer to generateAtPosition(). chunkMalformed errors now include the original error, chunk "filename" includes the length in sectors
2011-11-25 16:23:49 -10:00
David Vierra
4135f603c5 Added _nbt.pyx, a Cython implentation of nbt that uses extension classes and pointer arithmetic to speed up loading.
Renamed nbt.py to pynbt.py, added nbt.py as a thin loader for either _nbt.pyx or pynbt.py.
2011-11-25 16:10:39 -10:00
David Vierra
c48adf501a switch to cStringIO, clean up nbt.loadFile, add nbt.load to __all__ 2011-11-25 15:49:02 -10:00
David Vierra
7933473be3 move NBT tests to tests.py, add speed test and chunks with TileTicks 2011-11-20 15:13:42 -10:00
David Vierra
7edd6d3a5e unicode-format the log output from searching for yaml files 2011-11-19 15:39:25 -10:00
David Vierra
a7cd35af9a when finding an unused server version name, actually use the one we found 2011-11-19 15:38:55 -10:00
David Vierra
b540788f59 prepend "Alpha" or "Release" to the older and newer version numbers appropriately. 2011-11-19 15:38:27 -10:00
David Vierra
6b9176e5a8 check that javaExe was found before trying to identify new server versions 2011-11-19 15:24:09 -10:00
David Vierra
8dd5f1a135 speed up generateChunksInLevelIter when chunks is very big. add minRadius and maxRadius parameters; assume server generates at least minRadius and then attempt to copy over maxRadius chunks 2011-11-19 09:54:05 -10:00
David Vierra
0318086838 check an environment variable for where to load yaml files from, so MCEdit can change it 2011-11-19 09:52:41 -10:00
David Vierra
3f327931cc simulate the world for 15 seconds to process most of the tile ticks 2011-11-18 14:33:51 -10:00
David Vierra
43f0570c54 darkened tall grass 2011-11-17 20:43:29 -10:00
David Vierra
af4c11ea3f removed nbt_length() and data= keyword argument to TAG_*, replacing them with load_from to pass around the data cursor 2011-11-17 20:43:21 -10:00
David Vierra
4c35acb49d chain tracebacks for this ChunkMalformed exception 2011-11-17 20:42:24 -10:00
David Vierra
2809da320d which() now checks %SYSTEMROOT% (because usually it's looking for java.exe which gets installed there). for some reason, PATH is absent from environ sometimes also. 2011-11-17 20:41:58 -10:00
David Vierra
4032053d53 copyBlocksFromInfinite now has an iterator form, so copyBlocksFromIter callers can show progress 2011-11-17 20:40:45 -10:00
David Vierra
e739afa53b rearrange so __init__ is at the top of the class 2011-11-16 12:59:45 -10:00
David Vierra
6945b0185c Merge pull request #60 from chungy/master
Rewrite gametype command in mce.py
2011-11-16 09:18:13 -08:00
David Vierra
c313d25ecd add default name for dimensions 2011-11-14 10:18:09 -10:00
Mike Swanson
11aaca46a4 Change the help message to include gametype's new invokation. 2011-11-13 20:52:49 -08:00
Mike Swanson
59431458db Fix typo in a comment in my previous commit. 2011-11-13 15:30:46 -08:00
David Vierra
27ee33dd33 handle items with stack size in parens - has normal stack size but INVEdit only gives you one instead of a full stack 2011-11-12 17:45:17 -10:00
Mike Swanson
4d5a8ebe7f Refine gametype command to be more robust.
Now supports both single- and multi-player worlds, and it also
sets the player abilities added in Beta 1.9-pre5 to proper values
based on the gametype changed to.  No longer will allow flying and
invulnerable players when switching to survival mode!
2011-11-12 17:43:35 -08:00