From 7472c2d686db322925875a68482fa139af39f799 Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Thu, 6 Feb 2025 14:12:06 -0500 Subject: [PATCH] more sparse fireflies & split replacement gen --- .../wilderwild/entity/Firefly.java | 4 +- .../worldgen/modification/WWSpawns.java | 2 +- .../modification/WWVegetationGeneration.java | 95 ++++++++++++------- 3 files changed, 64 insertions(+), 37 deletions(-) diff --git a/src/main/java/net/frozenblock/wilderwild/entity/Firefly.java b/src/main/java/net/frozenblock/wilderwild/entity/Firefly.java index 8cc2588369..c6ed587411 100644 --- a/src/main/java/net/frozenblock/wilderwild/entity/Firefly.java +++ b/src/main/java/net/frozenblock/wilderwild/entity/Firefly.java @@ -119,7 +119,7 @@ public static boolean checkFireflySpawnRules( if (!EntitySpawnReason.isSpawner(reason) && !WWEntityConfig.get().firefly.spawnFireflies) return false; return (EntitySpawnReason.ignoresLightRequirements(reason) || level.getMaxLocalRawBrightness(pos) <= 13) && hasNearbyFireflyBush(level, pos, 3, 1) - && !reachedNearbyFireflyLimit(level, pos, 2, 12); + && !reachedNearbyFireflyLimit(level, pos, 3, 12); } @NotNull @@ -167,7 +167,7 @@ private static boolean shouldSetHome(EntitySpawnReason reason) { @Override public int getMaxSpawnClusterSize() { - return 12; + return 8; } @Override diff --git a/src/main/java/net/frozenblock/wilderwild/worldgen/modification/WWSpawns.java b/src/main/java/net/frozenblock/wilderwild/worldgen/modification/WWSpawns.java index 74c261c5f2..c8bed31ea6 100644 --- a/src/main/java/net/frozenblock/wilderwild/worldgen/modification/WWSpawns.java +++ b/src/main/java/net/frozenblock/wilderwild/worldgen/modification/WWSpawns.java @@ -34,7 +34,7 @@ public final class WWSpawns { public static void addBugs() { BiomeModifications.addSpawn(BiomeSelectors.all(), - FrozenMobCategories.getCategory(WWConstants.MOD_ID, "firefly"), WWEntityTypes.FIREFLY, 1, 4, 12); + FrozenMobCategories.getCategory(WWConstants.MOD_ID, "firefly"), WWEntityTypes.FIREFLY, 1, 4, 8); BiomeModifications.addSpawn(BiomeSelectors.tag(WWBiomeTags.HAS_BUTTERFLY), FrozenMobCategories.getCategory(WWConstants.MOD_ID, "butterfly"), WWEntityTypes.BUTTERFLY, 1, 1, 1); diff --git a/src/main/java/net/frozenblock/wilderwild/worldgen/modification/WWVegetationGeneration.java b/src/main/java/net/frozenblock/wilderwild/worldgen/modification/WWVegetationGeneration.java index 8b8ed44531..763923f0ba 100644 --- a/src/main/java/net/frozenblock/wilderwild/worldgen/modification/WWVegetationGeneration.java +++ b/src/main/java/net/frozenblock/wilderwild/worldgen/modification/WWVegetationGeneration.java @@ -145,6 +145,48 @@ public static void generateFlower() { generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.CLOVERS_SPARSE.getKey()); } + if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_MILKWEED)) { + generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.MILKWEED.getKey()); + } + + if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_BERRY_PATCH)) { + generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.PATCH_BERRY_FOREST.getKey()); + } + + if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_FIELD_FLOWERS)) { + generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.FLOWER_FLOWER_FIELD.getKey()); + } + + if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_CYPRESS_FLOWERS)) { + generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.CYPRESS_WETLANDS_FLOWERS.getKey()); + generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.CYPRESS_WETLANDS_FLOWERS_TALL.getKey()); + } + + if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_RARE_MILKWEED)) { + generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.MILKWEED_RARE.getKey()); + } + + if (biomeSelectionContext.hasTag(WWBiomeTags.MEADOW)) { + generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.FLOWER_MEADOW.getKey()); + } + + if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_BIRCH_CLEARING_FLOWERS)) { + generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.FLOWER_BIRCH_CLEARING.getKey()); + } + + if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_FOREST_CLEARING_FLOWERS)) { + generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.FLOWER_FOREST_CLEARING.getKey()); + } + } + }); + + BiomeModifications.create(WWConstants.id("flower_replacement_generation")) + .add(ModificationPhase.REPLACEMENTS, + BiomeSelectors.all(), + (biomeSelectionContext, context) -> { + if (WWWorldgenConfig.get().flowerGeneration) { + BiomeModificationContext.GenerationSettingsContext generationSettings = context.getGenerationSettings(); + if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_WILDFLOWERS)) { generationSettings.removeFeature(VegetationPlacements.WILDFLOWERS_BIRCH_FOREST); generationSettings.removeFeature(VegetationPlacements.WILDFLOWERS_MEADOW); @@ -205,10 +247,6 @@ public static void generateFlower() { generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.LANTANAS_AND_PHLOX_SPARSE.getKey()); } - if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_MILKWEED)) { - generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.MILKWEED.getKey()); - } - if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_PLAINS_FLOWERS)) { generationSettings.removeFeature(VegetationPlacements.FLOWER_PLAINS); generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.FLOWER_PLAINS.getKey()); @@ -229,39 +267,10 @@ public static void generateFlower() { generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.FLOWER_BIRCH.getKey()); } - if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_BERRY_PATCH)) { - generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.PATCH_BERRY_FOREST.getKey()); - } - - if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_FIELD_FLOWERS)) { - generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.FLOWER_FLOWER_FIELD.getKey()); - } - - if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_CYPRESS_FLOWERS)) { - generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.CYPRESS_WETLANDS_FLOWERS.getKey()); - generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.CYPRESS_WETLANDS_FLOWERS_TALL.getKey()); - } - - if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_RARE_MILKWEED)) { - generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.MILKWEED_RARE.getKey()); - } - if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_SUNFLOWER_PLAINS_FLOWERS)) { generationSettings.removeFeature(VegetationPlacements.FLOWER_PLAINS); generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.FLOWER_SUNFLOWER_PLAINS.getKey()); } - - if (biomeSelectionContext.hasTag(WWBiomeTags.MEADOW)) { - generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.FLOWER_MEADOW.getKey()); - } - - if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_BIRCH_CLEARING_FLOWERS)) { - generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.FLOWER_BIRCH_CLEARING.getKey()); - } - - if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_FOREST_CLEARING_FLOWERS)) { - generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.FLOWER_FOREST_CLEARING.getKey()); - } } }); } @@ -322,6 +331,15 @@ public static void generateBush() { if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_RAINFOREST_SHRUB)) { generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.GENERIC_SHRUB_PLACED.getKey()); } + } + }); + + BiomeModifications.create(WWConstants.id("firefly_bush_generation")) + .add(ModificationPhase.REPLACEMENTS, + BiomeSelectors.all(), + (biomeSelectionContext, context) -> { + if (WWWorldgenConfig.get().shrubGeneration) { + BiomeModificationContext.GenerationSettingsContext generationSettings = context.getGenerationSettings(); if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_FIREFLY_BUSH)) { generationSettings.removeFeature(VegetationPlacements.PATCH_FIREFLY_BUSH_NEAR_WATER); @@ -340,7 +358,7 @@ public static void generateBush() { generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.PATCH_FIREFLY_BUSH_SWAMP.getKey()); } } - }); + }); } public static void generateCacti() { @@ -449,6 +467,15 @@ public static void generateGrass() { if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_MYCELIUM_GROWTH)) { generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.MYCELIUM_GROWTH_PLACED.getKey()); } + } + }); + + BiomeModifications.create(WWConstants.id("dry_grass_generation")) + .add(ModificationPhase.REPLACEMENTS, + BiomeSelectors.all(), + (biomeSelectionContext, context) -> { + if (WWWorldgenConfig.get().grassGeneration) { + BiomeModificationContext.GenerationSettingsContext generationSettings = context.getGenerationSettings(); if (biomeSelectionContext.hasTag(WWBiomeTags.HAS_DRY_GRASS_BADLANDS)) { generationSettings.removeFeature(VegetationPlacements.PATCH_DRY_GRASS_BADLANDS);