Skip to content

Commit

Permalink
Remove old chunkgen code & little cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
maityyy committed Oct 14, 2024
1 parent 9141263 commit 385f755
Show file tree
Hide file tree
Showing 63 changed files with 506 additions and 1,252 deletions.
8 changes: 4 additions & 4 deletions src/data/java/moriyashiine/aylyth/datagen/AylythDatagen.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import moriyashiine.aylyth.datagen.common.world.feature.AylythConfiguredFeatureBootstrap;
import moriyashiine.aylyth.datagen.common.world.feature.AylythPlacedFeatureBootstrap;
import moriyashiine.aylyth.datagen.common.world.terrain.AylythDensityFunctionBootstrap;
import moriyashiine.aylyth.datagen.common.world.terrain.AylythNoiseSettingBootstrap;
import moriyashiine.aylyth.datagen.common.world.terrain.AylythNoiseTypeBootstrap;
import moriyashiine.aylyth.datagen.common.world.terrain.AylythChunkGenSettingsBootstrap;
import moriyashiine.aylyth.datagen.common.world.terrain.AylythNoiseParametersBootstrap;
import moriyashiine.aylyth.datagen.common.loot.AylythBlockLootProvider;
import moriyashiine.aylyth.datagen.common.loot.AylythEntityLootProvider;
import moriyashiine.aylyth.datagen.common.tag.*;
Expand Down Expand Up @@ -53,9 +53,9 @@ public void onInitializeDataGenerator(FabricDataGenerator dataGenerator) {

@Override
public void buildRegistry(RegistryBuilder registryBuilder) {
registryBuilder.addRegistry(RegistryKeys.NOISE_PARAMETERS, AylythNoiseTypeBootstrap::bootstrap);
registryBuilder.addRegistry(RegistryKeys.NOISE_PARAMETERS, AylythNoiseParametersBootstrap::bootstrap);
registryBuilder.addRegistry(RegistryKeys.DENSITY_FUNCTION, AylythDensityFunctionBootstrap::bootstrap);
registryBuilder.addRegistry(RegistryKeys.CHUNK_GENERATOR_SETTINGS, AylythNoiseSettingBootstrap::bootstrap);
registryBuilder.addRegistry(RegistryKeys.CHUNK_GENERATOR_SETTINGS, AylythChunkGenSettingsBootstrap::bootstrap);
registryBuilder.addRegistry(RegistryKeys.CONFIGURED_CARVER, AylythConfiguredCarverBootstrap::bootstrap);
registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, AylythConfiguredFeatureBootstrap::bootstrap);
registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, AylythPlacedFeatureBootstrap::bootstrap);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package moriyashiine.aylyth.datagen.common.world.terrain;

import moriyashiine.aylyth.common.data.world.AylythDimensionData;
import moriyashiine.aylyth.common.data.world.terrain.AylythDensityFunctions;
import net.minecraft.block.Blocks;
import net.minecraft.registry.Registerable;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.world.biome.source.util.MultiNoiseUtil.NoiseHypercube;
import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
import net.minecraft.world.gen.chunk.GenerationShapeConfig;
import net.minecraft.world.gen.densityfunction.DensityFunctions;
import net.minecraft.world.gen.noise.NoiseRouter;

import java.util.List;

import static moriyashiine.aylyth.common.data.world.terrain.AylythDensityFunctions.*;
import static net.minecraft.world.gen.densityfunction.DensityFunctionTypes.*;

public final class AylythChunkGenSettingsBootstrap {
private AylythChunkGenSettingsBootstrap() {}

public static void bootstrap(Registerable<ChunkGeneratorSettings> context) {
var densityFunctions = context.getRegistryLookup(RegistryKeys.DENSITY_FUNCTION);
var noiseParameters = context.getRegistryLookup(RegistryKeys.NOISE_PARAMETERS);

// VANILLACOPY ChunkGeneratorSettings.OVERWORLD
// Fewer oceans, flatter terrain, disable ore veins, height 384 -> 304, vertical size 2 -> 1

var vanillaChunkGenSettings = ChunkGeneratorSettings.createSurfaceSettings(context, false, false);

var vanillaShape = vanillaChunkGenSettings.generationShapeConfig();
var shape = new GenerationShapeConfig(vanillaShape.minimumY(), 304, vanillaShape.horizontalSize(), 1);

var vanillaNoiseRouter = DensityFunctions.createSurfaceNoiseRouter(densityFunctions, noiseParameters, false, false);
var noiseRouter = new NoiseRouter(
vanillaNoiseRouter.barrierNoise(),
vanillaNoiseRouter.fluidLevelFloodednessNoise(),
vanillaNoiseRouter.fluidLevelSpreadNoise(),
vanillaNoiseRouter.lavaNoise(),
vanillaNoiseRouter.temperature(),
vanillaNoiseRouter.vegetation(),
AylythDensityFunctionBootstrap.wrap(densityFunctions.getOrThrow(MODIFIED_CONTINENTS)),
AylythDensityFunctionBootstrap.wrap(densityFunctions.getOrThrow(AylythDensityFunctions.MODIFIED_EROSION)),
AylythDensityFunctionBootstrap.wrap(densityFunctions.getOrThrow(OVERRIDDEN_DEPTH)),
vanillaNoiseRouter.ridges(),
AylythDensityFunctionBootstrap.wrap(densityFunctions.getOrThrow(OVERRIDDEN_INITIAL_DENSITY_WITHOUT_JAGGEDNESS)),
AylythDensityFunctionBootstrap.wrap(densityFunctions.getOrThrow(OVERRIDDEN_FINALE_DENSITY)),
zero(),
zero(),
zero()
);

var materialRules = AylythMaterialRuleBootstrap.materialRules();
var spawnTarget = List.<NoiseHypercube>of();
var seaLevel = vanillaChunkGenSettings.seaLevel();

context.register(AylythDimensionData.CHUNK_GEN_SETTINGS, new ChunkGeneratorSettings(shape, Blocks.DEEPSLATE.getDefaultState(), Blocks.WATER.getDefaultState(), noiseRouter, materialRules, spawnTarget, seaLevel, false, true, false, false));
}
}
Loading

0 comments on commit 385f755

Please sign in to comment.