Merge branch 'fix/tms-consumption-tmm-screen' into 'main'

fix: tm stack not consumed on use in tmm screen

See merge request cable-mc/cobblemon!2466
This commit is contained in:
Polymeta
2026-10-09 14:31:51 +00:00
3 changed files with 9 additions and 2 deletions
+2
View File
@@ -170,6 +170,8 @@
- Bees now grow Apricorns and the Galarica Nut Bush, which were in the bee growables tag but never handled, and correctly spend their nectar when they do
- Saccharine Leaves can now be bone mealed
- Fixed equipping a stack of items instead of one item of a stack
- Fixed TM stack consumption in TMM screen when player teaches a move to species
### Developer
- Evolution requirements can now set `pokedexIcon` and `pokedexTooltip` directly in their JSON to control how they're shown on the Pokédex's evolution tree, for example:
```json
@@ -1041,7 +1041,10 @@ class TMMachineScreen(containerMenu: TMMachineMenu, val inventory: Inventory, ti
// Scroll to move if moves list contains held TM move
if (tmList.get().contains(heldStackTm)) {
val moveListIndex = tmList.get().indexOf(heldStackTm)
movesScrollingList.scrollAmount = (if (moveListIndex == tmList.get().lastIndex) 1.0 else (moveListIndex / tmList.get().size.toDouble()))* movesScrollingList.maxScroll
movesScrollingList.scrollAmount = movesScrollingList.maxScroll * when (moveListIndex) {
tmList.get().lastIndex -> 1.0
else -> (moveListIndex / tmList.get().size.toDouble())
}
}
}
}
@@ -43,6 +43,8 @@ object TMMachineTeachMoveHandler : ServerNetworkPacketHandler<TMMachineTeachMove
!pokemon.moveSet.getMoveTemplates().contains(moveTemplate) &&
!pokemon.allAccessibleMoves.contains(moveTemplate)
) {
menu.incrementStateId()
if (!player.isCreative && !Cobblemon.config.infiniteTmUses) menu.carried.shrink(1)
if (pokemon.moveSet.hasSpace()) {
@@ -58,4 +60,4 @@ object TMMachineTeachMoveHandler : ServerNetworkPacketHandler<TMMachineTeachMove
player.playNotifySound(CobblemonSounds.MOVE_LEARN, SoundSource.MASTER, 1.0F, 1.0F)
}
}
}
}