Compare commits

...
Author SHA1 Message Date
Landon Wills 0d4eaa464a Fix event logic 2025-11-18 06:00:29 -05:00
Jackson Bowes ac3628d907 Merge branch 'ufo-turning-and-head-rot-fix' into 'main'
Fix various bugs with riding.

See merge request cable-mc/cobblemon!1998
2025-11-18 00:32:11 -06:00
jackowes 4563770835 - fix nonJumping horses from falling through to Tpose when trying to jump. The in_air flag checks for the player.jumping flag so its true for a moment. Block this from being true when horse has no jump. 2025-11-17 23:00:13 -06:00
jackowes cc80f69c47 - Fix jet bug/mishap
- Fixed ride sounds not working in multiplayer
- Made the velocity threshold lower for ridesounds so that they can be heard in more 'normal' situations.
- Revert player head rotation changes for rollables.
2025-11-17 22:56:30 -06:00
Landon 128366f9c2 Merge branch '1.7-spawns-update' into 'main'
Updated spawns for Marill, Bidoof, Rufflet, and Tadbulb lines.

See merge request cable-mc/cobblemon!1996
2025-11-18 04:43:51 +00:00
Landon ddd63ac841 Merge branch 'Aprijuice-Recipe-Change' into 'main'
Energy Root added to Aprijuice recipes & slight update to compost values.

See merge request cable-mc/cobblemon!1995
2025-11-18 03:57:18 +00:00
Veraxiel 118a682451 Updated spawns for Marill, Bidoof, Rufflet, and Tadbulb lines. 2025-11-17 22:26:13 -05:00
Landon d202efc0a9 Merge branch 'validate-op-permissions-riding' into 'main'
Add is OP player check to riding stats debug GUI

See merge request cable-mc/cobblemon!1988
2025-11-18 03:16:00 +00:00
Carmendar 81a1314493 Energy Root added to Aprijuice recipes & slight update to compost values. 2025-11-17 21:08:16 -06:00
Jackson Bowes a316329359 Merge branch 'very-minor-molang-change' into 'main'
Fix boats and truthy values

See merge request cable-mc/cobblemon!1993
2025-11-17 16:29:54 -06:00
jackowes ea59981b58 - fix ufo momentum by rotating the rideVelocity vector by the induced ride yaw. 2025-11-17 15:22:41 -06:00
JPAKx4 960460ec08 Fix Boats being 'in_air' in water and vice versa. 2025-11-17 13:58:06 -06:00
JPAKx4 8d587c5287 Fix unintendid behaviour, shouldn't actually change anything currently though. 2025-11-17 13:35:19 -06:00
Guilherme Pereira e0b79c9bab change is op check to use cobblemon permissions validator 2025-11-17 09:36:56 -03:00
Polymeta 6206330b76 Merge branch 'getting-statistical' into 'main'
Getting statistical and minor Advancement fixes

See merge request cable-mc/cobblemon!1760
2025-11-17 09:30:28 +00:00
Polymeta 7b137fbe14 Merge branch 'Saccharine-Tree-Biome-List-Update' into 'main'
Saccharine tree biome list update

See merge request cable-mc/cobblemon!1990
2025-11-17 09:21:35 +00:00
Landon 4d472d0b36 Merge branch 'molang-json-interaction' into 'main'
Molang json interaction

See merge request cable-mc/cobblemon!1934
2025-11-17 09:10:40 +00:00
Slippy fd442211d3 Change Saccharine Tree Rarity 2025-11-17 03:07:58 -06:00
Landon 144f857a3b Merge branch 'fix-blocks-traveled-requirement' into 'main'
Fix Blocks Traveled requirement

See merge request cable-mc/cobblemon!1979
2025-11-17 08:20:35 +00:00
lion 80131e57f8 Fix Blocks Traveled requirement 2025-11-17 08:20:35 +00:00
Slippy 30d89a2704 Make Saccharine Trees a little less common 2025-11-17 02:04:51 -06:00
Landon 5e147545b7 Merge branch 'advancing-advancements' into 'main'
Advancing Advancements for Cobblemon 1.7.0

See merge request cable-mc/cobblemon!1974
2025-11-17 07:59:41 +00:00
Landon e962079cda Merge branch 'remove-poke-puff' into 'main'
Disable Poké Puffs temporarily

See merge request cable-mc/cobblemon!1989
2025-11-17 07:30:41 +00:00
lion 6f934cfbd4 Disable Poké Puffs temporarily 2025-11-17 07:30:41 +00:00
MoeBoy76 47ecef81a6 fix changelog errors 2025-11-17 18:02:04 +11:00
MoeBoy76 16762ae933 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into getting-statistical 2025-11-17 17:56:53 +11:00
MoeBoy76 ba47f6a833 remove species check from catch trigger 2025-11-17 17:56:26 +11:00
dhi_holo 522ffefd0a Stone fix and Z-fix
All Evolution Stone blocks (besides Nether Fire Stone Ore) now need Iron to mine, and Display Cases now look better in more contexts
2025-11-17 16:04:15 +10:00
dhi_holo e17ca360df Merge branch 'main' into advancing-advancements 2025-11-17 15:46:04 +10:00
Landon e18d5837af Merge branch 'riding-molang-electric-bogaloo' into 'main'
Switch asMoLangValue from the states to the behaviour to allow for more dynamic options.

See merge request cable-mc/cobblemon!1986
2025-11-17 05:15:10 +00:00
Landon 65ae67d9ac Merge branch 'disable-nvb' into 'main'
Disable third_person_view_bobbing Config.

See merge request cable-mc/cobblemon!1987
2025-11-17 05:15:08 +00:00
Paul 05c77a6156 Hitbox improvements for melee attack, also don't randomly attack piglins or slimes or creepers 2025-11-17 15:11:50 +10:00
Paul 8ae6792785 Fixed fossil substitutes not working, fixed aspects not working in fossil tank rendering, fixed slowpoke tail aspects being added to everything 2025-11-17 11:21:23 +10:00
Guilherme Pereira 5f67fc167a add is op player check to riding stats debug gui 2025-11-16 20:16:08 -03:00
JPAKx4 0eee6e8634 Merge remote-tracking branch 'origin/riding-molang-electric-bogaloo' into riding-molang-electric-bogaloo
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/behaviour/types/air/BirdBehaviour.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/behaviour/types/air/HoverBehaviour.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/behaviour/types/air/JetBehaviour.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/behaviour/types/air/RocketBehaviour.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/behaviour/types/land/HorseBehaviour.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/behaviour/types/land/MinekartBehaviour.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/behaviour/types/land/VehicleBehaviour.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/behaviour/types/liquid/BoatBehaviour.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/behaviour/types/liquid/BurstBehaviour.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/behaviour/types/liquid/DolphinBehaviour.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/behaviour/types/liquid/SubmarineBehaviour.kt
2025-11-16 15:10:45 -06:00
JPAKx4 a16a7c31fe Switch asMoLangValue from the states to the behaviour to allow for more dynamic options. 2025-11-16 15:10:07 -06:00
JPAKx4 a4254df0ca Disable third_person_view_bobbing Config. 2025-11-16 12:02:25 -06:00
JPAKx4 21df52daf7 Switch asMoLangValue from the states to the behaviour to allow for more dynamic options. 2025-11-16 11:49:08 -06:00
Landon 5e81e26c69 Merge branch 'molang-riding' into 'main'
Updates to riding to work better in Molang

See merge request cable-mc/cobblemon!1984
2025-11-16 15:33:38 +00:00
Hiroku d103629fd2 Merge branch '1.7-spawns-update' into 'main'
1.7 spawns update

See merge request cable-mc/cobblemon!1983
2025-11-16 09:27:54 +00:00
JPAKx4 6e2a0cd3b9 Switch to using ObjectValues for states to support riding styles with multiple properties. Added a few useful properties that can now be accessed through get_riding_state(name). 2025-11-16 07:12:59 +00:00
Veraxiel 37f6010381 Edit to Popplio line spawns. 2025-11-15 23:44:38 -05:00
Hiroku 798dd64f84 Merge branch 'RestoreSheepShearing' into 'main'
Restore Sheep Shearing

See merge request cable-mc/cobblemon!1982
2025-11-16 03:43:58 +00:00
Paul c1acf8494c Slowpoke tails are snipped a bit less short 2025-11-16 13:15:44 +10:00
Veraxiel d4601326a7 Removed Water and Lava block tags. Updated spawns using those tags to use the blocks directly. 2025-11-15 22:09:50 -05:00
JazzMcNade a037af6948 Allow herding sheep to eat grass, fix typo 2025-11-15 20:55:58 -06:00
JazzMcNade 517ac94b8d Restore sheep shearing and eating grass to restore wool 2025-11-15 20:26:31 -06:00
Paul b5ec2b28fd Merge remote-tracking branch 'origin/main' 2025-11-16 12:14:50 +10:00
Paul f45a4b784b Fixed percentSum being exceeded during multi-pass spawns, closes #1778 2025-11-16 12:14:35 +10:00
Hiroku 91dda046d8 Merge branch 'revert-transition-logic' into 'main'
Revert transition logic so land mounts can be consistently mounted

See merge request cable-mc/cobblemon!1981
2025-11-16 01:47:59 +00:00
Landon Wills 49577d2518 Revert transition logic so land mounts can be consistently mounted 2025-11-15 19:29:36 -05:00
Landon 2bad8ec673 Merge branch 'implement_pokemon' into 'main'
Implement pokemon

See merge request cable-mc/cobblemon!1945
2025-11-15 22:44:48 +00:00
Carmendar 1524e9c476 smol species fixes. 2025-11-15 15:55:14 -06:00
Carmendar c8ad0cd7e7 Merge branch 'main' into implement_pokemon
# Conflicts:
#	common/src/main/resources/data/cobblemon/species/generation1/aerodactyl.json
#	common/src/main/resources/data/cobblemon/species/generation1/arcanine.json
#	common/src/main/resources/data/cobblemon/species/generation1/blastoise.json
#	common/src/main/resources/data/cobblemon/species/generation1/charizard.json
#	common/src/main/resources/data/cobblemon/species/generation1/dewgong.json
#	common/src/main/resources/data/cobblemon/species/generation1/dragonite.json
#	common/src/main/resources/data/cobblemon/species/generation1/gyarados.json
#	common/src/main/resources/data/cobblemon/species/generation1/lapras.json
#	common/src/main/resources/data/cobblemon/species/generation1/mrmime.json
#	common/src/main/resources/data/cobblemon/species/generation1/nidoking.json
#	common/src/main/resources/data/cobblemon/species/generation1/parasect.json
#	common/src/main/resources/data/cobblemon/species/generation1/rhydon.json
#	common/src/main/resources/data/cobblemon/species/generation1/rhyhorn.json
#	common/src/main/resources/data/cobblemon/species/generation1/seaking.json
#	common/src/main/resources/data/cobblemon/species/generation1/tauros.json
#	common/src/main/resources/data/cobblemon/species/generation1/venusaur.json
#	common/src/main/resources/data/cobblemon/species/generation2/ariados.json
#	common/src/main/resources/data/cobblemon/species/generation2/forretress.json
#	common/src/main/resources/data/cobblemon/species/generation2/girafarig.json
#	common/src/main/resources/data/cobblemon/species/generation2/heracross.json
#	common/src/main/resources/data/cobblemon/species/generation2/piloswine.json
#	common/src/main/resources/data/cobblemon/species/generation2/ursaring.json
#	common/src/main/resources/data/cobblemon/species/generation3/altaria.json
#	common/src/main/resources/data/cobblemon/species/generation3/camerupt.json
#	common/src/main/resources/data/cobblemon/species/generation3/claydol.json
#	common/src/main/resources/data/cobblemon/species/generation3/flygon.json
#	common/src/main/resources/data/cobblemon/species/generation3/latias.json
#	common/src/main/resources/data/cobblemon/species/generation3/latios.json
#	common/src/main/resources/data/cobblemon/species/generation3/metagross.json
#	common/src/main/resources/data/cobblemon/species/generation3/relicanth.json
#	common/src/main/resources/data/cobblemon/species/generation3/salamence.json
#	common/src/main/resources/data/cobblemon/species/generation3/sharpedo.json
#	common/src/main/resources/data/cobblemon/species/generation3/slaking.json
#	common/src/main/resources/data/cobblemon/species/generation3/tropius.json
#	common/src/main/resources/data/cobblemon/species/generation3/wailmer.json
#	common/src/main/resources/data/cobblemon/species/generation3/wailord.json
#	common/src/main/resources/data/cobblemon/species/generation4/bastiodon.json
#	common/src/main/resources/data/cobblemon/species/generation4/bronzong.json
#	common/src/main/resources/data/cobblemon/species/generation4/drifblim.json
#	common/src/main/resources/data/cobblemon/species/generation4/dusknoir.json
#	common/src/main/resources/data/cobblemon/species/generation4/garchomp.json
#	common/src/main/resources/data/cobblemon/species/generation4/gastrodon.json
#	common/src/main/resources/data/cobblemon/species/generation4/lickilicky.json
#	common/src/main/resources/data/cobblemon/species/generation4/magnezone.json
#	common/src/main/resources/data/cobblemon/species/generation4/mamoswine.json
#	common/src/main/resources/data/cobblemon/species/generation4/rhyperior.json
#	common/src/main/resources/data/cobblemon/species/generation4/staraptor.json
#	common/src/main/resources/data/cobblemon/species/generation4/togekiss.json
#	common/src/main/resources/data/cobblemon/species/generation5/bouffalant.json
#	common/src/main/resources/data/cobblemon/species/generation5/braviary.json
#	common/src/main/resources/data/cobblemon/species/generation5/crustle.json
#	common/src/main/resources/data/cobblemon/species/generation5/darmanitan.json
#	common/src/main/resources/data/cobblemon/species/generation5/golurk.json
#	common/src/main/resources/data/cobblemon/species/generation5/hydreigon.json
#	common/src/main/resources/data/cobblemon/species/generation5/klinklang.json
#	common/src/main/resources/data/cobblemon/species/generation5/serperior.json
#	common/src/main/resources/data/cobblemon/species/generation5/volcarona.json
#	common/src/main/resources/data/cobblemon/species/generation5/zebstrika.json
#	common/src/main/resources/data/cobblemon/species/generation6/gogoat.json
#	common/src/main/resources/data/cobblemon/species/generation6/noivern.json
#	common/src/main/resources/data/cobblemon/species/generation6/skiddo.json
#	common/src/main/resources/data/cobblemon/species/generation6/tyrantrum.json
#	common/src/main/resources/data/cobblemon/species/generation7/dhelmise.json
#	common/src/main/resources/data/cobblemon/species/generation7/mudsdale.json
#	common/src/main/resources/data/cobblemon/species/generation8/corviknight.json
#	common/src/main/resources/data/cobblemon/species/generation8/dragapult.json
#	common/src/main/resources/data/cobblemon/species/generation8a/sneasler.json
#	common/src/main/resources/data/cobblemon/species/generation8a/ursaluna.json
#	common/src/main/resources/data/cobblemon/species/generation8a/wyrdeer.json
#	common/src/main/resources/data/cobblemon/species/generation9/cyclizar.json
#	common/src/main/resources/data/cobblemon/species/generation9/dondozo.json
#	common/src/main/resources/data/cobblemon/species/generation9/dudunsparce.json
#	common/src/main/resources/data/cobblemon/species/generation9/espathra.json
#	common/src/main/resources/data/cobblemon/species/generation9/farigiraf.json
#	common/src/main/resources/data/cobblemon/species/generation9/kilowattrel.json
#	common/src/main/resources/data/cobblemon/species/generation9/orthworm.json
#	common/src/main/resources/data/cobblemon/species/generation9/revavroom.json
2025-11-15 15:53:14 -06:00
Kenji_64 33a4e31b60 Fixed Wartortle's shiny shell not being green 2025-11-15 19:51:14 +01:00
Carmendar 1526c2f037 Merge branch 'main' into implement_pokemon 2025-11-15 04:30:45 -06:00
Carmendar 408cf8c5ca One last poser tweak for the night. 2025-11-15 04:29:59 -06:00
violet ceb70dbf2d Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2025-11-15 04:26:14 -05:00
Carmendar 6d46992ad7 More poser tweaks. 2025-11-15 03:25:53 -06:00
violet 84242194ba fixed drampa look 2025-11-15 04:25:52 -05:00
violet 529e4bef46 fixed espurr line posers 2025-11-15 04:07:10 -05:00
violet aa1658bb5d fixed alolan muk's portrait 2025-11-15 03:55:16 -05:00
violet 068df2b138 added eelektross and eelektrik placeholder animations + fixed look animations 2025-11-15 03:47:56 -05:00
Carmendar 3499758203 Darmanitan Zen poser fix. 2025-11-15 00:29:54 -06:00
RedGenesectNinja 7d97df3407 Fixed Shiny Spring, Summer and Winter Sawsbuck using the wrong models 2025-11-15 00:17:06 -06:00
Carmendar 22b0e0612a Vanillite line shiny textures for real. 2025-11-14 23:57:48 -06:00
Carmendar e52c63d565 Metagross jump stat adjustment. 2025-11-14 23:52:45 -06:00
Carmendar fe7f72cb3d Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2025-11-14 23:51:50 -06:00
Carmendar 8187905987 Adjusted walk speed for Gogoat. 2025-11-14 23:51:04 -06:00
RedGenesectNinja 11b3043e6c Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2025-11-14 22:47:24 -06:00
RedGenesectNinja 8d871ac949 Fixed Dragonair's shiny not working 2025-11-14 22:47:04 -06:00
Carmendar 8f7a523404 stat tweaks. 2025-11-14 22:40:22 -06:00
Carmendar bb98992635 Surface mount tweaks. 2025-11-14 20:02:34 -06:00
Landon Wills d3984843e2 Run scraper 2025-11-14 19:32:31 -05:00
Carmendar 7a14c51df2 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2025-11-14 18:05:45 -06:00
Carmendar a7b023203f Merge branch 'main' into implement_pokemon 2025-11-14 18:04:18 -06:00
MoeBoy76 2b64174cfe fix input order which causes logic bug 2025-11-15 00:56:58 +11:00
MoeBoy76 918282893c Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into getting-statistical 2025-11-15 00:50:37 +11:00
violet dbbca02619 centiskorch texture tweaks 2025-11-14 05:52:46 -05:00
violet c50d5841d8 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2025-11-14 05:51:05 -05:00
violet 5489cfb4b0 fixed bellibolt's look anims 2025-11-14 05:39:07 -05:00
violet e421de547f SLOWPOKE TAILS NOW DROP WHEN YOU KILL THEM 2025-11-14 05:30:24 -05:00
violet 075dcdb9e9 BRAND NEW COBBLEMON EXCLUSIVE FURFROU FORMS PROPERLY IMPLEMENTED 2025-11-14 04:53:22 -05:00
Carmendar 2ebe8d6434 breach jump for Dragapult 2025-11-14 02:53:18 -06:00
Carmendar d7c77f5f3f a few ride stats adjusted ahead of scraper 2025-11-14 02:50:10 -06:00
Carmendar 572682a23a Merge branch 'main' into implement_pokemon 2025-11-14 01:36:27 -06:00
Carmendar 6241865f95 Grounded again 2025-11-14 01:34:02 -06:00
dhi_holo 67dbda3113 Final Checks
Fixed the icons being outdated formattings, we are good to gold
2025-11-14 17:33:33 +10:00
Carmendar c50d3183e6 Submarine expression tweak 2025-11-14 01:22:35 -06:00
dhi_holo 9eae394ff5 Merge branch 'advancing-advancements' of https://gitlab.com/cable-mc/cobblemon into advancing-advancements 2025-11-14 17:15:14 +10:00
MoeBoy76 76b640984c changelog
[skip-ci]
2025-11-14 18:13:40 +11:00
dhi_holo 72d142a781 Merge branch 'main' into advancing-advancements 2025-11-14 17:08:21 +10:00
MoeBoy76 af1df22e4d ride stat trigger logic finalisation, added getBaseRideStat method to check the minimum value of a stat and updated the advancement 2025-11-14 18:07:15 +11:00
dhi_holo 66787bfea4 Merge branch 'main' into advancing-advancements 2025-11-14 15:03:10 +10:00
dhi_holo c113e68488 Moomoo Mistake
Fixed lang string for moomoo milk tooltip
2025-11-14 15:03:05 +10:00
Carmendar 8284b04426 Merge branch 'main' into implement_pokemon
# Conflicts:
#	common/src/main/resources/data/cobblemon/species/generation1/rattata.json
#	common/src/main/resources/data/cobblemon/species/generation2/unown.json
#	common/src/main/resources/data/cobblemon/species/generation3/latias.json
#	common/src/main/resources/data/cobblemon/species/generation3/latios.json
#	common/src/main/resources/data/cobblemon/species/generation3/shuppet.json
#	common/src/main/resources/data/cobblemon/species/generation5/hydreigon.json
#	common/src/main/resources/data/cobblemon/species/generation5/volcarona.json
#	common/src/main/resources/data/cobblemon/species/generation9/wiglett.json
2025-11-13 18:16:41 -06:00
dhi_holo f1bdaad97d Merge branch 'main' into advancing-advancements 2025-11-13 19:29:15 +10:00
dhi_holo f725e5fcba Improve max_ride_stats description 2025-11-13 19:28:40 +10:00
violet 2237e1eeca added missing emissive textures for magmar, magmortar, torracat, incineroar, sizzlipede, & centiskorch 2025-11-13 04:24:36 -05:00
dhi_holo bb54f8414e Merge branch 'main' into advancing-advancements 2025-11-13 18:17:07 +10:00
Carmendar 99c7d39705 Grounded. 2025-11-13 01:42:08 -06:00
Carmendar bdd27078b5 Merge branch 'main' into implement_pokemon 2025-11-13 00:33:06 -06:00
dhi_holo 7c3fdbc921 Merge branch 'main' into advancing-advancements 2025-11-13 14:06:59 +10:00
RedGenesectNinja 9596f08957 Fixed Dusknoir's shiny not working and Updated Bronzong's textures 2025-11-12 21:12:00 -06:00
MoeBoy76 d9433960cd fml, forgot the license 2025-11-13 13:09:02 +11:00
MoeBoy76 89b6fd56b6 Merge remote-tracking branch 'origin/getting-statistical' into getting-statistical 2025-11-13 12:52:58 +11:00
MoeBoy76 10c441e3cd worked out rod casting, updated changelog 2025-11-13 12:52:36 +11:00
MoeBoy76 461b22efa8 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into getting-statistical
# Conflicts:
#	common/src/main/resources/assets/cobblemon/lang/en_us.json
2025-11-13 12:44:17 +11:00
Carmendar 57a19909aa Merge branch 'main' into implement_pokemon 2025-11-12 19:32:00 -06:00
MoeBoy76 dc1473919e riding trigger added, added empty_bait check to reel in trigger 2025-11-13 12:24:16 +11:00
Carmendar ee20986ee0 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2025-11-12 19:23:57 -06:00
RedGenesectNinja 436aa5ea75 Updated textures for a handful of Pokemon 2025-11-12 19:14:19 -06:00
Carmendar e49f761417 Poser fixes and cries added. 2025-11-12 19:09:38 -06:00
Carmendar 95e3ab213a anim fixes for Scorbunny and Sneasler 2025-11-12 18:48:14 -06:00
Carmendar 0c33de61b9 Species file updates for Tauros, Salamence, Latias, Latios and Staraptor. 2025-11-12 03:05:12 -06:00
Carmendar 91a3fb5031 Removed Kilowattrel mounted run. 2025-11-12 03:04:32 -06:00
Carmendar 3a46b2c218 Updated look posing for Tropius, Garchomp and Pidove. 2025-11-12 03:03:28 -06:00
Carmendar 2f631ddc64 Ursaring texture fix 2025-11-12 03:02:39 -06:00
Carmendar 2a2ef6ff7d Removed mount 2025-11-12 02:42:32 -06:00
Carmendar d3d94a3614 Adjusted Dragonite flying pose when mounted. 2025-11-12 02:42:03 -06:00
Carmendar f34cc3072b Cutiefly Shoulder poses. 2025-11-12 02:41:12 -06:00
Carmendar 68bff6a40b Jet Handling expression tweak. 2025-11-12 00:45:26 -06:00
dhi_holo 2a6381d610 Eggant Is Here Now 2025-11-12 10:47:12 +10:00
dhi_holo 93dba4f3b8 Merge branch 'main' into advancing-advancements 2025-11-12 10:43:55 +10:00
Carmendar a7e7c2e814 Merge branch 'main' into implement_pokemon 2025-11-11 17:52:15 -06:00
MoeBoy76 6bf62b3f9d change debug message to log as error 2025-11-11 11:05:38 +00:00
Carmendar 00be470281 Alolan Rattata fix. 2025-11-11 02:58:28 -06:00
Carmendar 57afbe79c2 Orthworm and Honedge line texture fixes. 2025-11-11 00:49:30 -06:00
Carmendar d5f336ce73 Merge branch 'main' into implement_pokemon 2025-11-11 00:48:17 -06:00
violet b79a0b1b6f various animation fixes 2025-11-10 03:17:58 -05:00
violet 57721d1696 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2025-11-09 22:51:33 -05:00
violet b0711528d6 tiny tweaks :3 2025-11-09 22:51:19 -05:00
violet 7e968fcff9 Murdered Shulker Forretress 2025-11-09 22:50:41 -05:00
Carmendar e399130fda forgor one last change 2025-11-09 18:45:12 -06:00
Carmendar 0083e54f6a Galar Weezing crash fix 2025-11-09 18:27:38 -06:00
Carmendar 9512252b72 ^ 2025-11-09 14:24:41 -06:00
Carmendar 73028d4c2a Gave Dondozo basic land & fixed pivot issues with Bramblin. 2025-11-09 14:20:58 -06:00
Carmendar 2f5910c436 Merge branch 'main' into implement_pokemon 2025-11-09 03:09:26 -06:00
Carmendar d1197cbc0b Updated Kangaskhan poser & added held item condition. 2025-11-09 02:30:09 -06:00
Carmendar 2ccf699a86 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2025-11-09 01:37:47 -06:00
Carmendar d767420814 Wiglett lost floating privileges. 2025-11-09 01:37:08 -06:00
Carmendar 77100300b1 Fixed Luxray feet textures. 2025-11-09 01:35:05 -06:00
Carmendar 5c80fc03e2 Toxicroak remodel 2025-11-09 01:33:55 -06:00
Carmendar aa39bb84fe Fixed Lanturn t-posing on land. 2025-11-09 00:50:19 -06:00
violet a767b3d0fe Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2025-11-09 01:28:31 -05:00
violet 3dbcbc34d0 ICE CREAM 2025-11-09 01:28:17 -05:00
violet 0bdadb3794 altered posers for solosis line 2025-11-09 01:20:50 -05:00
dhi_holo 05b5782cd5 Merge branch 'main' into advancing-advancements 2025-11-09 12:54:24 +10:00
dhi_holo 0c220a8990 Berry Colour Tags
Small sorting thing to make it easier to find specific berry colours for cooking/crafting/smelting
2025-11-09 12:53:58 +10:00
dhi_holo da787bf9bf Merge branch 'main' into advancing-advancements 2025-11-07 16:15:29 +10:00
Paul 57a839d000 Removed some test stuff I forgor about 2025-11-06 22:14:08 +10:00
Paul e77e49c8b1 Minor cleanup 2025-11-06 22:13:03 +10:00
Paul ce6d142bd4 Merge remote-tracking branch 'origin/main' into molang-json-interaction 2025-11-06 22:12:17 +10:00
MoeBoy76 f2db63164c general riding and PokéRod cast/reel stats 2025-11-05 16:05:52 +11:00
MoeBoy76 604b4d39ea Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into getting-statistical 2025-11-05 14:26:27 +11:00
Paul 5d3741f2e5 Added JSON file interactions for molang and function arguments for q.run_script 2025-11-02 11:23:50 +10:00
dhi_holo 5e21ac94dc Merge branch 'main' into advancing-advancements 2025-10-25 17:13:13 +10:00
dhi_holo 1d055253d2 Merge branch 'main' into advancing-advancements 2025-10-10 16:00:30 +10:00
dhi_holo d56c5520f9 Merge branch 'main' into advancing-advancements 2025-10-04 17:26:10 +10:00
dhi_holo 89bc893f06 gamerule.healersHealPC 2025-10-04 17:25:50 +10:00
dhi_holo acc8d066e5 stOre 2025-10-03 19:17:00 +10:00
dhi_holo 6608268117 Update cobblemon.json
fixed typo
2025-10-03 14:03:35 +10:00
dhi_holo bdecab25a6 Merge branch 'main' into advancing-advancements 2025-10-03 13:38:45 +10:00
dhi_holo 81ed97a68b Update cobblemon.json
Removed removed item, added new items
2025-09-30 11:03:26 +10:00
dhi_holo 1e051deb9e Update CHANGELOG.md 2025-09-29 18:06:37 +10:00
dhi_holo 38c54e255a Chromatic Upgrades
- Removed Vivichoke advancement
- Reworded Galar Fossil advancement
- Renamed Master Rod advancement, made hidden by default
- Name tweak for IV Candy advancement
- Description update for regional delicacy advancement
- Renamed Poke Bait advancement
- Description update to ride stats
- Removed Aprijuice advancement
- Combined interaction advancements
- Added Saccharine advancement
- Moved Poke Snack advancement
- Updated some icons for advancements
2025-09-29 15:34:14 +10:00
dhi_holo e7ad38d1df Interactions and Clean Up
Added more Interaction based advancements, moved some stuff around, cleaned up visuals and description for max ride stats
2025-09-28 23:13:59 +10:00
dhi_holo 67c0abea8f Better Brush Desc 2025-09-28 21:15:54 +10:00
dhi_holo 85c1543df1 More tweaks
Brushing Pokemon advancement now works swell, Aprijuice advancement good, started work on the concept for Max Ride Stats, still need to actually get a trigger for it though
2025-09-28 17:10:15 +10:00
dhi_holo f38a1f83e2 More
Started on Bait and Brush advancements, renamed A Luring Aroma
2025-09-28 00:36:02 +10:00
dhi_holo 28785a01f6 Update revive.json
Reduced output to 1
2025-09-26 20:04:08 +10:00
dhi_holo 01c4260763 Merge branch 'main' into advancing-advancements 2025-09-25 20:05:09 +10:00
dhi_holo 150b3eb178 Snack 2025-09-25 20:05:07 +10:00
dhi_holo 5ab52d37f2 Fix Typo 2025-09-25 19:50:26 +10:00
dhi_holo ce191fd4c7 3 New, Minor Reorg
New: Cooking Regional Delicacies, Cooking EV Mochi, Cooking Poké Snack
Cleaned Up: Any Plant no longer announces to chat, Battle Win is on root, Use Candy is on Place Campfire Pot (also moves IV Candy to that tree instead)
2025-09-24 19:34:20 +10:00
MoeBoy76 9a7e349101 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into getting-statistical 2025-09-23 09:33:46 +10:00
MoeBoy76 07a7d2a51a Statistics correctly register and if something goes wrong a more helpful crash should be thrown. 2025-09-23 09:33:28 +10:00
MoeBoy76 d2b192cb07 stats still don't register 2025-09-22 13:36:54 +10:00
MoeBoy76 d8e3e93a87 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into getting-statistical 2025-09-22 10:06:52 +10:00
MoeBoy76 af12df38ed stats should work for NF now 2025-09-22 10:05:03 +10:00
MoeBoy76 7fb8268fae Lang tweaks 2025-08-04 10:38:54 +10:00
MoeBoy76 8b49eb1526 Stats work and Advancement fixes to match wiki 2025-08-04 10:19:25 +10:00
MoeBoy76 c6cdcf83a9 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into getting-statistical
# Conflicts:
#	common/src/main/resources/assets/cobblemon/lang/en_us.json
2025-08-04 08:26:06 +10:00
MoeBoy76 4bf82083b4 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into getting-statistical 2025-04-28 09:02:44 +10:00
MoeBoy76 6579fd8ebe more stats work, they load now and have lang 2025-04-23 11:02:12 +10:00
MoeBoy76 4d62ef771a Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into getting-statistical 2025-04-23 10:11:33 +10:00
MoeBoy76 7784a3a20c initial stats work 2025-04-22 09:49:47 +10:00
560 changed files with 6544 additions and 3813 deletions

No files matched your search

+24 -6
View File
@@ -43,9 +43,10 @@
- Added functionality to Everstone when held by a Pokémon; suppresses evolution notification and hides evolve button in summary interface.
- Added optional `filePath` parameter to MoLang functions to allow for global stores (ex. `../global/`). Path must end in a forward slash.
- Added new optional property `attachment_options` for most EmitterShapes to be attached to the locator/entities scale, rotation, and/or position. Position is true by default.
- Added Statistics for battles won, fled, and total, Pokémon captured (shiny and total), Pokémon released, dex entries added, trades completed, Pokémon levels gained, Pokémon evolved, fossils revived, PokéRod casts and reel-ins and Pokémon times ridden.
- Galarica Nut bushes now generate on beaches.
- Some Pokémon now pitch their bodies in the direction they're moving.
- Added new advancements Didn't Stop To Think, We Need To Cook, and Pokémon Jockey!.
- Added new advancements Didn't Stop To Think, We Need To Cook, Pokémon Jockey!, Souped-Up Stats, Culinary World Tour, Mochi Mochi!, A Luring Aroma, That's Bait, Star Pokéathlete, Home on the Range, and Just a Smackerel.
- Berries can now be smelted into their respective dyes.
- Added Syrupy Apples.
- Added `/runmolang <molang> [<npc>|<player>|<pokemon>]` command that executes a MoLang expression with the provided options as environment variables, as well as the entity (as `q.entity`) that executed the command.
@@ -61,6 +62,7 @@
- Added `min_perfect_ivs` property to PokemonProperties to specify the minimum number of perfect IVs of the Pokemon.
- Added `defaultKeyItems` config option to specify which key items players always have.
- Added `scale_modifier` property to PokemonProperties to modify the scale of the Pokemon.
- Added advancement trigger to check riding stat boosts.
- Added Tasty Tail which you can get from Slowpokes if you happen to have a pair of shears. They don't mind, we asked.
### Pokémon Added
@@ -309,7 +311,6 @@
- Tauros - Paldea Blaze
- Tauros - Paldea Combat
- Dewgong
- Exeggutor - Kanto
- Corphish (updated placeholders for crustaceous tripod gait legs)
- Crawdaunt (updated placeholders for crustaceous bipedal legs)
- Dragapult
@@ -475,8 +476,7 @@
- When using the `cobblemon` or `generation_9` capture calculators a critical capture with a single shake will always play for successful captures when you've already registered the Pokémon as caught in your Pokédex.
- Improved the performance of saving Pokédex and player data.
- Pokémon hitbox now scales with entity attribute `generic.scale`.
- Removed Shulker aspect and replaced it with cosmetic_item-shulker_shell.
- Shulker shell Forretress is now a cosmetic rather than a special evo and thus all shulker Forretress will revert back to normal until a shulker shell is put in their cosmetic slot.
- Removed Shulker shell Forretress.
- Updated `doPokemonSpawning` gamerule to support per-dimension configurations.
- The Pokedex now displays a form name of a "normal" Pokémon for when the base form is still a named form.
- Improved the zoom functionality of the Pokédex Scanner by giving the levels logarithmic scaling.
@@ -485,7 +485,7 @@
- Quirk animations no longer play in the battle GUI since they were pretty distracting.
- A number of Pokemon that float above the ground visually (Gastly, Klingklang, etc.) are no longer considered to be touching the ground
- Changed the recipes for Level, Lure, and Moon Balls to be cleaner
- Renamed `pokemonId` and `type` to `species` in relevant Advancement triggers for conformity, this is a breaking change.
- Renamed `pokemonId` and `type` to `species` and `evolved` to `has_evolved` in relevant Advancement triggers for conformity, this is a breaking change.
- Added a separate `species` argument to the `pick_starter`, `pasture_use` and `resurrect_pokemon` Advancement triggers.
- Made `CobblemonAgingDespawner` thresholds configurable via the config file.
- Tweaked Berry flavor data to balance cooking pot mechanics
@@ -520,10 +520,16 @@
- Updated `HatchEggEvent.Post` to include the Pokemon that hatched.
- Roseli Berry Trees now naturally generate in their preferred biomes.
- Refactored dynamic lights compat to be more future proof. The dynamic light support is only tested with LambDynamicLights, on NeoForged use that mod in combination with Sinytra Connector
- Renamed Masterful Dedication advancement to This will affect the Whiscash Population
- Changed icon for the following advancements: New Angles for Angling, Researcher Recruit, Doing my Part, Reapriforestation
- Disabled advancement Mother Nature's Bounty from appearing in chat when obtained, now only appears as a toast and in the advancements menu
- Removed Oki-Doki Vivichokey advancement
- Shulker Boxes and Traveler's Backpacks can no longer be held by Pokémon. Thanks Monocle ;) You could re-enable this with a datapack but you'd be crazy.
- Shulker Boxes and Traveler's Backpacks AND Packed Up backpacks can no longer be held by Pokémon. Thanks Monocle ;) You could re-enable this with our datapack (but you'd be crazy).
- Moomoo Milk now clears Pokémon stat changes when used in battle.
- Updated Evolution Stone Block light levels
- Added light levels to Evolution Stone Ores. These levels are reduced versions of the full blocks light levels
- Added a steps counter to the summary screen for Pokémon that require walking a certain number of steps to evolve.
### Fixes
- Fixed game crashing when removing national pokedex using datapacks
@@ -608,13 +614,17 @@
- Fixed singular Pokémon corruption causing entire storage corruption. Storages will now skip corrupted Pokémon and print an error to console.
- Fixed species additions not being able to properly mark a species as implemented.
- Fixed Pokémon item models not showing a glint when enchanted.
- Fixed the missing Terracotta Sun Stone Ore smelting and blasting recipes
- Improved experience gain from smelting evolution stone ores to better match other ore types
- Fixed some specific bag items not being dropped when used in battle.
- The Corphish line will now sink in water.
- Fixed the "use all berry bait" achievement not being progressed
- Fixed bobber hook and berry sprouts texture sizes causing mipmap issues.
- Fixed head locator not taking into account scale for positioning.
- Fixed Pokémon step counts not being saved when recalling them to a Pokéball or reentering the world.
- Fixed NPC pokémon not being linked to their NPC, which previously caused NPC pokémon to be catchable.
- Fixed an uncommon error caused by scanning a pokémon on a player's shoulder.
- Fixed a case where spawning could fail and log warnings when nothing wrong was happening.
### Developer
- A finished battle now has winners and losers set inside of `PokemonBattle` instead of them always being empty.
@@ -680,6 +690,7 @@
- Added `IVs.MAX_TOTAL` constant.
- Added `PokemonStats#total()`.
- Add `NatureAdapter` for serializing and deserializing Natures using Gson.
- Added `Pokemon.getBaseRideStat(RidingStat)` for getting the base value of the given stat.
- Fixed `Species#create` using the species name instead of identifier, which had led to certain mismatches generating random pokémon.
### MoLang & Datapacks
@@ -721,6 +732,7 @@
- Adds Flows for `POKEMON_HEALED`, `POKEMON_SCANNED`, `BERRY_HARVEST`, `LOOT_DROPPED`, `POKEMON_SEEN`, `COLLECT_EGG`, `HATCH_EGG`, and `EXPERIENCE_GAINED`.
- Adds Flows for `POKEMON_CATCH_RATE`, `BAIT_SET`, `BAIT_SET_PRE`, `BAIT_CONSUMED`, `POKEROD_CAST_PRE`, `POKEROD_CAST_POST`, `POKEROD_REEL`, and `BOBBER_SPAWN_POKEMON_PRE`.
- Adds Flows for `POKEMON_ASPECTS_CHANGED`, `FRIENDSHIP_UPDATED`, `CHANGE_PC_BOX_WALLPAPER_EVENT_PRE`, `CHANGE_PC_BOX_WALLPAPER_EVENT_POST`, and `FULLNESS_UPDATED`.
- Added Callback for `SERVER_STOPPING`
- MoLang triggered battles may now set the battle format, whether to clone the player's party, set level, or heal prior.
- Added Molang function for Player: `inventory`
- Adds Flows for `STARTER_CHOSEN`, `EV_GAINED`, `POKEMON_RELEASED`, `POKEMON_NICKNAMED`, `HELD_ITEM`, and `TRADE_COMPLETED` events
@@ -790,6 +802,12 @@
- Added support for species-specific move action effects, using the format `{move_id}_{species}.json`.
- Added `look_at_entity_types` variable for look_at_entities to specify what entity type or entity tag to look at.
- Added `Looks At Players` behaviour preset that only sets the look target to players.
- Added various functions to `q.file` for JSON file handling in MoLang, strictly for `./config` and `./data` folders that have `/molang/` in the path:
- `q.file.save(<path>, <struct>)` Saves to the given file path with the given variable struct.
- `q.file.load(<path>)` Loads a variable struct from the given path, or gets it from the cache if it's already been loaded.
- `q.file.exists(<path>)` Returns 1 if the given file path exists.
- `q.file.clear(<path>)` Clears the given file from the cache.
- Using `q.run_script` will now allow additional arguments which will be put into `c.arg_1`, `c.arg_2`, etc.
### Particles
Added new/updated particles for the following moves:
@@ -3022,4 +3040,4 @@ Thank you so much to all of our community translators that bring the mod to the
- Added species, ability, and move translations for `ko_ko`, `jp_jp`, `fr_fr`, `es_es`, `it_it`, and `zh_cn`.
## [1.0.0 (November 12th, 2022)](#1-0-0)
- Initial release.
- Initial release.
@@ -71,14 +71,15 @@ public class HumanoidModelMixin {
// If the player is on a rollable ride then use the ride local rotations to rotate the head
// This is to allow the player head to face the correct direction when "freelooking"
if (entity instanceof RidePassenger playerRotater &&
vehicle instanceof OrientationControllable controller &&
controller.getOrientationController().isActive()) {
this.head.xRot = playerRotater.cobblemon$getRideXRot();
headPitch = playerRotater.cobblemon$getRideXRot();
this.head.yRot = playerRotater.cobblemon$getRideYRot();
netHeadYaw = playerRotater.cobblemon$getRideYRot();
}
// TODO: find a way for this to work on built jars without borking head rotations.
// if (entity instanceof RidePassenger playerRotater &&
// vehicle instanceof OrientationControllable controller &&
// controller.getOrientationController().isActive()) {
// this.head.xRot = playerRotater.cobblemon$getRideXRot();
// headPitch = playerRotater.cobblemon$getRideXRot();
// this.head.yRot = playerRotater.cobblemon$getRideYRot();
// netHeadYaw = playerRotater.cobblemon$getRideYRot();
// }
if (!shouldRotatePlayerHead) {
netHeadYaw = 0f;
@@ -52,7 +52,7 @@ public class RecipeBookCategoriesMixin {
types.add(cobblemon$createCategory("COOKING_POT_SEARCH", $VALUES.length, new ItemStack(Items.COMPASS)));
types.add(cobblemon$createCategory("COOKING_POT_FOODS", $VALUES.length + 1, new ItemStack(CobblemonItems.LEEK_AND_POTATO_STEW)));
types.add(cobblemon$createCategory("COOKING_POT_MEDICINES", $VALUES.length + 2, new ItemStack(CobblemonItems.POTION)));
types.add(cobblemon$createCategory("COOKING_POT_COMPLEX_DISHES", $VALUES.length + 3, new ItemStack(CobblemonItems.POKE_PUFF)));
types.add(cobblemon$createCategory("COOKING_POT_COMPLEX_DISHES", $VALUES.length + 3, new ItemStack(CobblemonItems.APRIJUICE_RED)));
types.add(cobblemon$createCategory("COOKING_POT_MISC", $VALUES.length + 4, new ItemStack(CobblemonItems.PROTEIN)));
$VALUES = types.toArray(RecipeBookCategories[]::new);
}
@@ -19,6 +19,7 @@ import com.cobblemon.mod.common.api.drop.ItemDropEntry
import com.cobblemon.mod.common.api.events.CobblemonEvents
import com.cobblemon.mod.common.api.events.CobblemonEvents.DATA_SYNCHRONIZED
import com.cobblemon.mod.common.api.interaction.RequestManager
import com.cobblemon.mod.common.api.molang.MoLangLoadedFilesCache
import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.permission.PermissionValidator
import com.cobblemon.mod.common.api.pokeball.catching.calculators.CaptureCalculator
@@ -44,6 +45,7 @@ import com.cobblemon.mod.common.api.spawning.CobblemonSpawningZoneGenerator
import com.cobblemon.mod.common.api.spawning.position.AreaSpawnablePositionResolver
import com.cobblemon.mod.common.api.spawning.SpawningZoneGenerator
import com.cobblemon.mod.common.api.starter.StarterHandler
import com.cobblemon.mod.common.api.stats.CobblemonStats
import com.cobblemon.mod.common.api.storage.PokemonStoreManager
import com.cobblemon.mod.common.api.storage.adapter.conversions.ReforgedConversion
import com.cobblemon.mod.common.api.storage.adapter.database.MongoDBStoreAdapter
@@ -79,6 +81,7 @@ import com.cobblemon.mod.common.events.EntityCallbackHandler
import com.cobblemon.mod.common.events.CallbackHandler
import com.cobblemon.mod.common.events.PokedexHandler
import com.cobblemon.mod.common.events.ServerTickHandler
import com.cobblemon.mod.common.events.StatHandler
import com.cobblemon.mod.common.net.messages.client.settings.ServerSettingsPacket
import com.cobblemon.mod.common.permission.LaxPermissionValidator
import com.cobblemon.mod.common.platform.events.PlatformEvents
@@ -164,6 +167,8 @@ object Cobblemon {
val serverPlayerStructs = mutableMapOf<UUID, ObjectValue<Player>>()
val statistics: CobblemonStats = CobblemonStats
@JvmStatic
val builtinPacks = listOf<CobblemonPack>(
CobblemonPack(id = "adorncompatibility", name = "Adorn Compatibility", packType = PackType.CLIENT_RESOURCES, activationBehaviour = ResourcePackActivationBehaviour.ALWAYS_ENABLED, neededMods = setOf("adorn")),
@@ -339,6 +344,7 @@ object Cobblemon {
}
PlatformEvents.SERVER_STARTING.subscribe { event ->
val server = event.server
MoLangLoadedFilesCache.initialize(server)
playerDataManager = PlayerInstancedDataStoreManager().also { it.setup(server) }
val mongoClient: MongoClient?
@@ -441,6 +447,7 @@ object Cobblemon {
fun registerEventHandlers() {
AdvancementHandler.registerListeners()
PokedexHandler.registerListeners()
StatHandler.registerListeners()
}
fun getLevel(dimension: ResourceKey<Level>): Level? {
@@ -382,8 +382,8 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
@JvmField
val SINISTER_TEA = create("sinister_tea", SinisterTeaItem())
@JvmField
val POKE_PUFF = pokepuffItem("poke_puff")
// @JvmField
// val POKE_PUFF = pokepuffItem("poke_puff")
// FOODS
@JvmField
@@ -683,7 +683,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
}
})
@JvmField
val ENERGY_ROOT = compostableItem("energy_root", EnergyRootItem(CobblemonBlocks.ENERGY_ROOT, Properties()), 0.60f)
val ENERGY_ROOT = compostableItem("energy_root", EnergyRootItem(CobblemonBlocks.ENERGY_ROOT, Properties()), 0.65f)
@JvmField
val REVIVAL_HERB = compostableItem("revival_herb", RevivalHerbItem(CobblemonBlocks.REVIVAL_HERB))
@JvmField
@@ -693,9 +693,9 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
@JvmField
val REMEDY = compostableItem("remedy", RemedyItem(RemedyItem.NORMAL), 0.65f)
@JvmField
val FINE_REMEDY = compostableItem("fine_remedy", RemedyItem(RemedyItem.FINE), 0.75f)
val FINE_REMEDY = compostableItem("fine_remedy", RemedyItem(RemedyItem.FINE), 0.85f)
@JvmField
val SUPERB_REMEDY = compostableItem("superb_remedy", RemedyItem(RemedyItem.SUPERB), 0.85f)
val SUPERB_REMEDY = compostableItem("superb_remedy", RemedyItem(RemedyItem.SUPERB), 1f)
@JvmField
val MOOMOO_MILK = create("moomoo_milk", MoomooMilk(Item.Properties().craftRemainder(Items.GLASS_BOTTLE).stacksTo((16))))
@@ -915,7 +915,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
@JvmField
val ASSAULT_VEST = heldItem("assault_vest")
@JvmField
val BIG_ROOT = compostableBlockItem("big_root", CobblemonBlocks.BIG_ROOT, 0.40f)
val BIG_ROOT = compostableBlockItem("big_root", CobblemonBlocks.BIG_ROOT, 0.30f)
@JvmField
val BINDING_BAND = heldItem("binding_band")
@JvmField
@@ -1063,15 +1063,15 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
@JvmField
val ZOOM_LENS = heldItem("zoom_lens")
@JvmField
val MENTAL_HERB = compostableHeldItem("mental_herb", null, 1F)
val MENTAL_HERB = compostableHeldItem("mental_herb", null, 0.85F)
@JvmField
val MIRROR_HERB = compostableHeldItem("mirror_herb", null, 1F)
val MIRROR_HERB = compostableHeldItem("mirror_herb", null, 0.85F)
@JvmField
val MISTY_SEED = heldItem("misty_seed")
@JvmField
val POWER_HERB = compostableHeldItem("power_herb", null, 1F)
val POWER_HERB = compostableHeldItem("power_herb", null, 0.85F)
@JvmField
val WHITE_HERB = compostableHeldItem("white_herb", null, 1F)
val WHITE_HERB = compostableHeldItem("white_herb", null, 0.85F)
@JvmField
val BRIGHT_POWDER = heldItem("bright_powder")
@JvmField
@@ -22,6 +22,7 @@ import com.cobblemon.mod.common.client.net.cooking.ToggleCookingPotLidHandler
import com.cobblemon.mod.common.client.net.data.CobblemonMechanicsSyncHandler
import com.cobblemon.mod.common.client.net.data.DataRegistrySyncPacketHandler
import com.cobblemon.mod.common.client.net.data.RideSettingsSyncHandler
import com.cobblemon.mod.common.client.net.debug.OpenRidingStatsDebugGUIHandler
import com.cobblemon.mod.common.client.net.dialogue.DialogueClosedHandler
import com.cobblemon.mod.common.client.net.dialogue.DialogueOpenedHandler
import com.cobblemon.mod.common.client.net.effect.PokeSnackBlockParticlesHandler
@@ -79,6 +80,7 @@ import com.cobblemon.mod.common.net.messages.client.callback.OpenPartyMoveCallba
import com.cobblemon.mod.common.net.messages.client.cooking.SeasoningRegistrySyncPacket
import com.cobblemon.mod.common.net.messages.client.cooking.ToggleCookingPotLidPacket
import com.cobblemon.mod.common.net.messages.client.data.*
import com.cobblemon.mod.common.net.messages.client.debug.RequestOpenRidingStatsDebugGUIPacket
import com.cobblemon.mod.common.net.messages.client.dialogue.DialogueClosedPacket
import com.cobblemon.mod.common.net.messages.client.dialogue.DialogueOpenedPacket
import com.cobblemon.mod.common.net.messages.client.effect.PokeSnackBlockParticlesPacket
@@ -160,6 +162,7 @@ import com.cobblemon.mod.common.net.messages.server.callback.party.PartyPokemonS
import com.cobblemon.mod.common.net.messages.server.callback.party.PartySelectCancelledPacket
import com.cobblemon.mod.common.net.messages.server.callback.partymove.PartyMoveSelectCancelledPacket
import com.cobblemon.mod.common.net.messages.server.callback.partymove.PartyPokemonMoveSelectedPacket
import com.cobblemon.mod.common.net.messages.server.debug.OpenRidingStatsDebugGUIPacket
import com.cobblemon.mod.common.net.messages.server.debug.ServerboundUpdateRidingSettingsPacket
import com.cobblemon.mod.common.net.messages.server.debug.ServerboundUpdateRidingStatRangePacket
import com.cobblemon.mod.common.net.messages.server.debug.ServerboundUpdateRidingStatsPacket
@@ -213,6 +216,7 @@ import com.cobblemon.mod.common.net.serverhandling.callback.party.PartyPokemonSe
import com.cobblemon.mod.common.net.serverhandling.callback.party.PartySelectCancelledHandler
import com.cobblemon.mod.common.net.serverhandling.callback.partymove.PartyMoveSelectCancelledHandler
import com.cobblemon.mod.common.net.serverhandling.callback.partymove.PartyPokemonMoveSelectedHandler
import com.cobblemon.mod.common.net.serverhandling.debug.RequestOpenRidingStatsDebugGUIHandler
import com.cobblemon.mod.common.net.serverhandling.debug.ServerboundUpdateRidingSettingsHandler
import com.cobblemon.mod.common.net.serverhandling.debug.ServerboundUpdateRidingStatRangeHandler
import com.cobblemon.mod.common.net.serverhandling.debug.ServerboundUpdateRidingStatsHandler
@@ -487,6 +491,9 @@ object CobblemonNetwork {
list.add(PacketRegisterInfo(ClientboundUpdateRidingStatePacket.ID, ClientboundUpdateRidingStatePacket::decode, ClientboundUpdateRidingStateHandler))
list.add(PacketRegisterInfo(ClientboundUpdateDriverInputPacket.ID, ClientboundUpdateDriverInputPacket::decode, ClientboundUpdateDriverInputHandler))
// Debug
list.add(PacketRegisterInfo(OpenRidingStatsDebugGUIPacket.ID, OpenRidingStatsDebugGUIPacket::decode, OpenRidingStatsDebugGUIHandler))
return list
}
@@ -603,6 +610,9 @@ object CobblemonNetwork {
list.add(PacketRegisterInfo(SetEntityBehaviourPacket.ID, SetEntityBehaviourPacket::decode, SetEntityBehaviourHandler))
list.add(PacketRegisterInfo(DamageOnCollisionPacket.ID, DamageOnCollisionPacket::decode, DamageOnCollisionPacketHandler))
// Debug
list.add(PacketRegisterInfo(RequestOpenRidingStatsDebugGUIPacket.ID, RequestOpenRidingStatsDebugGUIPacket::decode, RequestOpenRidingStatsDebugGUIHandler))
return list
}
@@ -78,6 +78,8 @@ object CobblemonCriteria : PlatformRegistry<Registry<CriterionTrigger<*>>, Resou
@JvmField
val PLANT_TUMBLESTONE = this.create("plant_tumblestone", SimpleCriterionTrigger(PlantTumblestoneCriterion.CODEC))
val RIDING_STAT_BOOST = this.create("riding_stat_boost", SimpleCriterionTrigger(RidingStatBoostCriterion.CODEC))
override val registry = BuiltInRegistries.TRIGGER_TYPES
override val resourceKey = Registries.TRIGGER_TYPE
}
@@ -32,6 +32,6 @@ class CastPokeRodCriterionCondition(
}
override fun matches(player: ServerPlayer, context: CastPokeRodContext): Boolean {
return (context.baitId == this.baitId.asIdentifierDefaultingNamespace() || this.baitId.equals("empty_bait"))
return (context.baitId == this.baitId.asIdentifierDefaultingNamespace() || this.baitId == "empty_bait")
}
}
@@ -21,23 +21,25 @@ import java.util.Optional
* @author Hiroku
* @since November 4th, 2022
*/
open class CountablePokemonTypeContext(times: Int, var species: String) : CountableContext(times)
open class CountablePokemonTypeContext(times: Int, var type: String/*, var species: String*/) : CountableContext(times)
class CaughtPokemonCriterion(
playerCtx: Optional<ContextAwarePredicate>,
val species: String,
val type : String,
//val species: String,
count: Int
): CountableCriterion<CountablePokemonTypeContext>(playerCtx, count) {
companion object {
val CODEC: Codec<CaughtPokemonCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(CaughtPokemonCriterion::playerCtx),
Codec.STRING.optionalFieldOf("species", "any").forGetter(CaughtPokemonCriterion::species),
Codec.STRING.optionalFieldOf("type", "any").forGetter(CaughtPokemonCriterion::type),
//Codec.STRING.optionalFieldOf("species", "any").forGetter(CaughtPokemonCriterion::species),
Codec.INT.optionalFieldOf("count", 0).forGetter(CaughtPokemonCriterion::count)
).apply(it, ::CaughtPokemonCriterion) }
}
override fun matches(player: ServerPlayer, context: CountablePokemonTypeContext): Boolean {
return super.matches(player, context) && (context.species == species || species == "any")
return super.matches(player, context) && (context.type == type || type == "any")// && (context.species == species || species == "any")
}
}
@@ -28,7 +28,7 @@ class LevelUpCriterion(
val CODEC: Codec<LevelUpCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(LevelUpCriterion::playerCtx),
Codec.INT.optionalFieldOf("level", 0).forGetter(LevelUpCriterion::level),
Codec.BOOL.optionalFieldOf("evolved", true).forGetter(LevelUpCriterion::evolved)
Codec.BOOL.optionalFieldOf("has_evolved", true).forGetter(LevelUpCriterion::evolved)
).apply(it, ::LevelUpCriterion) }
}
@@ -35,6 +35,6 @@ class ReelInPokemonCriterionCondition(
override fun matches(player: ServerPlayer, context: ReelInPokemonContext): Boolean {
return (context.species == this.species.asIdentifierDefaultingNamespace() || this.species == "any")
&& (context.baitId == this.baitId.asIdentifierDefaultingNamespace() || this.baitId == "any")
&& (context.baitId == this.baitId.asIdentifierDefaultingNamespace() || this.baitId == "any" || this.baitId == "empty_bait")
}
}
@@ -0,0 +1,54 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.advancement.criterion
import com.cobblemon.mod.common.api.riding.RidingStyle
import com.cobblemon.mod.common.api.riding.stats.RidingStat
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.advancements.critereon.ContextAwarePredicate
import net.minecraft.advancements.critereon.EntityPredicate
import net.minecraft.server.level.ServerPlayer
import java.util.Optional
class RidingStatBoostContext(val pokemon: PokemonEntity)
class RidingStatBoostCriterion(
playerCtx: Optional<ContextAwarePredicate>,
val rideStat: String,
val statValue : Double,
val isMax : Boolean
) : SimpleCriterionCondition<RidingStatBoostContext>(playerCtx) {
companion object {
val CODEC: Codec<RidingStatBoostCriterion> = RecordCodecBuilder.create { it.group(
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter { it.playerCtx },
Codec.STRING.optionalFieldOf("ride_stat", "any").forGetter { it.rideStat },
Codec.DOUBLE.optionalFieldOf("stat_value", 0.0).forGetter { it.statValue },
Codec.BOOL.optionalFieldOf("is_max", false).forGetter { it.isMax }
).apply(it, ::RidingStatBoostCriterion) }
}
override fun matches(player: ServerPlayer, context: RidingStatBoostContext) : Boolean {
RidingStyle.entries.forEach { ridingStyle ->
RidingStat.entries.forEach { rideStat ->
if (rideStat.name.equals(this.rideStat, true) || this.rideStat == "any") {
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)
if ((value >= this.statValue && this.statValue > 0.0) || value == max || !context.pokemon.pokemon.canAddRideBoost(rideStat)) {
return true
}
}
}
}
return false
}
}
@@ -19,7 +19,7 @@ import net.minecraft.world.entity.ai.memory.MemoryModuleType
class MeleeAttackTaskConfig : SingleTaskConfig {
val condition = booleanVariable(SharedEntityVariables.ATTACKING_CATEGORY, "attacks_melee", true).asExpressible()
val range = numberVariable(SharedEntityVariables.ATTACKING_CATEGORY, "melee_range", 1.5F).asExpressible()
val range = numberVariable(SharedEntityVariables.ATTACKING_CATEGORY, "melee_range", 0.75F).asExpressible()
val cooldownTicks = numberVariable(SharedEntityVariables.ATTACKING_CATEGORY, "melee_cooldown", 20).asExpressible()
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(
@@ -12,6 +12,7 @@ import com.bedrockk.molang.runtime.MoLangEnvironment
import com.bedrockk.molang.runtime.MoLangRuntime
import com.bedrockk.molang.runtime.MoParams
import com.bedrockk.molang.runtime.struct.ArrayStruct
import com.bedrockk.molang.runtime.struct.ContextStruct
import com.bedrockk.molang.runtime.struct.QueryStruct
import com.bedrockk.molang.runtime.struct.VariableStruct
import com.bedrockk.molang.runtime.value.DoubleValue
@@ -179,6 +180,18 @@ object MoLangFunctions {
struct.map.clear()
DoubleValue.ONE
},
"get_variable" to java.util.function.Function { params ->
val struct = params.get<VariableStruct>(0)
val variable = params.getString(1)
return@Function struct.map[variable] ?: DoubleValue.ZERO
},
"set_variable" to java.util.function.Function { params ->
val struct = params.get<VariableStruct>(0)
val variable = params.getString(1)
val value = params.get<MoValue>(2)
struct.map[variable] = value
return@Function value
},
"set_query" to java.util.function.Function { params ->
val variable = params.getString(0)
val value = params.get<MoValue>(1)
@@ -296,8 +309,12 @@ object MoLangFunctions {
val runtime = MoLangRuntime()
runtime.environment.query = params.environment.query
runtime.environment.variable = params.environment.variable
runtime.environment.context = params.environment.context
val args = params.params.subList(1, params.params.size)
runtime.environment.context = ContextStruct(
params.environment.context.map + args.mapIndexed { index, value -> "arg_${index + 1}" to value }.toMap()
)
val script = params.getString(0).asIdentifierDefaultingNamespace()
// store the args in the
CobblemonScripts.run(script, runtime) ?: DoubleValue.ZERO
},
"run_molang" to java.util.function.Function { params ->
@@ -349,7 +366,8 @@ object MoLangFunctions {
val pickupPriority = params.getIntOrNull(1) ?: 0
val pickupItem = ObtainableItem(item = item, pickupPriority = pickupPriority)
return@Function pickupItem.struct
}
},
"file" to java.util.function.Function { MoLangLoadedFilesCache.struct }
)
val biomeFunctions = mutableListOf<(Holder<Biome>) -> HashMap<String, java.util.function.Function<MoParams, Any>>>()
val worldFunctions = mutableListOf<(Holder<Level>) -> HashMap<String, java.util.function.Function<MoParams, Any>>>(
@@ -1886,12 +1904,43 @@ object MoLangFunctions {
map.put("in_battle") { DoubleValue(pokemonEntity.isBattling) }
map.put("is_moving") { DoubleValue((pokemonEntity.moveControl as? PokemonMoveControl)?.hasWanted() == true) }
map.put("is_flying") { DoubleValue(pokemonEntity.getBehaviourFlag(PokemonBehaviourFlag.FLYING)) }
map.put("get_alt_pose") { StringValue(pokemonEntity.getAltPose()) }
map.put("is_gliding") { DoubleValue(pokemonEntity.isUsingAltPose(cobblemonResource("gliding"))) }
map.put("is_sprinting") { DoubleValue(pokemonEntity.isUsingAltPose(cobblemonResource("sprinting"))) }
map.put("is_drifting") { DoubleValue(pokemonEntity.isUsingAltPose(cobblemonResource("drifting"))) }
map.put("is_powered_drifting") { DoubleValue(pokemonEntity.isUsingAltPose(cobblemonResource("powered_drifting"))) }
map.put("in_air") { DoubleValue(pokemonEntity.isUsingAltPose(cobblemonResource("in_air"))) }
map.put("get_riding_state") { params ->
val name = params.getStringOrNull(0)
pokemonEntity.ifRidingAvailableSupply(DoubleValue.ZERO) { behaviour, settings, state ->
val moValue = behaviour.asMoLangValue(settings, state, pokemonEntity)
return@ifRidingAvailableSupply moValue.functions[name]?.apply(MoParams.EMPTY) as? MoValue ?: moValue
}
}
map.put("is_gliding") {
pokemonEntity.ifRidingAvailableSupply(DoubleValue.ZERO) { behaviour, settings, state ->
val moValue = behaviour.asMoLangValue(settings, state, pokemonEntity)
return@ifRidingAvailableSupply moValue.functions.get("gliding")?.apply(MoParams.EMPTY) as? MoValue ?: DoubleValue.ZERO
}
}
map.put("is_sprinting") {
pokemonEntity.ifRidingAvailableSupply(DoubleValue.ZERO) { behaviour, settings, state ->
val moValue = behaviour.asMoLangValue(settings, state, pokemonEntity)
return@ifRidingAvailableSupply moValue.functions.get("sprinting")?.apply(MoParams.EMPTY) as? MoValue ?: DoubleValue.ZERO
}
}
map.put("is_drifting") {
pokemonEntity.ifRidingAvailableSupply(DoubleValue.ZERO) { behaviour, settings, state ->
val moValue = behaviour.asMoLangValue(settings, state, pokemonEntity)
return@ifRidingAvailableSupply moValue.functions.get("drifting")?.apply(MoParams.EMPTY) as? MoValue ?: DoubleValue.ZERO
}
}
map.put("is_powered_drifting") {
pokemonEntity.ifRidingAvailableSupply(DoubleValue.ZERO) { behaviour, settings, state ->
val moValue = behaviour.asMoLangValue(settings, state, pokemonEntity)
return@ifRidingAvailableSupply moValue.functions.get("powered_drifting")?.apply(MoParams.EMPTY) as? MoValue ?: DoubleValue.ZERO
}
}
map.put("in_air") {
pokemonEntity.ifRidingAvailableSupply(DoubleValue.ZERO) { behaviour, settings, state ->
val moValue = behaviour.asMoLangValue(settings, state, pokemonEntity)
return@ifRidingAvailableSupply moValue.functions.get("in_air")?.apply(MoParams.EMPTY) as? MoValue ?: DoubleValue.ZERO
}
}
map.put("is_wild") { DoubleValue(pokemonEntity.ownerUUID == null) }
map.put("is_in_party") { DoubleValue(pokemonEntity.pokemon.storeCoordinates.get()?.store is PartyStore) }
map.put("is_ridden") { DoubleValue(pokemonEntity.hasControllingPassenger()) }
@@ -2469,6 +2518,17 @@ object MoLangFunctions {
return value
}
fun Vec3.asMoLangValue(): ObjectValue<Vec3> {
val value = ObjectValue(
obj = this
)
value.addFunction("x") { this.x }
value.addFunction("y") { this.y }
value.addFunction("z") { this.z }
return value
}
/**
* Different functions exist depending on the entity type, this tries to make the struct that's most specific to the type.
*/
@@ -0,0 +1,114 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.molang
import com.bedrockk.molang.runtime.struct.QueryStruct
import com.bedrockk.molang.runtime.struct.VariableStruct
import com.bedrockk.molang.runtime.value.DoubleValue
import com.bedrockk.molang.runtime.value.MoValue
import com.cobblemon.mod.common.Cobblemon
import com.google.gson.GsonBuilder
import com.google.gson.JsonElement
import java.nio.file.Path
import java.util.concurrent.ConcurrentHashMap
import net.minecraft.server.MinecraftServer
import net.minecraft.world.level.storage.LevelResource
/**
* A cache for loaded MoLang files to avoid redundant file I/O operations.
* Provides functions to load, save, check existence, and clear cached files.
*
* Only files with /molang/ in their path and a .json extension within the config
* or data folders can be accessed.
*
* @author Hiroku
* @since November 1st, 2025
*/
object MoLangLoadedFilesCache {
private val gson = GsonBuilder().setPrettyPrinting().create()
val loadedFiles = ConcurrentHashMap<String, VariableStruct>()
/** Essentially the server root or world root for singleplayer. */
lateinit var baseFolder: Path
private lateinit var configFolder: Path
private lateinit var dataFolder: Path
fun initialize(server: MinecraftServer) {
baseFolder = server.getWorldPath(LevelResource.ROOT)
configFolder = baseFolder.resolve("config").normalize().toAbsolutePath()
dataFolder = baseFolder.resolve("data").normalize().toAbsolutePath()
}
val struct = QueryStruct(hashMapOf())
.addFunction("load") { params ->
val fileName = params.params[0].asString()
return@addFunction load(fileName)
}
.addFunction("save") { params ->
val fileName = params.params[0].asString()
val data = params.params[1] as VariableStruct
save(fileName, data)
return@addFunction DoubleValue.ONE
}
.addFunction("exists") { params ->
val fileName = params.params[0].asString()
val exists = exists(fileName)
return@addFunction if (exists) DoubleValue.ONE else DoubleValue.ZERO
}
.addFunction("clear") { params ->
val fileName = params.params[0].asString()
clear(fileName)
return@addFunction DoubleValue.ONE
}
private fun validatePath(fileName: String): Path? {
val filePath = baseFolder.resolve(fileName).normalize().toAbsolutePath()
if (!filePath.startsWith(configFolder) && !filePath.startsWith(dataFolder)) {
Cobblemon.LOGGER.error("MoLang attempted to access file outside of config or data folder: $fileName")
return null
} else if ("/molang/" !in fileName) {
Cobblemon.LOGGER.error("MoLang attempted to access file outside of a 'molang' subfolder: $fileName")
return null
} else if (!fileName.endsWith(".json")) {
Cobblemon.LOGGER.error("MoLang attempted to access file without a .json extension: $fileName")
return null
}
return filePath
}
fun exists(fileName: String): Boolean {
val filePath = validatePath(fileName) ?: return false
return filePath.toFile().exists()
}
fun clear(fileName: String) {
loadedFiles.remove(fileName)
}
fun load(fileName: String): VariableStruct {
return loadedFiles.getOrPut(fileName) {
val filePath = validatePath(fileName) ?: return VariableStruct()
val file = filePath.toFile()
if (!file.exists()) {
return VariableStruct()
}
val jsonElement = gson.fromJson(file.readText(), JsonElement::class.java)
MoValue.of(jsonElement) as VariableStruct
}
}
fun save(fileName: String, data: VariableStruct) {
loadedFiles[fileName] = data
val filePath = validatePath(fileName) ?: return
val file = filePath.toFile()
file.parentFile?.mkdirs()
val jsonElement = MoValue.writeToJson(data)
file.writeText(gson.toJson(jsonElement))
}
}
@@ -147,6 +147,9 @@ object CobblemonPermissions {
@JvmStatic
val SEE_HIDDEN_NPCS = this.create("seehiddennpcs", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
@JvmStatic
val USE_RIDING_STATS_DEBUG = this.create("useridingstatsdebug", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
@JvmStatic
fun all(): Iterable<Permission> = this.permissions
@@ -735,10 +735,9 @@ open class PokemonProperties {
shiny?.let { json.addProperty(DataKeys.POKEMON_SHINY, it) }
gender?.let { json.addProperty(DataKeys.POKEMON_GENDER, it.name) }
species?.let { json.addProperty(DataKeys.POKEMON_SPECIES_TEXT, it) }
//nickname?.let { json.addProperty(DataKeys.POKEMON_NICKNAME, Text.Serialization.toJsonString(it)) }
form?.let { json.addProperty(DataKeys.POKEMON_FORM_ID, it) }
friendship?.let { json.addProperty(DataKeys.POKEMON_FRIENDSHIP, it) }
fullness?.let {json.addProperty(DataKeys.POKEMON_FULLNESS, it)}
fullness?.let { json.addProperty(DataKeys.POKEMON_FULLNESS, it) }
pokeball?.let { json.addProperty(DataKeys.POKEMON_CAUGHT_BALL, it) }
nature?.let { json.addProperty(DataKeys.POKEMON_NATURE, it) }
ability?.let { json.addProperty(DataKeys.POKEMON_ABILITY, it) }
@@ -770,7 +769,6 @@ open class PokemonProperties {
shiny = json.get(DataKeys.POKEMON_SHINY)?.asBoolean
gender = json.get(DataKeys.POKEMON_GENDER)?.asString?.let { Gender.valueOf(it) }
species = json.get(DataKeys.POKEMON_SPECIES_TEXT)?.asString
//nickname = json.get(DataKeys.POKEMON_NICKNAME)?.asString?.let { Text.Serialization.fromJson(it) }
form = json.get(DataKeys.POKEMON_FORM_ID)?.asString
friendship = json.get(DataKeys.POKEMON_FRIENDSHIP)?.asInt
fullness = json.get(DataKeys.POKEMON_FULLNESS)?.asInt
@@ -807,7 +805,7 @@ open class PokemonProperties {
shiny?.let { pieces.add("shiny=$it") }
gender?.let { pieces.add("gender=$it")}
friendship?.let { pieces.add("friendship=$it") }
fullness?.let {pieces.add("fullness=$it")}
fullness?.let { pieces.add("fullness=$it") }
pokeball?.let { pieces.add("pokeball=$it") }
nature?.let { pieces.add("nature=$it") }
ability?.let { pieces.add("ability=$it") }
@@ -66,12 +66,16 @@ class IntSpeciesFeature(override var name: String) : SynchronizedSpeciesFeature,
override fun apply(pokemon: Pokemon) {
val featureProvider = SpeciesFeatures.getFeature(name) ?: return
if (featureProvider in SpeciesFeatures.getFeaturesFor(pokemon.species)) {
val existingFeature = pokemon.getFeature<IntSpeciesFeature>(name)
var existingFeature = pokemon.getFeature<IntSpeciesFeature>(name)
if (existingFeature != null) {
existingFeature.value = value
} else {
pokemon.features.add(IntSpeciesFeature(name, value))
existingFeature = IntSpeciesFeature(name, value)
pokemon.features.add(existingFeature)
}
pokemon.markFeatureDirty(existingFeature)
pokemon.updateAspects()
}
}
@@ -8,6 +8,9 @@
package com.cobblemon.mod.common.api.riding.behaviour
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMoLangValue
import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.riding.RidingStyle
import com.cobblemon.mod.common.api.riding.sound.RideSoundSettingsList
import com.cobblemon.mod.common.entity.PoseType
@@ -18,7 +21,6 @@ import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.player.Player
import net.minecraft.world.phys.Vec2
import net.minecraft.world.phys.Vec3
import kotlin.math.abs
/**
* Represents the behaviour of a Pokemon when being ridden.
@@ -76,8 +78,6 @@ interface RidingBehaviour<Settings : RidingBehaviourSettings, State : RidingBeha
fun useAngVelSmoothing(settings: Settings, state: State, vehicle: PokemonEntity): Boolean
fun useRidingAltPose(settings: Settings, state: State, vehicle: PokemonEntity, driver: Player): ResourceLocation
fun inertia(settings: Settings, state: State, vehicle: PokemonEntity): Double
fun shouldRoll(settings: Settings, state: State, vehicle: PokemonEntity): Boolean
@@ -116,6 +116,18 @@ interface RidingBehaviour<Settings : RidingBehaviourSettings, State : RidingBeha
*/
fun mouseModifiesDriverRotation(settings: Settings, state: State, vehicle: PokemonEntity): Pair<Boolean, Boolean> = Pair(false, false)
/**
* Used in MoLang functions for querying states for animations or other magical MoLang effects.
*/
fun asMoLangValue(settings: Settings, state: State, vehicle: PokemonEntity): ObjectValue<RidingBehaviour<Settings, State>> {
val value = ObjectValue(
this
)
value.functions.put("ride_velocity") { state.rideVelocity.get().asMoLangValue() }
value.functions.put("stamina") { DoubleValue(state.stamina.get()) }
return value
}
/**
* Internal helpers to help behaviour specific calculations
*/
@@ -53,7 +53,6 @@ open class RidingBehaviourState {
rideVelocity.set(buffer.readVec3(), true)
stamina.set(buffer.readFloat(), true)
}
}
fun <T> ridingState(value: T, side: Side) = SidedRidingState(value, side)
@@ -146,7 +146,7 @@ class RidingController(
return (driver as DoubleJump).isDoubleJumping
}
else {
return !(entity.isUnderWater)
return !entity.onGround() && !(entity.isInLiquid || entity.isUnderWater)
}
}
}
@@ -10,9 +10,10 @@ package com.cobblemon.mod.common.api.riding.behaviour.types.air
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.MoLangMath.lerp
import com.cobblemon.mod.common.Cobblemon
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.CobblemonRideSettings
import com.cobblemon.mod.common.OrientationControllable
import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.orientation.OrientationController
import com.cobblemon.mod.common.api.riding.RidingStyle
import com.cobblemon.mod.common.api.riding.behaviour.*
@@ -33,7 +34,6 @@ import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.player.Player
import net.minecraft.world.phys.Vec2
import net.minecraft.world.phys.Vec3
import net.minecraft.world.phys.shapes.Shapes
import org.joml.Vector3f
import kotlin.math.*
@@ -550,18 +550,6 @@ class BirdBehaviour : RidingBehaviour<BirdSettings, BirdState> {
return false
}
override fun useRidingAltPose(
settings: BirdSettings,
state: BirdState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
if (state.gliding.get()) {
return cobblemonResource("gliding")
}
return cobblemonResource("no_pose")
}
override fun inertia(settings: BirdSettings, state: BirdState, vehicle: PokemonEntity): Double {
return 0.5
}
@@ -591,7 +579,7 @@ class BirdBehaviour : RidingBehaviour<BirdSettings, BirdState> {
state: BirdState,
vehicle: PokemonEntity
): Boolean {
return true
return false
}
override fun damageOnCollision(
@@ -614,6 +602,17 @@ class BirdBehaviour : RidingBehaviour<BirdSettings, BirdState> {
}
override fun createDefaultState(settings: BirdSettings) = BirdState()
override fun asMoLangValue(
settings: BirdSettings,
state: BirdState,
vehicle: PokemonEntity
): ObjectValue<RidingBehaviour<BirdSettings, BirdState>> {
val value = super.asMoLangValue(settings, state, vehicle)
value.functions.put("gliding") { DoubleValue(state.gliding.get()) }
value.functions.put("last_glide") { DoubleValue(state.lastGlide.get()) }
return value
}
}
class BirdSettings : RidingBehaviourSettings {
@@ -9,7 +9,6 @@
package com.cobblemon.mod.common.api.riding.behaviour.types.air
import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.CobblemonRideSettings
import com.cobblemon.mod.common.OrientationControllable
import com.cobblemon.mod.common.api.riding.RidingStyle
@@ -24,7 +23,6 @@ import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.util.*
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.SmoothDouble
import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.player.Player
@@ -155,15 +153,6 @@ class GliderBehaviour : RidingBehaviour<GliderSettings, RidingBehaviourState> {
return false
}
override fun useRidingAltPose(
settings: GliderSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
return cobblemonResource("no_pose")
}
override fun inertia(settings: GliderSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Double {
return 0.5
}
@@ -33,7 +33,6 @@ import kotlin.math.abs
import kotlin.math.pow
import kotlin.math.sin
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.SmoothDouble
import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.player.Player
@@ -246,15 +245,6 @@ class HelicopterBehaviour : RidingBehaviour<HelicopterSettings, RidingBehaviourS
return true
}
override fun useRidingAltPose(
settings: HelicopterSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
return cobblemonResource("no_pose")
}
override fun inertia(settings: HelicopterSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Double {
return 0.1
}
@@ -9,7 +9,9 @@
package com.cobblemon.mod.common.api.riding.behaviour.types.air
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.CobblemonRideSettings
import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.riding.RidingStyle
import com.cobblemon.mod.common.api.riding.behaviour.*
import com.cobblemon.mod.common.api.riding.posing.PoseOption
@@ -23,7 +25,6 @@ import com.cobblemon.mod.common.util.math.geometry.toRadians
import net.minecraft.client.Minecraft
import net.minecraft.network.FriendlyByteBuf
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.Mth
import net.minecraft.util.SmoothDouble
import net.minecraft.world.entity.LivingEntity
@@ -32,7 +33,6 @@ import net.minecraft.world.level.ClipContext
import net.minecraft.world.phys.HitResult
import net.minecraft.world.phys.Vec2
import net.minecraft.world.phys.Vec3
import net.minecraft.world.phys.shapes.Shapes
import org.joml.Matrix3f
import kotlin.math.*
@@ -156,6 +156,7 @@ class HoverBehaviour : RidingBehaviour<HoverSettings, HoverState> {
driver: LivingEntity
): Vec2 {
val turnAmount = calcRotAmount(settings, state, vehicle, driver)
state.rideVelocity.set( state.rideVelocity.get().yRot(turnAmount.toRadians()))
return Vec2(driver.xRot, vehicle.yRot + turnAmount )
}
@@ -349,15 +350,6 @@ class HoverBehaviour : RidingBehaviour<HoverSettings, HoverState> {
return false
}
override fun useRidingAltPose(
settings: HoverSettings,
state: HoverState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
return cobblemonResource("no_pose")
}
override fun inertia(
settings: HoverSettings,
state: HoverState,
@@ -415,6 +407,18 @@ class HoverBehaviour : RidingBehaviour<HoverSettings, HoverState> {
}
override fun createDefaultState(settings: HoverSettings) = HoverState()
override fun asMoLangValue(
settings: HoverSettings,
state: HoverState,
vehicle: PokemonEntity
): ObjectValue<RidingBehaviour<HoverSettings, HoverState>> {
val value = super.asMoLangValue(settings, state, vehicle)
value.functions.put("boosting") { DoubleValue(state.isBoosting.get()) }
value.functions.put("boost_ticks") { DoubleValue(state.boostTicks.get()) }
value.functions.put("too_high") { DoubleValue(state.tooHigh.get()) }
return value
}
}
class HoverSettings : RidingBehaviourSettings {
@@ -10,8 +10,10 @@ package com.cobblemon.mod.common.api.riding.behaviour.types.air
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.MoLangMath.lerp
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.CobblemonRideSettings
import com.cobblemon.mod.common.OrientationControllable
import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.riding.RidingStyle
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviour
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviourSettings
@@ -39,7 +41,6 @@ import kotlin.math.min
import net.minecraft.client.Minecraft
import net.minecraft.network.FriendlyByteBuf
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.SmoothDouble
import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.player.Player
@@ -71,7 +72,6 @@ class JetBehaviour : RidingBehaviour<JetSettings, JetState> {
if (vehicle.isInWater || vehicle.isUnderWater) {
return@any false
}
//This might not actually work, depending on what the yPos actually is. yPos of the middle of the entity? the feet?
if (it.y.toDouble() == (vehicle.position().y)) {
val blockState = vehicle.level().getBlockState(it.below())
return@any !(!blockState.isAir && blockState.fluidState.isEmpty)
@@ -329,7 +329,7 @@ class JetBehaviour : RidingBehaviour<JetSettings, JetState> {
// Have accumulated input begin decay when no input detected
if (abs(mouseX) == 0.0) {
// Have decay on roll be much stronger.
state.currMouseXForce.set(lerp(state.currMouseXForce.get(), 0.0, 0.08))
state.currMouseXForce.set(lerp(state.currMouseXForce.get(), 0.0, 0.02))
}
if (mouseY == 0.0) {
state.currMouseYForce.set(lerp(state.currMouseYForce.get(), 0.0, 0.02))
@@ -394,15 +394,6 @@ class JetBehaviour : RidingBehaviour<JetSettings, JetState> {
return true
}
override fun useRidingAltPose(
settings: JetSettings,
state: JetState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
return cobblemonResource("no_pose")
}
override fun inertia(settings: JetSettings, state: JetState, vehicle: PokemonEntity): Double {
return 1.0
}
@@ -432,7 +423,7 @@ class JetBehaviour : RidingBehaviour<JetSettings, JetState> {
state: JetState,
vehicle: PokemonEntity
): Boolean {
return true
return false
}
override fun getRideSounds(
@@ -454,6 +445,17 @@ class JetBehaviour : RidingBehaviour<JetSettings, JetState> {
val impactSpeed = impactVec.horizontalDistance().toFloat() * 10f
return vehicle.causeFallDamage(impactSpeed, 1f, vehicle.damageSources().flyIntoWall())
}
override fun asMoLangValue(
settings: JetSettings,
state: JetState,
vehicle: PokemonEntity
): ObjectValue<RidingBehaviour<JetSettings, JetState>> {
val value = super.asMoLangValue(settings, state, vehicle)
value.functions.put("boosting") { DoubleValue(state.boosting.get()) }
value.functions.put("can_speed_burst") { DoubleValue(state.canSpeedBurst.get()) }
return value
}
}
class JetSettings : RidingBehaviourSettings {
@@ -10,7 +10,9 @@ package com.cobblemon.mod.common.api.riding.behaviour.types.air
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.MoLangMath.lerp
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.CobblemonRideSettings
import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.riding.RidingStyle
import com.cobblemon.mod.common.api.riding.behaviour.*
import com.cobblemon.mod.common.api.riding.posing.PoseOption
@@ -24,14 +26,12 @@ import com.cobblemon.mod.common.util.math.geometry.toRadians
import net.minecraft.client.Minecraft
import net.minecraft.network.FriendlyByteBuf
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.Mth
import net.minecraft.util.SmoothDouble
import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.player.Player
import net.minecraft.world.phys.Vec2
import net.minecraft.world.phys.Vec3
import net.minecraft.world.phys.shapes.Shapes
import org.joml.Matrix3f
import kotlin.math.*
@@ -411,15 +411,6 @@ class RocketBehaviour : RidingBehaviour<RocketSettings, RocketState> {
return false
}
override fun useRidingAltPose(
settings: RocketSettings,
state: RocketState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
return cobblemonResource("no_pose")
}
override fun inertia(
settings: RocketSettings,
state: RocketState,
@@ -489,6 +480,17 @@ class RocketBehaviour : RidingBehaviour<RocketSettings, RocketState> {
}
override fun createDefaultState(settings: RocketSettings) = RocketState()
override fun asMoLangValue(
settings: RocketSettings,
state: RocketState,
vehicle: PokemonEntity
): ObjectValue<RidingBehaviour<RocketSettings, RocketState>> {
val value = super.asMoLangValue(settings, state, vehicle)
value.functions.put("boosting") { DoubleValue(state.boosting.get()) }
value.functions.put("can_speed_burst") { DoubleValue(state.canSpeedBurst.get()) }
return value
}
}
class RocketSettings : RidingBehaviourSettings {
@@ -170,17 +170,6 @@ class CompositeBehaviour : RidingBehaviour<CompositeSettings, CompositeState> {
}
}
override fun useRidingAltPose(
settings: CompositeSettings,
state: CompositeState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
return chooseBehaviour(settings, state) { behaviour, behaviourSettings, behaviourState ->
behaviour.useRidingAltPose(behaviourSettings, behaviourState, vehicle, driver)
}
}
override fun useAngVelSmoothing(
settings: CompositeSettings,
state: CompositeState,
@@ -9,7 +9,9 @@
package com.cobblemon.mod.common.api.riding.behaviour.types.land
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.CobblemonRideSettings
import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.riding.RidingStyle
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviour
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviourSettings
@@ -41,7 +43,6 @@ import kotlin.math.sqrt
import net.minecraft.core.Direction
import net.minecraft.network.FriendlyByteBuf
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.Mth
import net.minecraft.util.SmoothDouble
import net.minecraft.world.entity.LivingEntity
@@ -471,19 +472,6 @@ class HorseBehaviour : RidingBehaviour<HorseSettings, HorseState> {
return false
}
override fun useRidingAltPose(
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
when {
state.inAir.get() || (state.rideVelocity.get().y >= 0.0 && driver.jumping) || (state.rideVelocity.get().y > 0.0) -> return cobblemonResource("in_air")
state.sprinting.get() -> return cobblemonResource("sprinting")
}
return cobblemonResource("no_pose")
}
override fun inertia(
settings: HorseSettings,
state: HorseState,
@@ -541,6 +529,19 @@ class HorseBehaviour : RidingBehaviour<HorseSettings, HorseState> {
}
override fun createDefaultState(settings: HorseSettings) = HorseState()
override fun asMoLangValue(
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity
): ObjectValue<RidingBehaviour<HorseSettings, HorseState>> {
val canJump = vehicle.runtime.resolveBoolean(settings.canJump ?: globalHorse.canJump!!)
val value = super.asMoLangValue(settings, state, vehicle)
value.functions.put("sprinting") { DoubleValue(state.sprinting.get()) }
value.functions.put("walking") { DoubleValue(state.walking.get()) }
value.functions.put("in_air") { DoubleValue(state.inAir.get() || (state.rideVelocity.get().y >= 0.0 && (vehicle.controllingPassenger as? Player)?.jumping == true && canJump) || (state.rideVelocity.get().y > 0.0)) }
return value
}
}
class HorseSettings : RidingBehaviourSettings {
@@ -10,8 +10,10 @@ package com.cobblemon.mod.common.api.riding.behaviour.types.land
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.MoLangMath.lerp
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.CobblemonRideSettings
import com.cobblemon.mod.common.OrientationControllable
import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.riding.RidingStyle
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviour
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviourSettings
@@ -43,7 +45,6 @@ import kotlin.math.sign
import net.minecraft.core.Direction
import net.minecraft.network.FriendlyByteBuf
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.SmoothDouble
import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.player.Player
@@ -394,18 +395,6 @@ class MinekartBehaviour : RidingBehaviour<MinekartSettings, MinekartState> {
return false
}
override fun useRidingAltPose(
settings: MinekartSettings,
state: MinekartState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
when {
state.drifting.get() -> return cobblemonResource("drifting")
}
return cobblemonResource("no_pose")
}
override fun inertia(settings: MinekartSettings, state: MinekartState, vehicle: PokemonEntity): Double {
return 1.0
}
@@ -455,6 +444,19 @@ class MinekartBehaviour : RidingBehaviour<MinekartSettings, MinekartState> {
}
override fun createDefaultState(settings: MinekartSettings) = MinekartState()
override fun asMoLangValue(
settings: MinekartSettings,
state: MinekartState,
vehicle: PokemonEntity
): ObjectValue<RidingBehaviour<MinekartSettings, MinekartState>> {
val value = super.asMoLangValue(settings, state, vehicle)
value.functions.put("drifiting") { DoubleValue(state.drifting.get()) }
value.functions.put("clockwise_drift") { DoubleValue(state.clockwiseDrift.get()) }
value.functions.put("boosting") { DoubleValue(state.boost.get()) }
value.functions.put("in_air") { DoubleValue(state.inAir.get()) }
return value
}
}
class MinekartSettings : RidingBehaviourSettings {
@@ -10,8 +10,10 @@ package com.cobblemon.mod.common.api.riding.behaviour.types.land
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.MoLangMath.lerp
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.CobblemonRideSettings
import com.cobblemon.mod.common.OrientationControllable
import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.riding.RidingStyle
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviour
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviourSettings
@@ -42,7 +44,6 @@ import kotlin.math.sign
import net.minecraft.core.Direction
import net.minecraft.network.FriendlyByteBuf
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.SmoothDouble
import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.player.Player
@@ -359,19 +360,6 @@ class VehicleBehaviour : RidingBehaviour<VehicleSettings, VehicleState> {
return false
}
override fun useRidingAltPose(
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
when {
state.poweredDrifting.get() -> return cobblemonResource("powered_drifting")
state.drifting.get() -> return cobblemonResource("drifting")
}
return cobblemonResource("no_pose")
}
override fun inertia(settings: VehicleSettings, state: VehicleState, vehicle: PokemonEntity): Double {
return 1.0
}
@@ -421,6 +409,17 @@ class VehicleBehaviour : RidingBehaviour<VehicleSettings, VehicleState> {
}
override fun createDefaultState(settings: VehicleSettings) = VehicleState()
override fun asMoLangValue(
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity
): ObjectValue<RidingBehaviour<VehicleSettings, VehicleState>> {
val value = super.asMoLangValue(settings, state, vehicle)
value.functions.put("drifting") { DoubleValue(state.drifting.get()) }
value.functions.put("powered_drifting") { DoubleValue(state.poweredDrifting.get()) }
value.functions.put("in_air") { DoubleValue(state.inAir.get()) }
return value
}
}
class VehicleSettings : RidingBehaviourSettings {
@@ -9,8 +9,10 @@
package com.cobblemon.mod.common.api.riding.behaviour.types.liquid
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.CobblemonRideSettings
import com.cobblemon.mod.common.OrientationControllable
import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.riding.RidingStyle
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviour
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviourSettings
@@ -37,7 +39,6 @@ import kotlin.math.max
import kotlin.math.min
import net.minecraft.core.BlockPos
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.Mth
import net.minecraft.util.SmoothDouble
import net.minecraft.world.entity.LivingEntity
@@ -337,22 +338,6 @@ class BoatBehaviour : RidingBehaviour<BoatSettings, BoatState> {
return false
}
override fun useRidingAltPose(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
val isInWater = Shapes.create(vehicle.boundingBox).blockPositionsAsListRounded().any {
if (vehicle.isInWater || vehicle.isUnderWater) {
return@any true
}
val blockState = vehicle.level().getBlockState(it)
return@any !blockState.fluidState.isEmpty
}
return if (!isInWater) cobblemonResource("in_air") else cobblemonResource("no_pose")
}
override fun inertia(settings: BoatSettings, state: BoatState, vehicle: PokemonEntity): Double {
return 0.5
}
@@ -397,6 +382,25 @@ class BoatBehaviour : RidingBehaviour<BoatSettings, BoatState> {
override fun createDefaultState(settings: BoatSettings) = BoatState()
override fun asMoLangValue(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity
): ObjectValue<RidingBehaviour<BoatSettings, BoatState>> {
val value = super.asMoLangValue(settings, state, vehicle)
value.functions.put("sprinting") { DoubleValue(state.isVehicleSprinting.get()) }
value.functions.put("in_air") {
val isInWater = Shapes.create(vehicle.boundingBox).blockPositionsAsListRounded().any {
if (vehicle.isInWater || vehicle.isUnderWater) {
return@any true
}
val blockState = vehicle.level().getBlockState(it)
return@any !blockState.fluidState.isEmpty
}
DoubleValue(!isInWater)
}
return value
}
}
class BoatSettings : RidingBehaviourSettings {
@@ -492,5 +496,4 @@ class BoatState : RidingBehaviourState() {
if (previous !is BoatState) return false
return super.shouldSync(previous)
}
}
@@ -8,8 +8,10 @@
package com.cobblemon.mod.common.api.riding.behaviour.types.liquid
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.CobblemonRideSettings
import com.cobblemon.mod.common.OrientationControllable
import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.riding.RidingStyle
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviour
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviourSettings
@@ -25,10 +27,8 @@ import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.util.blockPositionsAsListRounded
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.readRidingStats
import com.cobblemon.mod.common.util.writeNullable
import com.cobblemon.mod.common.util.writeRidingStats
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.SmoothDouble
import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.player.Player
@@ -190,15 +190,6 @@ class BurstBehaviour : RidingBehaviour<BurstSettings, BurstState> {
return false
}
override fun useRidingAltPose(
settings: BurstSettings,
state: BurstState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
return cobblemonResource("no_pose")
}
override fun inertia(settings: BurstSettings, state: BurstState, vehicle: PokemonEntity): Double {
return 0.5
}
@@ -240,6 +231,16 @@ class BurstBehaviour : RidingBehaviour<BurstSettings, BurstState> {
}
override fun createDefaultState(settings: BurstSettings) = BurstState()
override fun asMoLangValue(
settings: BurstSettings,
state: BurstState,
vehicle: PokemonEntity
): ObjectValue<RidingBehaviour<BurstSettings, BurstState>> {
val value = super.asMoLangValue(settings, state, vehicle)
value.functions.put("dashing") { DoubleValue(state.dashing.get()) }
return value
}
}
class BurstSettings : RidingBehaviourSettings {
@@ -10,9 +10,10 @@ package com.cobblemon.mod.common.api.riding.behaviour.types.liquid
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.MoLangMath.lerp
import com.cobblemon.mod.common.Cobblemon
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.CobblemonRideSettings
import com.cobblemon.mod.common.OrientationControllable
import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.orientation.OrientationController
import com.cobblemon.mod.common.api.riding.RidingStyle
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviour
@@ -27,8 +28,8 @@ import com.cobblemon.mod.common.api.riding.sound.RideSoundSettingsList
import com.cobblemon.mod.common.api.riding.stats.RidingStat
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.util.blockPositionsAsListRounded
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.math.geometry.toDegrees
import com.cobblemon.mod.common.util.math.geometry.toRadians
import com.cobblemon.mod.common.util.readNullableExpression
import com.cobblemon.mod.common.util.readRidingStats
@@ -41,13 +42,14 @@ import kotlin.math.*
import net.minecraft.client.Minecraft
import net.minecraft.network.FriendlyByteBuf
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.Mth
import net.minecraft.util.SmoothDouble
import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.player.Player
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.phys.Vec2
import net.minecraft.world.phys.Vec3
import net.minecraft.world.phys.shapes.Shapes
import org.joml.Vector3f
class DolphinBehaviour : RidingBehaviour<DolphinSettings, DolphinState> {
@@ -67,7 +69,20 @@ class DolphinBehaviour : RidingBehaviour<DolphinSettings, DolphinState> {
.with(PoseOption(PoseType.SWIM) { _, state, entity -> abs(state.rideVelocity.get().length()) > 0.05 })
override fun isActive(settings: DolphinSettings, state: DolphinState, vehicle: PokemonEntity): Boolean {
return vehicle.isInWater || !vehicle.onGround()
// If its in water then the dolphin should definitely be active
if (vehicle.isInWater || vehicle.isUnderWater) {
return true
}
val blockPosBelow = vehicle.blockPosition().below()
val blockState = vehicle.level().getBlockState(blockPosBelow)
// Check if the block below is solid AND not a fluid
val isOnSolidGround = !blockState.isAir && blockState.fluidState.isEmpty
// The dolphin is only INACTIVE if it is on solid ground.
// Therefore, it is ACTIVE if it is NOT on solid ground
return !isOnSolidGround
}
override fun pose(settings: DolphinSettings, state: DolphinState, vehicle: PokemonEntity): PoseType {
@@ -388,8 +403,8 @@ class DolphinBehaviour : RidingBehaviour<DolphinSettings, DolphinState> {
val hoverSpeed = 0.2
val pitchDamping = abs(cos(controller.pitch.toRadians())).pow(2) // Helper value used when wanting to discard the influence of another value at steep pitches
// Yaw locally when at or below hoverSpeed but not when pitched up or rolled over
val globalYaw = xInput * (1 - sqrt(RidingBehaviour.scaleToRange(currSpeed, 0.0, hoverSpeed))).coerceIn(0.0, 1.0)
// Yaw locally when at or below topSpeed but not when pitched up or rolled over
val globalYaw = xInput * (1 - sqrt(RidingBehaviour.scaleToRange(currSpeed, 0.0, topSpeed))).coerceIn(0.0, 1.0)
controller.rotateYaw(pitchDamping*globalYaw.toFloat())
controller.rotateRoll((1-pitchDamping)*globalYaw.toFloat())
@@ -476,15 +491,6 @@ class DolphinBehaviour : RidingBehaviour<DolphinSettings, DolphinState> {
return false
}
override fun useRidingAltPose(
settings: DolphinSettings,
state: DolphinState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
return cobblemonResource("no_pose")
}
override fun inertia(settings: DolphinSettings, state: DolphinState, vehicle: PokemonEntity): Double {
return if (!vehicle.isInWater && !vehicle.isUnderWater) 1.0 else 0.1
}
@@ -514,7 +520,7 @@ class DolphinBehaviour : RidingBehaviour<DolphinSettings, DolphinState> {
state: DolphinState,
vehicle: PokemonEntity
): Boolean {
return true
return false
}
override fun getRideSounds(
@@ -527,6 +533,16 @@ class DolphinBehaviour : RidingBehaviour<DolphinSettings, DolphinState> {
override fun createDefaultState(settings: DolphinSettings) = DolphinState()
override fun asMoLangValue(
settings: DolphinSettings,
state: DolphinState,
vehicle: PokemonEntity
): ObjectValue<RidingBehaviour<DolphinSettings, DolphinState>> {
val value = super.asMoLangValue(settings, state, vehicle)
value.functions.put("boosting") { DoubleValue(state.boosting.get()) }
value.functions.put("has_breached") { DoubleValue(state.hasBreached.get()) }
return value
}
}
class DolphinSettings : RidingBehaviourSettings {
@@ -10,8 +10,10 @@ package com.cobblemon.mod.common.api.riding.behaviour.types.liquid
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.MoLangMath.lerp
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.CobblemonRideSettings
import com.cobblemon.mod.common.OrientationControllable
import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.orientation.OrientationController
import com.cobblemon.mod.common.api.riding.RidingStyle
import com.cobblemon.mod.common.api.riding.behaviour.*
@@ -33,7 +35,6 @@ import com.cobblemon.mod.common.util.writeRidingStats
import net.minecraft.core.BlockPos
import net.minecraft.network.FriendlyByteBuf
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.FluidTags
import net.minecraft.util.SmoothDouble
import net.minecraft.world.entity.LivingEntity
@@ -492,15 +493,6 @@ class SubmarineBehaviour : RidingBehaviour<SubmarineSettings, SubmarineState> {
return false
}
override fun useRidingAltPose(
settings: SubmarineSettings,
state: SubmarineState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
return cobblemonResource("no_pose")
}
override fun inertia(settings: SubmarineSettings, state: SubmarineState, vehicle: PokemonEntity): Double {
return if (!vehicle.isUnderWater) 1.0 else 0.1
}
@@ -534,7 +526,7 @@ class SubmarineBehaviour : RidingBehaviour<SubmarineSettings, SubmarineState> {
state: SubmarineState,
vehicle: PokemonEntity
): Boolean {
return true
return false
}
override fun getRideSounds(
@@ -547,6 +539,15 @@ class SubmarineBehaviour : RidingBehaviour<SubmarineSettings, SubmarineState> {
override fun createDefaultState(settings: SubmarineSettings) = SubmarineState()
override fun asMoLangValue(
settings: SubmarineSettings,
state: SubmarineState,
vehicle: PokemonEntity
): ObjectValue<RidingBehaviour<SubmarineSettings, SubmarineState>> {
val value = super.asMoLangValue(settings, state, vehicle)
value.functions.put("on_surface") { DoubleValue(state.onSurface.get()) }
return value
}
}
class SubmarineSettings : RidingBehaviourSettings {
@@ -71,7 +71,7 @@ open class FlatSelector : SpawningSelector<FlatSelector.SpawnablePositionSelecti
override fun removeSpawnDetails(shouldRemove: (SpawnDetail) -> Boolean) {
val toRemove = spawnToSpawnablePosition.entries.filter { shouldRemove(it.key) }
toRemove.forEach { spawnToSpawnablePosition.remove(it.key) }
percentSum -= toRemove.sumOf { it.key.percentage.toDouble() }.toFloat()
percentSum -= toRemove.sumOf { it.key.percentage.toDouble().takeIf { it > 0 } ?: 0.0 }.toFloat()
}
override fun removeSpawnablePositions(shouldRemove: (SpawnDetail, SpawnablePosition) -> Boolean) {
@@ -83,7 +83,7 @@ open class FlatSelector : SpawningSelector<FlatSelector.SpawnablePositionSelecti
toRemove.forEach { spawnToSpawnablePosition.remove(it.key) }
percentSum -= toRemove.sumOf { it.key.percentage.toDouble() }.toFloat()
percentSum -= toRemove.sumOf { it.key.percentage.toDouble().takeIf { it > 0 } ?: 0.0 }.toFloat()
}
}
@@ -72,7 +72,7 @@ open class FlatSpawnablePositionWeightedSelector : SpawningSelector<FlatSpawnabl
fun removeSpawnDetails(shouldRemove: (SpawnDetail) -> Boolean) {
val toRemove = spawnToSpawnablePosition.entries.filter { shouldRemove(it.key) }
toRemove.forEach { spawnToSpawnablePosition.remove(it.key) }
percentSum -= toRemove.sumOf { it.key.percentage.toDouble() }.toFloat()
percentSum -= toRemove.sumOf { it.key.percentage.toDouble().takeIf { it > 0 } ?: 0.0 }.toFloat()
}
fun removeSpawnablePositions(shouldRemove: (SpawnDetail, SpawnablePosition) -> Boolean) {
@@ -84,7 +84,7 @@ open class FlatSpawnablePositionWeightedSelector : SpawningSelector<FlatSpawnabl
toRemove.forEach { spawnToSpawnablePosition.remove(it.key) }
percentSum -= toRemove.sumOf { it.key.percentage.toDouble() }.toFloat()
percentSum -= toRemove.sumOf { it.key.percentage.toDouble().takeIf { it > 0 } ?: 0.0 }.toFloat()
}
}
@@ -165,6 +165,7 @@ open class FlatSpawnablePositionWeightedSelector : SpawningSelector<FlatSpawnabl
This means you don't understand how this option works.
""".trimIndent()
)
return null
}
@@ -0,0 +1,56 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.stats
import net.minecraft.resources.ResourceLocation
object CobblemonStats {
val stats = mutableMapOf<String, ResourceLocation>()
var CAPTURED: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "captured") //makeCustomStat("captured", StatFormatter.DEFAULT)
val SHINIES_CAPTURED: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "shinies_captured") //makeCustomStat("shinies_captured", StatFormatter.DEFAULT)
val RELEASED: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "released") //makeCustomStat("released", StatFormatter.DEFAULT)
val EVOLVED: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "evolved") //makeCustomStat("evolved", StatFormatter.DEFAULT)
val LEVEL_UP: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "level_up") //makeCustomStat("level_up", StatFormatter.DEFAULT)
val BATTLES_WON: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "battles_won") //makeCustomStat("battles_won", StatFormatter.DEFAULT)
val BATTLES_LOST: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "battles_lost") //makeCustomStat("battles_lost", StatFormatter.DEFAULT)
val BATTLES_FLED: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "battles_fled") //makeCustomStat("battles_fled", StatFormatter.DEFAULT)
val BATTLES_TOTAL: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "battles_total") //makeCustomStat("battles_total", StatFormatter.DEFAULT)
val DEX_ENTRIES: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "dex_entries") //makeCustomStat("dex_entries", StatFormatter.DEFAULT)
val EGGS_COLLECTED: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "eggs_collected") //makeCustomStat("eggs_collected", StatFormatter.DEFAULT)
val EGGS_HATCHED: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "eggs_hatched") //makeCustomStat("eggs_hatched", StatFormatter.DEFAULT)
val TRADED: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "traded") //makeCustomStat("traded", StatFormatter.DEFAULT)
val FOSSILS_REVIVED: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "fossils_revived") //makeCustomStat("fossils_revived", StatFormatter.DEFAULT)
val TIMES_RIDDEN: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "times_ridden")
val ROD_CASTS: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "rod_casts")
val REEL_INS: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "reel_ins")
val POKEMON_INTERACTED_WITH: ResourceLocation = ResourceLocation.fromNamespaceAndPath("cobblemon", "pokemon_interacted_with") //makeCustomStat("pokemon_interacted_with", StatFormatter.DEFAULT)
//TODO block, stats (interact, gimmi), riding (styles?)
fun registerStats() {
stats["captured"] = CAPTURED
stats["shinies_captured"] = SHINIES_CAPTURED
stats["released"] = RELEASED
stats["evolved"] = EVOLVED
stats["level_up"] = LEVEL_UP
stats["battles_won"] = BATTLES_WON
stats["battles_lost"] = BATTLES_LOST
stats["battles_fled"] = BATTLES_FLED
stats["battles_total"] = BATTLES_TOTAL
stats["dex_entries"] = DEX_ENTRIES
stats["eggs_collected"] = EGGS_COLLECTED
stats["eggs_hatched"] = EGGS_HATCHED
stats["traded"] = TRADED
stats["fossils_revived"] = FOSSILS_REVIVED
stats["times_ridden"] = TIMES_RIDDEN
stats["rod_casts"] = ROD_CASTS
stats["reel_ins"] = REEL_INS
stats["pokemon_interacted_with"] = POKEMON_INTERACTED_WITH
}
}
@@ -10,5 +10,4 @@ package com.cobblemon.mod.common.api.storage.party
import com.cobblemon.mod.common.entity.npc.NPCEntity
class NPCPartyStore(val npc: NPCEntity) : PartyStore(npc.uuid) {
}
class NPCPartyStore(val npc: NPCEntity) : PartyStore(npc.uuid)
@@ -44,7 +44,7 @@ open class BarSummarySpeciesFeatureRenderer(
}
open fun renderElement(guiGraphics: GuiGraphics, x: Float, y: Float, pokemon: Pokemon, barValue: Int = value) {
val barRatio = (barValue - min) / (max - min).toFloat()
val barRatio = ((barValue - min) / (max - min).toFloat()).coerceAtMost(1f)
val barWidth = Mth.ceil(barRatio * 110)
blitk(
@@ -130,7 +130,7 @@ class StatWidget(
val universalFeatures = listOf(
FriendshipFeatureRenderer(pokemon),
FullnessFeatureRenderer(pokemon)
FullnessFeatureRenderer(pokemon),
)
val renderableFeatures = SpeciesFeatures
@@ -261,7 +261,7 @@ class StatWidget(
var drawY = y + 15F
val featuresList: MutableList<Any> = renderableFeatures.filter {
!pokemon.aspects.contains("hide-" + it.name)
!pokemon.aspects.contains("hide-" + it.name) && (it.name != "blocks_traveled" || pokemon.hasBlocksTraveledRequirement())
}.toMutableList()
featuresList.addAll(0, universalFeatures.filter {
@@ -10,12 +10,12 @@ package com.cobblemon.mod.common.client.keybind.keybinds
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.client.CobblemonClient
import com.cobblemon.mod.common.client.gui.debug.riding.RidingStatsDebugGUI
import com.cobblemon.mod.common.client.keybind.CobblemonKeyBinding
import com.cobblemon.mod.common.client.keybind.KeybindCategories
import com.cobblemon.mod.common.client.render.models.blockbench.FloatingState
import com.cobblemon.mod.common.client.render.models.blockbench.repository.VaryingModelRepository
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.net.messages.client.debug.RequestOpenRidingStatsDebugGUIPacket
import com.mojang.blaze3d.platform.InputConstants
import net.minecraft.client.Minecraft
import net.minecraft.network.chat.Component
@@ -159,7 +159,7 @@ object DebugKeybindings {
override fun onPress() {
val vehicle = Minecraft.getInstance().player?.vehicle ?: return
if (vehicle is PokemonEntity) {
Minecraft.getInstance().setScreen(RidingStatsDebugGUI(vehicle))
RequestOpenRidingStatsDebugGUIPacket().sendToServer()
}
}
}
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.client.net.debug
import com.cobblemon.mod.common.api.net.ClientNetworkPacketHandler
import com.cobblemon.mod.common.client.gui.debug.riding.RidingStatsDebugGUI
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.net.messages.server.debug.OpenRidingStatsDebugGUIPacket
import net.minecraft.client.Minecraft
object OpenRidingStatsDebugGUIHandler : ClientNetworkPacketHandler<OpenRidingStatsDebugGUIPacket> {
override fun handle(
packet: OpenRidingStatsDebugGUIPacket,
client: Minecraft
) {
val vehicle = Minecraft.getInstance().player?.vehicle as? PokemonEntity ?: return
client.setScreen(RidingStatsDebugGUI(vehicle))
}
}
@@ -110,16 +110,15 @@ class RestorationTankRenderer(ctx: BlockEntityRendererProvider.Context) : BlockE
val struct = entity.multiblockStructure as FossilMultiblockStructure
val connectionDir = struct.tankConnectorDirection
val aspects = emptySet<String>()
val state = struc.fossilState
state.updatePartialTicks(tickDelta)
state.currentAspects = aspects
state.currentAspects = struc.resultingFossil?.result?.aspects ?: emptySet()
var fossilPoserId = fossil.identifier.withPath("${fossil.identifier.path}_fetus")
val completionPercentage = (1 - timeRemaining / FossilMultiblockStructure.TIME_TO_TAKE.toFloat()).coerceIn(0F, 1F)
val fossilFetusModel = VaryingModelRepository.getPoser(fossilPoserId, state) as? FossilModel ?: let {
fossilPoserId = cobblemonResource("fossil_fetus")
fossilPoserId = cobblemonResource("substitute_fetus")
VaryingModelRepository.getPoser(fossilPoserId, state) as FossilModel
}
@@ -37,7 +37,6 @@ import org.joml.Quaternionf
import org.joml.Vector3f
import kotlin.math.min
import kotlin.math.sign
import kotlin.math.sin
object MountedCameraRenderer {
private var returnTimer: Float = 0f
@@ -89,11 +88,11 @@ object MountedCameraRenderer {
offset.add(
if (isFirstPerson) {
getFirstPersonOffset(model, locatorName)
} else if (Cobblemon.config.thirdPersonViewBobbing) {
} else /* if (Cobblemon.config.thirdPersonViewBobbing) */ {
getThirdPersonOffset(thirdPersonReverse, model.thirdPersonCameraOffset, locatorName, shouldFlip)
} else {
} /* else {
getThirdPersonOffset(thirdPersonReverse, model.thirdPersonCameraOffsetNoViewBobbing, locatorName, shouldFlip)
}
} */
)
val rotation =
@@ -109,20 +108,20 @@ object MountedCameraRenderer {
// Get the camera position before offsets are applied (which are done with maxZoom to account for clipping). If 3rd person viewbobbing is enabled or the player is
// in first person then base the camera position off the seat locator offset
val pos = if (isFirstPerson || Cobblemon.config.thirdPersonViewBobbing) {
val locatorOffset = Vec3(locator.matrix.getTranslation(Vector3f()))
locatorOffset.add(entityPos).toVector3f()
} else {
val pokemonCenter = Vector3f(0f, driver.bbHeight/2, 0f)
val pos = /* if (isFirstPerson || Cobblemon.config.thirdPersonViewBobbing) { */
Vec3(locator.matrix.getTranslation(Vector3f()))
.add(entityPos).toVector3f()
/* } else {
val pokemonCenter = Vector3f(0f, driver.bbHeight/2, 0f)
val pivotOffsets = model.thirdPersonPivotOffset
val pivot = Vector3f(pokemonCenter)
val locatorName = delegate.getSeatLocator(driver)
if (pivotOffsets.containsKey(locatorName)) {
pivot.add(rotation.transform(pivotOffsets[locatorName]!!.toVector3f()))
}
pivot.add(entityPos.toVector3f())
val pivotOffsets = model.thirdPersonPivotOffset
val pivot = Vector3f(pokemonCenter)
val locatorName = delegate.getSeatLocator(driver)
if (pivotOffsets.containsKey(locatorName)) {
pivot.add(rotation.transform(pivotOffsets[locatorName]!!.toVector3f()))
}
pivot.add(entityPos.toVector3f())
} */
val offsetDistance = offset.length()
val offsetDirection = offset.mul(1 / offsetDistance)
@@ -154,6 +154,7 @@ object CobblemonModelPredicateRegistry {
}
}
/*
ItemProperties.register(CobblemonItems.POKE_PUFF, cobblemonResource("poke_puff_combined")) { stack, _, _, _ ->
val dominantFlavours = stack.get(CobblemonItemComponents.FLAVOUR)?.getDominantFlavours()
val flavour = when {
@@ -183,5 +184,6 @@ object CobblemonModelPredicateRegistry {
return@register PokePuffItemModelRegistry.getModelId(key)
}
*/
}
}
@@ -9,6 +9,7 @@
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
import com.cobblemon.mod.common.client.render.models.blockbench.PosableState
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType
@@ -31,6 +32,8 @@ class GloomModel(root: ModelPart) : PokemonPosableModel(root) {
lateinit var standing: Pose
lateinit var walk: Pose
override val cryAnimation = CryProvider { bedrockStateful("gloom", "cry") }
override fun registerPoses() {
standing = registerPose(
poseName = "standing",
@@ -9,6 +9,7 @@
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType.Companion.MOVING_POSES
@@ -31,6 +32,8 @@ class MachampModel(root: ModelPart) : PokemonPosableModel(root), HeadedFrame {
lateinit var standing: Pose
lateinit var walk: Pose
override val cryAnimation = CryProvider { bedrockStateful("machamp", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("machamp", "blink")}
standing = registerPose(
@@ -9,6 +9,7 @@
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType.Companion.MOVING_POSES
@@ -30,6 +31,8 @@ class MachokeModel(root: ModelPart) : PokemonPosableModel(root), HeadedFrame {
lateinit var standing: Pose
lateinit var walk: Pose
override val cryAnimation = CryProvider { bedrockStateful("machoke", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("machoke", "blink")}
standing = registerPose(
@@ -9,6 +9,7 @@
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType.Companion.MOVING_POSES
@@ -30,6 +31,8 @@ class MachopModel(root: ModelPart) : PokemonPosableModel(root), HeadedFrame {
lateinit var standing: Pose
lateinit var walk: Pose
override val cryAnimation = CryProvider { bedrockStateful("machop", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("machop", "blink") }
standing = registerPose(
@@ -9,6 +9,7 @@
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
import com.cobblemon.mod.common.client.render.models.blockbench.PosableState
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType
@@ -31,6 +32,8 @@ class OddishModel(root: ModelPart) : PokemonPosableModel(root) {
lateinit var standing: Pose
lateinit var walk: Pose
override val cryAnimation = CryProvider { bedrockStateful("oddish", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("oddish", "blink")}
standing = registerPose(
@@ -10,6 +10,7 @@ package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
import com.cobblemon.mod.common.client.render.models.blockbench.PosableState
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType
@@ -34,6 +35,8 @@ class ParasModel(root: ModelPart) : PokemonPosableModel(root), HeadedFrame {
lateinit var standing: Pose
lateinit var walk: Pose
override val cryAnimation = CryProvider { bedrockStateful("paras", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("paras", "blink") }
standing = registerPose(
@@ -8,6 +8,7 @@
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType
@@ -30,6 +31,8 @@ class PoliwagModel(root: ModelPart) : PokemonPosableModel(root) {
lateinit var float: Pose
lateinit var swim: Pose
override val cryAnimation = CryProvider { bedrockStateful("poliwag", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("poliwag", "blink")}
standing = registerPose(
@@ -36,13 +36,13 @@ class RattataAlolanModel(root: ModelPart) : PokemonPosableModel(root), HeadedFra
lateinit var standing: Pose
lateinit var walk: Pose
override val cryAnimation = CryProvider { bedrockStateful("rattata_alolan", "cry") }
override val cryAnimation = CryProvider { bedrockStateful("rattata", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("rattata_alolan", "blink")}
val blink = quirk { bedrockStateful("rattata", "blink")}
sleep = registerPose(
poseType = PoseType.SLEEP,
animations = arrayOf(bedrock("rattata_alolan", "sleep"))
animations = arrayOf(bedrock("rattata", "sleep"))
)
standing = registerPose(
@@ -51,7 +51,7 @@ class RattataAlolanModel(root: ModelPart) : PokemonPosableModel(root), HeadedFra
quirks = arrayOf(blink),
animations = arrayOf(
singleBoneLook(),
bedrock("rattata_alolan", "ground_idle")
bedrock("rattata", "ground_idle")
)
)
@@ -60,10 +60,10 @@ class RattataAlolanModel(root: ModelPart) : PokemonPosableModel(root), HeadedFra
quirks = arrayOf(blink),
animations = arrayOf(
singleBoneLook(),
bedrock("rattata_alolan", "ground_walk")
bedrock("rattata", "ground_walk")
)
)
}
override fun getFaintAnimation(state: PosableState) = bedrockStateful("rattata_alolan", "faint")
override fun getFaintAnimation(state: PosableState) = bedrockStateful("rattata", "faint")
}
@@ -11,6 +11,7 @@ package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BiWingedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pose.CobblemonPose
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.PoseType.Companion.MOVING_POSES
@@ -40,6 +41,8 @@ class VenomothModel(root: ModelPart) : PokemonPosableModel(root), HeadedFrame, B
lateinit var hover: CobblemonPose
lateinit var flying: CobblemonPose
override val cryAnimation = CryProvider { bedrockStateful("venomoth", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("venomoth", "blink") }
val quirk1 = quirk { bedrockStateful("venomoth", "quirk1") }
@@ -10,6 +10,7 @@ package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.PosableState
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.PoseType.Companion.MOVING_POSES
@@ -31,6 +32,8 @@ class VileplumeModel(root: ModelPart) : PokemonPosableModel(root) {
lateinit var standing: Pose
lateinit var walk: Pose
override val cryAnimation = CryProvider { bedrockStateful("vileplume", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("vileplume", "blink")}
standing = registerPose(
@@ -1,60 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.pose.CobblemonPose
import com.cobblemon.mod.common.entity.PoseType.Companion.MOVING_POSES
import com.cobblemon.mod.common.entity.PoseType.Companion.STATIONARY_POSES
import com.cobblemon.mod.common.entity.PoseType.Companion.UI_POSES
import net.minecraft.client.model.geom.ModelPart
import net.minecraft.world.phys.Vec3
class WeezingModel(root: ModelPart) : PokemonPosableModel(root) {
override val rootPart = root.registerChildWithAllChildren("weezing")
override var portraitScale = 1.5F
override var portraitTranslation = Vec3(0.0, 0.0, 0.0)
override var profileScale = 1.0F
override var profileTranslation = Vec3(0.05, 0.4, 0.0)
lateinit var standing: CobblemonPose
lateinit var walk: CobblemonPose
override val cryAnimation = CryProvider { bedrockStateful("weezing", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("weezing", "blink")}
val blink2 = quirk { bedrockStateful("weezing", "blink2")}
standing = registerPose(
poseName = "standing",
poseTypes = STATIONARY_POSES + UI_POSES,
quirks = arrayOf(blink, blink2),
animations = arrayOf(
bedrock("weezing", "ground_idle")
)
)
walk = registerPose(
poseName = "walk",
poseTypes = MOVING_POSES,
quirks = arrayOf(blink, blink2),
animations = arrayOf(
bedrock("weezing", "ground_idle")
)
)
}
// override fun getFaintAnimation(
// pokemonEntity: PokemonEntity,
// state: PosableState<PokemonEntity>
// ) = if (state.isPosedIn(standing, walk)) bedrockStateful("weezing", "faint") else null
}
@@ -14,6 +14,7 @@ import com.cobblemon.mod.common.client.render.models.blockbench.createTransforma
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BimanualFrame
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BipedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pose.ModelPartTransformation
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType
@@ -46,6 +47,8 @@ class LombreModel (root: ModelPart) : PokemonPosableModel(root), HeadedFrame, Bi
val wateroffset = 1
override val cryAnimation = CryProvider { bedrockStateful("lombre", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("lombre", "blink") }
standing = registerPose(
@@ -11,6 +11,7 @@ package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen3
import com.cobblemon.mod.common.client.render.models.blockbench.PosableState
import com.cobblemon.mod.common.client.render.models.blockbench.createTransformation
import com.cobblemon.mod.common.client.render.models.blockbench.frame.QuadrupedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.pose.ModelPartTransformation
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
@@ -43,6 +44,8 @@ class LotadModel (root: ModelPart) : PokemonPosableModel(root), QuadrupedFrame {
val wateroffset = -2
override val cryAnimation = CryProvider { bedrockStateful("lotad", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("lotad", "blink") }
@@ -13,6 +13,7 @@ import com.cobblemon.mod.common.client.render.models.blockbench.PosableState
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BimanualFrame
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BipedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType
import net.minecraft.client.model.geom.ModelPart
@@ -39,6 +40,8 @@ class LudicoloModel (root: ModelPart) : PokemonPosableModel(root), HeadedFrame,
lateinit var swim: Pose
lateinit var sleep: Pose
override val cryAnimation = CryProvider { bedrockStateful("ludicolo", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("ludicolo", "blink") }
standing = registerPose(
@@ -297,7 +297,6 @@ object VaryingModelRepository {
inbuilt("tentacool", ::TentacoolModel)
inbuilt("venomoth", ::VenomothModel)
inbuilt("venonat", ::VenonatModel)
inbuilt("weezing", ::WeezingModel)
inbuilt("elekid", ::ElekidModel)
inbuilt("smoochum", ::SmoochumModel)
inbuilt("hitmontop", ::HitmontopModel)
@@ -290,7 +290,8 @@ class CobblemonConfig {
@CobblemonConfigField(Category.Interface, lang = "animate_battle_tiles", CLIENT)
var animateBattleTiles = false
@CobblemonConfigField(Category.Riding, lang = "third_person_view_bobbing", CLIENT)
// Disabled as non-tenable for 1.7 until all the posers catch up with this property.
// @CobblemonConfigField(Category.Riding, lang = "third_person_view_bobbing", CLIENT)
var thirdPersonViewBobbing = true
@CobblemonConfigField(Category.Riding, lang = "invert_roll", CLIENT)
@@ -327,7 +328,7 @@ class CobblemonConfig {
var rememberRidingCamera = false
@CobblemonConfigField(Category.Debug, lang = "enable_debug_keys", CLIENT)
var enableDebugKeys = true
var enableDebugKeys = false
@CobblemonConfigField(Category.Spawning, lang = "despawner_near_distance", SERVER)
var despawnerNearDistance = 32f
@@ -32,7 +32,7 @@ object MeleeAttackTask {
val cooldownTicks = mainThreadRuntime.resolveInt(cooldownTicks)
val attackTarget = it.get(attackTarget)
if (entity.distanceTo(attackTarget) <= range) {
if (entity.boundingBox.inflate(range.toDouble(), 0.5, range.toDouble()).intersects(attackTarget.boundingBox)) {
entity.doHurtTarget(attackTarget)
cooldown.setWithExpiry(true, cooldownTicks.toLong())
true
@@ -21,6 +21,7 @@ import com.cobblemon.mod.common.api.events.CobblemonEvents
import com.cobblemon.mod.common.api.events.entity.PokemonEntityLoadEvent
import com.cobblemon.mod.common.api.events.entity.PokemonEntitySaveEvent
import com.cobblemon.mod.common.api.events.entity.PokemonEntitySaveToWorldEvent
import com.cobblemon.mod.common.api.events.pokemon.HeldItemEvent
import com.cobblemon.mod.common.api.events.pokemon.RidePokemonEvent
import com.cobblemon.mod.common.api.events.pokemon.ShoulderMountEvent
import com.cobblemon.mod.common.api.interaction.PokemonEntityInteraction
@@ -320,7 +321,7 @@ open class PokemonEntity(
.withQueryValue("entity", struct)
.also {
it.environment.query.addFunction("passenger_count") { DoubleValue(passengers.size.toDouble()) }
it.environment.query.addFunction("ride_velocity") { DoubleValue(deltaMovement.length()) }
it.environment.query.addFunction("ride_velocity") { DoubleValue(min(ridingAnimationData.velocitySpring.value.length() * 1.5,1.5)) }
it.environment.query.addFunction("driver_input") { DoubleValue(min(ridingAnimationData.driverInputSpring.value.length(),1.0)) }
it.environment.query.addFunction("get_ride_stats") { params ->
val rideStat = RidingStat.valueOf(params.getString(0).uppercase())
@@ -343,7 +344,6 @@ open class PokemonEntity(
/**
* The amount of steps this entity has traveled.
*/
var blocksTraveled: Double = 0.0
var countsTowardsSpawnCap = true
/**
@@ -1470,10 +1470,16 @@ open class PokemonEntity(
return false
}
val returned = if (isCosmetic) {
this.pokemon.swapCosmeticItem(stack = stack, decrement = !player.isCreative)
val currentItem = if (isCosmetic) pokemon.cosmeticItem else pokemon.heldItem
val pre = HeldItemEvent.Pre(pokemon, stack, currentItem.copy(), !player.isCreative)
if (isCosmetic) CobblemonEvents.COSMETIC_ITEM_PRE.post(pre) else CobblemonEvents.HELD_ITEM_PRE.post(pre)
if (pre.isCanceled) return false
val returned = pre.returning
if (isCosmetic) {
this.pokemon.swapCosmeticItem(stack = pre.receiving, decrement = !player.isCreative)
} else {
this.pokemon.swapHeldItem(stack = stack, decrement = !player.isCreative, false)
this.pokemon.swapHeldItem(stack = pre.receiving, decrement = !player.isCreative, false)
}
val text = when {
@@ -1485,7 +1491,7 @@ open class PokemonEntity(
else -> lang("held_item.replace", returned.displayName, this.pokemon.getDisplayName(), giving.displayName)
}
player.giveOrDropItemStack(returned, false)
player.giveOrDropItemStack(pre.returning, false)
player.sendSystemMessage(text)
this.level().playSoundServer(
position = this.position(),
@@ -1494,6 +1500,13 @@ open class PokemonEntity(
pitch = 1.4F
)
if (isCosmetic) {
CobblemonEvents.COSMETIC_ITEM_POST.post(HeldItemEvent.Post(pokemon, pokemon.cosmeticItem.copy(), pre.returning.copy(), pre.decrement))
}
else {
CobblemonEvents.HELD_ITEM_POST.post(HeldItemEvent.Post(pokemon, pokemon.heldItem.copy(), pre.returning.copy(), pre.decrement))
}
return true
}
@@ -1860,7 +1873,9 @@ open class PokemonEntity(
}
}
this.updateBlocksTraveled(prevBlockPos)
if (this.pokemon.hasBlocksTraveledRequirement()) {
this.updateBlocksTraveled(prevBlockPos)
}
}
if (isBattling && this.isInWater) {
// Prevent swimmers from sinking in battle
@@ -1875,7 +1890,7 @@ open class PokemonEntity(
}
val blocksTaken = this.blockPosition().distSqr(fromBp)
if (blocksTaken > 0) {
this.blocksTraveled += blocksTaken
this.pokemon.addBlocksTraveled(blocksTaken.toInt())
}
}
@@ -2086,7 +2101,7 @@ open class PokemonEntity(
} else if (slowpokeRegrowthFeature != null) {
true
} else {
this.pokemon.getFeature<FlagSpeciesFeature>(DataKeys.HAS_BEEN_SHEARED)?.enabled == true
this.pokemon.getFeature<FlagSpeciesFeature>(DataKeys.HAS_BEEN_SHEARED)?.enabled == false
}
}
@@ -2407,22 +2422,6 @@ open class PokemonEntity(
}
}
fun getAltPose(): String {
val driver = this.controllingPassenger as? Player ?: return "cobblemon:no_pose"
val str = ifRidingAvailableSupply(fallback = "cobblemon:no_pose") { behaviour, settings, state ->
behaviour.useRidingAltPose(settings, state, this, driver).toString()
}
return str
}
fun isUsingAltPose(resourceLocation: ResourceLocation): Boolean {
val driver = this.controllingPassenger as? Player ?: return false
val loc = ifRidingAvailableSupply(fallback = cobblemonResource("no_pose")) { behaviour, settings, state ->
behaviour.useRidingAltPose(settings, state, this, driver)
}
return loc.compareTo(resourceLocation) == 0
}
var jumpInputStrength: Int = 0 // move this
override fun onPlayerJump(strength: Int) {
// See if this controls the hot bar element
@@ -15,8 +15,10 @@ import net.minecraft.world.entity.ai.behavior.OneShot
import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder
import net.minecraft.world.entity.ai.behavior.declarative.Trigger
import net.minecraft.world.entity.ai.memory.MemoryModuleType
import net.minecraft.world.entity.monster.Creeper
import net.minecraft.world.entity.monster.Enemy
import net.minecraft.world.entity.player.Player
import net.minecraft.world.entity.monster.Slime
import net.minecraft.world.entity.monster.piglin.AbstractPiglin
object AttackHostileMobsTask {
fun create(): OneShot<LivingEntity> = BehaviorBuilder.create {
@@ -46,7 +48,7 @@ object AttackHostileMobsTask {
// Filter for hostile, non-player, living mobs around the pasture radius if pastured. todo maybe we want to add Pokemon too?
val hostile = nearby.firstOrNull { potentialTarget ->
if (potentialTarget !is Mob || potentialTarget is Player || potentialTarget !is Enemy || !potentialTarget.isAlive)
if (potentialTarget !is Mob || potentialTarget is Slime || potentialTarget is AbstractPiglin || potentialTarget !is Enemy || !potentialTarget.isAlive || potentialTarget is Creeper)
return@firstOrNull false
val tethering = (entity as? PokemonEntity)?.tethering
@@ -19,6 +19,7 @@ import com.cobblemon.mod.common.api.events.CobblemonEvents.EVOLUTION_COMPLETE
import com.cobblemon.mod.common.api.events.CobblemonEvents.HATCH_EGG_POST
import com.cobblemon.mod.common.api.events.CobblemonEvents.LEVEL_UP_EVENT
import com.cobblemon.mod.common.api.events.CobblemonEvents.POKEMON_CAPTURED
import com.cobblemon.mod.common.api.events.CobblemonEvents.RIDE_EVENT_POST
import com.cobblemon.mod.common.api.events.CobblemonEvents.TRADE_EVENT_POST
import com.cobblemon.mod.common.api.events.battles.BattleVictoryEvent
import com.cobblemon.mod.common.api.events.pokemon.*
@@ -40,6 +41,7 @@ object AdvancementHandler : EventHandler {
EVOLUTION_COMPLETE.subscribe(Priority.LOWEST, ::onEvolve)
LEVEL_UP_EVENT.subscribe(Priority.LOWEST, ::onLevelUp)
TRADE_EVENT_POST.subscribe(Priority.LOWEST, ::onTradeCompleted)
RIDE_EVENT_POST.subscribe(Priority.LOWEST, ::startRiding)
HATCH_EGG_POST.subscribe(Priority.LOWEST, ::onHatch)
COLLECT_EGG.subscribe(Priority.LOWEST, ::onEggCollect)
}
@@ -49,10 +51,10 @@ object AdvancementHandler : EventHandler {
val advancementData = playerData.advancementData
advancementData.updateTotalCaptureCount()
advancementData.updateAspectsCollected(event.player, event.pokemon)
CobblemonCriteria.CATCH_POKEMON.trigger(event.player, CountablePokemonTypeContext(advancementData.totalCaptureCount, "any"))
CobblemonCriteria.CATCH_POKEMON.trigger(event.player, CountablePokemonTypeContext(advancementData.totalCaptureCount, "any"/*, event.pokemon.species.resourceIdentifier.toString()*/))
event.pokemon.types.forEach {
advancementData.updateTotalTypeCaptureCount(it)
CobblemonCriteria.CATCH_POKEMON.trigger(event.player, CountablePokemonTypeContext(advancementData.getTotalTypeCaptureCount(it), it.showdownId))
CobblemonCriteria.CATCH_POKEMON.trigger(event.player, CountablePokemonTypeContext(advancementData.getTotalTypeCaptureCount(it), it.showdownId/*, event.pokemon.species.resourceIdentifier.toString()*/))
}
if (event.pokemon.shiny) {
advancementData.updateTotalShinyCaptureCount()
@@ -184,4 +186,8 @@ object AdvancementHandler : EventHandler {
CobblemonCriteria.PLANT_TUMBLESTONE.trigger(event.player, PlantTumblestoneContext(event.pos, block))
}
}
fun startRiding(event: RidePokemonEvent.Post) {
CobblemonCriteria.RIDING_STAT_BOOST.trigger(event.player, RidingStatBoostContext(event.pokemon))
}
}
@@ -100,6 +100,8 @@ object CallbackHandler {
PlatformEvents.SERVER_PLAYER_TICK_PRE.subscribe { CobblemonCallbacks.run(cobblemonResource("player_tick_pre"), it.context) }
PlatformEvents.SERVER_PLAYER_TICK_POST.subscribe { CobblemonCallbacks.run(cobblemonResource("player_tick_post"), it.context) }
PlatformEvents.SERVER_STOPPING.subscribe { CobblemonCallbacks.run(cobblemonResource("server_stopping"), emptyMap()) }
PlatformEvents.SERVER_PLAYER_ADVANCEMENT_EARNED.subscribe { CobblemonCallbacks.run(cobblemonResource("advancement_earned"), it.context) }
PlatformEvents.RIGHT_CLICK_BLOCK.subscribe { CobblemonCallbacks.run(cobblemonResource("right_clicked_block"), it.context, it.functions) }
PlatformEvents.RIGHT_CLICK_ENTITY.subscribe { CobblemonCallbacks.run(cobblemonResource("right_clicked_entity"), it.context, it.functions) }
@@ -0,0 +1,150 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.events
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.Priority
import com.cobblemon.mod.common.api.events.CobblemonEvents.BATTLE_FLED
import com.cobblemon.mod.common.api.events.CobblemonEvents.BATTLE_STARTED_POST
import com.cobblemon.mod.common.api.events.CobblemonEvents.BATTLE_VICTORY
import com.cobblemon.mod.common.api.events.CobblemonEvents.COLLECT_EGG
import com.cobblemon.mod.common.api.events.CobblemonEvents.EVOLUTION_COMPLETE
import com.cobblemon.mod.common.api.events.CobblemonEvents.FOSSIL_REVIVED
import com.cobblemon.mod.common.api.events.CobblemonEvents.HATCH_EGG_POST
import com.cobblemon.mod.common.api.events.CobblemonEvents.LEVEL_UP_EVENT
import com.cobblemon.mod.common.api.events.CobblemonEvents.POKEMON_CAPTURED
import com.cobblemon.mod.common.api.events.CobblemonEvents.POKEMON_GAINED
import com.cobblemon.mod.common.api.events.CobblemonEvents.POKEMON_RELEASED_EVENT_POST
import com.cobblemon.mod.common.api.events.CobblemonEvents.POKEROD_CAST_POST
import com.cobblemon.mod.common.api.events.CobblemonEvents.POKEROD_REEL
import com.cobblemon.mod.common.api.events.CobblemonEvents.RIDE_EVENT_POST
import com.cobblemon.mod.common.api.events.CobblemonEvents.TRADE_EVENT_POST
import com.cobblemon.mod.common.api.events.battles.BattleFledEvent
import com.cobblemon.mod.common.api.events.battles.BattleStartedEvent
import com.cobblemon.mod.common.api.events.battles.BattleVictoryEvent
import com.cobblemon.mod.common.api.events.fishing.PokerodCastEvent
import com.cobblemon.mod.common.api.events.fishing.PokerodReelEvent
import com.cobblemon.mod.common.api.events.pokemon.CollectEggEvent
import com.cobblemon.mod.common.api.events.pokemon.FossilRevivedEvent
import com.cobblemon.mod.common.api.events.pokemon.HatchEggEvent
import com.cobblemon.mod.common.api.events.pokemon.LevelUpEvent
import com.cobblemon.mod.common.api.events.pokemon.PokemonCapturedEvent
import com.cobblemon.mod.common.api.events.pokemon.PokemonGainedEvent
import com.cobblemon.mod.common.api.events.pokemon.RidePokemonEvent
import com.cobblemon.mod.common.api.events.pokemon.TradeEvent
import com.cobblemon.mod.common.api.events.pokemon.evolution.EvolutionCompleteEvent
import com.cobblemon.mod.common.api.events.storage.ReleasePokemonEvent
import com.cobblemon.mod.common.util.getPlayer
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.resources.ResourceLocation
import net.minecraft.server.level.ServerPlayer
import java.util.UUID
object StatHandler : EventHandler {
override fun registerListeners() {
POKEMON_CAPTURED.subscribe(Priority.NORMAL, ::onCapture)
POKEMON_RELEASED_EVENT_POST.subscribe(Priority.NORMAL, ::onRelease)
EVOLUTION_COMPLETE.subscribe(Priority.LOWEST, ::onEvolve)
LEVEL_UP_EVENT.subscribe(Priority.NORMAL, ::onLevelUp)
BATTLE_VICTORY.subscribe(Priority.NORMAL, ::onWinBattle)
BATTLE_FLED.subscribe(Priority.NORMAL, ::onFleeBattle)
BATTLE_STARTED_POST.subscribe(Priority.NORMAL, ::onBattleStart)
POKEMON_GAINED.subscribe(Priority.NORMAL, ::onDexEntryGain)
COLLECT_EGG.subscribe(Priority.NORMAL, ::onCollectEgg)
HATCH_EGG_POST.subscribe(Priority.NORMAL, ::onHatchEgg)
TRADE_EVENT_POST.subscribe(Priority.NORMAL, ::onTradeCompleted)
FOSSIL_REVIVED.subscribe(Priority.NORMAL, ::onFossilRevived)
RIDE_EVENT_POST.subscribe(Priority.NORMAL, ::onRide)
POKEROD_CAST_POST.subscribe(Priority.NORMAL, ::onPokeRodCast)
POKEROD_REEL.subscribe(Priority.NORMAL, ::onReelIn)
}
fun onCapture(event : PokemonCapturedEvent) {
event.player.awardStat(getStat(Cobblemon.statistics.CAPTURED))
if (event.pokemon.shiny) {
event.player.awardStat(getStat(Cobblemon.statistics.SHINIES_CAPTURED))
}
}
fun onRelease(event : ReleasePokemonEvent.Post) {
event.player.awardStat(getStat(Cobblemon.statistics.RELEASED))
}
fun onEvolve(event : EvolutionCompleteEvent) {
event.pokemon.getOwnerPlayer()?.awardStat(getStat(Cobblemon.statistics.EVOLVED))
}
fun onLevelUp(event : LevelUpEvent) {
event.pokemon.getOwnerPlayer()?.awardStat(getStat(Cobblemon.statistics.LEVEL_UP))
}
fun onWinBattle(event : BattleVictoryEvent) {
if (!event.wasWildCapture) {
if (event.battle.isPvW) {
event.winners
.flatMap { it.getPlayerUUIDs().mapNotNull(UUID::getPlayer) }
.forEach { player -> player.awardStat(getStat(Cobblemon.statistics.BATTLES_WON)) }
}
}
}
fun onFleeBattle(event: BattleFledEvent) {
event.player.entity?.awardStat(getStat(Cobblemon.statistics.BATTLES_FLED))
}
fun onBattleStart(event : BattleStartedEvent) {
event.battle.players.forEach { player ->
player.awardStat(this.getStat(getStat(Cobblemon.statistics.BATTLES_TOTAL)))
}
}
fun onDexEntryGain(event : PokemonGainedEvent) {
val player = event.pokemon.getOwnerPlayer()
player?.awardStat(getStat(getStat(Cobblemon.statistics.DEX_ENTRIES)))
}
fun onCollectEgg(event : CollectEggEvent) {
event.player.awardStat(getStat(Cobblemon.statistics.EGGS_COLLECTED))
}
fun onHatchEgg(event : HatchEggEvent.Post) {
event.player.awardStat(getStat(Cobblemon.statistics.EGGS_HATCHED))
}
fun onTradeCompleted(event : TradeEvent.Post) {
event.tradeParticipant1Pokemon.getOwnerPlayer()?.awardStat(getStat(Cobblemon.statistics.TRADED))
event.tradeParticipant2Pokemon.getOwnerPlayer()?.awardStat(getStat(Cobblemon.statistics.TRADED))
}
fun onFossilRevived(event : FossilRevivedEvent) {
event.player?.awardStat(getStat(Cobblemon.statistics.FOSSILS_REVIVED))
}
fun onRide(event : RidePokemonEvent.Post) {
event.player.awardStat(getStat(Cobblemon.statistics.TIMES_RIDDEN))
}
fun onPokeRodCast(event : PokerodCastEvent.Post) {
if (event.bobber.owner is ServerPlayer) {
(event.bobber.owner as ServerPlayer).awardStat(getStat(Cobblemon.statistics.ROD_CASTS))
}
}
fun onReelIn(event : PokerodReelEvent) {
event.player.awardStat(getStat(Cobblemon.statistics.REEL_INS))
}
fun getStat(resourceLocation: ResourceLocation) : ResourceLocation {
val stat = BuiltInRegistries.CUSTOM_STAT.get(resourceLocation)
if (stat == null) {
Cobblemon.LOGGER.error("Could not find stat with id {}", resourceLocation)
}
return stat ?: throw NullPointerException("Could not find stat with id $resourceLocation")
}
}
@@ -19,7 +19,7 @@ object FlavourSeasoningProcessor : SeasoningProcessor {
override val type = "flavour"
override fun apply(result: ItemStack, seasoning: List<ItemStack>) {
val isPokePuff = result.`is`(CobblemonItems.POKE_PUFF)
val isPokePuff = false // result.`is`(CobblemonItems.POKE_PUFF)
val flavours = mutableMapOf<Flavour, Int>()
for (seasoningStack in seasoning) {
@@ -0,0 +1,27 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.net.messages.client.debug
import com.cobblemon.mod.common.api.net.NetworkPacket
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.network.RegistryFriendlyByteBuf
class RequestOpenRidingStatsDebugGUIPacket : NetworkPacket<RequestOpenRidingStatsDebugGUIPacket> {
override val id = ID
companion object {
val ID = cobblemonResource("request_open_riding_stats_debug_gui")
fun decode(buffer: RegistryFriendlyByteBuf): RequestOpenRidingStatsDebugGUIPacket {
return RequestOpenRidingStatsDebugGUIPacket()
}
}
override fun encode(buf: RegistryFriendlyByteBuf) {}
}
@@ -0,0 +1,27 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.net.messages.server.debug
import com.cobblemon.mod.common.api.net.NetworkPacket
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.network.RegistryFriendlyByteBuf
class OpenRidingStatsDebugGUIPacket : NetworkPacket<OpenRidingStatsDebugGUIPacket> {
override val id = ID
companion object {
val ID = cobblemonResource("open_riding_stats_debug_gui")
fun decode(buffer: RegistryFriendlyByteBuf): OpenRidingStatsDebugGUIPacket {
return OpenRidingStatsDebugGUIPacket()
}
}
override fun encode(buf: RegistryFriendlyByteBuf) {}
}
@@ -0,0 +1,39 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.net.serverhandling.debug
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.net.ServerNetworkPacketHandler
import com.cobblemon.mod.common.api.permission.CobblemonPermissions.USE_RIDING_STATS_DEBUG
import com.cobblemon.mod.common.api.text.red
import com.cobblemon.mod.common.net.messages.client.debug.RequestOpenRidingStatsDebugGUIPacket
import com.cobblemon.mod.common.net.messages.server.debug.OpenRidingStatsDebugGUIPacket
import com.cobblemon.mod.common.util.lang
import net.minecraft.server.MinecraftServer
import net.minecraft.server.level.ServerPlayer
object RequestOpenRidingStatsDebugGUIHandler : ServerNetworkPacketHandler<RequestOpenRidingStatsDebugGUIPacket> {
override fun handle(
packet: RequestOpenRidingStatsDebugGUIPacket,
server: MinecraftServer,
player: ServerPlayer
) {
if (!Cobblemon.config.enableDebugKeys) {
player.sendSystemMessage(lang("requires_debug_keys").red())
return
}
if (!Cobblemon.permissionValidator.hasPermission(player, USE_RIDING_STATS_DEBUG)) {
player.sendSystemMessage(lang("requires_permission").red())
return
}
OpenRidingStatsDebugGUIPacket().sendToPlayer(player)
}
}
@@ -10,11 +10,10 @@ package com.cobblemon.mod.common.net.serverhandling.debug
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.net.ServerNetworkPacketHandler
import com.cobblemon.mod.common.api.permission.CobblemonPermissions.USE_RIDING_STATS_DEBUG
import com.cobblemon.mod.common.api.riding.RidingStyle
import com.cobblemon.mod.common.api.riding.stats.RidingStat
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.net.messages.server.debug.ServerboundUpdateRidingSettingsPacket
import com.cobblemon.mod.common.net.messages.server.debug.ServerboundUpdateRidingStatsPacket
import com.cobblemon.mod.common.util.asExpression
import net.minecraft.server.MinecraftServer
import net.minecraft.server.level.ServerPlayer
@@ -23,6 +22,7 @@ object ServerboundUpdateRidingSettingsHandler : ServerNetworkPacketHandler<Serve
override fun handle(packet: ServerboundUpdateRidingSettingsPacket, server: MinecraftServer, player: ServerPlayer) {
if (!Cobblemon.config.enableDebugKeys) return
if (!Cobblemon.permissionValidator.hasPermission(player, USE_RIDING_STATS_DEBUG)) return
val entity = player.level().getEntity(packet.entity) ?: return
if (entity !is PokemonEntity) return
@@ -10,6 +10,7 @@ package com.cobblemon.mod.common.net.serverhandling.debug
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.net.ServerNetworkPacketHandler
import com.cobblemon.mod.common.api.permission.CobblemonPermissions.USE_RIDING_STATS_DEBUG
import com.cobblemon.mod.common.api.riding.stats.RidingStat
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.net.messages.server.debug.ServerboundUpdateRidingStatRangePacket
@@ -20,6 +21,7 @@ object ServerboundUpdateRidingStatRangeHandler : ServerNetworkPacketHandler<Serv
override fun handle(packet: ServerboundUpdateRidingStatRangePacket, server: MinecraftServer, player: ServerPlayer) {
if (!Cobblemon.config.enableDebugKeys) return
if (!Cobblemon.permissionValidator.hasPermission(player, USE_RIDING_STATS_DEBUG)) return
val entity = player.level().getEntity(packet.entity) ?: return
if (entity !is PokemonEntity) return
@@ -10,6 +10,7 @@ package com.cobblemon.mod.common.net.serverhandling.debug
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.net.ServerNetworkPacketHandler
import com.cobblemon.mod.common.api.permission.CobblemonPermissions.USE_RIDING_STATS_DEBUG
import com.cobblemon.mod.common.api.riding.stats.RidingStat
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.net.messages.server.debug.ServerboundUpdateRidingStatsPacket
@@ -20,10 +21,12 @@ object ServerboundUpdateRidingStatsHandler : ServerNetworkPacketHandler<Serverbo
override fun handle(packet: ServerboundUpdateRidingStatsPacket, server: MinecraftServer, player: ServerPlayer) {
if (!Cobblemon.config.enableDebugKeys) return
if (!Cobblemon.permissionValidator.hasPermission(player, USE_RIDING_STATS_DEBUG)) return
val entity = player.level().getEntity(packet.entity) ?: return
if (entity !is PokemonEntity) return
if (entity.controllingPassenger != player) return
entity.overrideRideStat(packet.ridingStyle, RidingStat.SPEED, packet.speed)
entity.overrideRideStat(packet.ridingStyle, RidingStat.ACCELERATION, packet.acceleration)
entity.overrideRideStat(packet.ridingStyle, RidingStat.SKILL, packet.skill)
@@ -47,6 +47,7 @@ import com.cobblemon.mod.common.api.pokemon.evolution.EvolutionProxy
import com.cobblemon.mod.common.api.pokemon.evolution.PreEvolution
import com.cobblemon.mod.common.api.pokemon.experience.ExperienceGroup
import com.cobblemon.mod.common.api.pokemon.experience.ExperienceSource
import com.cobblemon.mod.common.api.pokemon.feature.IntSpeciesFeature
import com.cobblemon.mod.common.api.pokemon.feature.SpeciesFeature
import com.cobblemon.mod.common.api.pokemon.feature.SpeciesFeatures
import com.cobblemon.mod.common.api.pokemon.feature.SynchronizedSpeciesFeature
@@ -99,6 +100,7 @@ import com.cobblemon.mod.common.pokemon.feature.SeasonFeatureHandler
import com.cobblemon.mod.common.pokemon.feature.StashHandler
import com.cobblemon.mod.common.pokemon.properties.BattleCloneProperty
import com.cobblemon.mod.common.pokemon.properties.UncatchableProperty
import com.cobblemon.mod.common.pokemon.requirements.BlocksTraveledRequirement
import com.cobblemon.mod.common.pokemon.status.PersistentStatus
import com.cobblemon.mod.common.pokemon.status.PersistentStatusContainer
import com.cobblemon.mod.common.util.cobblemonResource
@@ -108,7 +110,6 @@ import com.cobblemon.mod.common.util.codec.internal.ClientPokemonP3
import com.cobblemon.mod.common.util.codec.internal.PokemonP1
import com.cobblemon.mod.common.util.codec.internal.PokemonP2
import com.cobblemon.mod.common.util.codec.internal.PokemonP3
import com.cobblemon.mod.common.util.lang
import com.cobblemon.mod.common.util.playSoundServer
import com.cobblemon.mod.common.util.server
import com.cobblemon.mod.common.util.setPositionSafely
@@ -1187,25 +1188,19 @@ open class Pokemon : ShowdownIdentifiable {
* @see [HeldItemEvent]
*/
fun swapHeldItem(stack: ItemStack, decrement: Boolean = true, aiCanDrop: Boolean = true): ItemStack {
val existing = this.heldItem()
val event = HeldItemEvent.Pre(this, stack, existing, decrement)
if (!isClient) {
CobblemonEvents.HELD_ITEM_PRE.post(event)
val returning = this.heldItem.copy()
val giving = stack.copy().apply { count = 1 }
if (decrement) {
stack.shrink(1)
}
if (!event.isCanceled) {
val giving = event.receiving.copy().apply { count = 1 }
if (event.decrement) {
event.receiving.shrink(1)
}
this.heldItem = giving
this.canDropHeldItem = giving.isEmpty || aiCanDrop
onChange(HeldItemUpdatePacket({ this }, giving))
CobblemonEvents.HELD_ITEM_POST.post(HeldItemEvent.Post(this, this.heldItem(), event.returning.copy(), event.decrement)) {
StashHandler.giveHeldItem(it)
}
return event.returning
this.heldItem = giving
this.canDropHeldItem = giving.isEmpty || aiCanDrop
onChange(HeldItemUpdatePacket({ this }, giving))
val shouldRemoveHeldItem = StashHandler.handleItem(this, giving.item)
if (shouldRemoveHeldItem) {
removeHeldItem()
}
return stack
return returning
}
/**
@@ -1229,21 +1224,13 @@ open class Pokemon : ShowdownIdentifiable {
* @see [HeldItemEvent]
*/
fun swapCosmeticItem(stack: ItemStack, decrement: Boolean = true): ItemStack {
val existing = this.cosmeticItem.copy()
val event = HeldItemEvent.Pre(this, stack, existing, decrement)
if (!isClient) {
CobblemonEvents.COSMETIC_ITEM_PRE.post(event)
val returning = this.cosmeticItem.copy()
val giving = stack.copy().apply { count = 1 }
if (decrement) {
stack.shrink(1)
}
if (!event.isCanceled) {
val giving = event.receiving.copy().apply { count = 1 }
if (event.decrement) {
event.receiving.shrink(1)
}
this.cosmeticItem = giving
CobblemonEvents.COSMETIC_ITEM_POST.post(HeldItemEvent.Post(this, this.cosmeticItem.copy(), event.returning.copy(), event.decrement))
return event.returning
}
return stack
this.cosmeticItem = giving
return returning
}
/**
@@ -1847,6 +1834,11 @@ open class Pokemon : ShowdownIdentifiable {
moveSet.update()
}
fun getBaseRideStat(stat: RidingStat): Float {
val behaviours = form.riding.behaviours ?: return 0F
return behaviours.values.maxOf { behaviour -> behaviour.stats[stat]?.first?.toFloat() ?: 0F }
}
fun getMaxRideBoost(stat: RidingStat): Float {
val behaviours = form.riding.behaviours ?: return 0F
// Get the widest range for this stat, max - min, since that's how far it can be boosted in theory.
@@ -1915,6 +1907,23 @@ open class Pokemon : ShowdownIdentifiable {
onChange(RideBoostsUpdatePacket({ this }, getRideBoosts()))
}
fun getBlocksTraveled(): Int {
return getFeature<IntSpeciesFeature>("blocks_traveled")?.value ?: 0
}
fun addBlocksTraveled(value: Int) {
val blocksTraveledFeature = getFeature<IntSpeciesFeature>("blocks_traveled") ?: return
blocksTraveledFeature.value += value
markFeatureDirty(blocksTraveledFeature)
}
fun hasBlocksTraveledRequirement(): Boolean {
return evolutions
.flatMap { it.requirements }
.filterIsInstance<BlocksTraveledRequirement>()
.isNotEmpty()
}
fun getExperienceToNextLevel() = getExperienceToLevel(level + 1)
fun getExperienceToLevel(level: Int) = if (level <= this.level) 0 else experienceGroup.getExperience(level) - experience
@@ -142,13 +142,13 @@ object SlowpokeTailRegrowthSpeciesFeatureProvider: SpeciesFeatureProvider<Slowpo
override fun provide(pokemon: Pokemon): Set<String> {
val mechanic = CobblemonMechanics.slowpokeTails
val regrowthSeconds = pokemon.getFeature<SlowpokeTailRegrowthSpeciesFeature>(SlowpokeTailRegrowthSpeciesFeature.NAME)?.regrowthSeconds ?: 0
val regrowthSeconds = pokemon.getFeature<SlowpokeTailRegrowthSpeciesFeature>(SlowpokeTailRegrowthSpeciesFeature.NAME)?.regrowthSeconds ?: return emptySet()
return mechanic.getAspects(regrowthSeconds)
}
override fun provide(properties: PokemonProperties): Set<String> {
val mechanic = CobblemonMechanics.slowpokeTails
val regrowthSeconds = properties.customProperties.filterIsInstance<SlowpokeTailRegrowthSpeciesFeature>().firstOrNull()?.regrowthSeconds ?: 0
val regrowthSeconds = properties.customProperties.filterIsInstance<SlowpokeTailRegrowthSpeciesFeature>().firstOrNull()?.regrowthSeconds ?: return emptySet()
return mechanic.getAspects(regrowthSeconds)
}
}
@@ -1,94 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.pokemon.misc
import com.cobblemon.mod.common.CobblemonItems
import com.cobblemon.mod.common.CobblemonSounds
import com.cobblemon.mod.common.api.events.pokemon.HeldItemEvent
import com.cobblemon.mod.common.api.pokemon.feature.IntSpeciesFeature
import com.cobblemon.mod.common.pokemon.Pokemon
import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.Item
import net.minecraft.world.item.Items
import net.minecraft.server.level.ServerPlayer
import net.minecraft.world.InteractionHand
/**
* Handles logic relating to Gimmighoul's Coin Stash and Scrap Stash bars.
*
* @author whatsy
*/
object GimmighoulStashHandler {
val COIN_VALUE = 1
val POUCH_VALUE = COIN_VALUE * 9
val SACK_VALUE = POUCH_VALUE * 9
val SCRAP_VALUE = 1
val INGOT_VALUE = SCRAP_VALUE * 4
val BLOCK_VALUE = INGOT_VALUE * 9
fun interactMob(player: Player, hand: InteractionHand, pokemon:Pokemon) : Boolean {
val itemStack = player.getItemInHand(hand)
var success = false
if(player is ServerPlayer && pokemon.getOwnerPlayer() == player) {
success = handleItem(pokemon, itemStack.item)
if(success) {
itemStack.shrink(1)
}
}
return success
}
fun giveHeldItem(event: HeldItemEvent.Post) {
val pokemon = event.pokemon
val item = event.received.item
if(handleItem(pokemon, item)) {
pokemon.removeHeldItem()
}
}
fun handleItem(pokemon: Pokemon, item: Item) : Boolean {
val goldHoard = pokemon.getFeature<IntSpeciesFeature>("gimmighoul_coins")
val netheriteHoard = pokemon.getFeature<IntSpeciesFeature>("gimmighoul_netherite")
if (goldHoard != null && goldHoard.value < 999) {
val increase = when (item) {
CobblemonItems.RELIC_COIN -> COIN_VALUE
CobblemonItems.RELIC_COIN_POUCH -> POUCH_VALUE
CobblemonItems.RELIC_COIN_SACK -> SACK_VALUE
else -> 0
}
if (increase != 0) {
goldHoard.value += increase
if (goldHoard.value > 999) goldHoard.value = 999
if (pokemon.entity != null) pokemon.entity!!.playSound(CobblemonSounds.GIMMIGHOUL_GIVE_ITEM, 1f, 1f)
pokemon.markFeatureDirty(goldHoard)
return true
}
}
if (netheriteHoard != null && netheriteHoard.value < 256) {
val increase = when (item) {
Items.NETHERITE_SCRAP -> SCRAP_VALUE
Items.NETHERITE_INGOT -> INGOT_VALUE
Items.NETHERITE_BLOCK -> BLOCK_VALUE
else -> 0
}
if (increase != 0) {
netheriteHoard.value += increase
if (netheriteHoard.value > 256) netheriteHoard.value = 256
if (pokemon.entity != null) pokemon.entity!!.playSound(CobblemonSounds.GIMMIGHOUL_GIVE_ITEM, 1f, 1f)
pokemon.markFeatureDirty(netheriteHoard)
return true
}
}
return false
}
}
@@ -27,12 +27,11 @@ class BlocksTraveledRequirement(amount: Int) : Requirement {
val amount: Int = amount
override fun check(pokemon: Pokemon): Boolean {
val pokemonEntity = pokemon.entity ?: return false
return pokemonEntity.blocksTraveled >= this.amount
return pokemon.getBlocksTraveled() >= this.amount
}
companion object {
const val ADAPTER_VARIANT = "blocks_traveled"
}
}
}
@@ -18,8 +18,8 @@ import com.mojang.serialization.Codec
import com.mojang.serialization.MapCodec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.resources.ResourceLocation
import java.util.*
import net.minecraft.world.item.ItemStack
import java.util.*
internal data class ClientPokemonP3(
val originalTrainerType: OriginalTrainerType,
@@ -34,7 +34,7 @@ internal data class ClientPokemonP3(
val markings: List<Int>,
val rideBoosts: Map<String, Float>,
val currentFullness: Int,
val interactionCooldowns: Map<ResourceLocation, Int>
val interactionCooldowns: Map<ResourceLocation, Int>,
) : Partial<Pokemon> {
override fun into(other: Pokemon): Pokemon {
@@ -74,8 +74,8 @@ internal data class ClientPokemonP3(
Codec.list(Codec.INT).optionalFieldOf(DataKeys.POKEMON_MARKINGS, listOf(0, 0, 0, 0, 0, 0)).forGetter(ClientPokemonP3::markings),
Codec.unboundedMap(Codec.STRING, Codec.FLOAT).fieldOf(DataKeys.POKEMON_RIDE_BOOSTS).forGetter(ClientPokemonP3::rideBoosts),
Codec.intRange(0, 100).fieldOf(DataKeys.POKEMON_FULLNESS).forGetter(ClientPokemonP3::currentFullness),
Codec.unboundedMap(ResourceLocation.CODEC, Codec.INT).fieldOf(DataKeys.POKEMON_INTERACTION_COOLDOWN).forGetter(ClientPokemonP3::interactionCooldowns)
).apply(instance, ::ClientPokemonP3)
Codec.unboundedMap(ResourceLocation.CODEC, Codec.INT).fieldOf(DataKeys.POKEMON_INTERACTION_COOLDOWN).forGetter(ClientPokemonP3::interactionCooldowns),
).apply(instance, ::ClientPokemonP3)
}
internal fun from(pokemon: Pokemon): ClientPokemonP3 = ClientPokemonP3(
@@ -91,7 +91,7 @@ internal data class ClientPokemonP3(
pokemon.markings,
pokemon.getRideBoosts().mapKeys { it.key.name },
pokemon.currentFullness,
pokemon.interactionCooldowns
pokemon.interactionCooldowns,
)
}
}
@@ -10,7 +10,6 @@ package com.cobblemon.mod.common.util.codec.internal
import com.cobblemon.mod.common.api.mark.Marks
import com.cobblemon.mod.common.api.pokemon.feature.SpeciesFeatures
import com.cobblemon.mod.common.api.pokemon.feature.SynchronizedSpeciesFeatureProvider
import com.cobblemon.mod.common.api.riding.stats.RidingStat
import com.cobblemon.mod.common.pokemon.OriginalTrainerType
import com.cobblemon.mod.common.pokemon.Pokemon
@@ -21,12 +20,12 @@ import com.cobblemon.mod.common.util.codec.optionalFieldOfWithDefault
import com.mojang.serialization.Codec
import com.mojang.serialization.MapCodec
import com.mojang.serialization.codecs.RecordCodecBuilder
import java.util.*
import net.minecraft.nbt.CompoundTag
import net.minecraft.nbt.StringTag
import net.minecraft.nbt.Tag
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.item.ItemStack
import java.util.*
internal data class PokemonP3(
val originalTrainerType: OriginalTrainerType,
@@ -43,7 +42,7 @@ internal data class PokemonP3(
val rideBoosts: Map<String, Float>,
val rideStamina: Float,
val currentFullness: Int,
val interactionCooldowns: Map<ResourceLocation, Int>
val interactionCooldowns: Map<ResourceLocation, Int>,
) : Partial<Pokemon> {
override fun into(other: Pokemon): Pokemon {
@@ -100,8 +99,40 @@ internal data class PokemonP3(
Codec.unboundedMap(Codec.STRING, Codec.FLOAT).optionalFieldOf(DataKeys.POKEMON_RIDE_BOOSTS, emptyMap<String, Float>()).forGetter(PokemonP3::rideBoosts),
Codec.FLOAT.optionalFieldOf(DataKeys.POKEMON_RIDE_STAMINA, 1F).forGetter(PokemonP3::rideStamina),
Codec.intRange(0, 100).optionalFieldOf(DataKeys.POKEMON_FULLNESS, 0).forGetter(PokemonP3::currentFullness),
Codec.unboundedMap(ResourceLocation.CODEC, Codec.INT).optionalFieldOf(DataKeys.POKEMON_INTERACTION_COOLDOWN, emptyMap<ResourceLocation, Int>()).forGetter(PokemonP3::interactionCooldowns)
).apply(instance) { originalTrainerType, originalTrainer, forcedAspects, features, heldItemVisible, canDropHeldItem, cosmeticItem, activeMark, marks, potentialMarks, markings, rideBoosts, rideStamina, currentFullness, interactionCooldown -> PokemonP3(originalTrainerType, originalTrainer, forcedAspects.toSet(), features, heldItemVisible, canDropHeldItem, cosmeticItem.orElse(ItemStack.EMPTY), activeMark, marks.toMutableSet(), potentialMarks.toMutableSet(), markings, rideBoosts, rideStamina, currentFullness, interactionCooldown) }
Codec.unboundedMap(ResourceLocation.CODEC, Codec.INT).optionalFieldOf(DataKeys.POKEMON_INTERACTION_COOLDOWN, emptyMap<ResourceLocation, Int>()).forGetter(PokemonP3::interactionCooldowns),
).apply(instance) {
originalTrainerType,
originalTrainer,
forcedAspects,
features,
heldItemVisible,
canDropHeldItem,
cosmeticItem,
activeMark,
marks,
potentialMarks,
markings,
rideBoosts,
rideStamina,
currentFullness,
interactionCooldown -> PokemonP3(
originalTrainerType,
originalTrainer,
forcedAspects.toSet(),
features,
heldItemVisible,
canDropHeldItem,
cosmeticItem.orElse(ItemStack.EMPTY),
activeMark,
marks.toMutableSet(),
potentialMarks.toMutableSet(),
markings,
rideBoosts,
rideStamina,
currentFullness,
interactionCooldown,
)
}
}
internal fun from(pokemon: Pokemon): PokemonP3 = PokemonP3(
@@ -123,7 +154,7 @@ internal data class PokemonP3(
pokemon.getRideBoosts().mapKeys { it.key.name },
pokemon.rideStamina,
pokemon.currentFullness,
pokemon.interactionCooldowns
pokemon.interactionCooldowns,
)
}
}
@@ -46,6 +46,12 @@
"leg_back_left": {
"rotation": ["-math.sin(q.anim_time*90*8)*0.2", 0, 0],
"position": [0, "-math.clamp(math.sin(q.anim_time*90*8+180)*0.05,-0.5,0.5)", 0]
},
"whisker_left": {
"rotation": [0, "-(math.sin(q.anim_time*90*8*2)*4)", 0]
},
"ear_left": {
"rotation": [0, "-(math.sin(q.anim_time*90*4*2)*2)", 0]
}
}
},
@@ -109,6 +115,12 @@
"-math.clamp(math.sin(q.anim_time*90*4*2)*1,0,2)-math.clamp(math.sin(-q.anim_time*90*4*2)*0.8,0,2)",
"math.clamp(math.sin(q.anim_time*90*4*2-30)*0.5,0,2)-math.clamp(math.sin(q.anim_time*90*4*2-30+180)*0.5,0,2)"
]
},
"whisker_left": {
"rotation": [0, "-15-math.sin(q.anim_time*90*4*2)*8", 0]
},
"ear_left": {
"rotation": [0, "-15-math.sin(q.anim_time*90*4*2)*8", 0]
}
}
},
@@ -166,6 +178,12 @@
},
"leg_back_left2": {
"rotation": [5, 0, 0]
},
"whisker_left": {
"rotation": [0, "-20.25-math.sin(q.anim_time*90*2-40)*5", 0]
},
"ear_left": {
"rotation": [0, "-35.5-math.sin(q.anim_time*90*2-40)*4", 0]
}
}
},
@@ -330,35 +348,48 @@
"1.1667": [0, 0, 0],
"1.2083": [0.1, 0, 0]
}
},
"whisker_left": {
"rotation": {
"0.0": [0, 0, 0],
"0.0417": [0, 55, 0],
"0.3333": [0, -17.5, 0],
"1.1667": [0, -17.5, 0],
"1.2083": [0, -67.5, 0],
"1.25": [0, -55, 0],
"1.2917": [0, -70, 0],
"1.3333": [0, -57.5, 0]
}
},
"ear_left": {
"rotation": {
"0.0": [0, 0, 0],
"0.0833": [0, 65, 0],
"0.3333": [0, 5, 0],
"1.1667": [0, 5, 0],
"1.2083": [45.7803, 22.39073, -52.0215],
"1.25": [28.95446, 24.32786, -59.67401],
"1.3333": [42.37797, 19.10791, -71.77865]
}
}
}
},
"animation.rattata.blink": {
"animation_length": 0.16667,
"animation_length": 0.1667,
"bones": {
"eyelid_right": {
"position": {
"0.0": [-0.1, 0, 0],
"0.125": [-0.1, 0, 0],
"0.1667": [0, 0, 0]
"0.1667": {"pre": [-0.1, 0, 0], "post": [0, 0, 0]}
}
},
"eyelid_left": {
"position": {
"0.0": [0.1, 0, 0],
"0.125": [0.1, 0, 0],
"0.1667": [0, 0, 0]
"0.1667": {"pre": [0.1, 0, 0], "post": [0, 0, 0]}
}
}
}
},
"animation.rattata.cry": {
"animation_length": 1.33333,
"sound_effects": {
"0.04": {
"effect": "pokemon.rattata.cry"
}
}
}
}
}
@@ -1,7 +1,7 @@
{
"format_version": "1.8.0",
"animations": {
"animation.rattata_alolan.ground_idle": {
"animation.rattata.ground_idle": {
"loop": true,
"animation_length": 21.375,
"bones": {
@@ -46,10 +46,16 @@
"leg_back_left": {
"rotation": ["-math.sin(q.anim_time*90*8)*0.2", 0, 0],
"position": [0, "-math.clamp(math.sin(q.anim_time*90*8+180)*0.05,-0.5,0.5)", 0]
},
"whisker_left": {
"rotation": [0, "-(math.sin(q.anim_time*90*8*2)*4)", 0]
},
"ear_left": {
"rotation": [0, "-(math.sin(q.anim_time*90*4*2)*2)", 0]
}
}
},
"animation.rattata_alolan.ground_walk": {
"animation.rattata.ground_walk": {
"loop": true,
"bones": {
"body": {
@@ -109,264 +115,16 @@
"-math.clamp(math.sin(q.anim_time*90*4*2)*1,0,2)-math.clamp(math.sin(-q.anim_time*90*4*2)*0.8,0,2)",
"math.clamp(math.sin(q.anim_time*90*4*2-30)*0.5,0,2)-math.clamp(math.sin(q.anim_time*90*4*2-30+180)*0.5,0,2)"
]
},
"whisker_left": {
"rotation": [0, "-15-math.sin(q.anim_time*90*4*2)*8", 0]
},
"ear_left": {
"rotation": [0, "-15-math.sin(q.anim_time*90*4*2)*8", 0]
}
}
},
"animation.rattata_alolan.mouth_open": {
"animation_length": 1.25,
"bones": {
"jaw": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [57.5, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.75": [0, -0.3, -0.5]
}
},
"mouth": {
"position": {
"0.0": [0, 0, 0],
"0.0417": [0, 0, -0.11],
"0.75": [0, -1, -0.1]
}
}
}
},
"animation.rattata_alolan.standing": {
"animation_length": 2.5,
"bones": {
"body": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [-82.5, 0, 0],
"1.25": [-82.5, 0, 0],
"2.0": [0, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.75": [0, -0.4, 0],
"1.125": [0, -0.2, 0],
"1.25": [0, -0.4, 0],
"2.0": [0, 0, 0]
}
},
"head": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [85, 0, 0],
"1.25": [85, 0, 0],
"2.0": [0, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.75": [0, 0.3, -1.7],
"1.25": [0, 0.3, -1.7],
"2.0": [0, 0, 0]
}
},
"tail": {
"rotation": {
"0.0": [15, 0, 0],
"0.75": [65, 0, 0],
"1.25": [65, 0, 0],
"2.0": [15, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.75": [0, 2, -1],
"1.25": [0, 2, -1],
"2.0": [0, 0, 0]
}
},
"tail2": {
"rotation": {
"0.0": [50, 0, 0],
"0.75": [50, 0, 0],
"1.25": [50, 0, 0],
"2.0": [50, 0, 0]
}
},
"tail3": {
"rotation": {
"0.0": [40, 0, 0],
"0.75": [40, 0, 0],
"1.25": [40, 0, 0],
"2.0": [40, 0, 0]
}
},
"tail4": {
"rotation": {
"0.0": [20, 0, 0],
"0.75": [20, 0, 0],
"1.25": [20, 0, 0],
"2.0": [20, 0, 0]
}
},
"leg_front_right": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [45, 12, 70],
"1.25": [45, 12, 70],
"2.0": [0, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.75": [-0.2, 0.5, 0.5],
"1.25": [-0.2, 0.5, 0.5],
"2.0": [0, 0, 0]
}
},
"leg_front_right_standing": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [0, 0, -35],
"1.25": [0, 0, -35],
"2.0": [0, 0, 0]
}
},
"leg_front_right3": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [80, -25, 0],
"1.25": [80, -25, 0],
"2.0": [0, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.75": [0.3, -0.9, -0.8],
"1.25": [0.3, -0.9, -0.8]
}
},
"leg_front_left": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [45, -12, -70],
"1.25": [45, -12, -70],
"2.0": [0, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.75": [0.2, 0.5, 0.5],
"1.25": [0.2, 0.5, 0.5],
"2.0": [0, 0, 0]
}
},
"leg_front_left_standing": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [0, 0, 35],
"1.25": [0, 0, 35],
"2.0": [0, 0, 0]
}
},
"leg_front_left3": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [80, 25, 0],
"1.25": [80, 25, 0],
"2.0": [0, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.75": [0.3, -0.9, -0.8],
"1.25": [0.3, -0.9, -0.8]
}
},
"leg_back_right": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [45, 0, 27.5],
"1.25": [45, 0, 27.5],
"2.0": [0, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.75": [0.2, -0.2, 0],
"1.125": [0.2, -0.2, 0.2],
"1.25": [0.2, -0.2, 0],
"2.0": [0, 0, 0]
}
},
"leg_back_right2": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [49.5, 0, 0],
"1.25": [49.5, 0, 0],
"2.0": [0, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.75": [0, -0.6, -0.7],
"1.25": [0, -0.6, -0.7],
"2.0": [0, 0, 0]
}
},
"leg_back_right3": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [-10, 0, -2],
"1.25": [-10, 0, -2],
"2.0": [0, 0, 0]
}
},
"leg_back_left": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [45, 0, -27.5],
"1.25": [45, 0, -27.5],
"2.0": [0, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.75": [-0.2, -0.2, 0],
"1.125": [-0.2, -0.2, 0.2],
"1.25": [-0.2, -0.2, 0],
"2.0": [0, 0, 0]
}
},
"leg_back_left2": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [49.5, 0, 0],
"1.25": [49.5, 0, 0],
"2.0": [0, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.75": [0, -0.6, -0.7],
"1.25": [0, -0.6, -0.7],
"2.0": [0, 0, 0]
}
},
"leg_back_left3": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [-10, 0, 2],
"1.25": [-10, 0, 2],
"2.0": [0, 0, 0]
}
},
"leg_front_left4": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [45, 0, 0],
"1.25": [45, 0, 0],
"2.0": [0, 0, 0]
}
},
"leg_front_right4": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [45, 0, 0],
"1.25": [45, 0, 0],
"2.0": [0, 0, 0]
}
}
}
},
"animation.rattata_alolan.faint": {
"animation.rattata.faint": {
"animation_length": 3,
"bones": {
"body": {
@@ -527,10 +285,55 @@
"1.1667": [0, 0, 0],
"1.2083": [0.1, 0, 0]
}
},
"whisker_left": {
"rotation": {
"0.0": [0, 0, 0],
"0.0417": [0, 55, 0],
"0.3333": [0, -17.5, 0],
"1.1667": [0, -17.5, 0],
"1.2083": [0, -67.5, 0],
"1.25": [0, -55, 0],
"1.2917": [0, -70, 0],
"1.3333": [0, -57.5, 0]
}
},
"ear_left": {
"rotation": {
"0.0": [0, 0, 0],
"0.0833": [0, 65, 0],
"0.3333": [0, 5, 0],
"1.1667": [0, 5, 0],
"1.2083": [45.7803, 22.39073, -52.0215],
"1.25": [28.95446, 24.32786, -59.67401],
"1.3333": [42.37797, 19.10791, -71.77865]
}
}
}
},
"animation.rattata_alolan.sleep": {
"animation.rattata.mouth_open": {
"animation_length": 1.25,
"bones": {
"jaw": {
"rotation": {
"0.0": [0, 0, 0],
"0.75": [57.5, 0, 0]
},
"position": {
"0.0": [0, 0, 0],
"0.75": [0, -0.3, -0.5]
}
},
"mouth": {
"position": {
"0.0": [0, 0, 0],
"0.0417": [0, 0, -0.11],
"0.75": [0, -1, -0.1]
}
}
}
},
"animation.rattata.sleep": {
"loop": true,
"bones": {
"body": {
@@ -587,7 +390,24 @@
}
}
},
"animation.rattata_alolan.blink": {
"animation.rattata.blink": {
"animation_length": 0.1667,
"bones": {
"eyelid_right": {
"position": {
"0.0": [-0.1, 0, 0],
"0.1667": {"pre": [-0.1, 0, 0], "post": [0, 0, 0]}
}
},
"eyelid_left": {
"position": {
"0.0": [0.1, 0, 0],
"0.1667": {"pre": [0.1, 0, 0], "post": [0, 0, 0]}
}
}
}
},
"animation.rattata.blink2": {
"animation_length": 0.16667,
"bones": {
"eyelid_right": {
@@ -605,33 +425,6 @@
}
}
}
},
"animation.rattata_alolan.blink2": {
"animation_length": 0.16667,
"bones": {
"eyelid_right": {
"position": {
"0.0": [-0.1, 0, 0],
"0.125": [-0.1, 0, 0],
"0.1667": [0, 0, 0]
}
},
"eyelid_left": {
"position": {
"0.0": [0.1, 0, 0],
"0.125": [0.1, 0, 0],
"0.1667": [0, 0, 0]
}
}
}
},
"animation.rattata_alolan.cry": {
"animation_length": 1.33333,
"sound_effects": {
"0.0417": {
"effect": "pokemon.rattata_alolan.cry"
}
}
}
}
}
@@ -93,6 +93,9 @@
},
"torso": {
"rotation": [-2.5, 0, 0]
},
"whiskers_left": {
"rotation": [0, "-(math.sin(q.anim_time*90*8*2+90)*4)", 0]
}
}
},
@@ -164,7 +167,7 @@
"rotation": [0, "-(math.sin(query.anim_time*90*8+90)*1-5)-math.sin(q.anim_time*90*8*2+90)*2", 0]
},
"whiskers_left": {
"rotation": [0, "3*(math.sin(query.anim_time*90*8+90)*1-5)+math.sin(q.anim_time*90*8*2+90)*3", 0]
"rotation": [0, "3*(math.sin(query.anim_time*90*8+90)*1-5)+math.sin(q.anim_time*90*8*2+90)*-3", 0]
},
"arm_right": {
"rotation": [0, "-62.5-math.sin(query.anim_time*90*4-50)*10", 0]
@@ -621,6 +624,15 @@
"1.95": [26.9208, -1.70779, 0.30237],
"2.0": [29.4208, -1.70779, 0.30237]
}
},
"whiskers_left": {
"rotation": {
"0.0": [0, "-(math.sin(q.anim_time*90*8*2+90)*4)", 0],
"0.1": [0, "-(math.sin(q.anim_time*90*8*2+90)*4)", 0],
"0.25": [0, "55+math.sin(q.anim_time*90*8*2+90)*4", 0],
"0.3": [0, "-17.5+math.sin(q.anim_time*90*8*2+90)*4", 0],
"0.35": [0, "-(math.sin(q.anim_time*90*8*2+90)*4)", 0]
}
}
}
},
@@ -684,21 +696,25 @@
"eyelid_right": {
"position": {
"0.0": [-0.1, 0, 0],
"0.125": [-0.1, 0, 0],
"0.1667": [0, 0, 0]
"0.1667": {
"pre": [-0.1, 0, 0],
"post": [0, 0, 0]
}
}
},
"eyelid_left": {
"position": {
"0.0": [0.1, 0, 0],
"0.125": [0.1, 0, 0],
"0.1667": [0, 0, 0]
"0.1667": {
"pre": [0.1, 0, 0],
"post": [0, 0, 0]
}
}
}
}
},
"animation.raticate.cry": {
"animation_length": 0.79167,
"animation_length": 0.7917,
"bones": {
"head": {
"rotation": {
@@ -592,7 +592,7 @@
},
"sound_effects": {
"0.0": {
"effect": "pokemon.raticate_alolan.cry"
"effect": "pokemon.raticate_alolan.alola.cry"
}
}
},
@@ -688,6 +688,9 @@
},
"torso": {
"rotation": [-2.5, 0, 0]
},
"whiskers_left": {
"rotation": [0, "-(math.sin(q.anim_time*90*8*2+90)*4)", 0]
}
}
},
@@ -759,7 +762,7 @@
"rotation": [0, "-(math.sin(query.anim_time*90*8+90)*1-5)-math.sin(q.anim_time*90*8*2+90)*2", 0]
},
"whiskers_left": {
"rotation": [0, "3*(math.sin(query.anim_time*90*8+90)*1-5)+math.sin(q.anim_time*90*8*2+90)*3", 0]
"rotation": [0, "3*(math.sin(query.anim_time*90*8+90)*1-5)+math.sin(q.anim_time*90*8*2+90)*-3", 0]
},
"arm_right": {
"rotation": [0, "-62.5-math.sin(query.anim_time*90*4-50)*10", 0]
@@ -1245,6 +1248,15 @@
"1.95": [26.9208, -1.70779, 0.30237],
"2.0": [29.4208, -1.70779, 0.30237]
}
},
"whiskers_left": {
"rotation": {
"0.0": [0, "-(math.sin(q.anim_time*90*8*2+90)*4)", 0],
"0.1": [0, "-(math.sin(q.anim_time*90*8*2+90)*4)", 0],
"0.25": [0, "55+math.sin(q.anim_time*90*8*2+90)*4", 0],
"0.3": [0, "-17.5+math.sin(q.anim_time*90*8*2+90)*4", 0],
"0.35": [0, "-(math.sin(q.anim_time*90*8*2+90)*4)", 0]
}
}
}
},
@@ -1303,7 +1315,7 @@
}
},
"animation.raticate.blink": {
"animation_length": 0.16667,
"animation_length": 0.1667,
"bones": {
"eyelid_right": {
"position": {
@@ -853,6 +853,14 @@
}
}
}
}
},
"animation.oddish.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0417": {
"effect": "pokemon.oddish.cry"
}
}
}
}
}
@@ -817,6 +817,14 @@
"rotation": [-13.71961, 3.42335, -6.25049]
}
}
}
},
"animation.gloom.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0417": {
"effect": "pokemon.gloom.cry"
}
}
}
}
}
@@ -651,6 +651,14 @@
}
}
}
}
},
"animation.vileplume.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0417": {
"effect": "pokemon.vileplume.cry"
}
}
}
}
}
@@ -346,6 +346,14 @@
}
}
}
}
},
"animation.paras.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0417": {
"effect": "pokemon.paras.cry"
}
}
}
}
}
@@ -694,6 +694,14 @@
}
}
}
}
},
"animation.parasect.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0417": {
"effect": "pokemon.parasect.cry"
}
}
}
}
}
@@ -614,7 +614,12 @@
"0.5417": [0, 0, 0]
}
}
}
},
"sound_effects": {
"0.0417": {
"effect": "pokemon.venomoth.cry"
}
}
},
"animation.venomoth.blink": {
"animation_length": 0.16667,
@@ -244,6 +244,14 @@
"rotation": [0, 0, 0]
}
}
}
},
"animation.poliwag.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0417": {
"effect": "pokemon.poliwag.cry"
}
}
}
}
}
@@ -442,6 +442,14 @@
"rotation": [0, 5, 0]
}
}
}
},
"animation.poliwhirl.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0417": {
"effect": "pokemon.poliwhirl.cry"
}
}
}
}
}
@@ -3410,6 +3410,14 @@
}
}
}
}
},
"animation.poliwrath.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0417": {
"effect": "pokemon.poliwrath.cry"
}
}
}
}
}
@@ -284,6 +284,14 @@
}
}
}
}
},
"animation.machop.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0417": {
"effect": "pokemon.machop.cry"
}
}
}
}
}
@@ -313,6 +313,14 @@
}
}
}
}
},
"animation.machoke.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0417": {
"effect": "pokemon.machoke.cry"
}
}
}
}
}
@@ -483,6 +483,14 @@
}
}
}
}
},
"animation.machamp.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0417": {
"effect": "pokemon.machamp.cry"
}
}
}
}
}
@@ -166,6 +166,14 @@
"position": [-0.1, 0, -0.1]
}
}
}
},
"animation.muk.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0417": {
"effect": "pokemon.muk.cry"
}
}
}
}
}
@@ -0,0 +1,243 @@
{
"format_version": "1.8.0",
"animations": {
"animation.weezing_galar.ground_idle": {
"loop": true,
"bones": {
"main_body": {
"rotation": [2.5, 0, -2.5],
"position": [0, 1, 0]
},
"smoke1": {
"rotation": [0, 0, -10]
},
"smoke2": {
"rotation": [0, 0, 12.5]
},
"smoke3": {
"rotation": [-9.76758, -2.15393, -12.31594]
},
"smoke4": {
"rotation": [-10, 0, 10]
},
"smoke5": {
"rotation": [7.5, 0, 0]
}
}
},
"animation.weezing_galar.blink": {
"animation_length": 0.1667,
"bones": {
"eyebrow_left": {
"position": {
"0.0": [0, -1, 0],
"0.125": [0, -1, 0],
"0.1667": [0, 0, 0]
}
},
"eyelid_left": {
"position": {
"0.0": [0, 0, -0.1],
"0.125": [0, 0, -0.1],
"0.1667": [0, 0, 0]
}
},
"eyebrow_right": {
"position": {
"0.0": [0, -1, 0],
"0.125": [0, -1, 0],
"0.1667": [0, 0, 0]
}
},
"eyelid_right": {
"position": {
"0.0": [0, 0, -0.1],
"0.125": [0, 0, -0.1],
"0.1667": [0, 0, 0]
}
}
}
},
"animation.weezing_galar.blink2": {
"animation_length": 0.1667,
"bones": {
"small_eyebrow_left": {
"position": {
"0.0": [0, -1, 0],
"0.125": [0, -1, 0],
"0.1667": [0, 0, 0]
}
},
"small_eyelid_left": {
"position": {
"0.0": [0, 0, -0.1],
"0.125": [0, 0, -0.1],
"0.1667": [0, 0, 0]
}
},
"small_eyebrow_right": {
"position": {
"0.0": [0, -1, 0],
"0.125": [0, -1, 0],
"0.1667": [0, 0, 0]
}
},
"small_eyelid_right": {
"position": {
"0.0": [0, 0, -0.1],
"0.125": [0, 0, -0.1],
"0.1667": [0, 0, 0]
}
}
}
},
"animation.weezing_galar.shock": {
"loop": true,
"bones": {
"pupil_left": {
"position": [0.5, -0.5, 0],
"scale": [0.7, 0.7, 1]
},
"pupil_right": {
"position": [-0.5, -0.5, 0],
"scale": [0.7, 0.7, 1]
},
"small_pupil_left": {
"position": [0.5, -0.25, 0],
"scale": [0.7, 0.7, 1]
},
"small_eyebrow_left": {
"rotation": [0, 0, -10]
},
"small_pupil_right": {
"position": [-0.5, -0.25, 0],
"scale": [0.7, 0.7, 1]
},
"small_eyebrow_right": {
"rotation": [0, 0, 10]
}
}
},
"animation.weezing_galar.angry": {
"loop": true,
"bones": {
"pupil_left": {
"position": [0, -0.5, 0]
},
"eyebrow_left": {
"rotation": [0, 0, -12.5],
"position": [-0.25, -0.5, 0]
},
"pupil_right": {
"position": [0, -0.5, 0]
},
"eyebrow_right": {
"rotation": [0, 0, 12.5],
"position": [0.25, -0.5, 0]
},
"mouth_open": {
"position": [0, 0, 1]
},
"mouth_closed": {
"position": [0, 0, -1]
},
"small_eyebrow_left": {
"rotation": [0, 0, -20],
"position": [0, -0.5, 0]
},
"small_eyebrow_right": {
"rotation": [0, 0, 20],
"position": [0, -0.5, 0]
},
"small_mouth_open": {
"position": [0, 0, 1]
},
"small_mouth_closed": {
"position": [0, 0, -1]
},
"beard_top": {
"position": [0, -0.25, 0]
}
}
},
"animation.weezing_galar.sad": {
"loop": true,
"bones": {
"eyebrow_left": {
"rotation": [0, 0, 7.5],
"position": [0, -0.25, 0]
},
"eyebrow_right": {
"rotation": [0, 0, -7.5],
"position": [0, -0.25, 0]
},
"small_eyebrow_left": {
"rotation": [0, 0, 5],
"position": [0, 0.25, 0]
},
"small_eyebrow_right": {
"rotation": [0, 0, -5],
"position": [0, 0.25, 0]
}
}
},
"animation.weezing_galar.happy": {
"loop": true,
"bones": {
"small_eyelid_happy_left": {
"position": [0, 0, -0.1]
},
"small_eyelid_happy_right": {
"position": [0, 0, -0.1]
},
"eyelid_happy_right": {
"position": [0, 0, -0.1]
},
"eyelid_happy_left": {
"position": [0, 0, -0.1]
}
}
},
"animation.weezing_galar.hurt": {
"loop": true,
"bones": {
"eyebrow_left": {
"rotation": [0, 0, -7.5],
"position": [0, -0.5, 0]
},
"eyebrow_right": {
"rotation": [0, 0, 7.5],
"position": [0, -0.5, 0]
},
"small_eyebrow_left": {
"rotation": [0, 0, -22.5],
"position": [0, -0.5, 0]
},
"small_eyelid_recoil_left": {
"position": [0, 0, -0.1]
},
"small_eyebrow_right": {
"rotation": [0, 0, 22.5],
"position": [0, -0.5, 0]
},
"small_eyelid_recoil_right": {
"position": [0, 0, -0.1]
},
"eyelid_recoil_right": {
"position": [0, 0, -0.1]
},
"eyelid_recoil_left": {
"position": [0, 0, -0.1]
}
}
},
"animation.weezing_galar.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0417": {
"effect": "pokemon.weezing.cry"
}
}
}
}
}
@@ -1519,6 +1519,14 @@
"position": [0, 0, "-q.anim_time*90*0.19"]
}
}
},
"animation.kangaskhan.hold_item": {
"loop": true,
"bones": {
"kid_arm_right": {
"rotation": [-19.9299, 1.70818, 32.19986]
}
}
}
}
}
Loaded 100 of 560 files, more files were not shown because too many files have changed in this diff. Show more