From 3fd887eb1297c801511bd5ff0ea2ee2f8351ee2e Mon Sep 17 00:00:00 2001 From: Forstride Date: Sun, 14 Jan 2024 10:28:45 -0500 Subject: [PATCH] Started on Dead Coral generation, improvements to Anomaly generation --- .../103d9f3f36b01595f1aa5172191e60eff02e6924 | 8 +- .../worldgen/biome/end_reef.json | 8 ++ .../configured_feature/barnacles.json | 4 + .../configured_feature/dead_coral.json | 28 ++++++ .../worldgen/placed_feature/barnacles.json | 19 ++++ .../worldgen/placed_feature/dead_coral.json | 21 +++++ .../biomesoplenty/biome/BOPEndBiomes.java | 2 + .../main/java/biomesoplenty/init/ModTags.java | 4 + .../worldgen/feature/BOPBaseFeatures.java | 9 +- .../worldgen/feature/BOPEndFeatures.java | 11 ++- .../worldgen/feature/misc/AnomalyFeature.java | 4 +- .../feature/misc/BarnacleFeature.java | 80 ++++++++++++++++ .../feature/misc/DeadCoralClawFeature.java | 93 +++++++++++++++++++ .../misc/DeadCoralMushroomFeature.java | 93 +++++++++++++++++++ .../feature/misc/DeadCoralTreeFeature.java | 93 +++++++++++++++++++ .../worldgen/placement/BOPEndPlacements.java | 6 ++ .../tags/blocks/dead_coral_blocks.json | 9 ++ .../tags/blocks/dead_coral_plants.json | 9 ++ .../tags/blocks/dead_corals.json | 10 ++ .../tags/blocks/dead_wall_corals.json | 9 ++ 20 files changed, 511 insertions(+), 9 deletions(-) create mode 100644 common/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/barnacles.json create mode 100644 common/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/dead_coral.json create mode 100644 common/src/generated/resources/data/biomesoplenty/worldgen/placed_feature/barnacles.json create mode 100644 common/src/generated/resources/data/biomesoplenty/worldgen/placed_feature/dead_coral.json create mode 100644 common/src/main/java/biomesoplenty/worldgen/feature/misc/BarnacleFeature.java create mode 100644 common/src/main/java/biomesoplenty/worldgen/feature/misc/DeadCoralClawFeature.java create mode 100644 common/src/main/java/biomesoplenty/worldgen/feature/misc/DeadCoralMushroomFeature.java create mode 100644 common/src/main/java/biomesoplenty/worldgen/feature/misc/DeadCoralTreeFeature.java create mode 100644 common/src/main/resources/data/biomesoplenty/tags/blocks/dead_coral_blocks.json create mode 100644 common/src/main/resources/data/biomesoplenty/tags/blocks/dead_coral_plants.json create mode 100644 common/src/main/resources/data/biomesoplenty/tags/blocks/dead_corals.json create mode 100644 common/src/main/resources/data/biomesoplenty/tags/blocks/dead_wall_corals.json diff --git a/common/src/generated/resources/.cache/103d9f3f36b01595f1aa5172191e60eff02e6924 b/common/src/generated/resources/.cache/103d9f3f36b01595f1aa5172191e60eff02e6924 index 4d193607b..1db8af5a4 100644 --- a/common/src/generated/resources/.cache/103d9f3f36b01595f1aa5172191e60eff02e6924 +++ b/common/src/generated/resources/.cache/103d9f3f36b01595f1aa5172191e60eff02e6924 @@ -1,4 +1,4 @@ -// 1.20.4 2024-01-14T02:13:56.8026759 Registries +// 1.20.4 2024-01-14T10:15:31.5981195 Registries bec08031dc5126119d3c7a1033703f8235bdf56e data/biomesoplenty/damage_type/bramble.json 41f8df67f585538edc9847b6754275d24b813e06 data/biomesoplenty/damage_type/fumarole.json 1db19ce8d33b8c131955b60ed830200bbee6a912 data/biomesoplenty/worldgen/biome/aspen_glade.json @@ -16,7 +16,7 @@ d4a9226ceaef3cf4eed45892e027c1eabf9fcd72 data/biomesoplenty/worldgen/biome/dune_ 253f26c8caa759d436ace9d8d5fe7ddc55ee4f8c data/biomesoplenty/worldgen/biome/end_aeries.json 1d2989a8aed931ff5de5fabff53cd9014d8f0c21 data/biomesoplenty/worldgen/biome/end_corruption.json 253f26c8caa759d436ace9d8d5fe7ddc55ee4f8c data/biomesoplenty/worldgen/biome/end_drifts.json -253f26c8caa759d436ace9d8d5fe7ddc55ee4f8c data/biomesoplenty/worldgen/biome/end_reef.json +32b9b82ab839f70df725c3aceaf2ea2a0bb2cbd3 data/biomesoplenty/worldgen/biome/end_reef.json 01773716ee0f40a49bb0f57b9abd91d5195f0be2 data/biomesoplenty/worldgen/biome/end_wilds.json a89d541384f1a879bb82d9c984d98c512474d27c data/biomesoplenty/worldgen/biome/erupting_inferno.json d662a9e04a7840345595d343cc34426393c04699 data/biomesoplenty/worldgen/biome/field.json @@ -78,6 +78,7 @@ a4d5101a19a38da4f42164b672b74766edb26bc9 data/biomesoplenty/worldgen/configured_ d5b35b4d78f4ece7de470e07042aa6b0d37b967f data/biomesoplenty/worldgen/configured_feature/acacia_twiglet_small.json 5ad22ddf8febfef57979f7bed8ab4afe22358ee9 data/biomesoplenty/worldgen/configured_feature/anomaly.json 0a655897c67fb080ad5a16402720bfbec87cf3e7 data/biomesoplenty/worldgen/configured_feature/aspen_tree.json +3cf80e67a2afd31591c0c30781dc8193105ec316 data/biomesoplenty/worldgen/configured_feature/barnacles.json 14386c8cb811e1cd0d768ba7fe5b06642e0471c7 data/biomesoplenty/worldgen/configured_feature/big_dripleaf.json 9e764721494e61fc108e60fa5e2b3c44158b736f data/biomesoplenty/worldgen/configured_feature/big_flowering_oak_tree.json 76d786439348db02c59279d595db7e28459d07d1 data/biomesoplenty/worldgen/configured_feature/big_flowering_oak_tree_bees.json @@ -109,6 +110,7 @@ d208d291658b2a5cabee58b8efffdfbbce41aee8 data/biomesoplenty/worldgen/configured_ 64932fa65018e2be7acff61093a904d583277b44 data/biomesoplenty/worldgen/configured_feature/cypress_tree.json 0f79e15b55bf3b5be1523ed3e85ea4fa26a796d0 data/biomesoplenty/worldgen/configured_feature/cypress_tree_medium.json 1c568da7ae87f6695078ede1bef42f1488501f5e data/biomesoplenty/worldgen/configured_feature/dark_oak_poplar_tree.json +732e6858936bf354d3274e1c4b4e5217a5ccaba0 data/biomesoplenty/worldgen/configured_feature/dead_coral.json cd2b9f82f108fe30dd3a4a878bd7216a37c98091 data/biomesoplenty/worldgen/configured_feature/dead_grass.json 08290748a4feb659eabc32c099b036ba04f3d930 data/biomesoplenty/worldgen/configured_feature/dead_tree_wasteland.json 599fe99edb01b6d56389ca55908717765a1ea2cb data/biomesoplenty/worldgen/configured_feature/dead_twiglet_tree.json @@ -345,6 +347,7 @@ c548e3e1710931daabe90c90b6b7ad46c66bedda data/biomesoplenty/worldgen/configured_ 5b240cfa80edf39078866602b63410068a2dae30 data/biomesoplenty/worldgen/placed_feature/acacia_twiglet_small.json 0381b44f5e62e5796b4a89805d3c337730562c51 data/biomesoplenty/worldgen/placed_feature/anomaly.json 176edb4fcaa5785050c8543834fc6c30848fe124 data/biomesoplenty/worldgen/placed_feature/aspen_tree.json +262fcb297eaf8332542e67df044ed67d3c6f9211 data/biomesoplenty/worldgen/placed_feature/barnacles.json 7395a3d04e360d03dc998ebc9cf6b8d66e41433d data/biomesoplenty/worldgen/placed_feature/big_dripleaf.json ea928d87f641694fd67f7dd56ffb25f2cf02d033 data/biomesoplenty/worldgen/placed_feature/big_flowering_tree.json 0e5d77a2ea27daea073139ed83382706b1562332 data/biomesoplenty/worldgen/placed_feature/big_hellbark_tree.json @@ -372,6 +375,7 @@ ea74748c10a9cb9224fc0be2822956acc94867a1 data/biomesoplenty/worldgen/placed_feat 5c6e712bb74bc268bb6659e0f73e7797fdb2d353 data/biomesoplenty/worldgen/placed_feature/cypress_tree.json 195481b0426113a9bcaf519cc9064cbebf8507b4 data/biomesoplenty/worldgen/placed_feature/cypress_tree_medium.json 4143fbe4921960b7c766593a0c0fb4bef8c2e88a data/biomesoplenty/worldgen/placed_feature/dark_oak_poplar_tree.json +bd6c74a95487b39da5b3d9ff003d485685b547c9 data/biomesoplenty/worldgen/placed_feature/dead_coral.json 491adc1fc84802b69d5bb5800507d773cb23e54b data/biomesoplenty/worldgen/placed_feature/dead_grass_45.json cec9215a5d9f08511ddbddd59bec252ce4c4d204 data/biomesoplenty/worldgen/placed_feature/dead_tree_wasteland.json 57486a3dd4ba0cb77a463c588a2af146eb586b40 data/biomesoplenty/worldgen/placed_feature/dead_twiglet_tree.json diff --git a/common/src/generated/resources/data/biomesoplenty/worldgen/biome/end_reef.json b/common/src/generated/resources/data/biomesoplenty/worldgen/biome/end_reef.json index 72d67b7c2..7979ba1e7 100644 --- a/common/src/generated/resources/data/biomesoplenty/worldgen/biome/end_reef.json +++ b/common/src/generated/resources/data/biomesoplenty/worldgen/biome/end_reef.json @@ -20,6 +20,14 @@ [], [ "minecraft:end_gateway_return" + ], + [], + [], + [], + [], + [ + "biomesoplenty:dead_coral", + "biomesoplenty:barnacles" ] ], "has_precipitation": false, diff --git a/common/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/barnacles.json b/common/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/barnacles.json new file mode 100644 index 000000000..ec9a363bc --- /dev/null +++ b/common/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/barnacles.json @@ -0,0 +1,4 @@ +{ + "type": "biomesoplenty:barnacles", + "config": {} +} \ No newline at end of file diff --git a/common/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/dead_coral.json b/common/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/dead_coral.json new file mode 100644 index 000000000..7c5c2dd38 --- /dev/null +++ b/common/src/generated/resources/data/biomesoplenty/worldgen/configured_feature/dead_coral.json @@ -0,0 +1,28 @@ +{ + "type": "minecraft:simple_random_selector", + "config": { + "features": [ + { + "feature": { + "type": "biomesoplenty:dead_coral_tree", + "config": {} + }, + "placement": [] + }, + { + "feature": { + "type": "biomesoplenty:dead_coral_claw", + "config": {} + }, + "placement": [] + }, + { + "feature": { + "type": "biomesoplenty:dead_coral_mushroom", + "config": {} + }, + "placement": [] + } + ] + } +} \ No newline at end of file diff --git a/common/src/generated/resources/data/biomesoplenty/worldgen/placed_feature/barnacles.json b/common/src/generated/resources/data/biomesoplenty/worldgen/placed_feature/barnacles.json new file mode 100644 index 000000000..9314c46fa --- /dev/null +++ b/common/src/generated/resources/data/biomesoplenty/worldgen/placed_feature/barnacles.json @@ -0,0 +1,19 @@ +{ + "feature": "biomesoplenty:barnacles", + "placement": [ + { + "type": "minecraft:count", + "count": 4 + }, + { + "type": "minecraft:in_square" + }, + { + "type": "minecraft:heightmap", + "heightmap": "MOTION_BLOCKING" + }, + { + "type": "minecraft:biome" + } + ] +} \ No newline at end of file diff --git a/common/src/generated/resources/data/biomesoplenty/worldgen/placed_feature/dead_coral.json b/common/src/generated/resources/data/biomesoplenty/worldgen/placed_feature/dead_coral.json new file mode 100644 index 000000000..de54e1421 --- /dev/null +++ b/common/src/generated/resources/data/biomesoplenty/worldgen/placed_feature/dead_coral.json @@ -0,0 +1,21 @@ +{ + "feature": "biomesoplenty:dead_coral", + "placement": [ + { + "type": "minecraft:noise_based_count", + "noise_factor": 400.0, + "noise_offset": 0.0, + "noise_to_count_ratio": 20 + }, + { + "type": "minecraft:in_square" + }, + { + "type": "minecraft:heightmap", + "heightmap": "OCEAN_FLOOR_WG" + }, + { + "type": "minecraft:biome" + } + ] +} \ No newline at end of file diff --git a/common/src/main/java/biomesoplenty/biome/BOPEndBiomes.java b/common/src/main/java/biomesoplenty/biome/BOPEndBiomes.java index 741c80e05..98632ddab 100644 --- a/common/src/main/java/biomesoplenty/biome/BOPEndBiomes.java +++ b/common/src/main/java/biomesoplenty/biome/BOPEndBiomes.java @@ -49,6 +49,8 @@ public static Biome endReef(HolderGetter placedFeatureGetter, Hol { BiomeGenerationSettings.Builder biomeBuilder = new BiomeGenerationSettings.Builder(placedFeatureGetter, carverGetter); biomeBuilder.addFeature(GenerationStep.Decoration.SURFACE_STRUCTURES, EndPlacements.END_GATEWAY_RETURN); + biomeBuilder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, BOPEndPlacements.DEAD_CORAL); + biomeBuilder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, BOPEndPlacements.BARNACLES); return baseEndBiome(biomeBuilder); } diff --git a/common/src/main/java/biomesoplenty/init/ModTags.java b/common/src/main/java/biomesoplenty/init/ModTags.java index 9d59c2f1b..53bb60700 100644 --- a/common/src/main/java/biomesoplenty/init/ModTags.java +++ b/common/src/main/java/biomesoplenty/init/ModTags.java @@ -27,6 +27,10 @@ private static void setup() {} public static final TagKey BLACKSTONE_DECORATION_PLACEABLE = create(new ResourceLocation(BiomesOPlenty.MOD_ID, "blackstone_decoration_placeable")); public static final TagKey BRIMSTONE_DECORATION_PLACEABLE = create(new ResourceLocation(BiomesOPlenty.MOD_ID, "brimstone_decoration_placeable")); + public static final TagKey DEAD_CORALS = create(new ResourceLocation(BiomesOPlenty.MOD_ID, "dead_corals")); + public static final TagKey DEAD_CORAL_BLOCKS = create(new ResourceLocation(BiomesOPlenty.MOD_ID, "dead_coral_blocks")); + public static final TagKey DEAD_CORAL_PLANTS = create(new ResourceLocation(BiomesOPlenty.MOD_ID, "dead_coral_plants")); + public static final TagKey DEAD_WALL_CORALS = create(new ResourceLocation(BiomesOPlenty.MOD_ID, "dead_wall_corals")); public static final TagKey FLESH = create(new ResourceLocation(BiomesOPlenty.MOD_ID, "flesh")); public static final TagKey FLESH_DECORATION_PLACEABLE = create(new ResourceLocation(BiomesOPlenty.MOD_ID, "flesh_decoration_placeable")); diff --git a/common/src/main/java/biomesoplenty/worldgen/feature/BOPBaseFeatures.java b/common/src/main/java/biomesoplenty/worldgen/feature/BOPBaseFeatures.java index fb0a69235..d6a515136 100644 --- a/common/src/main/java/biomesoplenty/worldgen/feature/BOPBaseFeatures.java +++ b/common/src/main/java/biomesoplenty/worldgen/feature/BOPBaseFeatures.java @@ -87,7 +87,10 @@ public class BOPBaseFeatures public static BOPTreeFeature UMBRAN_TREE; public static Feature WEBBING; public static Feature ORIGIN_GRAVEL_CLIFFS; - + public static Feature DEAD_CORAL_TREE; + public static Feature DEAD_CORAL_MUSHROOM; + public static Feature DEAD_CORAL_CLAW; + public static Feature BARNACLES; public static void registerFeatures(BiConsumer> func) { @@ -159,6 +162,10 @@ public static void registerFeatures(BiConsumer> fun UMBRAN_TREE = register(func, "umbran_tree", new UmbranTreeFeature(TaigaTreeConfiguration.CODEC)); WEBBING = register(func, "webbing", new WebbingFeature(NoneFeatureConfiguration.CODEC)); ORIGIN_GRAVEL_CLIFFS = register(func, "origin_gravel_cliffs", new OriginGravelCliffFeature(NoneFeatureConfiguration.CODEC)); + DEAD_CORAL_TREE = register(func, "dead_coral_tree", new DeadCoralTreeFeature(NoneFeatureConfiguration.CODEC)); + DEAD_CORAL_MUSHROOM = register(func, "dead_coral_mushroom", new DeadCoralMushroomFeature(NoneFeatureConfiguration.CODEC)); + DEAD_CORAL_CLAW = register(func, "dead_coral_claw", new DeadCoralClawFeature(NoneFeatureConfiguration.CODEC)); + BARNACLES = register(func, "barnacles", new BarnacleFeature(NoneFeatureConfiguration.CODEC)); } private static > F register(BiConsumer> func, String name, F feature) diff --git a/common/src/main/java/biomesoplenty/worldgen/feature/BOPEndFeatures.java b/common/src/main/java/biomesoplenty/worldgen/feature/BOPEndFeatures.java index f6a5aece1..6a42f05b8 100644 --- a/common/src/main/java/biomesoplenty/worldgen/feature/BOPEndFeatures.java +++ b/common/src/main/java/biomesoplenty/worldgen/feature/BOPEndFeatures.java @@ -10,24 +10,25 @@ import com.google.common.collect.ImmutableList; import net.minecraft.core.Holder; import net.minecraft.core.HolderGetter; +import net.minecraft.core.HolderSet; import net.minecraft.core.registries.Registries; import net.minecraft.data.worldgen.BootstapContext; import net.minecraft.data.worldgen.features.FeatureUtils; +import net.minecraft.data.worldgen.placement.PlacementUtils; import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.LakeFeature; import net.minecraft.world.level.levelgen.feature.WeightedPlacedFeature; -import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.RandomFeatureConfiguration; -import net.minecraft.world.level.levelgen.feature.configurations.SimpleBlockConfiguration; +import net.minecraft.world.level.levelgen.feature.configurations.*; import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider; import net.minecraft.world.level.levelgen.placement.PlacedFeature; public class BOPEndFeatures { public static final ResourceKey> ANOMALY = BOPFeatureUtils.createKey("anomaly"); + public static final ResourceKey> BARNACLES = BOPFeatureUtils.createKey("barnacles"); + public static final ResourceKey> DEAD_CORAL = BOPFeatureUtils.createKey("dead_coral"); public static final ResourceKey> ENDERPHYTE_BONEMEAL = BOPFeatureUtils.createKey("enderphyte_bonemeal"); public static final ResourceKey> FLOWER_END_WILDS = BOPFeatureUtils.createKey("flower_end_wilds"); public static final ResourceKey> NULL_LAKE = BOPFeatureUtils.createKey("null_lake"); @@ -40,6 +41,8 @@ public static void bootstrap(BootstapContext> context) final Holder NULL_TREE_CHECKED = placedFeatureGetter.getOrThrow(BOPTreePlacements.NULL_TREE_CHECKED); register(context, BOPEndFeatures.ANOMALY, BOPBaseFeatures.ANOMALY, NoneFeatureConfiguration.INSTANCE); + register(context, BOPEndFeatures.BARNACLES, BOPBaseFeatures.BARNACLES, NoneFeatureConfiguration.INSTANCE); + register(context, BOPEndFeatures.DEAD_CORAL, Feature.SIMPLE_RANDOM_SELECTOR, new SimpleRandomFeatureConfiguration(HolderSet.direct(PlacementUtils.inlinePlaced(BOPBaseFeatures.DEAD_CORAL_TREE, FeatureConfiguration.NONE), PlacementUtils.inlinePlaced(BOPBaseFeatures.DEAD_CORAL_CLAW, FeatureConfiguration.NONE), PlacementUtils.inlinePlaced(BOPBaseFeatures.DEAD_CORAL_MUSHROOM, FeatureConfiguration.NONE)))); register(context, BOPEndFeatures.ENDERPHYTE_BONEMEAL, Feature.SIMPLE_BLOCK, new SimpleBlockConfiguration(BlockStateProvider.simple(BOPBlocks.ENDERPHYTE.defaultBlockState()))); register(context, BOPEndFeatures.FLOWER_END_WILDS, Feature.FLOWER, FeatureUtils.simplePatchConfiguration(Feature.SIMPLE_BLOCK, new SimpleBlockConfiguration(BlockStateProvider.simple(BOPBlocks.ALGAE_BLOOM)))); register(context, BOPEndFeatures.NULL_LAKE, Feature.LAKE, new LakeFeature.Configuration(BlockStateProvider.simple(BOPBlocks.NULL_BLOCK), BlockStateProvider.simple(BOPBlocks.NULL_END_STONE))); diff --git a/common/src/main/java/biomesoplenty/worldgen/feature/misc/AnomalyFeature.java b/common/src/main/java/biomesoplenty/worldgen/feature/misc/AnomalyFeature.java index 2ccf3ee89..3d278d0f2 100644 --- a/common/src/main/java/biomesoplenty/worldgen/feature/misc/AnomalyFeature.java +++ b/common/src/main/java/biomesoplenty/worldgen/feature/misc/AnomalyFeature.java @@ -46,8 +46,8 @@ public boolean place(FeaturePlaceContext featurePlaceC return false; } - int size = rand.nextInt(5); - int anomalyHeight = size+4; + int size = rand.nextInt(3) + 2; + int anomalyHeight = size+3; if (!this.checkSpace(world, startPos, size, anomalyHeight)) { diff --git a/common/src/main/java/biomesoplenty/worldgen/feature/misc/BarnacleFeature.java b/common/src/main/java/biomesoplenty/worldgen/feature/misc/BarnacleFeature.java new file mode 100644 index 000000000..6edd38828 --- /dev/null +++ b/common/src/main/java/biomesoplenty/worldgen/feature/misc/BarnacleFeature.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * Copyright 2022, the Glitchfiend Team. + * All rights reserved. + ******************************************************************************/ +package biomesoplenty.worldgen.feature.misc; + +import biomesoplenty.api.block.BOPBlocks; +import biomesoplenty.init.ModTags; +import com.mojang.serialization.Codec; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.MultifaceBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.chunk.ChunkGenerator; +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; + +public class BarnacleFeature extends Feature +{ + public BarnacleFeature(Codec deserializer) + { + super(deserializer); + } + + @Override + public boolean place(FeaturePlaceContext featurePlaceContext) + { + WorldGenLevel worldIn = featurePlaceContext.level(); + ChunkGenerator chunkGenerator = featurePlaceContext.chunkGenerator(); + RandomSource rand = featurePlaceContext.random(); + BlockPos pos = featurePlaceContext.origin(); + NoneFeatureConfiguration config = featurePlaceContext.config(); + int i = 0; + int j = rand.nextInt(8 - 2) + 2; + + for (int k = pos.getX() - j; k <= pos.getX() + j; ++k) + { + for (int l = pos.getZ() - j; l <= pos.getZ() + j; ++l) + { + int i1 = k - pos.getX(); + int j1 = l - pos.getZ(); + if (i1 * i1 + j1 * j1 <= j * j) + { + for (int k1 = pos.getY() - j; k1 <= pos.getY() + j; ++k1) + { + BlockPos blockpos = new BlockPos(k, k1, l); + BlockState blockstate = worldIn.getBlockState(blockpos); + BlockState barnaclestate = BOPBlocks.BARNACLES.defaultBlockState(); + + int faces = 0; + + for (Direction direction : Direction.values()) + { + BlockState blockstate1 = worldIn.getBlockState(blockpos.relative(direction)); + if (blockstate1 == Blocks.END_STONE.defaultBlockState() || blockstate1 == BOPBlocks.ALGAL_END_STONE.defaultBlockState() || blockstate1.is(ModTags.Blocks.DEAD_CORAL_BLOCKS)) + { + barnaclestate = barnaclestate.setValue(MultifaceBlock.getFaceProperty(direction), true); + faces++; + } + } + + if (blockstate.isAir() && faces > 0) + { + worldIn.setBlock(blockpos, barnaclestate, 2); + + ++i; + break; + } + } + } + } + } + + return i > 0; + } +} diff --git a/common/src/main/java/biomesoplenty/worldgen/feature/misc/DeadCoralClawFeature.java b/common/src/main/java/biomesoplenty/worldgen/feature/misc/DeadCoralClawFeature.java new file mode 100644 index 000000000..cfd5b093b --- /dev/null +++ b/common/src/main/java/biomesoplenty/worldgen/feature/misc/DeadCoralClawFeature.java @@ -0,0 +1,93 @@ +package biomesoplenty.worldgen.feature.misc; + +import biomesoplenty.api.block.BOPBlocks; +import biomesoplenty.init.ModTags; +import com.mojang.serialization.Codec; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.feature.CoralClawFeature; +import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; +import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; + +import java.util.Iterator; +import java.util.Optional; + +public class DeadCoralClawFeature extends CoralClawFeature +{ + public DeadCoralClawFeature(Codec $$0) + { + super($$0); + } + + @Override + public boolean place(FeaturePlaceContext $$0) { + RandomSource $$1 = $$0.random(); + WorldGenLevel $$2 = $$0.level(); + BlockPos $$3 = $$0.origin(); + Optional $$4 = BuiltInRegistries.BLOCK.getTag(ModTags.Blocks.DEAD_CORAL_BLOCKS).flatMap(($$1x) -> { + return $$1x.getRandomElement($$1); + }).map(Holder::value); + return $$4.isEmpty() ? false : this.placeFeature($$2, $$1, $$3, ((Block)$$4.get()).defaultBlockState()); + } + + @Override + protected boolean placeCoralBlock(LevelAccessor $$0, RandomSource $$1, BlockPos $$2, BlockState $$3) + { + BlockPos $$4 = $$2.above(); + BlockState $$5 = $$0.getBlockState($$2); + if (($$5.isAir() || $$5.is(ModTags.Blocks.DEAD_CORALS) || $$5.getBlock() == BOPBlocks.BARNACLES) && $$0.getBlockState($$4).isAir()) + { + $$0.setBlock($$2, $$3, 3); + if ($$1.nextFloat() < 0.25F) + { + BuiltInRegistries.BLOCK.getTag(ModTags.Blocks.DEAD_CORALS).flatMap(($$1x) -> { + return $$1x.getRandomElement($$1); + }).map(Holder::value).ifPresent(($$2x) -> { + $$0.setBlock($$4, $$2x.defaultBlockState().setValue(BaseCoralPlantTypeBlock.WATERLOGGED, false), 2); + }); + } + else if ($$1.nextFloat() < 0.05F) + { + $$0.setBlock($$4, (BlockState)Blocks.SEA_PICKLE.defaultBlockState().setValue(SeaPickleBlock.PICKLES, $$1.nextInt(4) + 1).setValue(SeaPickleBlock.WATERLOGGED, false), 2); + } + + Iterator var7 = Direction.Plane.HORIZONTAL.iterator(); + + while(var7.hasNext()) + { + Direction $$6 = (Direction)var7.next(); + if ($$1.nextFloat() < 0.2F) + { + BlockPos $$7 = $$2.relative($$6); + if ($$0.getBlockState($$7).isAir() || $$0.getBlockState($$7).getBlock() == BOPBlocks.BARNACLES) + { + BuiltInRegistries.BLOCK.getTag(ModTags.Blocks.DEAD_WALL_CORALS).flatMap(($$1x) -> { + return $$1x.getRandomElement($$1); + }).map(Holder::value).ifPresent(($$3x) -> { + BlockState $$4x = $$3x.defaultBlockState().setValue(BaseCoralPlantTypeBlock.WATERLOGGED, false); + if ($$4x.hasProperty(BaseCoralWallFanBlock.FACING)) + { + $$4x = (BlockState)$$4x.setValue(BaseCoralWallFanBlock.FACING, $$6); + } + + $$0.setBlock($$7, $$4x, 2); + }); + } + } + } + + return true; + } + else + { + return false; + } + } +} diff --git a/common/src/main/java/biomesoplenty/worldgen/feature/misc/DeadCoralMushroomFeature.java b/common/src/main/java/biomesoplenty/worldgen/feature/misc/DeadCoralMushroomFeature.java new file mode 100644 index 000000000..fbaca968b --- /dev/null +++ b/common/src/main/java/biomesoplenty/worldgen/feature/misc/DeadCoralMushroomFeature.java @@ -0,0 +1,93 @@ +package biomesoplenty.worldgen.feature.misc; + +import biomesoplenty.api.block.BOPBlocks; +import biomesoplenty.init.ModTags; +import com.mojang.serialization.Codec; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.feature.CoralMushroomFeature; +import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; +import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; + +import java.util.Iterator; +import java.util.Optional; + +public class DeadCoralMushroomFeature extends CoralMushroomFeature +{ + public DeadCoralMushroomFeature(Codec $$0) + { + super($$0); + } + + @Override + public boolean place(FeaturePlaceContext $$0) { + RandomSource $$1 = $$0.random(); + WorldGenLevel $$2 = $$0.level(); + BlockPos $$3 = $$0.origin(); + Optional $$4 = BuiltInRegistries.BLOCK.getTag(ModTags.Blocks.DEAD_CORAL_BLOCKS).flatMap(($$1x) -> { + return $$1x.getRandomElement($$1); + }).map(Holder::value); + return $$4.isEmpty() ? false : this.placeFeature($$2, $$1, $$3, ((Block)$$4.get()).defaultBlockState()); + } + + @Override + protected boolean placeCoralBlock(LevelAccessor $$0, RandomSource $$1, BlockPos $$2, BlockState $$3) + { + BlockPos $$4 = $$2.above(); + BlockState $$5 = $$0.getBlockState($$2); + if (($$5.isAir() || $$5.is(ModTags.Blocks.DEAD_CORALS) || $$5.getBlock() == BOPBlocks.BARNACLES) && $$0.getBlockState($$4).isAir()) + { + $$0.setBlock($$2, $$3, 3); + if ($$1.nextFloat() < 0.25F) + { + BuiltInRegistries.BLOCK.getTag(ModTags.Blocks.DEAD_CORALS).flatMap(($$1x) -> { + return $$1x.getRandomElement($$1); + }).map(Holder::value).ifPresent(($$2x) -> { + $$0.setBlock($$4, $$2x.defaultBlockState().setValue(BaseCoralPlantTypeBlock.WATERLOGGED, false), 2); + }); + } + else if ($$1.nextFloat() < 0.05F) + { + $$0.setBlock($$4, (BlockState)Blocks.SEA_PICKLE.defaultBlockState().setValue(SeaPickleBlock.PICKLES, $$1.nextInt(4) + 1).setValue(SeaPickleBlock.WATERLOGGED, false), 2); + } + + Iterator var7 = Direction.Plane.HORIZONTAL.iterator(); + + while(var7.hasNext()) + { + Direction $$6 = (Direction)var7.next(); + if ($$1.nextFloat() < 0.2F) + { + BlockPos $$7 = $$2.relative($$6); + if ($$0.getBlockState($$7).isAir() || $$0.getBlockState($$7).getBlock() == BOPBlocks.BARNACLES) + { + BuiltInRegistries.BLOCK.getTag(ModTags.Blocks.DEAD_WALL_CORALS).flatMap(($$1x) -> { + return $$1x.getRandomElement($$1); + }).map(Holder::value).ifPresent(($$3x) -> { + BlockState $$4x = $$3x.defaultBlockState().setValue(BaseCoralPlantTypeBlock.WATERLOGGED, false); + if ($$4x.hasProperty(BaseCoralWallFanBlock.FACING)) + { + $$4x = (BlockState)$$4x.setValue(BaseCoralWallFanBlock.FACING, $$6); + } + + $$0.setBlock($$7, $$4x, 2); + }); + } + } + } + + return true; + } + else + { + return false; + } + } +} diff --git a/common/src/main/java/biomesoplenty/worldgen/feature/misc/DeadCoralTreeFeature.java b/common/src/main/java/biomesoplenty/worldgen/feature/misc/DeadCoralTreeFeature.java new file mode 100644 index 000000000..d04bc5954 --- /dev/null +++ b/common/src/main/java/biomesoplenty/worldgen/feature/misc/DeadCoralTreeFeature.java @@ -0,0 +1,93 @@ +package biomesoplenty.worldgen.feature.misc; + +import biomesoplenty.api.block.BOPBlocks; +import biomesoplenty.init.ModTags; +import com.mojang.serialization.Codec; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.feature.CoralTreeFeature; +import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; +import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; + +import java.util.Iterator; +import java.util.Optional; + +public class DeadCoralTreeFeature extends CoralTreeFeature +{ + public DeadCoralTreeFeature(Codec $$0) + { + super($$0); + } + + @Override + public boolean place(FeaturePlaceContext $$0) { + RandomSource $$1 = $$0.random(); + WorldGenLevel $$2 = $$0.level(); + BlockPos $$3 = $$0.origin(); + Optional $$4 = BuiltInRegistries.BLOCK.getTag(ModTags.Blocks.DEAD_CORAL_BLOCKS).flatMap(($$1x) -> { + return $$1x.getRandomElement($$1); + }).map(Holder::value); + return $$4.isEmpty() ? false : this.placeFeature($$2, $$1, $$3, ((Block)$$4.get()).defaultBlockState()); + } + + @Override + protected boolean placeCoralBlock(LevelAccessor $$0, RandomSource $$1, BlockPos $$2, BlockState $$3) + { + BlockPos $$4 = $$2.above(); + BlockState $$5 = $$0.getBlockState($$2); + if (($$5.isAir() || $$5.is(ModTags.Blocks.DEAD_CORALS) || $$5.getBlock() == BOPBlocks.BARNACLES) && $$0.getBlockState($$4).isAir()) + { + $$0.setBlock($$2, $$3, 3); + if ($$1.nextFloat() < 0.25F) + { + BuiltInRegistries.BLOCK.getTag(ModTags.Blocks.DEAD_CORALS).flatMap(($$1x) -> { + return $$1x.getRandomElement($$1); + }).map(Holder::value).ifPresent(($$2x) -> { + $$0.setBlock($$4, $$2x.defaultBlockState().setValue(BaseCoralPlantTypeBlock.WATERLOGGED, false), 2); + }); + } + else if ($$1.nextFloat() < 0.05F) + { + $$0.setBlock($$4, (BlockState)Blocks.SEA_PICKLE.defaultBlockState().setValue(SeaPickleBlock.PICKLES, $$1.nextInt(4) + 1).setValue(SeaPickleBlock.WATERLOGGED, false), 2); + } + + Iterator var7 = Direction.Plane.HORIZONTAL.iterator(); + + while(var7.hasNext()) + { + Direction $$6 = (Direction)var7.next(); + if ($$1.nextFloat() < 0.2F) + { + BlockPos $$7 = $$2.relative($$6); + if ($$0.getBlockState($$7).isAir() || $$0.getBlockState($$7).getBlock() == BOPBlocks.BARNACLES) + { + BuiltInRegistries.BLOCK.getTag(ModTags.Blocks.DEAD_WALL_CORALS).flatMap(($$1x) -> { + return $$1x.getRandomElement($$1); + }).map(Holder::value).ifPresent(($$3x) -> { + BlockState $$4x = $$3x.defaultBlockState().setValue(BaseCoralPlantTypeBlock.WATERLOGGED, false); + if ($$4x.hasProperty(BaseCoralWallFanBlock.FACING)) + { + $$4x = (BlockState)$$4x.setValue(BaseCoralWallFanBlock.FACING, $$6); + } + + $$0.setBlock($$7, $$4x, 2); + }); + } + } + } + + return true; + } + else + { + return false; + } + } +} diff --git a/common/src/main/java/biomesoplenty/worldgen/placement/BOPEndPlacements.java b/common/src/main/java/biomesoplenty/worldgen/placement/BOPEndPlacements.java index aa5966b77..55df329e3 100644 --- a/common/src/main/java/biomesoplenty/worldgen/placement/BOPEndPlacements.java +++ b/common/src/main/java/biomesoplenty/worldgen/placement/BOPEndPlacements.java @@ -23,6 +23,8 @@ public class BOPEndPlacements { public static final ResourceKey ANOMALY = BOPPlacementUtils.createKey("anomaly"); + public static final ResourceKey BARNACLES = BOPPlacementUtils.createKey("barnacles"); + public static final ResourceKey DEAD_CORAL = BOPPlacementUtils.createKey("dead_coral"); public static final ResourceKey ENDERPHYTE_BONEMEAL = BOPPlacementUtils.createKey("enderphyte_bonemeal"); public static final ResourceKey FLOWER_END_WILDS = BOPPlacementUtils.createKey("flower_end_wilds"); public static final ResourceKey NULL_LAKE = BOPPlacementUtils.createKey("null_lake"); @@ -34,6 +36,8 @@ public static void bootstrap(BootstapContext context) HolderGetter> configuredFeatureGetter = context.lookup(Registries.CONFIGURED_FEATURE); final Holder> ANOMALY = configuredFeatureGetter.getOrThrow(BOPEndFeatures.ANOMALY); + final Holder> BARNACLES = configuredFeatureGetter.getOrThrow(BOPEndFeatures.BARNACLES); + final Holder> DEAD_CORAL = configuredFeatureGetter.getOrThrow(BOPEndFeatures.DEAD_CORAL); final Holder> ENDERPHYTE_BONEMEAL = configuredFeatureGetter.getOrThrow(BOPEndFeatures.ENDERPHYTE_BONEMEAL); final Holder> FLOWER_END_WILDS = configuredFeatureGetter.getOrThrow(BOPEndFeatures.FLOWER_END_WILDS); final Holder> NULL_LAKE = configuredFeatureGetter.getOrThrow(BOPEndFeatures.NULL_LAKE); @@ -41,6 +45,8 @@ public static void bootstrap(BootstapContext context) final Holder> PATCH_ENDERPHYTES = configuredFeatureGetter.getOrThrow(BOPEndFeatures.PATCH_ENDERPHYTES); register(context, BOPEndPlacements.ANOMALY, ANOMALY, List.of(RarityFilter.onAverageOnceEvery(1), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, BiomeFilter.biome())); + register(context, BOPEndPlacements.BARNACLES, BARNACLES, List.of(CountPlacement.of(4), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, BiomeFilter.biome())); + register(context, BOPEndPlacements.DEAD_CORAL, DEAD_CORAL, NoiseBasedCountPlacement.of(20, 400.0D, 0.0D), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP_TOP_SOLID, BiomeFilter.biome()); register(context, BOPEndPlacements.ENDERPHYTE_BONEMEAL, ENDERPHYTE_BONEMEAL, PlacementUtils.isEmpty()); register(context, BOPEndPlacements.FLOWER_END_WILDS, FLOWER_END_WILDS, List.of(RarityFilter.onAverageOnceEvery(1), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, BiomeFilter.biome())); register(context, BOPEndPlacements.NULL_LAKE, NULL_LAKE, List.of(CountPlacement.of(1), InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, BiomeFilter.biome())); diff --git a/common/src/main/resources/data/biomesoplenty/tags/blocks/dead_coral_blocks.json b/common/src/main/resources/data/biomesoplenty/tags/blocks/dead_coral_blocks.json new file mode 100644 index 000000000..24a4ddf0d --- /dev/null +++ b/common/src/main/resources/data/biomesoplenty/tags/blocks/dead_coral_blocks.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:dead_tube_coral_block", + "minecraft:dead_brain_coral_block", + "minecraft:dead_bubble_coral_block", + "minecraft:dead_fire_coral_block", + "minecraft:dead_horn_coral_block" + ] +} \ No newline at end of file diff --git a/common/src/main/resources/data/biomesoplenty/tags/blocks/dead_coral_plants.json b/common/src/main/resources/data/biomesoplenty/tags/blocks/dead_coral_plants.json new file mode 100644 index 000000000..4cafbcd59 --- /dev/null +++ b/common/src/main/resources/data/biomesoplenty/tags/blocks/dead_coral_plants.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:dead_tube_coral", + "minecraft:dead_brain_coral", + "minecraft:dead_bubble_coral", + "minecraft:dead_fire_coral", + "minecraft:dead_horn_coral" + ] +} \ No newline at end of file diff --git a/common/src/main/resources/data/biomesoplenty/tags/blocks/dead_corals.json b/common/src/main/resources/data/biomesoplenty/tags/blocks/dead_corals.json new file mode 100644 index 000000000..ced950bc3 --- /dev/null +++ b/common/src/main/resources/data/biomesoplenty/tags/blocks/dead_corals.json @@ -0,0 +1,10 @@ +{ + "values": [ + "#biomesoplenty:dead_coral_plants", + "minecraft:dead_tube_coral_fan", + "minecraft:dead_brain_coral_fan", + "minecraft:dead_bubble_coral_fan", + "minecraft:dead_fire_coral_fan", + "minecraft:dead_horn_coral_fan" + ] +} \ No newline at end of file diff --git a/common/src/main/resources/data/biomesoplenty/tags/blocks/dead_wall_corals.json b/common/src/main/resources/data/biomesoplenty/tags/blocks/dead_wall_corals.json new file mode 100644 index 000000000..93bb93c23 --- /dev/null +++ b/common/src/main/resources/data/biomesoplenty/tags/blocks/dead_wall_corals.json @@ -0,0 +1,9 @@ +{ + "values": [ + "minecraft:dead_tube_coral_wall_fan", + "minecraft:dead_brain_coral_wall_fan", + "minecraft:dead_bubble_coral_wall_fan", + "minecraft:dead_fire_coral_wall_fan", + "minecraft:dead_horn_coral_wall_fan" + ] +} \ No newline at end of file