Merge branch 'my-goodness-more-fixes' into 'main'

There are more damn 1.8 QA fixes

See merge request cable-mc/cobblemon!2256
This commit is contained in:
Polymeta
2026-05-15 08:27:44 +00:00
9 changed files with 36 additions and 23 deletions
+3
View File
@@ -254,6 +254,7 @@
- Apricorns now make a new sound when harvested
- Lowered the volume of harvesting berries
- Fixed Raichu (male) and Alolan Raichu (both genders) not displaying the correct Partner Cap when Pewter Crunchies are in the cosmetic slot.
- Regional Foods will now prioritize being eaten instead of used for healing Pokémon, shift clicking will use it as healing
### Fixes
- Fixed Croagunk's walkspeed
@@ -296,6 +297,8 @@
- Fixed removing mulch from berry trees with a shovel not working.
- Fixed collecting honey from Saccharine Leaf blocks deleting Honey Bottles when the inventory was full
- Fixed CancelableSoundInstance causing lag by attempting to create sounds every tick when out of range of hearing
- Fixed Stat Reducing Aprijuice not being possible to apply on a max out Pokémon, and the possibility of going into negatives
- Fixed Exploit where you could take out the bait or drop your Pokérod with bait to avoid consuming bait, now the bobber will just disappear if you do so
### Developer
- Added `PokeSnackSpawnerFactory` which allows influence registration on PokeSnack encounters
@@ -48,7 +48,7 @@ class RidingStatBoostCriterion(
val max = context.pokemon.pokemon.getMaxRideBoost(rideStat).toDouble()
val min = context.pokemon.pokemon.getBaseRideStat(rideStat).toDouble()
val value = context.pokemon.getRideStat(rideStat, ridingStyle, min, max)
val isSufficient = (value >= this.statValue && this.statValue > 0.0) || !context.pokemon.pokemon.canAddRideBoost(rideStat)
val isSufficient = (value >= this.statValue && this.statValue > 0.0) || !context.pokemon.pokemon.canApplyRideBoost(rideStat)
if (isSufficient && this.rideStat == "any") {
return true
} else if (!isSufficient && this.rideStat == "all") {
@@ -38,7 +38,7 @@ import net.minecraft.world.phys.AABB
* @since July 29th, 2023
*/
interface PokemonSelectingItem {
fun use(player: ServerPlayer, stack: ItemStack): InteractionResultHolder<ItemStack> {
fun use(player: ServerPlayer, stack: ItemStack, ignoreShift: Boolean = false): InteractionResultHolder<ItemStack> {
val range = player.entityInteractionRange()
val entity = player.level()
.getEntities(player, AABB.ofSize(player.position(), range, range, range))
@@ -60,7 +60,7 @@ interface PokemonSelectingItem {
return interactWithSpecificBattle(player, stack, battlePokemon)
}
} ?: run {
if (!player.isShiftKeyDown) {
if (ignoreShift || !player.isShiftKeyDown) {
return if (entity != null) {
val pokemon = entity.pokemon
if (entity.ownerUUID == player.uuid) {
@@ -479,9 +479,11 @@ class PokeRodFishingBobberEntity(type: EntityType<out PokeRodFishingBobberEntity
private fun removeIfInvalid(player: Player): Boolean {
val itemStack = player.mainHandItem
val itemStack2 = player.offhandItem
val bl = BuiltInRegistries.ITEM[this.usedRod] == itemStack.item //(itemStack.item is PokerodItem) // todo make this work again so the line breaks when you swap items
val bl2 = BuiltInRegistries.ITEM[this.usedRod] == itemStack2.item //(itemStack2.item is PokerodItem) // todo make this work again so the line breaks when you swap items
if (player.isRemoved || !player.isAlive || !bl && !bl2 || this.distanceToSqr(player) > 1024.0) {
val bobberPokerodEqquiped = itemStack == rodStack || itemStack2 == rodStack // Ensure one of the held rods is the one that cast
val pokerodBaitConsistent = rodStack == null || PokerodItem.getBaitStackOnRod(rodStack!!) == bobberBait
if (player.isRemoved || !player.isAlive || !bobberPokerodEqquiped || !pokerodBaitConsistent || this.distanceToSqr(player) > 1024.0) {
discard()
isCast = false
return true
@@ -44,7 +44,7 @@ class AprijuiceItem(val type: Apricorn): CobblemonItem(Properties().stacksTo(16)
InteractionResultHolder.consume(stack)
} else {
if (world is ServerLevel && user is ServerPlayer) {
return super<PokemonSelectingItem>.use(user, stack)
return super<PokemonSelectingItem>.use(user, stack, false)
}
InteractionResultHolder.pass(stack)
}
@@ -76,7 +76,7 @@ class AprijuiceItem(val type: Apricorn): CobblemonItem(Properties().stacksTo(16)
override fun canUseOnPokemon(stack: ItemStack, pokemon: Pokemon): Boolean {
val boosts = getBoosts(stack)
return boosts.isNotEmpty() && boosts.any { pokemon.canAddRideBoost(it.key) } && super.canUseOnPokemon(stack, pokemon)
return boosts.isNotEmpty() && boosts.any { pokemon.canApplyRideBoost(it.key, it.value < 0) } && super.canUseOnPokemon(stack, pokemon)
}
fun getBoosts(stack: ItemStack): Map<RidingStat, Int> {
@@ -84,7 +84,7 @@ class PokePuffItem : Item(Properties().stacksTo(64)), PokemonSelectingItem {
InteractionResultHolder.consume(stack)
} else {
if (user is ServerPlayer) {
super<PokemonSelectingItem>.use(user, stack)
super<PokemonSelectingItem>.use(user, stack, false)
} else {
InteractionResultHolder.pass(stack)
}
@@ -33,18 +33,18 @@ class RegionalFoodItem(properties: Properties) : Item(properties), PokemonSelect
return InteractionResultHolder.pass(stack);
}
// Prioritizes healing pokémon with the item
val superInteractionResult = super<PokemonSelectingItem>.use(player, stack)
if (superInteractionResult.result != InteractionResult.PASS) {
return superInteractionResult
}
// Otherwise allow eating normally if player needs food OR in creative
if (player.foodData.needsFood() || player.isCreative) {
// Prioritizes eating the food
if ((player.foodData.needsFood() || player.isCreative) && !player.isShiftKeyDown) {
player.startUsingItem(hand)
return InteractionResultHolder.consume(stack)
}
// Otherwise heal pokémon with the item
val superInteractionResult = super<PokemonSelectingItem>.use(player, stack, true)
if (superInteractionResult.result != InteractionResult.PASS) {
return superInteractionResult
}
return InteractionResultHolder.pass(stack)
}
@@ -251,5 +251,4 @@ class PokerodItem(val pokeRodId: ResourceLocation, settings: Properties) : Fishi
private fun playDetachSound(entity: Entity) {
entity.playSound(CobblemonSounds.FISHING_BAIT_DETACH, 1F, 1F)
}
}
@@ -1988,17 +1988,26 @@ open class Pokemon : ShowdownIdentifiable {
return 0F
}
fun canAddRideBoost(stat: RidingStat): Boolean {
fun canApplyRideBoost(stat: RidingStat, decreases: Boolean = false): Boolean {
return if (!decreases) canIncreaseRideBoost(stat) else canDecreaseRideBoost(stat)
}
private fun canIncreaseRideBoost(stat: RidingStat): Boolean {
val current = rideBoosts[stat] ?: 0F
return current < getMaxRideBoost(stat)
}
private fun canDecreaseRideBoost(stat: RidingStat): Boolean {
val current = rideBoosts[stat] ?: 0F
return current > 0
}
fun addRideBoost(stat: RidingStat, boostAmount: Float): Boolean {
if (!canAddRideBoost(stat)) {
if (!canApplyRideBoost(stat, boostAmount < 0F)) {
return false
}
val max = getMaxRideBoost(stat)
rideBoosts[stat] = (getRideBoost(stat) + boostAmount).coerceAtMost(max)
rideBoosts[stat] = (getRideBoost(stat) + boostAmount).coerceIn(0F, max)
onChange(RideBoostsUpdatePacket({ this }, getRideBoosts()))
return true
}
@@ -2009,12 +2018,12 @@ open class Pokemon : ShowdownIdentifiable {
for (boost in boosts) {
val (stat, boostAmount) = boost
if (!canAddRideBoost(stat)) {
if (!canApplyRideBoost(stat, boostAmount < 0F)) {
continue
}
val max = getMaxRideBoost(stat)
rideBoosts[stat] = (getRideBoost(stat) + boostAmount).coerceAtMost(max)
rideBoosts[stat] = (getRideBoost(stat) + boostAmount).coerceIn(0F, max)
changed = true
}