Skip to content

Commit

Permalink
more sparse fireflies & split replacement gen
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Feb 6, 2025
1 parent 74162ff commit 7472c2d
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 37 deletions.
4 changes: 2 additions & 2 deletions src/main/java/net/frozenblock/wilderwild/entity/Firefly.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -167,7 +167,7 @@ private static boolean shouldSetHome(EntitySpawnReason reason) {

@Override
public int getMaxSpawnClusterSize() {
return 12;
return 8;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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());
Expand All @@ -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());
}
}
});
}
Expand Down Expand Up @@ -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);
Expand All @@ -340,7 +358,7 @@ public static void generateBush() {
generationSettings.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, WWPlacedFeatures.PATCH_FIREFLY_BUSH_SWAMP.getKey());
}
}
});
});
}

public static void generateCacti() {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7472c2d

Please sign in to comment.