mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-10-21 14:46:25 -04:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d11ef0411a |
@@ -127,6 +127,7 @@
|
||||
- Fixed Pokémon marked as silent still playing shiny sounds and effects.
|
||||
- Fixed an issue with newer versions of Fabric API where underground Pokémon were spawning in The End.
|
||||
- Fixed spawning not working well when you're at high points surrounded by lower altitude spawning areas, such as flying.
|
||||
- Fixed swapping held items with wild Pokémon under certain circumstances causing duplicate items
|
||||
|
||||
### Developer
|
||||
- A finished battle now has winners and losers set inside of `PokemonBattle` instead of them always being empty.
|
||||
|
||||
+9
-1
@@ -20,6 +20,7 @@ import com.cobblemon.mod.common.util.battleLang
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.world.item.Items
|
||||
import java.util.function.Function
|
||||
|
||||
/**
|
||||
@@ -130,7 +131,14 @@ object CobblemonHeldItemManager : BaseCobblemonHeldItemManager() {
|
||||
}
|
||||
// if items aren't consumed, then we don't want to give them to wild pokemon (dupe)
|
||||
if (this.giveItemEffect.contains(effectId) && (pokemon.actor is PlayerBattleActor || consumeHeldItems)) {
|
||||
this.give(pokemon, itemID)
|
||||
// extra check for item swapping abuse
|
||||
// checks if the pokemon whose item is being taken away (wild pokemon) has its held item tampered with in any way
|
||||
// this assumes its always moves causing the swaps
|
||||
// I still think this is a bit brittle and can cause false positives, but for now this should do the trick I hope
|
||||
var fromBattlePokemon = battle.majorBattleActions[pokemon.uuid]?.battlePokemon(2, battle)
|
||||
if(showdownIdOf(fromBattlePokemon?.originalPokemon?.heldItem?.item ?: Items.AIR) == itemID) {
|
||||
this.give(pokemon, itemID)
|
||||
}
|
||||
}
|
||||
// allow players to steal wild held items
|
||||
if (this.takeItemEffect.contains(effectId) && (pokemon.actor !is PlayerBattleActor || consumeHeldItems)) {
|
||||
|
||||
Reference in New Issue
Block a user