Amulet-Core icon indicating copy to clipboard operation
Amulet-Core copied to clipboard

[Feature Request] Chunk ownership

Open gentlegiantJGC opened this issue 2 years ago • 1 comments

Feature Request

The Problem

Currently chunks are intended to be independent of the world however I think we should change this behaviour. There is an issue when adding chunks to a world that the same chunk object may already be in a different world. Should editing this chunk object change the chunk in both worlds? Should marking the chunk as changed do so for both worlds? Which block and biome palette should the chunk reference?

I think it would make it a lot easier if each chunk was associated with at most one level. Putting the chunk in a different level would copy the chunk and put the copy in the new level leaving the original in the old one.

This would also make it possible to reach back into the world that owns the chunk. Amulet-Team/Amulet-Map-Editor#685

Feature Description

Add a weak reference to the chunk that stores the level that owns the chunk. This may be None if the chunk is an orphan chunk.

Here is a prototype including this https://gist.github.com/gentlegiantJGC/d0f0b6d34db696b5e5d41d166a0033e0

gentlegiantJGC avatar May 19 '22 11:05 gentlegiantJGC