Paper: Reimplement Chunk-Regeneration

Created on 11 Sep 2019  ·  25Comments  ·  Source: PaperMC/Paper

We are hosting a minecraft-network with 500-1000 concurrent players and we love to use paper especially because of the performance problems in the new versions (our servers are running on 1.14.4).

Now we have a problem: With version 1.14 it is no longer posible to regenerate chunks like before: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#regenerateChunk-int-int-

We need an implementation of that for the version 1.14.4 but our dev-team has not the time and the knowledge to do this. So we decided to give the person that can do this for us a donation of 150€. The condition is a working implementation for regenerating chunks that works like World#regenerateChunk in version 1.13.2 or better.

If you need any proof for this offer, add me on Discord: Cytoox#3169

Thanks for you time!

feature

Most helpful comment

I’ll give it a go, I’ve been working with terrain generation for 8 months so I feel like I should try to solve this problem.

All 25 comments

@Spottedleaf ez 150€

@Cytoox you could use https://www.spigotmc.org/resources/coreprotect.8631/ and restore area to its original state. I know it's not the same thing but would help in the mean time.
(note that this will apply only from the moment you'll install CoreProtect as it logs block changes, it won't be able to know what changes were made before its installation).

Can I get my 150€? lol

Well thats not what we want 😅

From the JavaDocs
"Deprecated.
regenerating a single chunk is not likely to produce the same chunk as before as terrain decoration may be spread across chunks. Use of this method should be avoided as it is known to produce buggy results."

If you don't mind that, you can keep on using the regenerateChunk method.
If you do, you'd need to pretty much rewrite all world generation in order to support it. (Also, look below for another possible solution)

@Cytoox
Only way to restore the exact state of chunk is to save it with a logger plugin or a custom made one (pretty simple to do, you just have to save chunk data on chunk generation event).
If you don't care about getting the same exact chunk you can use regenerateChunk method as @PixelLima said

... The point of this issue is that the method currently does not have any implementation at all.

We don't need to restore the chunk 100% accurately. That's why we said "works like World#regenerateChunk in version 1.13.2 or better". It didn't work perfectly in 1.13.2 and doesn't need to be any better than that.
We can't use regenerateChunk, since it's functionality got completely removed. That's why we opened this issue in the first place.

Only way to do that is to save chunk data on its first generation and restore it later.

You are answering the wrong question - all they (and we) want is for that method to be reimplemented. Not to search for (hacky and/or memory intensive) alternatives 🤷‍♂️

Well how did it work in 1.13.2 then? Again: We are not asking for chunks the be restored accurately. We only want an implementation in 1.14.4 like the one that exists in 1.13.2.

Let me see what I can do

Maybe you can take a look at https://github.com/Jikoo/Regionerator code, it deletes chunk data directly from region files, so they can be regenerated automatically by server

World Edit has a fix for this, you could try using the WE API.

not so much a fix as a workaround. we just make a new world and copy blocks in from that.

Without restarting?

not so much a fix as a workaround. we just make a new world and copy blocks in from that.

Very smart, didn't think about this. Basically you have two copies of the world, one with no buildings and one where players can play?

no, but you can do that with backups and the snapshot restore feature, which is completely separate but honestly much more useful if people have the foresight to make a backup.

edit: also for the record there's /delchunks, which does essentially the same thing as the regionerator that was linked earlier, though we only do it on a restart for safety reasons.

World Edit has a fix for this, you could try using the WE API.

We are testing the workaround from worldedit on our live systems now.
It seems to work well!

@wizjany Perhaps entities in the region should also be removed when regenerating

This isn't the place to discuss worldedit features.

I’ll give it a go, I’ve been working with terrain generation for 8 months so I feel like I should try to solve this problem.

Alright so I thought regenerating was going to be easier to implement than how it is. So after many failed attempts I came up with a workaround that does it's job and replaces the chunks with original generation ones, but it requires first the creation of another world on the same server. Then the plugin allows for easy selection and import of chunks from the other world. The chunks are grabbed from the same place as the replaced ones, so there's no coordinate and schematic headaches.
Have a look for yourselves, I also published the source.
https://www.spigotmc.org/resources/chunktransfer-across-worlds-useful-for-chunk-regeneration.74219/

Edit: I know that this isn't a regen function, but honestly this is extremely close to that, and you don't need a backup, just instantiate a new world with the same seed and generator. Also this produces consistent results where the decoration is how it was originally (for obvious reasons).

That's...pretty much exactly what worldedit does already?

That's...pretty much exactly what worldedit does already?

What command would you use from WE to do that?
I'm not sure how easy it is to use WE's function, I wrote something that made sense to me in terms of simplicity and goal. Also my approach loads one chunk at a time, I tested it on a 600MB server with 40 x 40 chunks transferred, and it was fine.

Was this page helpful?
0 / 5 - 0 ratings