implement caching biome provider

This commit is contained in:
dfsek
2021-12-30 16:01:19 -07:00
parent 74237e7568
commit d36fc7dec1
10 changed files with 74 additions and 50 deletions

View File

@@ -21,7 +21,6 @@ import com.dfsek.terra.api.block.state.BlockState;
import com.dfsek.terra.bukkit.world.BukkitWorldProperties;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.generator.BiomeProvider;
import org.bukkit.generator.BlockPopulator;
@@ -35,11 +34,9 @@ import java.util.Random;
import java.util.stream.Collectors;
import com.dfsek.terra.api.config.ConfigPack;
import com.dfsek.terra.api.world.ServerWorld;
import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator;
import com.dfsek.terra.api.world.chunk.generation.util.GeneratorWrapper;
import com.dfsek.terra.bukkit.world.BukkitProtoWorld;
import com.dfsek.terra.bukkit.world.BukkitServerWorld;
public class BukkitChunkGeneratorWrapper extends org.bukkit.generator.ChunkGenerator implements GeneratorWrapper {
@@ -60,7 +57,7 @@ public class BukkitChunkGeneratorWrapper extends org.bukkit.generator.ChunkGener
@Override
public void generateNoise(@NotNull WorldInfo worldInfo, @NotNull Random random, int x, int z, @NotNull ChunkData chunkData) {
delegate.generateChunkData(new BukkitProtoChunk(chunkData), new BukkitWorldProperties(worldInfo), x, z);
delegate.generateChunkData(new BukkitProtoChunk(chunkData), new BukkitWorldProperties(worldInfo), pack.getBiomeProvider().caching(), x, z);
}
@Override

View File

@@ -88,7 +88,7 @@ public class CLIWorld implements ServerWorld, NBTSerializable<Stream<Pair<Vector
try {
int num = amount.getAndIncrement();
CLIChunk chunk = getChunkAt(finalX, finalZ);
chunkGenerator.generateChunkData(chunk, this, finalX, finalZ);
chunkGenerator.generateChunkData(chunk, this, pack.getBiomeProvider().caching(), finalX, finalZ);
CLIProtoWorld protoWorld = new CLIProtoWorld(this, finalX, finalZ);
pack.getStages().forEach(stage -> stage.populate(protoWorld));
if(num % 240 == 239) {

View File

@@ -155,7 +155,7 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
public CompletableFuture<Chunk> populateNoise(Executor executor, Blender arg, StructureAccessor structureAccessor, Chunk chunk) {
return CompletableFuture.supplyAsync(() -> {
ProtoWorld world = (ProtoWorld) ((StructureAccessorAccessor) structureAccessor).getWorld();
delegate.generateChunkData((ProtoChunk) chunk, world, chunk.getPos().x, chunk.getPos().z);
delegate.generateChunkData((ProtoChunk) chunk, world, pack.getBiomeProvider().caching(), chunk.getPos().x, chunk.getPos().z);
pack.getStages().forEach(populator -> {
if(populator instanceof Chunkified) {
populator.populate(world);