mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 16:35:50 +00:00
update FabricChunkGeneratorWrapper
This commit is contained in:
parent
cd57a32f31
commit
9d131a8992
@ -17,32 +17,30 @@
|
||||
|
||||
package com.dfsek.terra.fabric.generation;
|
||||
|
||||
import com.dfsek.terra.api.world.info.WorldProperties;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.structure.StructureSet;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.math.random.CheckedRandom;
|
||||
import net.minecraft.util.math.random.ChunkRandom;
|
||||
import net.minecraft.util.math.random.RandomSeed;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryEntry;
|
||||
import net.minecraft.world.ChunkRegion;
|
||||
import net.minecraft.world.HeightLimitView;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.world.Heightmap.Type;
|
||||
import net.minecraft.world.SpawnHelper;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.source.BiomeAccess;
|
||||
import net.minecraft.world.biome.source.util.MultiNoiseUtil;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.GenerationStep.Carver;
|
||||
import net.minecraft.world.gen.StructureAccessor;
|
||||
import net.minecraft.world.gen.chunk.Blender;
|
||||
import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
|
||||
import net.minecraft.world.gen.chunk.VerticalBlockSample;
|
||||
import net.minecraft.world.gen.random.AtomicSimpleRandom;
|
||||
import net.minecraft.world.gen.random.ChunkRandom;
|
||||
import net.minecraft.world.gen.random.RandomSeed;
|
||||
import net.minecraft.world.gen.noise.NoiseConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -58,6 +56,7 @@ import com.dfsek.terra.api.world.chunk.generation.ProtoChunk;
|
||||
import com.dfsek.terra.api.world.chunk.generation.ProtoWorld;
|
||||
import com.dfsek.terra.api.world.chunk.generation.stage.Chunkified;
|
||||
import com.dfsek.terra.api.world.chunk.generation.util.GeneratorWrapper;
|
||||
import com.dfsek.terra.api.world.info.WorldProperties;
|
||||
import com.dfsek.terra.fabric.config.PreLoadCompatibilityOptions;
|
||||
import com.dfsek.terra.fabric.data.Codecs;
|
||||
import com.dfsek.terra.fabric.mixin.access.StructureAccessorAccessor;
|
||||
@ -76,7 +75,7 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
|
||||
|
||||
public FabricChunkGeneratorWrapper(Registry<StructureSet> noiseRegistry, TerraBiomeSource biomeSource, long seed, ConfigPack configPack,
|
||||
RegistryEntry<ChunkGeneratorSettings> settingsSupplier) {
|
||||
super(noiseRegistry, Optional.empty(), biomeSource, biomeSource, seed);
|
||||
super(noiseRegistry, Optional.empty(), biomeSource);
|
||||
this.noiseRegistry = noiseRegistry;
|
||||
this.pack = configPack;
|
||||
this.settings = settingsSupplier;
|
||||
@ -98,27 +97,19 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.minecraft.world.gen.chunk.ChunkGenerator withSeed(long seed) {
|
||||
return new FabricChunkGeneratorWrapper(noiseRegistry, (TerraBiomeSource) this.biomeSource.withSeed(seed), seed, pack, settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiNoiseUtil.MultiNoiseSampler getMultiNoiseSampler() {
|
||||
return MultiNoiseUtil.method_40443(); // zero
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildSurface(ChunkRegion region, StructureAccessor structures, Chunk chunk) {
|
||||
public void buildSurface(ChunkRegion region, StructureAccessor structures, NoiseConfig noiseConfig, Chunk chunk) {
|
||||
// no op
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populateEntities(ChunkRegion region) {
|
||||
ChunkPos chunkPos = region.getCenterPos();
|
||||
RegistryEntry<Biome> biome = region.getBiome(chunkPos.getStartPos().withY(region.getTopY() - 1));
|
||||
ChunkRandom chunkRandom = new ChunkRandom(new AtomicSimpleRandom(RandomSeed.getSeed()));
|
||||
chunkRandom.setPopulationSeed(region.getSeed(), chunkPos.getStartX(), chunkPos.getStartZ());
|
||||
SpawnHelper.populateEntities(region, biome, chunkPos, chunkRandom);
|
||||
if (!this.settings.value().mobGenerationDisabled()) {
|
||||
ChunkPos chunkPos = region.getCenterPos();
|
||||
RegistryEntry<Biome> registryEntry = region.getBiome(chunkPos.getStartPos().withY(region.getTopY() - 1));
|
||||
ChunkRandom chunkRandom = new ChunkRandom(new CheckedRandom(RandomSeed.getSeed()));
|
||||
chunkRandom.setPopulationSeed(region.getSeed(), chunkPos.getStartX(), chunkPos.getStartZ());
|
||||
SpawnHelper.populateEntities(region, registryEntry, chunkPos, chunkRandom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -127,7 +118,8 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Chunk> populateNoise(Executor executor, Blender arg, StructureAccessor structureAccessor, Chunk chunk) {
|
||||
public CompletableFuture<Chunk> populateNoise(Executor executor, Blender blender, NoiseConfig noiseConfig,
|
||||
StructureAccessor structureAccessor, Chunk chunk) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
ProtoWorld world = (ProtoWorld) ((StructureAccessorAccessor) structureAccessor).getWorld();
|
||||
BiomeProvider biomeProvider = pack.getBiomeProvider().caching(world);
|
||||
@ -162,8 +154,9 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
|
||||
return settings.value().generationShapeConfig().minimumY();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getHeight(int x, int z, Heightmap.Type heightmap, HeightLimitView height) {
|
||||
public int getHeight(int x, int z, Type heightmap, HeightLimitView height, NoiseConfig noiseConfig) {
|
||||
int y = height.getTopY();
|
||||
WorldProperties properties = FabricAdapter.adapt(height, seed);
|
||||
BiomeProvider biomeProvider = pack.getBiomeProvider().caching(properties);
|
||||
@ -175,7 +168,7 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
|
||||
}
|
||||
|
||||
@Override
|
||||
public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView height) {
|
||||
public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView height, NoiseConfig noiseConfig) {
|
||||
BlockState[] array = new BlockState[height.getHeight()];
|
||||
WorldProperties properties = FabricAdapter.adapt(height, seed);
|
||||
BiomeProvider biomeProvider = pack.getBiomeProvider().caching(properties);
|
||||
@ -186,7 +179,7 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDebugHudText(List<String> text, BlockPos pos) {
|
||||
public void getDebugHudText(List<String> text, NoiseConfig noiseConfig, BlockPos pos) {
|
||||
|
||||
}
|
||||
|
||||
@ -203,9 +196,9 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
|
||||
}
|
||||
|
||||
@Override
|
||||
public void carve(ChunkRegion chunkRegion, long seed, BiomeAccess biomeAccess, StructureAccessor structureAccessor, Chunk chunk,
|
||||
GenerationStep.Carver generationStep) {
|
||||
|
||||
public void carve(ChunkRegion chunkRegion, long seed, NoiseConfig noiseConfig, BiomeAccess world, StructureAccessor structureAccessor,
|
||||
Chunk chunk, Carver carverStep) {
|
||||
// no op
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user