Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion common/src/main/kotlin/accieo/cobbleworkers/jobs/Healer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import accieo.cobbleworkers.config.CobbleworkersConfigHolder
import accieo.cobbleworkers.enums.JobType
import accieo.cobbleworkers.interfaces.Worker
import accieo.cobbleworkers.utilities.CobbleworkersNavigationUtils
import com.cobblemon.mod.common.api.pokemon.PokemonSpecies
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import net.minecraft.entity.effect.StatusEffectInstance
import net.minecraft.entity.effect.StatusEffects
Expand All @@ -22,6 +23,15 @@ import net.minecraft.world.World

object Healer : Worker {
private val VALID_SPECIES: Set<String> = setOf("happiny", "chansey", "blissey")
private val VALID_TRANSLATED_SPECIES by lazy {
VALID_SPECIES.map { name ->
PokemonSpecies.getByName(name)
?.translatedName
?.string
?.lowercase()
?: name.lowercase()
}.toSet()
}
private val config = CobbleworkersConfigHolder.config.healing
private val generalConfig = CobbleworkersConfigHolder.config.general
private val searchRadius get() = generalConfig.searchRadius
Expand Down Expand Up @@ -109,7 +119,7 @@ object Healer : Worker {
private fun isAllowedBySpecies(pokemonEntity: PokemonEntity): Boolean {
if (!config.chanseyLineHealsPlayers) return false
val speciesName = pokemonEntity.pokemon.species.translatedName.string.lowercase()
return speciesName in VALID_SPECIES
return speciesName in VALID_TRANSLATED_SPECIES
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import accieo.cobbleworkers.interfaces.Worker
import accieo.cobbleworkers.utilities.CobbleworkersInventoryUtils
import accieo.cobbleworkers.utilities.CobbleworkersNavigationUtils
import accieo.cobbleworkers.utilities.CobbleworkersTypeUtils
import com.cobblemon.mod.common.api.pokemon.PokemonSpecies
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import net.minecraft.block.BeehiveBlock
import net.minecraft.block.Block
Expand All @@ -30,6 +31,15 @@ import java.util.UUID
*/
object HoneyCollector : Worker {
private val VALID_SPECIES: Set<String> = setOf("combee", "vespiquen")
private val VALID_TRANSLATED_SPECIES by lazy {
VALID_SPECIES.map { name ->
PokemonSpecies.getByName(name)
?.translatedName
?.string
?.lowercase()
?: name.lowercase()
}.toSet()
}
private val heldItemsByPokemon = mutableMapOf<UUID, List<ItemStack>>()
private val failedDepositLocations = mutableMapOf<UUID, MutableSet<BlockPos>>()
private val config = CobbleworkersConfigHolder.config.honey
Expand Down Expand Up @@ -171,7 +181,7 @@ object HoneyCollector : Worker {
private fun isAllowedBySpecies(pokemonEntity: PokemonEntity): Boolean {
if (!config.combeeLineCollectsHoney) return false
val speciesName = pokemonEntity.pokemon.species.translatedName.string.lowercase()
return speciesName in VALID_SPECIES
return speciesName in VALID_TRANSLATED_SPECIES
}

/**
Expand Down