fix: //regen with custom populators (#1376)

* Refraction + more fixes

* Remove exception debug

* Fix populator issues with //regen

* Fixed code style

* Further simplify

* Update adapters

Co-authored-by: Alex <mc.cache@web.de>
This commit is contained in:
Pierre Maurice Schwang 2021-10-25 16:13:02 +02:00 committed by GitHub
parent 1b1f3bbcbe
commit 14cb97d0ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import com.fastasyncworldedit.core.Fawe;
import com.fastasyncworldedit.core.queue.IChunkCache; import com.fastasyncworldedit.core.queue.IChunkCache;
import com.fastasyncworldedit.core.queue.IChunkGet; import com.fastasyncworldedit.core.queue.IChunkGet;
import com.fastasyncworldedit.core.util.ReflectionUtils; import com.fastasyncworldedit.core.util.ReflectionUtils;
import com.fastasyncworldedit.core.util.TaskManager;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.mojang.datafixers.util.Either; import com.mojang.datafixers.util.Either;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
@ -324,10 +325,10 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
}, },
() -> server.overworld().getDataStorage() () -> server.overworld().getDataStorage()
) { ) {
// redirect to our protoChunks list // redirect to LevelChunks created in #createChunks
@Override @Override
public ChunkAccess getChunk(int x, int z, ChunkStatus chunkstatus, boolean flag) { public ChunkAccess getChunk(int x, int z, ChunkStatus chunkstatus, boolean flag) {
return getProtoChunkAt(x, z); return getChunkAt(x, z);
} }
}; };
@ -399,7 +400,8 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
@Override @Override
protected void populate(LevelChunk levelChunk, Random random, BlockPopulator blockPopulator) { protected void populate(LevelChunk levelChunk, Random random, BlockPopulator blockPopulator) {
blockPopulator.populate(freshWorld.getWorld(), random, levelChunk.bukkitChunk); // BlockPopulator#populate has to be called synchronously for TileEntity access
TaskManager.IMP.task(() -> blockPopulator.populate(freshWorld.getWorld(), random, levelChunk.getBukkitChunk()));
} }
@Override @Override