diff --git a/common/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java b/common/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java index 8c0feb9932..251da45bed 100644 --- a/common/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java +++ b/common/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java @@ -148,6 +148,10 @@ public static class WorldGenConfigs { @Configurable @Configurable.Comment({"Debug ore vein placement? (will print placed veins to server's debug.log)", "Default: false (no placement printout in debug.log)"}) public boolean debugWorldgen; + + @Configurable + @Configurable.Comment({"Rubber Tree spawn chance (% per chunk)", "Default: 0.5"}) + public float rubberTreeSpawnChance = 0.5f; } public static class MachineConfigs { diff --git a/fabric/src/main/java/com/gregtechceu/gtceu/common/data/fabric/GTFeaturesImpl.java b/fabric/src/main/java/com/gregtechceu/gtceu/common/data/fabric/GTFeaturesImpl.java index 47ec0978bb..99122cf157 100644 --- a/fabric/src/main/java/com/gregtechceu/gtceu/common/data/fabric/GTFeaturesImpl.java +++ b/fabric/src/main/java/com/gregtechceu/gtceu/common/data/fabric/GTFeaturesImpl.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.common.data.GTPlacements; +import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.CustomTags; import net.fabricmc.fabric.api.biome.v1.BiomeModifications; import net.minecraft.core.BlockPos; @@ -63,11 +64,12 @@ public static void register() { new BiomePlacement(List.of( new BiomeWeightModifier(biomeRegistry.getOrCreateTag(CustomTags.IS_SWAMP), 50) )), - PlacementUtils.countExtra(0, 0.005F, 1), - InSquarePlacement.spread(), VegetationPlacements.TREE_THRESHOLD, + PlacementUtils.countExtra(0, ConfigHolder.INSTANCE.worldgen.rubberTreeSpawnChance, 1), + InSquarePlacement.spread(), + VegetationPlacements.TREE_THRESHOLD, PlacementUtils.HEIGHTMAP_OCEAN_FLOOR, - BlockPredicateFilter.forPredicate(BlockPredicate.wouldSurvive(GTBlocks.RUBBER_SAPLING.getDefaultState(), BlockPos.ZERO)), - BiomeFilter.biome() + BiomeFilter.biome(), + PlacementUtils.filteredByBlockSurvival(GTBlocks.RUBBER_SAPLING.get()) )); Registry.register(BuiltinRegistries.PLACED_FEATURE, id, placedFeature); diff --git a/forge/src/main/java/com/gregtechceu/gtceu/common/data/forge/GTFeaturesImpl.java b/forge/src/main/java/com/gregtechceu/gtceu/common/data/forge/GTFeaturesImpl.java index 0268824d6e..8e79ed3f8e 100644 --- a/forge/src/main/java/com/gregtechceu/gtceu/common/data/forge/GTFeaturesImpl.java +++ b/forge/src/main/java/com/gregtechceu/gtceu/common/data/forge/GTFeaturesImpl.java @@ -6,6 +6,7 @@ import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.common.data.GTPlacements; +import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.CustomTags; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; @@ -84,11 +85,12 @@ public static void register() { new BiomePlacement(List.of( new BiomeWeightModifier(biomeRegistry.getOrCreateTag(CustomTags.IS_SWAMP), 50) )), - PlacementUtils.countExtra(0, 0.005F, 1), - InSquarePlacement.spread(), VegetationPlacements.TREE_THRESHOLD, + PlacementUtils.countExtra(0, ConfigHolder.INSTANCE.worldgen.rubberTreeSpawnChance, 1), + InSquarePlacement.spread(), + VegetationPlacements.TREE_THRESHOLD, PlacementUtils.HEIGHTMAP_OCEAN_FLOOR, - BlockPredicateFilter.forPredicate(BlockPredicate.wouldSurvive(GTBlocks.RUBBER_SAPLING.getDefaultState(), BlockPos.ZERO)), - BiomeFilter.biome() + BiomeFilter.biome(), + PlacementUtils.filteredByBlockSurvival(GTBlocks.RUBBER_SAPLING.get()) )); });