def test_session_lock(self): temp = TempLevel("AnvilWorld") level = temp.level level2 = MCInfdevOldLevel(level.filename) def touch(): level.saveInPlace() self.assertRaises(SessionLockLost, touch)
def testCopyChunks(self): level = self.anvilLevel.level temppath = mktemp("AnvilCreate") newLevel = MCInfdevOldLevel(filename=temppath, create=True) for cx, cz in level.allChunks: newLevel.copyChunkFrom(level, cx, cz) newLevel.close() shutil.rmtree(temppath)
def manmade_relight(): t = templevel.TempLevel("TimeRelight", createFunc=lambda f: MCInfdevOldLevel(f, create=True)) world = t.level station = mclevel.fromFile("testfiles/station.schematic") times = 2 for x in range(times): for z in range(times): world.copyBlocksFrom(station, station.bounds, (x * station.Width, 63, z * station.Length), create=True) t = timeit(lambda: world.generateLights(world.allChunks), number=1) print "Relight manmade building: %d chunks in %.02f seconds (%.02fms per chunk)" % ( world.chunkCount, t, t / world.chunkCount * 1000)
def testCreate(self): temppath = mktemp("AnvilCreate") self.anvilLevel = MCInfdevOldLevel(filename=temppath, create=True) self.anvilLevel.close() shutil.rmtree(temppath)