pull more methods to WorldAccess

This commit is contained in:
dfsek
2021-11-28 12:01:12 -07:00
parent 5ed7733320
commit 01f6df4a19
7 changed files with 42 additions and 13 deletions

View File

@@ -19,6 +19,8 @@ package com.dfsek.terra.bukkit.generator;
import com.dfsek.terra.api.config.ConfigPack;
import com.dfsek.terra.bukkit.world.BukkitProtoWorld;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.generator.BiomeProvider;
@@ -59,7 +61,7 @@ public class BukkitChunkGeneratorWrapper extends org.bukkit.generator.ChunkGener
if(this.worldConfig == null) {
this.worldConfig = delegate.getConfigPack().toWorldConfig(BukkitAdapter.adapt(Bukkit.getWorld(worldInfo.getUID())));
}
delegate.generateChunkData(worldConfig.getWorld(), random, x, z, new BukkitProtoChunk(chunkData));
delegate.generateChunkData(new BukkitProtoChunk(chunkData), worldConfig.getWorld(), z, x);
}
@Override

View File

@@ -2,13 +2,17 @@ package com.dfsek.terra.bukkit.world;
import com.dfsek.terra.api.block.entity.BlockEntity;
import com.dfsek.terra.api.block.state.BlockState;
import com.dfsek.terra.api.config.WorldConfig;
import com.dfsek.terra.api.entity.Entity;
import com.dfsek.terra.api.entity.EntityType;
import com.dfsek.terra.api.util.vector.Vector3;
import com.dfsek.terra.api.world.access.World;
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator;
import com.dfsek.terra.api.world.chunk.generation.ProtoWorld;
import com.dfsek.terra.bukkit.BukkitEntity;
import com.dfsek.terra.bukkit.generator.BukkitChunkGeneratorWrapper;
import com.dfsek.terra.bukkit.world.block.data.BukkitBlockState;
import com.dfsek.terra.bukkit.world.block.state.BukkitBlockEntity;
@@ -69,6 +73,21 @@ public class BukkitProtoWorld implements ProtoWorld {
}
@Override
public ChunkGenerator getGenerator() {
return ((BukkitChunkGeneratorWrapper) delegate.getWorld().getGenerator()).getHandle();
}
@Override
public BiomeProvider getBiomeProvider() {
return ((BukkitChunkGeneratorWrapper) delegate.getWorld().getGenerator()).getWorldConfig().getProvider();
}
@Override
public WorldConfig getConfig() {
return ((BukkitChunkGeneratorWrapper) delegate.getWorld().getGenerator()).getWorldConfig();
}
@Override
public int centerChunkX() {
return delegate.getCenterChunkX();

View File

@@ -17,6 +17,8 @@
package com.dfsek.terra.fabric.generation;
import com.dfsek.terra.api.world.chunk.generation.ProtoWorld;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.block.BlockState;
@@ -62,7 +64,6 @@ import com.dfsek.terra.api.world.generator.GeneratorWrapper;
import com.dfsek.terra.fabric.FabricEntryPoint;
import com.dfsek.terra.fabric.block.FabricBlockState;
import com.dfsek.terra.fabric.mixin.StructureAccessorAccessor;
import com.dfsek.terra.util.FastRandom;
public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.ChunkGenerator implements GeneratorWrapper {
@@ -193,7 +194,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(() -> {
World world = (World) ((StructureAccessorAccessor) structureAccessor).getWorld();
delegate.generateChunkData(world, new FastRandom(), chunk.getPos().x, chunk.getPos().z, (ProtoChunk) chunk);
delegate.generateChunkData((ProtoChunk) chunk, (ProtoWorld) world, chunk.getPos().z, chunk.getPos().x);
delegate.getGenerationStages().forEach(populator -> {
if(populator instanceof Chunkified) {
populator.populate(world, (com.dfsek.terra.api.world.chunk.Chunk) world);