Merge branch 'type-gem-min-growth-fix' into 'main'

fix wrong value in CobblemonConfig for type gem min growth

See merge request cable-mc/cobblemon!2461
This commit is contained in:
Polymeta
2026-10-08 06:01:53 +00:00
3 changed files with 10 additions and 10 deletions
@@ -165,24 +165,24 @@ class TypeGemCoreBlock(properties: Properties) : Block(properties) {
expand(level, pos, random)
}
fun expand(level: LevelAccessor, pos: BlockPos, random: RandomSource) {
fun expand(level: LevelAccessor, pos: BlockPos, random: RandomSource, forceGrow: Boolean = false) {
getConnectedGemBlocks(level, pos).forEach {
val state = it.first
val pos = it.second
addClustersToBlock(state, pos, level, random)
growClusters(pos, level, random)
growClusters(pos, level, random, forceGrow)
}
}
private fun growClusters(pos: BlockPos, level: LevelAccessor, random: RandomSource) {
private fun growClusters(pos: BlockPos, level: LevelAccessor, random: RandomSource, forceGrow: Boolean) {
Direction.entries.forEach { direction ->
val relativePos = pos.relative(direction)
val relativeState = level.getBlockState(relativePos)
val clusterBlock = relativeState.block as? TypeGemClusterBlock ?: return@forEach
if (relativeState.getValue(DirectionalBlock.FACING) == direction &&
random.nextFloat() < Cobblemon.config.typeGemGrowthChance
) {
if ((relativeState.getValue(DirectionalBlock.FACING) == direction &&
random.nextFloat() < Cobblemon.config.typeGemGrowthChance) || forceGrow
) {
clusterBlock.advanceGrowth(relativeState, level, relativePos, random)
}
}
@@ -396,16 +396,16 @@ class CobblemonConfig {
var typeGemMaxConnected = 16
@CobblemonConfigField(Category.World, lang = "type_gem_min_growth", SERVER)
var typeGemMinGrowth = 5
var typeGemMinGrowth = 8
@CobblemonConfigField(Category.World, lang = "type_gem_growth_chance", SERVER)
var typeGemGrowthChance = 0.1f
@CobblemonConfigField(Category.World, lang = "type_gem_initial_expansion_cycles", SERVER)
var typeGemInitialExpansionCycles = 20
var typeGemInitialExpansionCycles = 100
@CobblemonConfigField(Category.World, lang = "type_gem_tick_chance", SERVER)
var typeGemTickChance = 0.1f
var typeGemTickChance = 1.0f
fun clone(): CobblemonConfig {
val newConfig = CobblemonConfig()
@@ -53,7 +53,7 @@ class TypeGemFeature : Feature<BlockStateConfiguration>(BlockStateConfiguration.
// Trigger forced growth with clusters
val coreBlock = coreState.block as TypeGemCoreBlock
repeat(Cobblemon.config.typeGemInitialExpansionCycles) {
coreBlock.expand(worldGenLevel, origin, random)
coreBlock.expand(worldGenLevel, origin, random, true)
}
// println("[TypeGemFeature] Placed ${gemId.path} at $chosenPos")