Skip to content

Conversation

@MamiyaOtaru
Copy link

first tiny commit is to ensure that (!WDL.downloading && !WDL.saving) means it is safe for another mod (like VoxelMap) to mess with chunk.isModified instead of having a (very very) brief period where downloading is false but before saving is true

Second updates some methods and fields to mcptest, didn't touch anything in conf folder though :(

also adds Distance Extender functionality where Minecraft will actually listen to the render distance the user chooses in the video UI. Works in SP as is, and in SMP if a download is running (to be sure WDL.chunkLoader is the right one for that world - it's not set to null after download is stopped, even after world is switched. Could probably do something about that but eh

ensure that (!downloading && !saving) means it is safe to mess with
chunk.isModified (instead of having a brief period where downloading is
false but before saving is true)
distance extender as suggested by stellardawn

I originally had ChunkProviderWDL inserted in between WorldClient and
ChunProviderClient, which kept track of its own chunkmap/list, but
decided it was best to just have it all in one class.  Could have edited
ChunkProviderClient, but I decided not to edit one more base class, so a
lot of ChunkProviderClient is replicated in ChunkProviderWDL which may
not be any better.  It is a pretty simple class at any rate.  And the
whole thing could likely be done better, but it works (SP too!)
back out change that involved changing the name of an unrelated classes
methods (for clarity in figuring out what it did, should have been
undone.  Now it is!)
do disk IO of loading in a separate thread (and make references to
chunkMap/Listing thread safe)

Restrict chunkListing to chunks added via loadChunk (ie what would be
there normally, ignoring what we load from disk).  This saves chunk
ticking (lighting recheck etc) on all those extra chunks, which aren't
even really the real chunks as received from the server anyway.  Their
lighting was most likely worked out satisfactorily when they were saved.
If not, they'll get ticked as we get closer and they are loaded the
normal way anwyay
@nairol
Copy link
Collaborator

nairol commented Jul 1, 2014

Hey MamiyaOtaru, thanks for this pull request and sorry for the long silence. Afaik cubic72 didn't have time to work on Minecraft mods and I haven't really followed the mod anymore for almost a year.

I'll have a look at your code. So the problem is that VoxelMap uses the Chunk.isModified field to keep track of some per Chunk state and WDL doesn't know about that, right? Maybe I can get rid of the isModified check. I didn't use it in the very first version of WDL but that resulted in empty chunks being written to disk. Maybe this is no longer the case...

Changing VoxelMap to store the state in some mod-local data structure wouldn't work, would it? E.g. a HashMap<ChunkPosition, YourStateDataType> inside your main class. I've used a HashMap like this in early versions of WDL to keep track of new TileEntities that should be merged into the loaded chunks later.

You also included a distance extender in this PR. I'd rather test the two changes separately. Which changes are for voxelmap compatibility and which ones for the distance extender? Do I need the new ChunkProviderWDL for compatibility? I hope you still remember :)

Again, sorry for the long wait and thanks!

@nairol nairol changed the title voxelmap compatibility Distance Extender (original title: voxelmap compatibility) Aug 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants