twoolie / NBT

Python Parser/Writer for the NBT file format, and it's container the RegionFile.
MIT License
362 stars 74 forks source link

Closed region connot be reopened for a given world #124

Open s-leroux opened 5 years ago

s-leroux commented 5 years ago

Because of region caching in the World class, it is not possible to re-open a region after having closed it:

world = nbt.world.WorldFolder(".minecraft/saves/New World")
region = world.get_region(0,0)
# do some changes, then close the underlying file:
region.close()

# later
home = world.get_region(0,0)
home.get_chunk(0,0)
> nbt.region.ChunkDataError: seek of closed file

I suggest get_region should reopen a region if the cached one was closed.