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>
Dieser Commit ist enthalten in:
Pierre Maurice Schwang 2021-10-25 16:13:02 +02:00 committet von GitHub
Ursprung 1b1f3bbcbe
Commit 14cb97d0ad
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 5 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -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