Skip to content

Commit

Permalink
added deeper pools to caverns
Browse files Browse the repository at this point in the history
  • Loading branch information
NewJumper committed Jan 7, 2024
1 parent c4f54db commit 4d8ab07
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// 1.20.1 2024-01-05T15:02:13.0963244 Registries
// 1.20.1 2024-01-06T18:09:35.1430196 Registries
65c8c67a4ec7ef0ce6846fb2f4d921cc6ceb02e2 data/deeperdarker/damage_type/bite.json
0b65c61bd1e5086d0f3685566cc6cecf6e324516 data/deeperdarker/damage_type/ring.json
67f8cd0621b1c3614da8c1910f6b7bcb61660293 data/deeperdarker/dimension_type/otherside.json
a6825ff3df193695bcd5c22ec30bba66331e2648 data/deeperdarker/worldgen/biome/blooming_caverns.json
77fa1d6c4e5f29aaa620ea412ff7be9fe06d2c78 data/deeperdarker/worldgen/biome/blooming_caverns.json
4491dd6887a8760b77f9a28406c3e4c0535b108d data/deeperdarker/worldgen/biome/deeplands.json
bd2c433caf3a3f7dfff3668a68dbdf56fa994df5 data/deeperdarker/worldgen/biome/echoing_forest.json
06d29b9291ed3a63be90750a8c6f182e0c168b7b data/deeperdarker/worldgen/biome/overcast_columns.json
Expand Down Expand Up @@ -40,6 +40,7 @@ d714f6f1bb21e81f1cfcf57da473584f1a5d34c9 data/deeperdarker/worldgen/configured_f
41dc97a21cc1f0da3024ed5ace2a6b863ef0493f data/deeperdarker/worldgen/configured_feature/ore_soul_sand.json
fc53b26d9b7805848d81c20fdc426b2fbad6ef7b data/deeperdarker/worldgen/configured_feature/ore_soul_soil.json
64610c84954b59e1b10419cf4b48f3cb2c7c4ba2 data/deeperdarker/worldgen/configured_feature/plant_blooming.json
86f4c66fe5463d1bde07dcdd2a6176f74ab69892 data/deeperdarker/worldgen/configured_feature/pool_blooming.json
c3cadcbe56faf51699411c61418e62470e8f6d20 data/deeperdarker/worldgen/configured_feature/sculk_decoration.json
96f3ef8cd15afedd3241978ed2b2db5e16a3201b data/deeperdarker/worldgen/configured_feature/sculk_gleam_extra.json
beac5ffbea4ba9fcfa17cdec34fd04773d8f780d data/deeperdarker/worldgen/configured_feature/sculk_patch.json
Expand All @@ -53,8 +54,9 @@ b8c3bd59a4e59f1077d06e8f598c08387b66a40b data/deeperdarker/worldgen/configured_f
5df9b477f5858b1cf8e0d3d0db7bff27a7a07d97 data/deeperdarker/worldgen/configured_feature/water_edge_blooming.json
34fb9a5e22128132e9fb0b0a7700008873e4ac41 data/deeperdarker/worldgen/placed_feature/blooming_moss.json
86e9199652b2f2b45db99b8aba845e0c841ee88c data/deeperdarker/worldgen/placed_feature/blooming_plant.json
7a014f12c936a2ce55cd0df3b6e7d66934996c63 data/deeperdarker/worldgen/placed_feature/blooming_pool.json
fe37fcf58645ddec579c794a106fbcff6e32c041 data/deeperdarker/worldgen/placed_feature/blooming_sculk_vegetation.json
fba28903988665227d8487b59d683c9fa387913b data/deeperdarker/worldgen/placed_feature/blooming_water_edge.json
7af28967be32198f89f2b307bdbd34274d1d555b data/deeperdarker/worldgen/placed_feature/blooming_water_edge.json
cc0ab13e199295089d8269584cc7aa83b3595c9b data/deeperdarker/worldgen/placed_feature/echo_soil.json
e18687e9b7d94385510ea85e00af1ba4e24e32ec data/deeperdarker/worldgen/placed_feature/echo_tree.json
739dfb25c8e5de7a098ca0c9a256cc28d890e63c data/deeperdarker/worldgen/placed_feature/gloomslate_coal.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
},
"features": [
[],
[],
[
"deeperdarker:blooming_water_edge",
"deeperdarker:blooming_pool"
],
[],
[],
[],
Expand All @@ -48,7 +51,6 @@
[],
[],
[
"deeperdarker:blooming_water_edge",
"deeperdarker:blooming_sculk_vegetation",
"deeperdarker:blooming_plant",
"deeperdarker:glowing_roots",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "deeperdarker:pool",
"config": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"feature": "deeperdarker:pool_blooming",
"placement": [
{
"type": "minecraft:count_on_every_layer",
"count": 2
},
{
"type": "minecraft:biome"
},
{
"type": "minecraft:block_predicate_filter",
"predicate": {
"type": "minecraft:would_survive",
"state": {
"Name": "deeperdarker:blooming_sculk_stone"
}
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"placement": [
{
"type": "minecraft:count",
"count": 8
"count": 13
},
{
"type": "minecraft:in_square"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public class DDConfiguredFeatures {

public static final ResourceKey<ConfiguredFeature<?,?>> ORE_BLOOMING_MOSS = createKey("ore_blooming_moss");
public static final ResourceKey<ConfiguredFeature<?, ?>> WATER_EDGE_BLOOMING = createKey("water_edge_blooming");
public static final ResourceKey<ConfiguredFeature<?, ?>> POOL_BLOOMING = createKey("pool_blooming");

public static final ResourceKey<ConfiguredFeature<?,?>> ORE_GLOOMY_SCULK = createKey("ore_gloomy_sculk");
public static final ResourceKey<ConfiguredFeature<?, ?>> ORE_MAGMA = createKey("ore_magma");
Expand Down Expand Up @@ -147,6 +148,7 @@ public static void bootstrap(BootstapContext<ConfiguredFeature<?, ?>> context) {

FeatureUtils.register(context, ORE_BLOOMING_MOSS, Feature.ORE, new OreConfiguration(BLOOMING_MOSS_TARGET_LIST, 40));
FeatureUtils.register(context, WATER_EDGE_BLOOMING, Feature.WATERLOGGED_VEGETATION_PATCH, new VegetationPatchConfiguration(DDTags.Blocks.BLOOMING_POOL_REPLACEABLE, BlockStateProvider.simple(DDBlocks.BLOOMING_SCULK_STONE.get()), PlacementUtils.inlinePlaced(configuredFeatures.getOrThrow(BLOOMING_SCULK_VEGETATION)), CaveSurface.FLOOR, ConstantInt.of(4), 0.8f, 3, 0f, UniformInt.of(2, 5), 0.3f));
FeatureUtils.register(context, POOL_BLOOMING, DDFeatures.POOL.get());

FeatureUtils.register(context, ORE_GLOOMY_SCULK, Feature.ORE, new OreConfiguration(GLOOMY_SCULK_TARGET_LIST, 64));
FeatureUtils.register(context, ORE_MAGMA, Feature.ORE, new OreConfiguration(MAGMA_TARGET_LIST, 64));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ public class DDFeatures {
public static final RegistryObject<SculkGleamFeature> SCULK_GLEAM_BLOB = FEATURES.register("sculk_gleam_blob", () -> new SculkGleamFeature(NoneFeatureConfiguration.CODEC));
public static final RegistryObject<SculkTendrilsFeature> SCULK_TENDRILS = FEATURES.register("sculk_tendrils", () -> new SculkTendrilsFeature(NoneFeatureConfiguration.CODEC));
public static final RegistryObject<GlowingRootsFeature> GLOWING_ROOTS = FEATURES.register("glowing_roots", () -> new GlowingRootsFeature(NoneFeatureConfiguration.CODEC));

public static final RegistryObject<OthersidePoolFeature> POOL = FEATURES.register("pool", () -> new OthersidePoolFeature(NoneFeatureConfiguration.CODEC));
public static final RegistryObject<BloomingStemFeature> BLOOMING_STEM = FEATURES.register("blooming_stem", () -> new BloomingStemFeature(NoneFeatureConfiguration.CODEC));
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class DDPlacedFeatures {

public static final ResourceKey<PlacedFeature> BLOOMING_MOSS = createKey("blooming_moss");
public static final ResourceKey<PlacedFeature> BLOOMING_WATER_EDGE = createKey("blooming_water_edge");
public static final ResourceKey<PlacedFeature> BLOOMING_POOL = createKey("blooming_pool");

public static final ResourceKey<PlacedFeature> GLOOMY_SCULK = createKey("gloomy_sculk");
public static final ResourceKey<PlacedFeature> MAGMA = createKey("magma");
Expand Down Expand Up @@ -100,7 +101,8 @@ public static void bootstrap(BootstapContext<PlacedFeature> context) {
PlacementUtils.register(context, SCULK_DIAMOND, features.getOrThrow(DDConfiguredFeatures.ORE_SCULK_DIAMOND), countPlacement(3, HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-32), VerticalAnchor.aboveBottom(50))));

PlacementUtils.register(context, BLOOMING_MOSS, features.getOrThrow(DDConfiguredFeatures.ORE_BLOOMING_MOSS), countPlacement(19, PlacementUtils.FULL_RANGE));
PlacementUtils.register(context, BLOOMING_WATER_EDGE, features.getOrThrow(DDConfiguredFeatures.WATER_EDGE_BLOOMING), CountPlacement.of(8), InSquarePlacement.spread(), PlacementUtils.FULL_RANGE, EnvironmentScanPlacement.scanningFor(Direction.DOWN, BlockPredicate.solid(), BlockPredicate.ONLY_IN_AIR_PREDICATE, 12), RandomOffsetPlacement.vertical(ConstantInt.of(1)), BiomeFilter.biome());
PlacementUtils.register(context, BLOOMING_WATER_EDGE, features.getOrThrow(DDConfiguredFeatures.WATER_EDGE_BLOOMING), CountPlacement.of(13), InSquarePlacement.spread(), PlacementUtils.FULL_RANGE, EnvironmentScanPlacement.scanningFor(Direction.DOWN, BlockPredicate.solid(), BlockPredicate.ONLY_IN_AIR_PREDICATE, 12), RandomOffsetPlacement.vertical(ConstantInt.of(1)), BiomeFilter.biome());
PlacementUtils.register(context, BLOOMING_POOL, features.getOrThrow(DDConfiguredFeatures.POOL_BLOOMING), CountOnEveryLayerPlacement.of(2), BiomeFilter.biome(), BlockPredicateFilter.forPredicate(BlockPredicate.wouldSurvive(DDBlocks.BLOOMING_SCULK_STONE.get().defaultBlockState(), BlockPos.ZERO)));

PlacementUtils.register(context, GLOOMY_SCULK, features.getOrThrow(DDConfiguredFeatures.ORE_GLOOMY_SCULK), countPlacement(96, HeightRangePlacement.uniform(VerticalAnchor.bottom(), VerticalAnchor.aboveBottom(32))));
PlacementUtils.register(context, MAGMA, features.getOrThrow(DDConfiguredFeatures.ORE_MAGMA), countPlacement(128, PlacementUtils.FULL_RANGE));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package com.kyanite.deeperdarker.world.features;

import com.kyanite.deeperdarker.content.DDBlocks;
import com.kyanite.deeperdarker.content.blocks.vegetation.GlowingGrassBlock;
import com.mojang.serialization.Codec;
import net.minecraft.core.BlockPos;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import org.jetbrains.annotations.NotNull;

public class OthersidePoolFeature extends Feature<NoneFeatureConfiguration> {
public OthersidePoolFeature(Codec<NoneFeatureConfiguration> pCodec) {
super(pCodec);
}

@Override
public boolean place(@NotNull FeaturePlaceContext<NoneFeatureConfiguration> pContext) {
BlockPos origin = pContext.origin();
WorldGenLevel level = pContext.level();
RandomSource random = pContext.random();

if(origin.getY() <= level.getMinBuildHeight() + 4) return false;

origin = origin.below(4);
boolean[] arr = new boolean[2048];
int size = random.nextInt(5, 10);

for(int i = 0; i < size; i++) {
double length = random.nextDouble() * 6 + 3;
double depth = random.nextDouble() * 5 + 2;
double width = random.nextDouble() * 6 + 3;
double d3 = random.nextDouble() * (14 - length) + 1 + length / 2.0;
double d4 = random.nextDouble() * (4 - depth) + 2 + depth / 2.0;
double d5 = random.nextDouble() * (14 - width) + 1 + width / 2.0;

for(int l = 1; l < 15; l++) {
for(int i1 = 1; i1 < 15; i1++) {
for(int j1 = 1; j1 < 7; j1++) {
double d6 = ((double)l - d3) / (length / 2.0);
double d7 = ((double)j1 - d4) / (depth / 2.0);
double d8 = ((double)i1 - d5) / (width / 2.0);
double d9 = d6 * d6 + d7 * d7 + d8 * d8;
if(d9 < 1) arr[(l * 16 + i1) * 8 + j1] = true;
}
}
}
}

for(int k1 = 0; k1 < 16; k1++) {
for(int k = 0; k < 16; k++) {
for(int l2 = 0; l2 < 8; l2++) {
boolean flag = !arr[(k1 * 16 + k) * 8 + l2] && (k1 < 15 && arr[((k1 + 1) * 16 + k) * 8 + l2] || k1 > 0 && arr[((k1 - 1) * 16 + k) * 8 + l2] || k < 15 && arr[(k1 * 16 + k + 1) * 8 + l2] || k > 0 && arr[(k1 * 16 + (k - 1)) * 8 + l2] || l2 < 7 && arr[(k1 * 16 + k) * 8 + l2 + 1] || l2 > 0 && arr[(k1 * 16 + k) * 8 + (l2 - 1)]);
if(flag) {
BlockState state = level.getBlockState(origin.offset(k1, l2, k));
if (l2 >= 4 && state.liquid()) return false;
if (l2 < 4 && !state.isSolid() && !level.getBlockState(origin.offset(k1, l2, k)).is(Blocks.WATER)) return false;
}
}
}
}

for(int l1 = 0; l1 < 16; ++l1) {
for(int i2 = 0; i2 < 16; ++i2) {
for(int i3 = 0; i3 < 8; ++i3) {
if(arr[(l1 * 16 + i2) * 8 + i3]) {
BlockPos pos = origin.offset(l1, i3, i2);
if(this.canReplaceBlock(level.getBlockState(pos))) {
boolean above = i3 >= 4;
if(!above && level.getBlockState(pos.below()).is(DDBlocks.SCULK_STONE.get()) && random.nextFloat() < 0.1f) level.setBlock(pos, DDBlocks.GLOWING_GRASS.get().defaultBlockState().setValue(GlowingGrassBlock.WATERLOGGED, true), 2);
else level.setBlock(pos, above ? Blocks.CAVE_AIR.defaultBlockState() : Blocks.WATER.defaultBlockState(), 2);
if(above) {
level.scheduleTick(pos, Blocks.CAVE_AIR, 0);
this.markAboveForPostProcessing(level, pos);
}
}
}
}
}
}

for(int j2 = 0; j2 < 16; ++j2) {
for(int j3 = 0; j3 < 16; ++j3) {
for(int l3 = 0; l3 < 8; ++l3) {
boolean flag2 = !arr[(j2 * 16 + j3) * 8 + l3] && (j2 < 15 && arr[((j2 + 1) * 16 + j3) * 8 + l3] || j2 > 0 && arr[((j2 - 1) * 16 + j3) * 8 + l3] || j3 < 15 && arr[(j2 * 16 + j3 + 1) * 8 + l3] || j3 > 0 && arr[(j2 * 16 + (j3 - 1)) * 8 + l3] || l3 < 7 && arr[(j2 * 16 + j3) * 8 + l3 + 1] || l3 > 0 && arr[(j2 * 16 + j3) * 8 + (l3 - 1)]);
if(flag2 && (l3 < 4 || random.nextInt(2) != 0)) {
BlockState state = level.getBlockState(origin.offset(j2, l3, j3));
if(state.isSolid() && !state.is(BlockTags.LAVA_POOL_STONE_CANNOT_REPLACE)) {
BlockPos pos = origin.offset(j2, l3, j3);
if(level.getBlockState(pos.above()).isAir()) level.setBlock(pos, DDBlocks.BLOOMING_SCULK_STONE.get().defaultBlockState(), 2);
else level.setBlock(pos, DDBlocks.SCULK_STONE.get().defaultBlockState(), 2);
this.markAboveForPostProcessing(level, pos);
}
}
}
}
}

return true;
}

private boolean canReplaceBlock(BlockState state) {
return !state.is(BlockTags.FEATURES_CANNOT_REPLACE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ private static Biome bloomingCaverns(HolderGetter<PlacedFeature> placedFeatures,
mobSpawnBuilder.addSpawn(MobCategory.MONSTER, new MobSpawnSettings.SpawnerData(DDEntities.SCULK_SNAPPER.get(), 1, 1, 2));

BiomeGenerationSettings.Builder biomeBuilder = new BiomeGenerationSettings.Builder(placedFeatures, worldCarvers);
biomeBuilder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, DDPlacedFeatures.BLOOMING_WATER_EDGE);
biomeBuilder.addFeature(GenerationStep.Decoration.LAKES, DDPlacedFeatures.BLOOMING_WATER_EDGE);
biomeBuilder.addFeature(GenerationStep.Decoration.LAKES, DDPlacedFeatures.BLOOMING_POOL);
biomeBuilder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, DDPlacedFeatures.BLOOMING_SCULK_VEGETATION);
biomeBuilder.addFeature(GenerationStep.Decoration.UNDERGROUND_ORES, DDPlacedFeatures.BLOOMING_MOSS);
biomeBuilder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, DDPlacedFeatures.BLOOMING_PLANT);
Expand Down

0 comments on commit 4d8ab07

Please sign in to comment.