|
1 | 1 | package com.cyao;
|
2 | 2 |
|
| 3 | +import com.mojang.serialization.MapCodec; |
| 4 | +import com.mojang.serialization.codecs.RecordCodecBuilder; |
3 | 5 | import net.minecraft.block.BlockState;
|
4 | 6 | import net.minecraft.block.Blocks;
|
5 | 7 | import net.minecraft.registry.entry.RegistryEntry;
|
| 8 | +import net.minecraft.world.ChunkRegion; |
| 9 | +import net.minecraft.world.biome.source.BiomeAccess; |
6 | 10 | import net.minecraft.world.biome.source.BiomeSource;
|
| 11 | +import net.minecraft.world.chunk.Chunk; |
| 12 | +import net.minecraft.world.gen.GenerationStep; |
| 13 | +import net.minecraft.world.gen.StructureAccessor; |
7 | 14 | import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
|
8 | 15 | import net.minecraft.world.gen.chunk.NoiseChunkGenerator;
|
| 16 | +import net.minecraft.world.gen.noise.NoiseConfig; |
9 | 17 |
|
10 | 18 | public class PaperWorldGenerator extends NoiseChunkGenerator {
|
| 19 | + public static final MapCodec<PaperWorldGenerator> CODEC = RecordCodecBuilder.mapCodec( |
| 20 | + instance -> instance.group( |
| 21 | + BiomeSource.CODEC.fieldOf("biome_source").forGetter(generator -> generator.biomeSource), |
| 22 | + ChunkGeneratorSettings.REGISTRY_CODEC.fieldOf("settings").forGetter(NoiseChunkGenerator::getSettings) |
| 23 | + ) |
| 24 | + .apply(instance, instance.stable(PaperWorldGenerator::new)) |
| 25 | + ); |
11 | 26 | private static final BlockState AIR = Blocks.AIR.getDefaultState();
|
12 | 27 |
|
13 | 28 | public PaperWorldGenerator(BiomeSource biomeSource, RegistryEntry<ChunkGeneratorSettings> settings) {
|
14 | 29 | super(biomeSource, settings);
|
15 |
| - System.out.println("Hello Paper Chunk Generator!"); |
| 30 | + } |
| 31 | + |
| 32 | + @Override |
| 33 | + public void carve( |
| 34 | + ChunkRegion chunkRegion, |
| 35 | + long seed, |
| 36 | + NoiseConfig noiseConfig, |
| 37 | + BiomeAccess biomeAccess, |
| 38 | + StructureAccessor structureAccessor, |
| 39 | + Chunk chunk, |
| 40 | + GenerationStep.Carver carverStep |
| 41 | + ) { |
| 42 | + FlatMinecraft.LOGGER.info("Carving!"); |
16 | 43 | }
|
17 | 44 | }
|
0 commit comments