Skip to content
This repository was archived by the owner on Sep 12, 2022. It is now read-only.

Race condition while editing never-generated chunks #13

Open
Muqsit opened this issue Apr 29, 2019 · 1 comment
Open

Race condition while editing never-generated chunks #13

Muqsit opened this issue Apr 29, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@Muqsit
Copy link
Owner

Muqsit commented Apr 29, 2019

Issue

While world-editing a massive region (eg: //pos1: [0, 0, 0] and //pos2: [1000, 255, 1000]), the cuboid formed by the two points may include chunks that have never been loaded/generated at all.

So what happens?

The plugin would request PocketMine to create the chunk. PocketMine's chunk creation is synchronous which works well with the design of WorldStyler, BUT PocketMine's world generation AND population is asynchronous and WorldStyler completely disregards that fact! Here's what happens when you //set stone f.e in a large area:
ece

  • How did the dirt and ores get there?
    Because the population task was done after the chunk had already been edited by WorldStyler.
  • What's up with that weird stair-like pattern?
    Just another possible thing that could happen while modifying non-generated chunks. The chunk was never generated, it's an empty chunk that the server is modifying. The chunk hasn't been flagged as "generated" before WorldStyler modifies it. So pocketmine's generators override the chunk.

The solution would be to queue the world edit task for such chunks. The plugin would request the chunk to generate and once it's done generating, WorldStyler may do whatever it likes.

@Muqsit Muqsit added the bug Something isn't working label Apr 29, 2019
@ZandercraftGames
Copy link

Oof

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants