Compare commits

..
Author SHA1 Message Date
JacksonB 9497175627 mk2 bird flight controller 2025-02-13 00:05:03 -06:00
JacksonB 0defd2614f Initial bird controller changes and refactoring of how riding controllers control rotation mouse+rotVel 2025-02-12 20:01:57 -06:00
JacksonB 181af6847d Add updated version of Helicopter ride controller. Tie in some static pokemonentity functions to be riding configurable. Modify the cameramixins, currently there is a temp change to them on this branch. 2025-02-12 12:29:35 -06:00
JacksonB ac1cdb0ba6 Add angular velocity constant modifier (roll can now influence yaw so the dolphin can turn). Spruce up dolphin swim controller. 2025-02-08 03:02:35 -06:00
JacksonB 59190209a2 initial commit with a bunch of poking around code 2025-02-05 19:30:21 -06:00
Paul fdc9d48bd6 Reworking generic liquid controller 2025-02-03 18:54:33 +10:00
Paul 74dcbc3e17 Added optional player animations to riding (Lapras as example) 2025-02-01 19:09:51 +10:00
Paul 832999850e Wait put that back 2025-02-01 17:35:42 +10:00
Paul 93b0f40c80 Added vehicle land controller (REVAVROOOOM) 2025-02-01 17:35:14 +10:00
Paul d1928f5b43 Added fall_to_flight controller and polished gliding on Gliscor 2025-02-01 10:22:55 +10:00
Paul 5374fe251d Merge branch 'main' into means-of-transportation
# Conflicts:
#	common/src/main/resources/data/cobblemon/species/generation1/aerodactyl.json
#	common/src/main/resources/data/cobblemon/species/generation1/charizard.json
#	common/src/main/resources/data/cobblemon/species/generation1/lapras.json
#	common/src/main/resources/data/cobblemon/species/generation4/bidoof.json
#	common/src/main/resources/data/cobblemon/species/generation4/gliscor.json
2025-01-31 20:55:59 +10:00
Hiroku 36169db388 Merge branch 'feature/save-file-juggling' into 'main'
old and temp files for everyone

See merge request cable-mc/cobblemon!1484
2025-01-31 07:46:10 +00:00
Paul 1900999a74 Changelogging [skip-ci] 2025-01-31 17:41:56 +10:00
Hiroku ab16814cd2 Merge branch 'fix-setpageondefaultdialoguepage' into 'main'
fix: calling setPages() when initializing the dialogue so default pages can have their timeout scheduled

Closes #1406

See merge request cable-mc/cobblemon!1504
2025-01-31 07:41:29 +00:00
Hiroku 9f622fcd74 Merge branch 'pc-box-2-fix' into 'main'
Fix PC opening on Box 2

See merge request cable-mc/cobblemon!1505
2025-01-31 07:40:16 +00:00
Hiroku 956e2c43b8 Merge branch 'feat-winners-and-losers' into 'main'
feat: set winners and losers on PokemonBattle end

See merge request cable-mc/cobblemon!1501
2025-01-31 07:37:14 +00:00
Hiroku 130f87c9f7 Merge branch 'strip-stripped-log' into 'main'
remove apricorn_stripped_log and apricorn_stripped_log_top as never used

See merge request cable-mc/cobblemon!1502
2025-01-31 07:27:54 +00:00
gbassinello 22b4e8c75f chore: changelog lines 2025-01-31 01:44:50 -03:00
gbassinello c19a3ca444 feat: set winners and losers on battle end 2025-01-31 01:44:50 -03:00
Polymeta a006eb5dcc revert previous attempt and fix camera mode
Signed-off-by: Polymeta <40173118+Polymeta@users.noreply.github.com>
2025-01-31 01:44:50 -03:00
gbassinello ed419e7e53 fix: removing activeDialogues from the DialogueManager map using the correct key (player uuid) 2025-01-31 01:44:50 -03:00
Hiroku bff2387b4d Merge branch 'feature/particle-fixes' into 'main'
revert previous attempt and fix camera mode

See merge request cable-mc/cobblemon!1506
2025-01-31 04:02:00 +00:00
Polymeta 41544efeba revert previous attempt and fix camera mode
Signed-off-by: Polymeta <40173118+Polymeta@users.noreply.github.com>
2025-01-30 23:15:08 +00:00
Paul e6e6c9f7f6 Merge remote-tracking branch 'origin/main' 2025-01-31 08:31:31 +10:00
Paul 22d8e39db3 back to snapshots 2025-01-31 08:31:17 +10:00
Hiroku bfdf1e9e6c Merge branch 'fix-activedialoguesmapkey' into 'main'
fix: removing activeDialogues from the DialogueManager map using the correct key (player uuid)

Closes #1405

See merge request cable-mc/cobblemon!1503
2025-01-30 22:19:22 +00:00
BuildTools c3fccfde09 Fix PC opening on Box 2 because default value for 'box' in OpenPCPacket was '1' instead of '0' 2025-01-30 21:48:18 +02:00
gbassinello 4bb8d43a6e fix: calling setPages() when initializing the dialogue so default pages can have their timeout scheduled 2025-01-30 13:50:18 -03:00
gbassinello fda4b67776 fix: removing activeDialogues from the DialogueManager map using the correct key (player uuid) 2025-01-30 13:34:52 -03:00
Xander Forrest f1ee9d45de remove apricorn_stripped_log and apricorn_stripped_log_top as never used 2025-01-28 19:39:28 +00:00
Polymeta 01f7d13e3f update tag and preset list [skip-ci]
Signed-off-by: Polymeta <40173118+Polymeta@users.noreply.github.com>
2025-01-26 21:32:32 +00:00
Paul d85e30f3a6 But what if we didn't break the yarn mapping 2025-01-26 22:15:17 +10:00
Guilherme Pereira 49d7129950 Merge branch 'means-of-transportation' of gitlab.com:cable-mc/cobblemon into means-of-transportation 2025-01-23 18:50:52 -03:00
Guilherme Pereira da46d71280 add configurable DABR controls for ride controllers 2025-01-23 18:50:23 -03:00
JPAK e44eb3f77f Fix rotations and player positioning on the ground. 2025-01-23 13:46:30 -06:00
Guilherme Pereira 6027934c22 add glider air controller 2025-01-23 05:17:37 -03:00
Polymeta 4074aa50ce refactor storage layer and introduce .old filetype as a stopgap for file corruption during crashes
Signed-off-by: Polymeta <40173118+Polymeta@users.noreply.github.com>
2025-01-21 02:14:35 +00:00
JPAK 608d004a9c Player now rolls, and sits on the seat correctly. Positioning the camera needs work still. 2025-01-18 20:32:34 -06:00
JPAK 2e532af5d2 Debug bools for testing hitboxes without camera/pokemon rolling. 2025-01-12 19:34:23 -06:00
Paul b1352db5c5 Fixed some bugs with the bird air controller and allowed wing flapping 2025-01-13 11:02:50 +10:00
apion 4df6233994 Added HelicopterAirController, allows for creative-like up and down movement 2025-01-12 20:01:50 -05:00
Paul 515d04c17c Conflicto fixo (AND LICENSES!!!11!one!) 2025-01-13 09:26:22 +10:00
Paul 81c5f9ce24 Merge remote-tracking branch 'origin/main' into flying-mount-prototype
# Conflicts:
#	common/src/main/java/com/cobblemon/mod/common/mixin/MouseHandlerMixin.java
#	common/src/main/java/com/cobblemon/mod/common/mixin/PlayerMixin.java
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonNetwork.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/events/CobblemonEvents.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/pokemon/PokemonRenderer.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/pokemon/FormData.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/pokemon/Species.kt
#	common/src/main/resources/assets/cobblemon/lang/en_us.json
#	common/src/main/resources/mixins.cobblemon-common.json
2025-01-13 08:57:25 +10:00
Paul d8cd1a6288 Merge remote-tracking branch 'origin/means-of-transportation' into flying-mount-prototype 2025-01-13 08:38:13 +10:00
JPAK cb4e331c29 Rotate the seat for the player based on the orientation of the first passenger. This currently pivots around (0,0) of the riding entity, IE the bottom center of the hitbox. 2024-10-27 22:36:39 -05:00
Landon Wills 18138c8374 Start synchronization of player orientation to server 2024-10-26 16:11:28 -04:00
Landon Wills 6280fd5420 Hello code-changes lurkers 2024-10-13 00:20:34 -04:00
Landon Wills b25271bf22 Fix rotation logic 2024-10-12 16:18:16 -04:00
Landon Wills 1b530a511b Update camera logic 2024-10-12 14:35:20 -04:00
Landon Wills 90791097f1 Add beginnings of camera tomfoolery 2024-10-11 20:45:21 -04:00
Paul 0b1c15bca8 Conflicto 2024-10-11 14:17:27 +10:00
Paul b490831944 Merge remote-tracking branch 'origin/main' into means-of-transportation
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
2024-10-11 14:16:16 +10:00
Paul d16e22c27d Further refinement to riding with state and composite controllers 2024-10-06 16:51:18 +10:00
Paul 892d9e78e9 Merge remote-tracking branch 'origin/main' into means-of-transportation
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/api/events/CobblemonEvents.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
#	common/src/main/resources/assets/cobblemon/lang/en_us.json
#	common/src/main/resources/mixins.cobblemon-common.json
2024-10-05 18:53:59 +10:00
Paul dfeae8031b Mappings conversions 2024-08-31 14:01:41 +10:00
Paul 53168aa4cb Merge remote-tracking branch 'origin/sega_bass_pro_fishing_2' into means-of-transportation
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/Cobblemon.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/snowstorm/BedrockParticle.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/gui/interact/wheel/InteractWheelGuiFactory.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/net/gui/InteractPokemonUIPacketHandler.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/block/DisplayCaseRenderer.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/net/messages/client/ui/InteractPokemonUIPacket.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/net/messages/server/pokemon/interact/InteractPokemonPacket.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/pokemon/Pokemon.kt
2024-08-31 12:28:55 +10:00
Paul a280fc5930 Merge branch 'refs/heads/sega_bass_pro_fishing_2' into means-of-transportation
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
2024-06-23 09:07:40 +10:00
Paul 4d6744549c Merged in the fishing branch so we're 1.20.6 here now cool thx 2024-06-14 20:45:28 +10:00
Paul 1c14f3261d Merge branch 'refs/heads/sega_bass_pro_fishing_2' into means-of-transportation
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonNetwork.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/molang/MoLangFunctions.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/net/serializers/StringSetDataSerializer.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/reference/Reference.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/battles/BattleBuilder.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/gui/dialogue/RenderableFace.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/particle/ParticleStorm.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/generic/GenericBedrockRenderer.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/PosableState.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/PoseableEntityModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/bedrock/animation/BedrockAnimation.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/npc/PosableNPCModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/repository/NPCModelRepository.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/npc/NPCRenderer.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/pokeball/PokeBallRenderer.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/pokemon/PokemonRenderer.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/command/TestCommand.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/generic/GenericBedrockEntity.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/npc/NPCEntity.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokeball/EmptyPokeBallEntity.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/item/interactive/PokerodItem.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/util/MiscUtils.kt
#	common/src/main/resources/cobblemon-common.accesswidener
#	deps/local/com/bedrockk/molang/maven-metadata-local.xml
#	fabric/src/main/kotlin/com/cobblemon/mod/fabric/client/CobblemonFabricClient.kt
#	gradle/libs.versions.toml
2024-06-14 15:13:36 +10:00
Paul 6fb38fc70c Correction 2024-06-14 15:12:48 +10:00
Paul 3f04102990 Merge branch 'refs/heads/1.20.5' into means-of-transportation
# Conflicts:
#	common/build.gradle.kts
#	common/src/main/kotlin/com/cobblemon/mod/common/Cobblemon.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonNetwork.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/molang/MoLangFunctions.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/net/serializers/StringSetDataSerializer.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/battles/BattleBuilder.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/gui/dialogue/RenderableFace.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/particle/ParticleStorm.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/block/DisplayCaseRenderer.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/PoseableEntityModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/ConkeldurrModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/GolettModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/GolurkModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/generic/GenericBedrockEntity.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokeball/EmptyPokeBallEntity.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/net/messages/client/animation/PlayPosableAnimationPacket.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/net/messages/client/ui/InteractPokemonUIPacket.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/net/messages/server/pokemon/interact/InteractPokemonPacket.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/pokemon/FormData.kt
#	common/src/main/resources/cobblemon-common.accesswidener
#	fabric/src/main/kotlin/com/cobblemon/mod/fabric/client/CobblemonFabricClient.kt
#	gradle.properties
2024-06-14 14:50:47 +10:00
Nick 28cbc0a6fa Adjustments for driver selection, fixes NPE 2024-06-02 23:53:29 -07:00
Nick 5c74fabdc6 Add new event for driver selection 2024-06-02 22:25:21 -07:00
Nick ab53a2cad4 Merge remote-tracking branch 'origin/means-of-transportation' into means-of-transportation
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/seats/Seat.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
2024-06-02 21:30:50 -07:00
Paul 14b3e84b77 Riding seat rework, render players at seat locators where they exist 2024-06-03 14:26:48 +10:00
Nick a629a59654 Merge remote-tracking branch 'origin/means-of-transportation' into means-of-transportation
# Conflicts:
#	common/build.gradle.kts
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
2024-06-02 00:16:24 -07:00
Paul d51c91cb5a Handled jumping and molang and blackjack for land controller 2024-06-02 13:19:40 +10:00
Paul 706bf65664 Merge branch 'refs/heads/no-entity-rendering' into means-of-transportation
# Conflicts:
#	build-logic/settings.gradle.kts
#	common/build.gradle.kts
#	common/src/main/kotlin/com/cobblemon/mod/common/Cobblemon.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/PoseableEntityModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/animation/SingleBoneLookAnimation.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
#	fabric/src/main/kotlin/com/cobblemon/mod/fabric/client/CobblemonFabricClient.kt
#	gradle/build-logic/src/main/kotlin/utilities/Git.kt
#	gradle/libs.versions.yml
#	gradle/wrapper/gradle-wrapper.properties
#	settings.gradle.kts
2024-06-01 19:47:06 +10:00
Paul 6394c6d686 Merge remote-tracking branch 'origin/means-of-transportation' into means-of-transportation 2024-06-01 19:14:54 +10:00
Paul 145a8904c2 Why am I not getting compiler errors when there are compile errors dude just give me the danger squiggles 2024-06-01 18:28:56 +10:00
Paul eba400a6ec I will destroy the license with my mind lasers 2024-06-01 16:29:14 +10:00
Paul 12626e2d26 Major refactors and renames for animation system, documented the heck out of it all 2024-06-01 16:06:55 +10:00
Paul c044ff6d8b Conflicto patronum 2024-06-01 10:12:35 +10:00
Paul 33465b1d9e Merge branch 'refs/heads/sega_bass_pro_fishing_2' into no-entity-rendering
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/battles/interpreter/instructions/MoveInstruction.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/block/chest/GildedChestBlock.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/particle/ParticleStorm.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/block/RestorationTankRenderer.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/PoseableEntityModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/JsonPokemonPoseableModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/PidgeyModel.kt
2024-06-01 09:46:27 +10:00
Paul dbea41cbf4 MoLang refactors for optimizations, migrate to PokemonPosableModel subclass, fixes, do pose transitions from ticking so they still transition when off-screen 2024-05-31 17:05:49 +10:00
Paul 8cab5b17f7 Huge amounts of refactoring in animation code, still need to figure out aspects from PosableState 2024-05-26 21:06:57 +10:00
Paul 3c86d13b44 A lot of error resolution from giga merge 2024-05-24 20:31:22 +10:00
Paul a9a4cc8788 Merge remote-tracking branch 'origin/sega_bass_pro_fishing_2' into no-entity-rendering
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonNetwork.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonSounds.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/gui/GuiUtils.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/moves/animations/keyframes/AnimationActionEffectKeyframe.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/moves/animations/keyframes/EntityMoLangActionEffectKeyframe.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/moves/animations/keyframes/EntityParticlesActionEffectKeyframe.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/moves/animations/keyframes/EntitySoundActionEffectKeyframe.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/moves/animations/keyframes/MoLangActionEffectKeyframe.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/moves/animations/keyframes/PauseActionEffectKeyframe.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/moves/animations/keyframes/RemoveHoldsActionEffectKeyframe.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/moves/animations/keyframes/ReturnToPositionActionEffectKeyframe.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/spawning/detail/NPCSpawnAction.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/battles/interpreter/instructions/DamageInstruction.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/entity/EmptyPokeBallClientDelegate.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/entity/PokemonClientDelegate.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/net/effect/RunPosableMoLangHandler.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/JsonPose.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/PosableState.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/PoseableEntityModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/animation/PrimaryAnimation.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/animation/SingleBoneLookAnimation.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/bedrock/animation/BedrockAnimation.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/fossil/FossilModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/frame/HeadedFrame.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/JsonPokemonPoseableModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/AerodactylModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/ArcanineModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/ChanseyModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/CharizardModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/CuboneModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/DewgongModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/DiglettModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/DodrioModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/DoduoModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/DragonairModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/DragoniteModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/DratiniModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/DugtrioModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/ElectabuzzModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/ElectrodeModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/ExeggutorModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/GeodudeModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/GolbatModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/GolemModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/GravelerModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/GrimerModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/GrowlitheModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/KabutoModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/KabutopsModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/KinglerModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/KoffingModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/KrabbyModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/LaprasModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/MagikarpModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/MarowakModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/MeowthAlolanModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/MeowthGalarianModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/MeowthModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/MukModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/NidoranfModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/NinetalesModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/OmanyteModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/OmastarModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/PidgeotModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/PidgeyModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/PinsirModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/PsyduckModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/RapidashGalarianModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/ScytherModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/SeelModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/SnorlaxModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/SquirtleModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/TangelaModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/TentacoolModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/TentacruelModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/VenomothModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/VenonatModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/VoltorbModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/VulpixModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/WartortleModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/WeezingModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/BlisseyModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/ChinchouModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/DonphanModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/ElekidModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/FlaaffyModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/GligarModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/GranbullModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/IgglybuffModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/LanturnModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/NatuModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/PhanpyModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/PiloswineModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/SneaselModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/SwinubModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/XatuModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/YanmaModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/BarboachModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/CacneaModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/CacturneModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/ChimechoModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/GardevoirModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/GrovyleModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/IllumiseModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/KirliaModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/MawileModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/MightyenaModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/NumelModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/RaltsModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/SceptileModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/TorkoalModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/TreeckoModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/VolbeatModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/WhiscashModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/ZigzagoonGalarianModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/BibarelModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/BidoofModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/BuizelModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/CarnivineModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/ChinglingModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/DrifblimModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/DrifloonModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/DusknoirModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/ElectivireModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/FloatzelModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/GabiteModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/GalladeModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/GarchompModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/GibleModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/GliscorModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/HappinyModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/LucarioModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/MamoswineModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/TangrowthModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/WeavileModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/YanmegaModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/BasculinModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/BouffalantModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/ChandelureModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/ConkeldurrModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/GurdurrModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/KlangModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/KlinkModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/KlinklangModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/LampentModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/LitwickModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/OshawottModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/RoggenrolaModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/SamurottModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/SigilyphModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/TimburrModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen6/PumpkabooModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen6/ScatterbugModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen7/CutieflyModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen7/KomalaModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen8/CentiskorchModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen8/FalinksModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen8/ObstagoonModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen8/RabootModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen8/SizzlipedeModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen9/CharcadetModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen9/GholdengoModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen9/GimmighoulChestModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen9/GimmighoulRoamingModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen9/LechonkModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen9/MausholdModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen9/MausholdfourModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen9/OinkologneMaleModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen9/QuaquavalModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/pokemon/PokemonRenderer.kt
#	common/src/main/resources/assets/cobblemon/sounds.json
#	deps/local/com/bedrockk/molang/1.1.12/molang-1.1.12.pom
2024-05-24 19:35:12 +10:00
Nick a512a99fb2 Merge branch 'main' of gitlab.com:cable-mc/pokemon-cobbled into means-of-transportation
# Conflicts:
#	build-logic/settings.gradle.kts
#	common/build.gradle.kts
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
#	gradle/build-logic/src/main/kotlin/utilities/Git.kt
#	gradle/libs.versions.yml
#	gradle/wrapper/gradle-wrapper.properties
#	settings.gradle.kts
2024-05-18 12:04:34 -07:00
Nick 03a63e8310 Big main sync 2024-05-11 11:19:12 -07:00
Paul 0261df0f06 Toying around with jump controls on ride controllers 2024-05-10 09:44:56 +10:00
Paul a035ee7856 Some cleanup and fixes to land movement 2024-05-05 10:02:49 +10:00
Paul 6cf94307d3 Introducing molang to generic land controller 2024-05-04 22:25:36 +10:00
Paul 98bd827862 Merge remote-tracking branch 'origin/main' into means-of-transportation 2024-05-02 09:54:14 +10:00
Paul 86b49d5b1b Reworked ride controller serialization, scrubbed old properties and made ride jumping exist again 2024-04-30 12:39:03 +10:00
Paul a51f1e5ff9 Merge remote-tracking branch 'origin/means-of-transportation' into means-of-transportation
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/controller/RideController.kt
2024-04-30 10:36:22 +10:00
Nick 3307bedf08 Add basic enough conditions to liquid controllers, allow them to run 2024-04-28 23:56:00 -07:00
Nick 4bf3bf07e4 Goodbye capabilities 2024-04-28 23:37:14 -07:00
Paul 9c0647d656 Little logging to help me understand jumps 2024-04-29 13:30:01 +10:00
Paul 3b53035935 Merge remote-tracking branch 'origin/main' into means-of-transportation
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonServerDelegate.kt
2024-04-29 11:28:39 +10:00
Paul 22730cd452 Fixed land capability no worky 2024-04-29 11:00:15 +10:00
Paul da8d495a30 Merge remote-tracking branch 'origin/means-of-transportation' into means-of-transportation 2024-04-28 15:51:54 +10:00
Nick 6ea5a1f7ce Cleanup + don't defer render if in fabulous 2024-04-27 22:46:34 -07:00
Paul 5757b9c69e Merge remote-tracking branch 'origin/means-of-transportation' into means-of-transportation 2024-04-28 13:50:24 +10:00
Paul 3533181c91 Merge remote-tracking branch 'origin/main' into means-of-transportation
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/Cobblemon.kt
2024-04-28 13:47:13 +10:00
amo cb9cd76a15 fix translucent pokemon layering 2024-04-28 00:08:24 +01:00
Nick 6effa13dfb Work towards opacity on ridden models 2024-04-27 15:22:47 -07:00
Nick 5e78f89935 We're just going to claim stuff for this one 2024-04-26 21:01:49 -07:00
Nick 5a5442f666 Main sync 2024-04-19 19:01:30 -07:00
Paul 6d119dd9d4 Conflicts and corrections 2024-03-01 12:57:02 +10:00
Paul 32bd21eb04 Conflicts 2024-03-01 11:52:30 +10:00
apion 8d495a4be0 Made capabillity predicates a little bit more accurate 2024-02-14 19:13:09 -05:00
Nick d7069904c7 Better checks for capabilities, transitions now working between land and water 2024-02-10 23:05:04 -08:00
Nick 3d48324a43 Begin work on liquid capabilities for mounts 2024-02-05 18:00:50 -08:00
Paul 143dedaa06 Finished removing all generics from the model system 2024-01-28 10:44:37 +10:00
Paul b8fe170f19 Merge branch 'npcs' into no-entity-rendering
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/api/gui/GuiUtils.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/entity/PokemonClientDelegate.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/gui/dialogue/RenderableFace.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/PosableState.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/PoseableEntityModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/animation/BimanualSwingAnimation.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/animation/BipedWalkAnimation.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/animation/PrimaryAnimation.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/animation/QuadrupedWalkAnimation.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/animation/SingleBoneLookAnimation.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/animation/WingFlapIdleAnimation.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/bedrock/animation/BedrockAnimation.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/bedrock/animation/BedrockStatefulAnimation.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/bedrock/animation/BedrockStatelessAnimation.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/JsonPokemonPoseableModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/PokemonPoseableModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/BlastoiseModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/CharizardModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/GalladeModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pose/Pose.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/quirk/ModelQuirk.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/quirk/QuirkData.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/quirk/SimpleQuirk.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/quirk/SimpleQuirkData.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/repository/FossilModelRepository.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/Poseable.kt
2024-01-27 11:22:08 +10:00
Nick a02261fcac Adjust max block speed/tick and dummy solution for movement state 2024-01-25 07:56:22 -08:00
Nick 996bf3f929 Sync properties to client, working demo of riding 2024-01-24 23:23:43 -08:00
Nick 8449aff799 Merge branch 'main' of gitlab.com:cable-mc/pokemon-cobbled into means-of-transportation 2024-01-23 19:07:09 -08:00
Nick 80df79f93a Sync properly with latest main 2024-01-15 23:58:11 -08:00
Nick 897419a0b6 Decently large restructure of riding design, not fully linked up just yet 2024-01-15 23:13:00 -08:00
Paul 255dd5d974 Started rework of PoseableEntityModel 2024-01-05 19:55:04 +10:00
Nick c45085a520 Latest code towards riding 2023-10-23 22:15:31 -07:00
Nick 16bc881110 Blossom integration, crash report info details and API adjustments for riding design 2023-09-16 23:08:09 -07:00
Nick 0086d30755 Updates towards design 2023-09-07 20:49:16 -07:00
Nick 1170a61b81 Fix merge compilation errors 2023-09-05 23:05:06 -07:00
Nick 066013a9bd License 2023-09-05 22:30:40 -07:00
Nick 931e0b2613 Main sync 2023-09-05 21:53:33 -07:00
Nick f49409e021 Established speed and acceleration formulas to additionally calculate momentum per active tick 2023-08-19 02:17:26 -07:00
Nick 29eeebd178 Clean up API design, refactor momentum calculation design 2023-08-13 13:47:04 -07:00
Nick 50447b6d77 Fix compilation errors + riding positions 2023-08-12 18:10:14 -07:00
Nick 0b977cce84 Merge remote-tracking branch 'remotes/origin/main' into means-of-transportation 2023-08-12 17:42:55 -07:00
Nick 02f62896b0 Apply merge with origin 2023-08-05 12:04:05 -07:00
Nick 1535ba5cb5 Merge with latest main 2023-08-05 12:00:50 -07:00
Paul baccb9a9a1 Compat 1.20.1 2023-07-25 22:18:50 +10:00
Paul 50454ac2db Merge remote-tracking branch 'origin/main' into means-of-transportation
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/api/pokemon/PokemonSpecies.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/gui/interact/pokemon/PokemonInteractGUI.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/net/gui/InteractPokemonUIPacketHandler.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/net/serverhandling/pokemon/interact/InteractPokemonHandler.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/pokemon/FormData.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/pokemon/Pokemon.kt
#	common/src/main/resources/mixins.cobblemon-common.json
#	gradle.properties
2023-07-25 21:50:06 +10:00
Nick 574c9eb36b Begin working on riding traits (Tremendously experimental) 2023-06-06 20:46:09 -07:00
Nick bc75d3331f Begin work on jumping mounts + handle dismounting of riders when submerged underwater 2023-05-27 23:58:55 -07:00
Nick 950e683b45 Remove the no longer needed todo, we did it 2023-05-26 20:38:21 -07:00
Nick a010d97e51 Base riding design complete, now the fun begins... I hate you SPG 2023-05-26 20:31:45 -07:00
Nick bdb9a7e396 Work towards riding API and Implementation 2023-05-17 21:59:37 -07:00
104 changed files with 6618 additions and 431 deletions

No files matched your search

+28 -1
View File
@@ -1,4 +1,15 @@
# Changelog
## [1.7.0 (Month xth, 2025)](#1-7-0)
### Fixes
- Fixed Particles sometimes facing the wrong direction (looking at you, Swords Dance)
- Fixed PCs always opening at box 2 instead of box 1.
### Developer
- A finished battle now has winners and losers set inside of `PokemonBattle` instead of them always being empty.
- Dialogues are correctly removed from memory when they are stopped.
- Dialogues with variably-set initial pages now properly start timeout tracking.
## [1.6.1 (January 26th, 2025)](#1-6-1)
### Additions
@@ -12,6 +23,22 @@
- Added config setting `maxPokedexScanningDetectionRange` to control from what distance the player can scan Pokémon using the Pokédex.
- Added config setting `hideUnimplementedPokemonInThePokedex` which hides unimplemented Pokémon from the Pokédex when set to true.
- Added debug renderer for posable entity locators.
- Added crossover paintings from Close Combat, Premonition, Altar, Slumber, and Nomad.
- Added optional box argument to the /pc command
### Changes
- Pokémon will now be dynamically revealed to the Pokédex as they're seen instead of revealing entire parties at the end of battle regardless.
- Unseen wild Pokémon will update their name from '???' to their real name as soon as a battle starts to reflect the battle UI showing the actual species name.
- Pokémon under the illusion effect will reveal their disguise to the Pokédex first and then the base Pokémon once the disguise is broken.
- Added more support for a variety of Fabric/NeoForge Convention tags.
- Reformatted some tags to be more consistent.
- Edited some recipes to utilize tags instead of direct item ids, for greater mod compatibility.
- Berries will drop if broken at age 0
- Improved Fortune drops on Mint Seeds
- New Slowpoke shiny texture.
- Updated drops for many Pokémon.
- Completely resynced Pokémon move and stat data based on later games. Learnsets have changed considerably to maximise available moves.
- Cobblemon save data now saves .old files where applicable as a means to recover from file corruption due to crashes or similar abrupt stops
### Pokémon Added
@@ -175,7 +202,7 @@
- Added `hideNameTag` field and `HideNPCNameTag` nbt tag to `NPCEntity` to allow hiding the name tag of the NPC.
- Added the player to `PokerodReelEvent` so you know who is doing the reeling.
### MoLang & Datapacks
### MoLang & Datapacks
- Added flows for:
- `forme_change`: Triggered when a Pokémon changes form in battle.
- `mega_evolution`: Triggered when a Pokémon mega evolves in battle. (Note: Third-party mods are required for this feature currently)
@@ -0,0 +1,135 @@
/*
* 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;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.Nullable;
import org.joml.Matrix3f;
import org.joml.Vector3f;
import java.util.function.Function;
public interface Rollable {
Vector3f FORWARDS = new Vector3f(0, 0, 1);
Vector3f LEFT = new Vector3f(1, 0, 0);
Vector3f UP = new Vector3f(0, 1, 0);
@Nullable Matrix3f getOrientation();
Rollable updateOrientation(Function<Matrix3f, Matrix3f> update);
/**
* @return The forward vector (0, 0, 1) after the rotation matrix is applied.
*/
default Vector3f getForwardVector() {
if (getOrientation() == null) return new Vector3f(FORWARDS);
return getOrientation().transform(FORWARDS, new Vector3f());
}
/**
* @return The left vector (1, 0, 0) after the rotation matrix is applied.
*/
default Vector3f getLeftVector() {
if (getOrientation() == null) return new Vector3f(LEFT);
return getOrientation().transform(LEFT, new Vector3f());
}
/**
* @return The up vector (0, 1, 0) after the rotation matrix is applied.
*/
default Vector3f getUpVector() {
if (getOrientation() == null) return new Vector3f(UP);
return getOrientation().transform(UP, new Vector3f());
}
/**
*
* @param yaw change in degrees
* @return The Rollable object this method was called on
*/
default Rollable rotateYaw(float yaw) {
return updateOrientation(prev -> prev.rotateY((float) Math.toRadians(-yaw)));
}
/**
*
* @param pitch change in degrees
* @return The Rollable object this method was called on
*/
default Rollable rotatePitch(float pitch) {
return updateOrientation(prev -> prev.rotateX((float) Math.toRadians(-pitch)));
}
/**
*
* @param roll change in degrees
* @return The Rollable object this method was called on
*/
default Rollable rotateRoll(float roll) {
return updateOrientation(prev -> prev.rotateZ((float) Math.toRadians(-roll)));
}
/**
* Order matters when rotating an object. If you need a different order, individually call rotateYaw, rotatePitch, and rotateRoll
*
* @param yaw change in degrees
* @param pitch change in degrees
* @param roll change in degrees
* @return The Rollable object this method was called on
*/
default Rollable rotate(float yaw, float pitch, float roll) {
return rotateYaw(yaw).rotatePitch(pitch).rotateRoll(roll);
}
/**
* @return The yaw angle in degrees as a float.
* Value is between [-90, 90] with 0 being straight forward, 90 being straight down, and -90 being straight up
*/
default float getYaw() {
return (float) (180F - Math.toDegrees(FORWARDS.angleSigned(getForwardVector(), UP)));
}
/**
* Get the pitch angle in degrees as a float.
* Value is between [-180, 180] with 0 being South, 90 being West, 180/-180 being North, and -90 being East
*/
default float getPitch() {
return (float) Math.toDegrees(Math.asin(getForwardVector().y));
}
/**
* Get the roll angle in degrees as a float.
* Value is between [-180, 180] with 0 being no roll (normal), 90 being 90 degrees CW, 180/-180 being 180 degrees CW/CCW, and -90 being 90 degrees CCW
*/
default float getRoll() {
var upVector = getUpVector();
var forwardVector = getForwardVector();
return (float) Math.toDegrees(upVector.angleSigned(UP, forwardVector));
}
/**
* Get the angular velocity in degrees per second as a Vec3
*/
Vec3 angRollVel();
public void rotationOnMouseXY( double yMouse, double xMouse );
boolean shouldRoll();
boolean useMouseInputRoll();
void clearRotation();
}
@@ -0,0 +1,96 @@
/*
* 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.mixin;
import com.cobblemon.mod.common.Rollable;
import net.minecraft.client.Camera;
import net.minecraft.client.Minecraft;
import net.minecraft.world.entity.Entity;
import org.joml.Matrix3f;
import org.joml.Quaternionf;
import org.joml.Vector3f;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Camera.class)
public abstract class CameraMixin {
@Shadow private Entity entity;
@Shadow @Final private Quaternionf rotation;
@Shadow @Final private Vector3f forwards;
@Shadow @Final private Vector3f up;
@Shadow @Final private Vector3f left;
@Shadow private float xRot;
@Shadow private float yRot;
@Shadow public abstract float getXRot();
@Shadow public abstract float getYRot();
@Unique private float returnTimer = 0;
@Unique private float rollAngleStart = 0;
@Unique Minecraft minecraft = Minecraft.getInstance();
@Unique boolean disableRollableCameraDebug = false;
@Inject(method = "setRotation", at = @At("HEAD"), cancellable = true)
public void open_camera$setRotation(float f, float g, CallbackInfo ci) {
if (!(this.entity instanceof Rollable rollable) || disableRollableCameraDebug) return;
if (!rollable.shouldRoll() && rollable.getOrientation() != null) {
if(this.returnTimer < 1) {
//Rotation is taken from entity since we no longer handle mouse ourselves
//Stops a period of time when you can't input anything.
rollable.getOrientation().set(
new Matrix3f()
.rotateY((float) Math.toRadians(180 - this.entity.getYRot()))
.rotateX((float) Math.toRadians(-this.entity.getXRot()))
);
if(rollAngleStart == 0){
this.returnTimer = 1;
rollable.clearRotation();
return;
}
rollable.getOrientation().rotateZ((float) Math.toRadians(-rollAngleStart*(1-returnTimer)));
applyRotation();
this.returnTimer += .05F;
ci.cancel();
} else {
this.returnTimer = 1;
rollable.clearRotation();
}
return;
}
if (rollable.getOrientation() == null) return;
applyRotation();
this.returnTimer = 0;
this.rollAngleStart = rollable.getRoll();
ci.cancel();
}
@Unique
private void applyRotation(){
if (!(this.entity instanceof Rollable rollable) || rollable.getOrientation() == null) return;
var newRotation = rollable.getOrientation().normal(new Matrix3f()).getNormalizedRotation(new Quaternionf());
if (this.minecraft.options.getCameraType().isMirrored()) {
newRotation.rotateY((float)Math.toRadians(180));
}
this.rotation.set(newRotation);
this.xRot = rollable.getPitch();
this.yRot = rollable.getYaw();
this.forwards.set(rollable.getForwardVector());
this.up.set(rollable.getUpVector());
this.left.set(rollable.getLeftVector());
}
}
@@ -0,0 +1,66 @@
/*
* 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.mixin;
import com.cobblemon.mod.common.client.render.player.MountedPlayerRenderer;
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.HashMap;
@Mixin(HumanoidModel.class)
public class HumanoidModelMixin {
@Unique HashMap<String, ModelPart> relevantPartsByName = new HashMap<>();
@Shadow @Final
public ModelPart head;
@Shadow @Final
public ModelPart rightArm;
@Shadow @Final
public ModelPart leftArm;
@Shadow @Final
public ModelPart rightLeg;
@Shadow @Final
public ModelPart leftLeg;
@Inject(method = "setupAnim*", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/geom/ModelPart;copyFrom(Lnet/minecraft/client/model/geom/ModelPart;)V", shift = At.Shift.BEFORE))
public void cobblemon$animateRiders(
LivingEntity entity,
float limbSwing,
float limbSwingAmount,
float ageInTicks,
float netHeadYaw,
float headPitch,
CallbackInfo ci
) {
if (relevantPartsByName.isEmpty()) {
relevantPartsByName.put("arm_left", leftArm);
relevantPartsByName.put("arm_right", rightArm);
relevantPartsByName.put("leg_left", leftLeg);
relevantPartsByName.put("leg_right", rightLeg);
relevantPartsByName.put("head", head);
}
Entity vehicle = entity.getVehicle();
if (vehicle instanceof PokemonEntity && entity instanceof AbstractClientPlayer) {
MountedPlayerRenderer.INSTANCE.animate((PokemonEntity) vehicle, (AbstractClientPlayer) entity, relevantPartsByName, netHeadYaw, headPitch, ageInTicks, limbSwing, limbSwingAmount);
}
}
}
@@ -8,16 +8,21 @@
package com.cobblemon.mod.common.mixin;
import com.cobblemon.mod.common.Rollable;
import com.cobblemon.mod.common.item.PokedexItem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.client.renderer.ItemInHandRenderer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.item.ItemStack;
import org.joml.Quaternionf;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ItemInHandRenderer.class)
@@ -27,5 +32,15 @@ public class ItemInHandRendererMixin {
if (abstractClientPlayer.isUsingItem() && abstractClientPlayer.getUseItem().getItem() instanceof PokedexItem) {
ci.cancel();
}
else if (abstractClientPlayer instanceof Rollable rollable && rollable.shouldRoll()) {
}
}
@Redirect(method = "renderHandsWithItems", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;mulPose(Lorg/joml/Quaternionf;)V", ordinal = 1))
private void cobblemon$renderHandswithItems(PoseStack instance, Quaternionf quaternion) {
if (!(Minecraft.getInstance().player instanceof Rollable rollable && rollable.shouldRoll())) {
instance.mulPose(quaternion);
}
}
}
@@ -12,9 +12,15 @@ import com.cobblemon.mod.common.api.pokemon.effect.ShoulderEffectRegistry;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.phys.Vec3;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(LivingEntity.class)
@@ -28,4 +34,70 @@ public abstract class LivingEntityMixin {
}
}
/*
@Inject(method = "travelRidden", at = @At(value = "HEAD"))
private void cobblemon$altTravelRidden(Player player, Vec3 travelVector)
{
this.setSpeed(this.getRiddenSpeed(player));
this.travel(vec3);
}
/*
// Shadow the original method so we can call it.
@Shadow
protected abstract boolean isControlledByLocalInstance();
/**
* Redirect the call to isControlledByLocalInstance() within travelRidden.
* When travelRidden calls isControlledByLocalInstance(), it will get our modified result.
*/
/*
@Redirect(
method = "travelRidden(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/phys/Vec3;)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/entity/LivingEntity;isControlledByLocalInstance()Z"
)
)
private boolean redirectIsControlledByLocalInstance(LivingEntity instance) {
// Return true if either the original method returns true or our custom condition is true.
return this.isControlledByLocalInstance() || this.b;
}
@Overwrite
private void travelRidden(Player player, Vec3 travelVector) {
Vec3 vec3 = this.getRiddenInput(player, travelVector);
this.tickRidden(player, vec3);
if (this.isControlledByLocalInstance()) {
this.setSpeed(this.getRiddenSpeed(player));
this.travel(vec3);
} else {
this.calculateEntityAnimation(false);
this.setDeltaMovement(Vec3.ZERO);
this.tryCheckInsideBlocks();
}
}
@ModifyArg(
method = "travelRidden",
at = @At(
value = "INVOKE",
target = "setDeltaMovement(Lnet/minecraft/world/phys/Vec3;)V"
),
index = 0 // the first (and only) argument
)
private Vec3 modifyDeltaMovementArgument(Vec3 original) {
// Optionally, check if original is Vec3.ZERO, to only replace that call:
if (original.equals(Vec3.ZERO)) {
// Return your custom vector instead of Vec3.ZERO
return original;
}
// Otherwise, return the original value
return original;
}
*/
}
@@ -8,6 +8,7 @@
package com.cobblemon.mod.common.mixin;
import com.cobblemon.mod.common.Rollable;
import com.cobblemon.mod.common.client.CobblemonClient;
import com.cobblemon.mod.common.client.keybind.keybinds.PartySendBinding;
import com.cobblemon.mod.common.pokedex.scanner.PokedexUsageContext;
@@ -22,17 +23,22 @@ import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MouseHandler.class)
public class MouseHandlerMixin {
@Shadow
private double accumulatedScrollY;
@Shadow private double accumulatedScrollY;
@Shadow @Final private Minecraft minecraft;
@Unique SmoothDouble xMouseSmoother = new SmoothDouble();
@Unique SmoothDouble yMouseSmoother = new SmoothDouble();
@Unique SmoothDouble pitchSmoother = new SmoothDouble();
@Unique SmoothDouble rollSmoother = new SmoothDouble();
@Unique SmoothDouble yawSmoother = new SmoothDouble();
@Shadow @Final private SmoothDouble smoothTurnY;
@Shadow @Final private SmoothDouble smoothTurnX;
@@ -93,7 +99,6 @@ public class MouseHandlerMixin {
)
)
public boolean cobblemon$modifyRotation(LocalPlayer player, double cursorDeltaX, double cursorDeltaY, @Local(argsOnly = true) double d) {
// I know this technically doesn't need to be a WrapWithCondition, but it'll make things easier later for riding.
PokedexUsageContext usageContext = CobblemonClient.INSTANCE.getPokedexUsageContext();
if (usageContext.getScanningGuiOpen()) {
this.smoothTurnY.reset();
@@ -105,7 +110,62 @@ public class MouseHandlerMixin {
player.turn(this.accumulatedDX * sensitivity, (this.accumulatedDY * sensitivity));
return false;
}
return true;
if (!(player instanceof Rollable rollable)) return true;
if (!rollable.shouldRoll()) {
xMouseSmoother.reset();
yMouseSmoother.reset();
pitchSmoother.reset();
rollSmoother.reset();
yawSmoother.reset();
return true;
}
//maybe have a rollable x mouse and rollable y mouse that take the xmousesmoother
//and y mouse smoother ( which are right now named pichsmoother and roll smoother)
// values and feed it to those rollable functions which will be called by the
//specific ride controller where rollable.rotate can then be called and used
//controller specific.
var yMouse = yMouseSmoother.getNewDeltaValue(cursorDeltaY * 0.15f, d);
var xMouse = xMouseSmoother.getNewDeltaValue(cursorDeltaX * 0.15f, d);
rollable.rotationOnMouseXY( yMouse, xMouse );
//get the current angular velocity requested to be applied
//by the ride controller
var angRot = rollable.angRollVel();
//Multiply against deltatime to get a consistent turn
//independent of framerate
if( angRot != null ) {
//var yaw = angRot.x * d;
//Add the yaw to the mouse here... this all needs changed. It should
//just map which 0 1 or 2 of the three it is going to modulate with
//what
var yaw = yawSmoother.getNewDeltaValue(angRot.x * 0.5f, d);
//yaw += yawSmoother.getNewDeltaValue(cursorDeltaX * 0.15f, d);
//var pitch = angRot.y * d;
var pitch = pitchSmoother.getNewDeltaValue(angRot.y * 0.5f, d);
//pitch += pitchSmoother.getNewDeltaValue(cursorDeltaY * 0.15f, d);
//var roll = angRot.z * d;
var roll = rollSmoother.getNewDeltaValue(angRot.z * 0.5f, d);
rollable.rotate((float) yaw, (float) pitch, (float) roll);
}
return false;
}
@Inject(method = "handleAccumulatedMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MouseHandler;isMouseGrabbed()Z", ordinal = 0))
private void cobblemon$maintainMovementWhenInScreens(CallbackInfo ci, @Local(ordinal = 1) double e) {
if (minecraft.player == null) return;
if (!(minecraft.player instanceof Rollable rollable)) return;
if (!rollable.shouldRoll()) return;
if (minecraft.isPaused()) return;
var pitch = pitchSmoother.getNewDeltaValue(0, e);
var roll = rollSmoother.getNewDeltaValue(0, e);
rollable.rotate(0.0F, (float)pitch, (float)roll);
}
}
@@ -10,12 +10,15 @@ package com.cobblemon.mod.common.mixin;
import com.cobblemon.mod.common.Cobblemon;
import com.cobblemon.mod.common.CobblemonItems;
import com.cobblemon.mod.common.Rollable;
import com.cobblemon.mod.common.api.events.CobblemonEvents;
import com.cobblemon.mod.common.api.events.item.LeftoversCreatedEvent;
import com.cobblemon.mod.common.api.pokemon.PokemonSpecies;
import com.cobblemon.mod.common.api.riding.Rideable;
import com.cobblemon.mod.common.api.storage.party.PartyStore;
import com.cobblemon.mod.common.api.storage.party.PlayerPartyStore;
import com.cobblemon.mod.common.api.tags.CobblemonItemTags;
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity;
import com.cobblemon.mod.common.pokedex.scanner.PokedexEntityData;
import com.cobblemon.mod.common.pokedex.scanner.ScannableEntity;
import com.cobblemon.mod.common.pokemon.FormData;
@@ -26,6 +29,10 @@ import com.cobblemon.mod.common.util.CompoundTagExtensionsKt;
import com.cobblemon.mod.common.util.CompoundTagUtilities;
import com.cobblemon.mod.common.util.DataKeys;
import com.cobblemon.mod.common.world.gamerules.CobblemonGameRules;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
@@ -38,14 +45,18 @@ import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.Nullable;
import org.joml.Matrix3f;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@@ -53,10 +64,11 @@ import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.function.Function;
import java.util.stream.Collectors;
@Mixin(Player.class)
public abstract class PlayerMixin extends LivingEntity implements ScannableEntity {
public abstract class PlayerMixin extends LivingEntity implements Rollable, ScannableEntity {
@Shadow public abstract CompoundTag getShoulderEntityLeft();
@@ -74,6 +86,7 @@ public abstract class PlayerMixin extends LivingEntity implements ScannableEntit
@Shadow public abstract void displayClientMessage(Component message, boolean overlay);
@Unique private Matrix3f orientation = null;
protected PlayerMixin(EntityType<? extends LivingEntity> p_20966_, Level p_20967_) {
super(p_20966_, p_20967_);
@@ -225,4 +238,123 @@ public abstract class PlayerMixin extends LivingEntity implements ScannableEntit
public LivingEntity resolveEntityScan() {
return this;
}
}
@Override
public void absMoveTo(double x, double y, double z, float yaw, float pitch) {
if (shouldRoll()) {
this.absMoveTo(x, y, z);
this.setYRot(yaw % 360.0f);
this.setXRot(pitch % 360.0f);
this.yRotO = this.getYRot();
this.xRotO = this.getXRot();
}
else {
this.absMoveTo(x, y, z);
this.absRotateTo(yaw, pitch);
}
}
@Inject(method = "tick", at = @At("HEAD"))
public void tick(CallbackInfo ci) {
if (this.shouldRoll()) {
// Proof of concept for yaw movement
if (this.getMainHandItem().is(Items.STICK)) {
this.rotateYaw(2);
}
else if (this.getMainHandItem().is(Items.BLAZE_ROD)) {
this.rotateYaw(-2);
}
}
}
@Override
public Matrix3f getOrientation() {
return orientation;
}
@Override
public Rollable updateOrientation(Function<Matrix3f, Matrix3f> update) {
//Disabled to allow non mouse inputs to modify roll
if (!shouldRoll()) return this;
if (this.orientation == null) {
this.orientation = new Matrix3f();
this.rotate(getYRot() - 180, getXRot(), 0);
}
this.orientation = update.apply(this.orientation);
setYRot(this.getYaw());
setXRot(this.getPitch());
this.yRotO = this.getYRot();
this.xRotO = this.getXRot();
return this;
}
@Override
public boolean shouldRoll() {
LocalPlayer player = Minecraft.getInstance().player;
if (!this.equals(player)) return false;
if (player.isHolding(Items.DIAMOND)) return true;
var playerVehicle = player.getVehicle();
if (playerVehicle == null) return false;
if (!(playerVehicle instanceof PokemonEntity pokemonEntity)) return false;
return pokemonEntity.getRiding().shouldRoll(pokemonEntity);
}
@Override
public void rotationOnMouseXY( double yMouse, double xMouse ) {
LocalPlayer player = Minecraft.getInstance().player;
if (!this.equals(player)) return;
var playerVehicle = player.getVehicle();
if (playerVehicle == null) return;
if (!(playerVehicle instanceof PokemonEntity pokemonEntity)) return;
pokemonEntity.getRiding().rotationOnMouseXY(pokemonEntity, player, yMouse, xMouse);
}
@Override
public boolean useMouseInputRoll() {
LocalPlayer player = Minecraft.getInstance().player;
if (!this.equals(player)) return true;
if (player.isHolding(Items.DIAMOND)) return false;
var playerVehicle = player.getVehicle();
if (playerVehicle == null) return true;
if (!(playerVehicle instanceof PokemonEntity pokemonEntity)) return true;
return pokemonEntity.getRiding().useMouseInputRoll(pokemonEntity);
}
@Override
public Vec3 angRollVel() {
var ret = new Vec3(0.0, 0.0, 0.0);
LocalPlayer player = Minecraft.getInstance().player;
if (!this.equals(player)) return ret;
var playerVehicle = player.getVehicle();
if (playerVehicle == null) return ret;
if (!(playerVehicle instanceof PokemonEntity pokemonEntity)) return ret;
return pokemonEntity.getRiding().angRollVel(pokemonEntity, player);
}
@Override
public void clearRotation() {
this.orientation = null;
}
@WrapOperation(
method = "rideTick()V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Player;wantsToStopRiding()Z")
)
public boolean delegateDismountToController(Player instance, Operation<Boolean> original) {
if (this.getVehicle() instanceof Rideable vehicle) {
return vehicle.getRiding().dismountOnShift() && original.call(instance);
}
return original.call(instance);
}
}
@@ -8,11 +8,14 @@
package com.cobblemon.mod.common.mixin;
import com.cobblemon.mod.common.Rollable;
import com.cobblemon.mod.common.client.render.ClientPlayerIcon;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
import org.joml.Matrix4f;
import org.joml.Vector3f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -20,9 +23,33 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(PlayerRenderer.class)
public class PlayerRendererMixin {
private static boolean disableRollableRenderDebug = false;
@Inject(method = "render", at = @At(value = "TAIL"))
public void renderPlayer(AbstractClientPlayer player, float f, float g, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, CallbackInfo ci) {
@Inject(method = "render", at = @At(value = "HEAD"))
public void renderPlayer$head(AbstractClientPlayer player, float f, float g, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, CallbackInfo ci) {
if(player instanceof Rollable && !disableRollableRenderDebug) {
Rollable rollable = (Rollable) player;
if(rollable.shouldRoll()){
poseStack.pushPose();
Matrix4f transformationMatrix = new Matrix4f();
Vector3f center = new Vector3f(0, player.getBbHeight()/2, 0);
transformationMatrix.translate(center);
//transformationMatrix.rotate(180f.toRadians() - (rollable.getYaw()).toRadians(), rollable.getUpVector(), transformationMatrix);
transformationMatrix.rotate((float) Math.toRadians(-rollable.getPitch()), rollable.getLeftVector(), transformationMatrix);
transformationMatrix.rotate((float) Math.toRadians(-rollable.getRoll()), rollable.getForwardVector(), transformationMatrix);
transformationMatrix.translate(center.negate(new Vector3f()));
poseStack.mulPose(transformationMatrix);
}
}
}
@Inject(method = "render", at = @At(value = "TAIL"))
public void renderPlayer$tail(AbstractClientPlayer player, float f, float g, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, CallbackInfo ci) {
ClientPlayerIcon.Companion.onRenderPlayer(player);
if(player instanceof Rollable && !disableRollableRenderDebug && ((Rollable) player).shouldRoll()){
poseStack.popPose();
}
}
}
@@ -0,0 +1,43 @@
/*
* 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.mixin.client;
import com.cobblemon.mod.common.CobblemonNetwork;
import com.cobblemon.mod.common.Rollable;
import com.cobblemon.mod.common.net.messages.server.orientation.C2SUpdateOrientationPacket;
import net.minecraft.client.player.LocalPlayer;
import org.joml.Matrix3f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(LocalPlayer.class)
public class LocalPlayerMixin {
@Unique Matrix3f cobblemon$lastOrientation;
@Inject(method = "sendPosition", at = @At("TAIL"))
private void cobblemon_updateRotationMatrix(CallbackInfo ci) {
if (!(this instanceof Rollable rollable)) return;
if (rollable.getOrientation() == cobblemon$lastOrientation) return;
cobblemon$lastOrientation = rollable.getOrientation() != null ? new Matrix3f(rollable.getOrientation()) : null;
CobblemonNetwork.INSTANCE.sendToServer(new C2SUpdateOrientationPacket(rollable.getOrientation()));
}
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientPacketListener;send(Lnet/minecraft/network/protocol/Packet;)V"))
private void cobblemon_updateRotationMatrixPassenger(CallbackInfo ci) {
if (!(this instanceof Rollable rollable)) return;
if (rollable.getOrientation() == cobblemon$lastOrientation) return;
cobblemon$lastOrientation = rollable.getOrientation() != null ? new Matrix3f(rollable.getOrientation()) : null;
CobblemonNetwork.INSTANCE.sendToServer(new C2SUpdateOrientationPacket(rollable.getOrientation()));
}
}
@@ -0,0 +1,32 @@
/*
* 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.mixin.entity;
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity;
import net.minecraft.world.entity.Entity;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Entity.class)
public abstract class EntityMixin {
@Shadow @Nullable public abstract Entity getVehicle();
@Inject(method = "updateInWaterStateAndDoWaterCurrentPushing", at = @At(value = "FIELD", target = "Lnet/minecraft/world/entity/Entity;wasTouchingWater:Z", ordinal = 1), cancellable = true)
public void cobblemon$verifyActuallyTouchingWater(CallbackInfo ci) {
if(this.getVehicle() instanceof PokemonEntity) {
ci.cancel();
}
}
}
@@ -0,0 +1,30 @@
/*
* 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.mixin.renderer;
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import org.spongepowered.asm.mixin.Mixin;
/**
* @author landonjw
*/
@Mixin(LivingEntityRenderer.class)
public abstract class LivingEntityRendererMixin {
// @Redirect(
// method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V",
// at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;hasVehicle()Z"),
// slice = @Slice(
// from = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;lerpAngleDegrees(FFF)F"),
// to = @At(value = "TAIL")
// )
// )
// private boolean dodgeRenderer(LivingEntity instance) {
// return false;
// }
}
@@ -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.mixin.renderer;
import com.cobblemon.mod.common.client.render.player.MountedPlayerRenderer;
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
/**
* @author landonjw
*/
@Mixin(PlayerRenderer.class)
public class PlayerEntityRendererMixin {
@Inject(
method = "setupRotations(Lnet/minecraft/client/player/AbstractClientPlayer;Lcom/mojang/blaze3d/vertex/PoseStack;FFFF)V",
at = @At("HEAD")
)
private void doABibarelRoll$modifyRoll(AbstractClientPlayer player, PoseStack poseStack, float a, float b, float partialTicks, float i, CallbackInfo ci) {
if (player.isPassenger()) {
var vehicle = player.getVehicle();
if (vehicle instanceof PokemonEntity entity) {
MountedPlayerRenderer.INSTANCE.render(player, entity, poseStack);
}
}
}
}
@@ -0,0 +1,62 @@
/*
* 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.mixin.riding;
import net.minecraft.client.player.LocalPlayer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
@Mixin(LocalPlayer.class)
public class JetMixin {
@Shadow private int jumpRidingTicks;
@Shadow private float jumpRidingScale;
private float jetStrength;
// @Redirect(method = "tickMovement", at = @At(target = "Lnet/minecraft/entity/JumpingMount;getJumpCooldown()I", value = "INVOKE"))
// public int cobblemon$tryHandlingJet(JumpingMount mount) {
// if(mount instanceof PokemonEntity pokemon) {
//// if(pokemon.getDataTracker().get(PokemonEntity.MOVING)) {
//// ++this.field_3938;
//// if (this.field_3938 < 11) {
//// this.jetStrength = (float) this.field_3938 * 0.1F;
//// } else {
// this.mountJumpStrength = 0.8F + 2.0F / (float) (this.field_3938 - 9) * 0.1F;
//// }
//// } else {
//// this.field_3938 = 0;
//// this.jetStrength = 0;
//// }
//
//// return -1;
// }
//
// return 0;
// }
@Inject(
method = "aiStep",
at = @At(
target = "Lnet/minecraft/client/player/LocalPlayer;jumpRidingScale:F",
value = "FIELD",
ordinal = 4,
shift = At.Shift.AFTER
),
locals = LocalCapture.CAPTURE_FAILSOFT
)
public void cobblemon$applyCachedJumpStrength(CallbackInfo ci) {
this.jumpRidingScale = this.jetStrength;
}
}
@@ -12,6 +12,14 @@ object CobblemonBuildDetails {
const val BRANCH = "{{ branch | default("Not Specified") }}"
fun smallCommitHash(): String {
if(this.GIT_COMMIT.equals("Not Specified")) {
return "Unknown"
}
return this.GIT_COMMIT.substring(0, 7)
}
fun version(): String {
return this.VERSION + if(this.SNAPSHOT) "+${this.smallCommitHash()}" else ""
}
}
@@ -51,7 +51,14 @@ import com.cobblemon.mod.common.client.net.storage.pc.OpenPCHandler
import com.cobblemon.mod.common.client.net.storage.pc.SetPCBoxPokemonHandler
import com.cobblemon.mod.common.client.net.storage.pc.SetPCPokemonHandler
import com.cobblemon.mod.common.client.net.toast.ToastPacketHandler
import com.cobblemon.mod.common.client.net.trade.*
import com.cobblemon.mod.common.client.net.trade.TradeAcceptanceChangedHandler
import com.cobblemon.mod.common.client.net.trade.TradeCancelledHandler
import com.cobblemon.mod.common.client.net.trade.TradeCompletedHandler
import com.cobblemon.mod.common.client.net.trade.TradeOfferExpiredHandler
import com.cobblemon.mod.common.client.net.trade.TradeOfferNotificationHandler
import com.cobblemon.mod.common.client.net.trade.TradeProcessStartedHandler
import com.cobblemon.mod.common.client.net.trade.TradeStartedHandler
import com.cobblemon.mod.common.client.net.trade.TradeUpdatedHandler
import com.cobblemon.mod.common.net.PacketRegisterInfo
import com.cobblemon.mod.common.net.messages.client.PlayerInteractOptionsPacket
import com.cobblemon.mod.common.net.messages.client.SetClientPlayerDataPacket
@@ -93,14 +100,37 @@ import com.cobblemon.mod.common.net.messages.client.storage.party.InitializePart
import com.cobblemon.mod.common.net.messages.client.storage.party.MoveClientPartyPokemonPacket
import com.cobblemon.mod.common.net.messages.client.storage.party.SetPartyPokemonPacket
import com.cobblemon.mod.common.net.messages.client.storage.party.SetPartyReferencePacket
import com.cobblemon.mod.common.net.messages.client.storage.pc.*
import com.cobblemon.mod.common.net.messages.client.storage.pc.ClosePCPacket
import com.cobblemon.mod.common.net.messages.client.storage.pc.InitializePCPacket
import com.cobblemon.mod.common.net.messages.client.storage.pc.MoveClientPCPokemonPacket
import com.cobblemon.mod.common.net.messages.client.storage.pc.OpenPCPacket
import com.cobblemon.mod.common.net.messages.client.storage.pc.SetPCBoxPokemonPacket
import com.cobblemon.mod.common.net.messages.client.storage.pc.SetPCPokemonPacket
import com.cobblemon.mod.common.net.messages.client.toast.ToastPacket
import com.cobblemon.mod.common.net.messages.client.trade.*
import com.cobblemon.mod.common.net.messages.client.trade.TradeAcceptanceChangedPacket
import com.cobblemon.mod.common.net.messages.client.trade.TradeCancelledPacket
import com.cobblemon.mod.common.net.messages.client.trade.TradeCompletedPacket
import com.cobblemon.mod.common.net.messages.client.trade.TradeOfferExpiredPacket
import com.cobblemon.mod.common.net.messages.client.trade.TradeOfferNotificationPacket
import com.cobblemon.mod.common.net.messages.client.trade.TradeProcessStartedPacket
import com.cobblemon.mod.common.net.messages.client.trade.TradeStartedPacket
import com.cobblemon.mod.common.net.messages.client.trade.TradeUpdatedPacket
import com.cobblemon.mod.common.net.messages.client.ui.InteractPokemonUIPacket
import com.cobblemon.mod.common.net.messages.client.ui.PokedexUIPacket
import com.cobblemon.mod.common.net.messages.client.ui.SummaryUIPacket
import com.cobblemon.mod.common.net.messages.server.*
import com.cobblemon.mod.common.net.messages.server.battle.*
import com.cobblemon.mod.common.net.messages.server.BattleChallengePacket
import com.cobblemon.mod.common.net.messages.server.BattleChallengeResponsePacket
import com.cobblemon.mod.common.net.messages.server.BenchMovePacket
import com.cobblemon.mod.common.net.messages.server.RequestMoveSwapPacket
import com.cobblemon.mod.common.net.messages.server.RequestPlayerInteractionsPacket
import com.cobblemon.mod.common.net.messages.server.SelectStarterPacket
import com.cobblemon.mod.common.net.messages.server.SendOutPokemonPacket
import com.cobblemon.mod.common.net.messages.server.battle.BattleSelectActionsPacket
import com.cobblemon.mod.common.net.messages.server.battle.BattleTeamLeavePacket
import com.cobblemon.mod.common.net.messages.server.battle.BattleTeamRequestPacket
import com.cobblemon.mod.common.net.messages.server.battle.BattleTeamResponsePacket
import com.cobblemon.mod.common.net.messages.server.battle.RemoveSpectatorPacket
import com.cobblemon.mod.common.net.messages.server.battle.SpectateBattlePacket
import com.cobblemon.mod.common.net.messages.server.block.AdjustBlockEntityViewerCountPacket
import com.cobblemon.mod.common.net.messages.server.callback.move.MoveSelectCancelledPacket
import com.cobblemon.mod.common.net.messages.server.callback.move.MoveSelectedPacket
@@ -111,6 +141,7 @@ import com.cobblemon.mod.common.net.messages.server.callback.partymove.PartyPoke
import com.cobblemon.mod.common.net.messages.server.dialogue.EscapeDialoguePacket
import com.cobblemon.mod.common.net.messages.server.dialogue.InputToDialoguePacket
import com.cobblemon.mod.common.net.messages.server.npc.SaveNPCPacket
import com.cobblemon.mod.common.net.messages.server.orientation.C2SUpdateOrientationPacket
import com.cobblemon.mod.common.net.messages.server.pasture.PasturePokemonPacket
import com.cobblemon.mod.common.net.messages.server.pasture.UnpastureAllPokemonPacket
import com.cobblemon.mod.common.net.messages.server.pasture.UnpasturePokemonPacket
@@ -130,9 +161,21 @@ import com.cobblemon.mod.common.net.messages.server.storage.pc.MovePartyPokemonT
import com.cobblemon.mod.common.net.messages.server.storage.pc.ReleasePCPokemonPacket
import com.cobblemon.mod.common.net.messages.server.storage.pc.SwapPCPokemonPacket
import com.cobblemon.mod.common.net.messages.server.storage.pc.UnlinkPlayerFromPCPacket
import com.cobblemon.mod.common.net.messages.server.trade.*
import com.cobblemon.mod.common.net.serverhandling.*
import com.cobblemon.mod.common.net.serverhandling.battle.*
import com.cobblemon.mod.common.net.messages.server.trade.AcceptTradeRequestPacket
import com.cobblemon.mod.common.net.messages.server.trade.CancelTradePacket
import com.cobblemon.mod.common.net.messages.server.trade.ChangeTradeAcceptancePacket
import com.cobblemon.mod.common.net.messages.server.trade.OfferTradePacket
import com.cobblemon.mod.common.net.messages.server.trade.PerformTradePacket
import com.cobblemon.mod.common.net.messages.server.trade.UpdateTradeOfferPacket
import com.cobblemon.mod.common.net.serverhandling.ChallengeHandler
import com.cobblemon.mod.common.net.serverhandling.ChallengeResponseHandler
import com.cobblemon.mod.common.net.serverhandling.RequestInteractionsHandler
import com.cobblemon.mod.common.net.serverhandling.battle.BattleSelectActionsHandler
import com.cobblemon.mod.common.net.serverhandling.battle.RemoveSpectatorHandler
import com.cobblemon.mod.common.net.serverhandling.battle.SpectateBattleHandler
import com.cobblemon.mod.common.net.serverhandling.battle.TeamLeaveHandler
import com.cobblemon.mod.common.net.serverhandling.battle.TeamRequestHandler
import com.cobblemon.mod.common.net.serverhandling.battle.TeamRequestResponseHandler
import com.cobblemon.mod.common.net.serverhandling.block.AdjustBlockEntityViewerCountHandler
import com.cobblemon.mod.common.net.serverhandling.callback.move.MoveSelectCancelledHandler
import com.cobblemon.mod.common.net.serverhandling.callback.move.MoveSelectedHandler
@@ -144,6 +187,7 @@ import com.cobblemon.mod.common.net.serverhandling.dialogue.EscapeDialogueHandle
import com.cobblemon.mod.common.net.serverhandling.dialogue.InputToDialogueHandler
import com.cobblemon.mod.common.net.serverhandling.evolution.AcceptEvolutionHandler
import com.cobblemon.mod.common.net.serverhandling.npc.SaveNPCHandler
import com.cobblemon.mod.common.net.serverhandling.orientation.OrientationPacketHandler
import com.cobblemon.mod.common.net.serverhandling.pasture.PasturePokemonHandler
import com.cobblemon.mod.common.net.serverhandling.pasture.UnpastureAllPokemonHandler
import com.cobblemon.mod.common.net.serverhandling.pasture.UnpasturePokemonHandler
@@ -166,7 +210,12 @@ import com.cobblemon.mod.common.net.serverhandling.storage.pc.MovePartyPokemonTo
import com.cobblemon.mod.common.net.serverhandling.storage.pc.ReleasePartyPokemonHandler
import com.cobblemon.mod.common.net.serverhandling.storage.pc.SwapPCPokemonHandler
import com.cobblemon.mod.common.net.serverhandling.storage.pc.UnlinkPlayerFromPCHandler
import com.cobblemon.mod.common.net.serverhandling.trade.*
import com.cobblemon.mod.common.net.serverhandling.trade.AcceptTradeRequestHandler
import com.cobblemon.mod.common.net.serverhandling.trade.CancelTradeHandler
import com.cobblemon.mod.common.net.serverhandling.trade.ChangeTradeAcceptanceHandler
import com.cobblemon.mod.common.net.serverhandling.trade.OfferTradeHandler
import com.cobblemon.mod.common.net.serverhandling.trade.PerformTradeHandler
import com.cobblemon.mod.common.net.serverhandling.trade.UpdateTradeOfferHandler
import com.cobblemon.mod.common.util.server
import net.minecraft.server.level.ServerPlayer
@@ -443,6 +492,9 @@ object CobblemonNetwork {
// NPC packets
list.add(PacketRegisterInfo(SaveNPCPacket.ID, SaveNPCPacket::decode, SaveNPCHandler))
// Orientation packet(s)
list.add(PacketRegisterInfo(C2SUpdateOrientationPacket.ID, C2SUpdateOrientationPacket::decode, OrientationPacketHandler))
return list
}
@@ -450,4 +502,4 @@ object CobblemonNetwork {
//logger.info("[S->C] ${packet.type()}")
Cobblemon.implementation.networkManager.sendPacketToPlayer(player, packet)
}
}
}
@@ -55,6 +55,7 @@ class ActiveDialogue(var playerEntity: ServerPlayer, var dialogueReference: Dial
)
dialogueReference.initializationAction.invoke(this)
setPage(currentPage)
if (!completion.isDone) {
val packet = DialogueOpenedPacket(this, true)
@@ -52,6 +52,6 @@ object DialogueManager {
fun stopDialogue(playerEntity: ServerPlayer) {
val activeDialogue = playerEntity.activeDialogue ?: return
DialogueClosedPacket(activeDialogue.dialogueId).sendToPlayer(playerEntity)
activeDialogues.remove(activeDialogue.dialogueId)
activeDialogues.remove(playerEntity.uuid)
}
}
@@ -49,6 +49,7 @@ import com.cobblemon.mod.common.api.reactive.EventObservable
import com.cobblemon.mod.common.api.reactive.Observable.Companion.filter
import com.cobblemon.mod.common.api.reactive.Observable.Companion.map
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.api.riding.events.SelectDriverEvent
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import net.minecraft.server.level.ServerPlayer
@@ -232,4 +233,12 @@ object CobblemonEvents {
val HATCH_EGG_PRE = CancelableObservable<HatchEggEvent.Pre>()
@JvmField
val HATCH_EGG_POST = EventObservable<HatchEggEvent.Post>()
// -------------------------------------------------------------------------------------
//
// Riding
//
// -------------------------------------------------------------------------------------
@JvmField
val SELECT_DRIVER = EventObservable<SelectDriverEvent>()
}
@@ -8,6 +8,7 @@
package com.cobblemon.mod.common.api.pokemon
import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.abilities.AbilityPool
import com.cobblemon.mod.common.api.abilities.AbilityTemplate
@@ -32,6 +33,7 @@ import com.cobblemon.mod.common.api.pokemon.moves.Learnset
import com.cobblemon.mod.common.api.pokemon.stats.Stat
import com.cobblemon.mod.common.api.pokemon.stats.Stats
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.api.riding.controller.RideController
import com.cobblemon.mod.common.api.spawning.TimeRange
import com.cobblemon.mod.common.api.types.ElementalType
import com.cobblemon.mod.common.api.types.adapters.ElementalTypeAdapter
@@ -46,6 +48,7 @@ import com.cobblemon.mod.common.pokemon.evolution.adapters.NbtItemPredicateAdapt
import com.cobblemon.mod.common.pokemon.evolution.predicate.NbtItemPredicate
import com.cobblemon.mod.common.pokemon.helditem.CobblemonHeldItemManager
import com.cobblemon.mod.common.util.adapters.*
import com.cobblemon.mod.common.util.adapters.riding.RideControllerAdapter
import com.cobblemon.mod.common.util.cobblemonResource
import com.google.common.collect.HashBasedTable
import com.google.gson.Gson
@@ -100,6 +103,8 @@ object PokemonSpecies : JsonDataRegistry<Species> {
.registerTypeAdapter(EggGroup::class.java, EggGroupAdapter)
.registerTypeAdapter(MobEffect::class.java, RegistryElementAdapter<MobEffect>(BuiltInRegistries::MOB_EFFECT))
.registerTypeAdapter(NbtItemPredicate::class.java, NbtItemPredicateAdapter)
.registerTypeAdapter(RideController::class.java, RideControllerAdapter)
.registerTypeAdapter(Expression::class.java, ExpressionAdapter)
.disableHtmlEscaping()
.enableComplexMapKeySerialization()
.create()
@@ -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.api.riding
import net.minecraft.world.entity.PlayerRideableJumping
/**
* Represents an entity that supports riding.
*
* @since 1.5.0
*/
interface Rideable : PlayerRideableJumping {
/**
* Denotes the manager responsible for handling any instance of riding taking place on an entity
*/
val riding: RidingManager
}
@@ -0,0 +1,149 @@
/*
* 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.riding
import com.bedrockk.molang.runtime.MoLangRuntime
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.Rollable
import com.cobblemon.mod.common.api.molang.MoLangFunctions.setup
import com.cobblemon.mod.common.api.riding.controller.RideController
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.util.withQueryValue
import net.minecraft.ChatFormatting
import net.minecraft.network.chat.Component
import net.minecraft.resources.ResourceLocation
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.sin
data class RidingManager(val entity: PokemonEntity) {
var lastSpeed = 0F
var states: MutableMap<ResourceLocation, RidingState> = mutableMapOf()
var deltaRotation = Vec2.ZERO
val runtime: MoLangRuntime by lazy {
MoLangRuntime()
.setup()
.withQueryValue("entity", entity.struct)
.also {
it.environment.query.addFunction("passenger_count") { DoubleValue(entity.passengers.size.toDouble()) }
}
}
fun <T : RidingState> getState(id: ResourceLocation, constructor: (PokemonEntity) -> T): T {
val storedState = states[id]
if (storedState == null) {
val newState = constructor(entity)
states[id] = newState
return newState
}
return storedState as T
}
fun getController(entity: PokemonEntity): RideController? {
return entity.pokemon.riding.controller?.takeIf { it.condition.invoke(entity) }
}
/**
* Responsible for handling riding conditions and transitions amongst controllers. This will tick
* whenever the entity receives a tickControlled interaction.
*/
fun tick(entity: PokemonEntity, driver: Player, input: Vec3) {
val controller = getController(entity) ?: return
val pose = controller.pose(entity)
entity.entityData.set(PokemonEntity.POSE_TYPE, pose)
//val speedPlayer = driver.deltaMovement.horizontalDistance()
//driver.displayClientMessage(Component.literal("Speed player: ").withStyle { it.withColor(ChatFormatting.GREEN) }.append(Component.literal("$speedPlayer b/t")), true)
val speedEntity = entity.deltaMovement.horizontalDistance()
driver.displayClientMessage(Component.literal("Speed Entity: ").withStyle { it.withColor(ChatFormatting.GREEN) }.append(Component.literal("${String.format("%.2f", speedEntity)} b/t")), true)
}
fun speed(entity: PokemonEntity, driver: Player): Float {
val controller = getController(entity) ?: return 0.05F
this.lastSpeed = controller.speed(entity, driver)
return this.lastSpeed
}
fun controlledRotation(entity: PokemonEntity, driver: Player): Vec2 {
val controller = getController(entity) ?: return entity.rotationVector
val previousRotation = entity.rotationVector
val rotation = controller.rotation(entity, driver)
this.deltaRotation = Vec2(rotation.x - previousRotation.x, rotation.y - previousRotation.y)
return rotation
}
fun clampPassengerRotation(entity: PokemonEntity, driver: LivingEntity) {
val controller = getController(entity) ?: return
return controller.clampPassengerRotation(entity, driver)
}
fun updatePassengerRotation(entity: PokemonEntity, driver: LivingEntity) {
val controller = getController(entity) ?: return
return controller.updatePassengerRotation(entity, driver)
}
fun velocity(entity: PokemonEntity, driver: Player, input: Vec3): Vec3 {
val controller = getController(entity) ?: return Vec3.ZERO
return controller.velocity(entity, driver, input)
}
fun canJump(entity: PokemonEntity, driver: Player): Boolean {
val controller = getController(entity) ?: return false
return controller.canJump(entity, driver)
}
fun jumpVelocity(entity: PokemonEntity, driver: Player, jumpStrength: Int): Vec3 {
val controller = getController(entity) ?: return Vec3.ZERO
return controller.jumpForce(entity, driver, jumpStrength)
}
fun gravity(entity: PokemonEntity, regularGravity: Double): Double? {
val controller = getController(entity) ?: return null
return controller.gravity(entity, regularGravity)
}
fun shouldRoll(entity: PokemonEntity): Boolean {
val controller = getController(entity) ?: return false
return controller.shouldRoll(entity)
}
fun rotationOnMouseXY( entity: PokemonEntity, driver: Player, yMouse: Double, xMouse: Double ){
val controller = getController(entity) ?: return
controller.rotationOnMouseXY( entity, driver, yMouse, xMouse )
}
/**
* Determines whether mouse input will affect the rotation of
* the rollable object
*/
fun useMouseInputRoll(entity: PokemonEntity): Boolean {
val controller = getController(entity) ?: return true
return controller.useMouseInputRoll(entity)
}
fun turnOffOnGround(entity: PokemonEntity): Boolean {
val controller = getController(entity) ?: return false
return controller.turnOffOnGround(entity)
}
fun angRollVel(entity: PokemonEntity, driver: Player): Vec3 {
val controller = getController(entity) ?: return Vec3(0.0, 0.0, 0.0)
return controller.angRollVel(entity, driver)
}
fun dismountOnShift(): Boolean {
val controller = getController(entity) ?: return false
return controller.dismountOnShift(entity)
}
}
@@ -0,0 +1,49 @@
/*
* 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.riding
import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.api.riding.controller.RideController
import com.cobblemon.mod.common.util.adapters.riding.RideControllerAdapter
import com.cobblemon.mod.common.util.asExpression
import com.cobblemon.mod.common.util.getString
import com.cobblemon.mod.common.util.readIdentifier
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
class RidingProperties(
val seats: List<Seat> = listOf(),
val conditions: List<Expression> = listOf(),
val controller: RideController? = null
) {
companion object {
fun decode(buffer: RegistryFriendlyByteBuf): RidingProperties {
val seats: List<Seat> = buffer.readList { _ -> Seat.decode(buffer) }
val conditions = buffer.readList { buffer.readString().asExpression() }
val controller = buffer.readNullable { _ ->
val key = buffer.readIdentifier()
val controller = RideControllerAdapter.types[key]?.getConstructor()?.newInstance() ?: error("Unknown controller key: $key")
controller.decode(buffer)
return@readNullable controller
}
return RidingProperties(seats = seats, conditions = conditions, controller = controller)
}
}
val canRide: Boolean
get() = seats.isNotEmpty() && controller != null
fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeCollection(seats) { _, seat -> seat.encode(buffer) }
buffer.writeCollection(conditions) { _, condition -> buffer.writeString(condition.getString()) }
buffer.writeNullable(controller) { _, controller -> controller.encode(buffer) }
}
}
@@ -0,0 +1,18 @@
/*
* 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.riding
/**
* Honestly having a base interface is probably unnecessary I'm just considering whether there's going to be some
* kind of shared state later.
*
* @author Hiroku
* @since October 6th, 2024
*/
interface RidingState
@@ -0,0 +1,91 @@
/*
* 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.riding
import com.cobblemon.mod.common.api.net.Encodable
import com.cobblemon.mod.common.api.riding.controller.RidingAnimation
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.world.phys.Vec3
/**
* Seat Properties are responsible for the base information that would then be used to construct a Seat on an entity.
*/
data class Seat(
val locator: String = "seat1",
val offset: Vec3 = Vec3.ZERO,
val poseOffsets: MutableList<SeatPoseOffset> = mutableListOf(),
val poseAnimations: MutableList<SeatPoseAnimations> = mutableListOf()
) : Encodable {
fun getOffset(poseType: PoseType) : Vec3 {
return poseOffsets.firstOrNull { poseType in it.poseTypes }?.offset ?: offset
}
override fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeString(locator)
buffer.writeDouble(offset.x)
buffer.writeDouble(offset.y)
buffer.writeDouble(offset.z)
buffer.writeCollection(poseOffsets) { _, offset -> offset.encode(buffer) }
buffer.writeCollection(poseAnimations) { _, animations -> animations.encode(buffer) }
}
companion object {
fun decode(buffer: RegistryFriendlyByteBuf) : Seat {
return Seat(
buffer.readString(),
Vec3(buffer.readDouble(), buffer.readDouble(), buffer.readDouble()),
buffer.readList { SeatPoseOffset.decode(buffer) },
buffer.readList { SeatPoseAnimations.decode(buffer) }
)
}
}
}
class SeatPoseOffset {
val poseTypes = mutableSetOf<PoseType>()
var offset = Vec3.ZERO
fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeCollection(poseTypes) { _, poseType -> buffer.writeString(poseType.name) }
buffer.writeDouble(offset.x)
buffer.writeDouble(offset.y)
buffer.writeDouble(offset.z)
}
companion object {
fun decode(buffer: RegistryFriendlyByteBuf) : SeatPoseOffset {
val offset = SeatPoseOffset()
offset.poseTypes.addAll(buffer.readList { buffer.readString().let { PoseType.valueOf(it) } })
offset.offset = Vec3(buffer.readDouble(), buffer.readDouble(), buffer.readDouble())
return offset
}
}
}
class SeatPoseAnimations {
val poseTypes = mutableSetOf<PoseType>()
var animations = mutableListOf<RidingAnimation>()
fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeCollection(poseTypes) { _, poseType -> buffer.writeString(poseType.name) }
buffer.writeCollection(animations) { _, animation -> animation.encode(buffer) }
}
companion object {
fun decode(buffer: RegistryFriendlyByteBuf) : SeatPoseAnimations {
val animations = SeatPoseAnimations()
animations.poseTypes.addAll(buffer.readList { buffer.readString().let { PoseType.valueOf(it) } })
animations.animations = buffer.readList { RidingAnimation.decode(buffer) }
return animations
}
}
}
@@ -0,0 +1,127 @@
/*
* 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.riding.controller
import com.cobblemon.mod.common.Rollable
import com.cobblemon.mod.common.api.net.Decodable
import com.cobblemon.mod.common.api.net.Encodable
import com.cobblemon.mod.common.api.riding.RidingState
import com.cobblemon.mod.common.api.riding.controller.posing.PoseProvider
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.util.writeIdentifier
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
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
/**
* A riding controller is the internal control mechanism for determining how a pokemon
* handles during riding. Controllers come into play once the pokemon being ridden has
* established the path it's capable of. For instance, a land based controller could have
* the pokemon experience drifting after movement, or generic movement. It's up to the
* controller to decide how the pokemon behaves.
*
* @since x.x.x
*/
interface RideController : Encodable, Decodable {
/** A reference key used to denote the individual controller */
val key: ResourceLocation
/**
* Specifies the provider of poses which helps control updating the current pose on the pokemon
* being ridden. Controllers are expected to define the pose types responsible for posing the entity
* through all expected conditions. It should define a default pose, that will be used in all cases
* where a pose does not meet the current conditions for the current mount. Typically, this will be
* an idle pose.
*/
val poseProvider: PoseProvider
/**
* Represents a condition that must be met for this controller to be active. For instance, this can be used
* to evaluate things such as current velocity or block state of the entity.
*/
val condition: (PokemonEntity) -> Boolean
/**
* Specifies the pose the ridden mount should be positioned in. This queries the pose provider using
* the entity as a means of determining the conditions the entity is currently under. This allows for
* dynamic pose updates.
*/
fun pose(entity: PokemonEntity) : PoseType {
return this.poseProvider.select(entity)
}
/**
* Calculates the current speed of the mount.
*/
fun speed(entity: PokemonEntity, driver: Player) : Float
/**
* Sets the rotation of the mount. This is typically based on the controlling driver and is manipulated as
* necessary.
*/
fun rotation(entity: PokemonEntity, driver: LivingEntity) : Vec2
/**
* Sets the change current change in rotation for that tick in three
* dimensions
*/
fun angRollVel(entity: PokemonEntity, driver: Player): Vec3 {
return Vec3(0.0, 0.0, 0.0)
}
fun clampPassengerRotation(entity: PokemonEntity, driver: LivingEntity) {}
fun updatePassengerRotation(entity: PokemonEntity, driver: LivingEntity) {
driver.yRot = entity.yRot
}
/**
* Manipulates the movement input as necessary by the controller. This is primarily used to apply limits
* to the types of movements. For instance, we can apply limits to any sort of sideways movement input, so that
* it would otherwise be slower than normal forward movement.
*/
fun velocity(entity: PokemonEntity, driver: Player, input: Vec3) : Vec3
fun canJump(entity: PokemonEntity, driver: Player) : Boolean
fun jumpForce(entity: PokemonEntity, driver: Player, jumpStrength: Int) : Vec3
fun gravity(entity: PokemonEntity, regularGravity: Double) : Double? = null
fun shouldRoll(entity: PokemonEntity): Boolean = false
fun useMouseInputRoll(entity: PokemonEntity): Boolean = false
//If function is not overwritten by controllers then just perform the defualt
//rolling function
fun rotationOnMouseXY( entity: PokemonEntity, driver: Player, yMouse: Double, xMouse: Double ){
if(driver !is Rollable) return
val rollable = driver as Rollable
rollable.rotate(0.0f, yMouse.toFloat(), xMouse.toFloat())
}
fun turnOffOnGround(entity: PokemonEntity): Boolean = false
fun dismountOnShift(entity: PokemonEntity): Boolean = false
fun getRuntime(entity: PokemonEntity) = entity.riding.runtime
fun <T : RidingState> getState(entity: PokemonEntity, constructor: (PokemonEntity) -> T): T {
return entity.riding.getState(key, constructor)
}
override fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeIdentifier(this.key)
}
}
@@ -0,0 +1,32 @@
/*
* 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.riding.controller
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
class RidingAnimation(
val fileName: String,
val animationName: String
) {
fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeString(fileName)
buffer.writeString(animationName)
}
companion object {
fun decode(buffer: RegistryFriendlyByteBuf) : RidingAnimation {
return RidingAnimation(
buffer.readString(),
buffer.readString()
)
}
}
}
@@ -0,0 +1,15 @@
/*
* 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.riding.controller.posing
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import java.util.function.Predicate
data class PoseOption(val pose: PoseType, val condition: Predicate<PokemonEntity>)
@@ -0,0 +1,31 @@
/*
* 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.riding.controller.posing
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
class PoseProvider(private val fallback: PoseType) {
private val options = mutableListOf<PoseOption>()
fun select(entity: PokemonEntity) : PoseType {
return this.options.stream()
.filter { it.condition.test(entity) }
.map { it.pose }
.findFirst()
.orElse(this.fallback)
}
fun with(option: PoseOption) : PoseProvider {
this.options.add(option)
return this
}
}
@@ -0,0 +1,33 @@
/*
* 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.riding.events
import net.minecraft.world.entity.LivingEntity
data class SelectDriverEvent(val options: Set<LivingEntity>) {
private var result: DriverSuggestion? = null
fun result(): LivingEntity? {
return this.result?.entity
}
/**
* Suggests a particular living entity as a potential driver. Only non-negative
* values are permitted by this function. All priority values with lesser priorities
* will be outright ignored.
*/
fun suggest(target: LivingEntity, priority: Int) {
if (priority >= 0 && priority > (this.result?.priority ?: -1)) {
this.result = DriverSuggestion(target, priority)
}
}
data class DriverSuggestion(val entity: LivingEntity, val priority: Int)
}
@@ -498,7 +498,7 @@ class LookAtDirection : ParticleCameraMode {
rotation.hamiltonProduct(Axis.ZP.rotationDegrees(particleAngle))
// Minecraft in 1.21 or 1.20.4 or something fucked with vertex draw order, and it flipped everything.
rotation.hamiltonProduct(Axis.YP.rotationDegrees(180F))
rotation.hamiltonProduct(Axis.XP.rotationDegrees(180F))
return rotation
}
@@ -11,6 +11,7 @@ package com.cobblemon.mod.common.api.spawning.rules.component
import com.bedrockk.molang.Expression
import com.bedrockk.molang.ast.BooleanExpression
import com.bedrockk.molang.runtime.MoLangRuntime
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.api.molang.MoLangFunctions.setup
import com.cobblemon.mod.common.api.spawning.context.SpawningContext
import com.cobblemon.mod.common.api.spawning.detail.SpawnDetail
@@ -33,7 +34,7 @@ class FilterRuleComponent : SpawnRuleComponent {
val spawnSelector: SpawnDetailSelector = AllSpawnDetailSelector
val contextSelector: SpawningContextSelector = AllSpawningContextSelector
val allow: Expression = BooleanExpression(true)
val allow: Expression = BooleanExpression(false)
override fun affectSpawnable(detail: SpawnDetail, ctx: SpawningContext): Boolean {
return if (spawnSelector.selects(detail) && contextSelector.selects(ctx)) {
@@ -46,16 +46,16 @@ open class JSONStoreAdapter(
override fun <E, T : PokemonStore<E>> load(file: File, storeClass: Class<out T>, uuid: UUID, registryAccess: RegistryAccess): T? {
return try {
val br = BufferedReader(FileReader(file))
val json = gson.fromJson<JsonObject>(br)
br.close()
val store = try {
storeClass.getConstructor(UUID::class.java, UUID::class.java).newInstance(uuid, uuid)
} catch (exception: NoSuchMethodException) {
storeClass.getConstructor(UUID::class.java).newInstance(uuid)
file.reader().use {
val json = gson.fromJson<JsonObject>(it)
val store = try {
storeClass.getConstructor(UUID::class.java, UUID::class.java).newInstance(uuid, uuid)
} catch (exception: NoSuchMethodException) {
storeClass.getConstructor(UUID::class.java).newInstance(uuid)
}
store.loadFromJSON(json, registryAccess)
store
}
store.loadFromJSON(json, registryAccess)
store
} catch (e: Exception) {
null
}
@@ -42,6 +42,7 @@ abstract class OneToOneFileStoreAdapter<S>(
) : FileStoreAdapter<S>, CobblemonAdapterParent<S>() {
abstract fun save(file: File, serialized: S)
abstract fun <E, T : PokemonStore<E>> load(file: File, storeClass: Class<out T>, uuid: UUID, registryAccess: RegistryAccess): T?
fun getFile(storeClass: Class<out PokemonStore<*>>, uuid: UUID): File {
val className = storeClass.simpleName.lowercase()
val subfolder1 = if (folderPerClass) "$className/" else ""
@@ -56,34 +57,54 @@ abstract class OneToOneFileStoreAdapter<S>(
override fun save(storeClass: Class<out PokemonStore<*>>, uuid: UUID, serialized: S) {
val file = getFile(storeClass, uuid)
val tempFile = File(file.absolutePath + ".temp")
val oldFile = File(file.absolutePath + ".old")
tempFile.createNewFile()
save(tempFile, serialized)
if (file.exists()) {
file.copyTo(oldFile, overwrite = true)
}
tempFile.copyTo(file, overwrite = true)
tempFile.delete()
}
override fun <E : StorePosition, T : PokemonStore<E>> provide(storeClass: Class<T>, uuid: UUID, registryAccess: RegistryAccess): T? {
val file = getFile(storeClass, uuid)
val tempFile = File(file.absolutePath + ".temp")
if (tempFile.exists()) {
try {
val tempLoaded = load(tempFile, storeClass, uuid, registryAccess)
if (tempLoaded != null) {
save(file, serialize(tempLoaded, registryAccess))
return tempLoaded
}
} finally {
tempFile.delete()
}
}
val oldFile = File(file.absolutePath + ".old")
return if (file.exists()) {
return if (file.exists() && file.length() > 0L) {
load(file, storeClass, uuid, registryAccess)
?: let {
LOGGER.error("Pokémon save file for ${storeClass.simpleName} ($uuid) was corrupted. A fresh file will be created.")
storeClass.getConstructor(UUID::class.java).newInstance(uuid)
file.delete()
if (oldFile.exists() && oldFile.length() > 0L) {
var result = load(oldFile, storeClass, uuid, registryAccess) ?: let {
LOGGER.error("Pokémon save file for ${storeClass.simpleName} ($uuid) was corrupted. A fresh file will be created.")
var result = storeClass.getConstructor(UUID::class.java).newInstance(uuid)
save(storeClass, uuid, serialize(result, registryAccess))
oldFile.delete()
return result
}
LOGGER.warn("Loading old Pokémon save file for ${storeClass.simpleName} ($uuid) due to corruption of current file.")
oldFile.copyTo(file, overwrite = true)
result
}
else {
storeClass.getConstructor(UUID::class.java).newInstance(uuid)
var result = storeClass.getConstructor(UUID::class.java).newInstance(uuid)
save(storeClass, uuid, serialize(result, registryAccess))
oldFile.delete()
result
}
}
} else {
file.delete()
if (oldFile.exists() && oldFile.length() > 0L) {
var result = load(oldFile, storeClass, uuid, registryAccess) ?: let {
oldFile.delete()
return null
}
oldFile.copyTo(file, overwrite = true)
result
}
null
}
}
@@ -8,10 +8,12 @@
package com.cobblemon.mod.common.api.storage.player.adapter
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.storage.player.InstancedPlayerData
import com.cobblemon.mod.common.api.storage.player.PlayerInstancedDataStoreType
import net.minecraft.server.MinecraftServer
import net.minecraft.world.level.storage.LevelResource
import java.io.File
import java.nio.file.Path
import java.util.UUID
@@ -35,15 +37,70 @@ abstract class FileBasedPlayerDataStoreBackend<T : InstancedPlayerData>(
savePath = server.getWorldPath(LevelResource.PLAYER_DATA_DIR).parent
}
//TODO: Set file extension to be a field
fun getSubFile(uuid: UUID): String {
return if (useNestedStructure) {
"${uuid.toString().substring(0, 2)}/$uuid.$fileExt"
protected fun postSaveFileMoving(playerData: T) {
val tempFile = filePath(playerData.uuid, TEMPORARY_FILE_EXTENSION)
val oldFile = filePath(playerData.uuid, OLD_FILE_EXTENSION)
val file = filePath(playerData.uuid)
if (file.exists()) {
file.copyTo(oldFile, overwrite = true)
}
tempFile.copyTo(file, overwrite = true)
tempFile.delete()
}
protected fun loadWithFallback(uuid: UUID, loadFunction: (File) -> T): T {
val playerFile = filePath(uuid)
val playerFileOld = filePath(uuid, OLD_FILE_EXTENSION)
playerFile.parentFile.mkdirs()
val loadFallback: () -> T = {
playerFile.delete()
if (playerFileOld.exists() && playerFileOld.length() > 0L) {
try {
var result = loadFunction(playerFileOld)
playerFileOld.copyTo(playerFile)
Cobblemon.LOGGER.debug("Loaded .old {} for {}", subfolder, uuid)
result
} catch (e: Exception) {
Cobblemon.LOGGER.error("Failed to load .old $subfolder for $uuid due to ${e.message}. Data is lost")
Cobblemon.LOGGER.error(e)
playerFileOld.delete()
defaultData.invoke(uuid).also(::save)
}
}
else {
Cobblemon.LOGGER.error(".old File $subfolder for $uuid is corrupt or missing. Data is lost")
playerFileOld.delete()
defaultData.invoke(uuid).also(::save)
}
}
return if (playerFile.exists() && playerFile.length() > 0L) {
try {
loadFunction(playerFile)
}
catch (e: Exception) {
Cobblemon.LOGGER.warn("Failed to load $subfolder for $uuid due to ${e.message}")
Cobblemon.LOGGER.warn(e)
loadFallback()
}
} else {
"$uuid.$fileExt"
loadFallback()
}.also { it.initialize() }
}
@JvmOverloads
fun getSubFile(uuid: UUID, extension: String? = null): String {
return if (useNestedStructure) {
"${uuid.toString().substring(0, 2)}/$uuid.$fileExt${if (extension != null) ".$extension" else ""}"
} else {
"$uuid.$fileExt.${if (extension != null) ".$extension" else ""}"
}
}
fun filePath(uuid: UUID) = savePath.resolve("$subfolder/${getSubFile(uuid)}").toFile()
@JvmOverloads
fun filePath(uuid: UUID, extension: String? = null): File = savePath.resolve("$subfolder/${getSubFile(uuid, extension)}").toFile()
companion object {
const val OLD_FILE_EXTENSION = "old"
const val TEMPORARY_FILE_EXTENSION = "tmp"
}
}
@@ -28,29 +28,26 @@ abstract class JsonBackedPlayerDataStoreBackend<T : InstancedPlayerData>(
abstract val classToken: TypeToken<T>
override fun save(playerData: T) {
val file = filePath(playerData.uuid)
file.parentFile.mkdirs()
val pw = PrintWriter(filePath(playerData.uuid))
pw.write(gson.toJson(playerData))
pw.flush()
pw.close()
val fileTmp = filePath(playerData.uuid, TEMPORARY_FILE_EXTENSION)
fileTmp.parentFile.mkdirs()
fileTmp.printWriter().use { pw ->
pw.write(gson.toJson(playerData))
}
postSaveFileMoving(playerData)
}
override fun load(uuid: UUID): T {
val playerFile = filePath(uuid)
playerFile.parentFile.mkdirs()
return if (playerFile.exists() && playerFile.length() > 0L) {
gson.fromJson(BufferedReader(FileReader(playerFile)), classToken).also {
// Resolves old data that's missing new properties
val newProps = it::class.memberProperties.filterIsInstance<KMutableProperty<*>>().filter { member -> member.getter.call(it) == null }
if (newProps.isNotEmpty()) {
val defaultData = defaultData(uuid)
newProps.forEach { member -> member.setter.call(it, member.getter.call(defaultData)) }
return loadWithFallback(uuid) {
it.reader().use { reader ->
gson.fromJson(reader, classToken).also {
// Resolves old data that's missing new properties
val newProps = it::class.memberProperties.filterIsInstance<KMutableProperty<*>>().filter { member -> member.getter.call(it) == null }
if (newProps.isNotEmpty()) {
val defaultData = defaultData(uuid)
newProps.forEach { member -> member.setter.call(it, member.getter.call(defaultData)) }
}
}
}
} else {
defaultData.invoke(uuid).also(::save)
}.also { it.initialize() }
}
}
}
@@ -24,29 +24,24 @@ abstract class NbtBackedPlayerData<T : InstancedPlayerData>(
type: PlayerInstancedDataStoreType
) : FileBasedPlayerDataStoreBackend<T>(subfolder, type, "nbt") {
abstract val codec: Codec<T>
override fun save(playerData: T) {
val file = filePath(playerData.uuid)
file.parentFile.mkdirs()
val os = DataOutputStream(FileOutputStream(filePath(playerData.uuid)))
val encodeResult = NbtOps.INSTANCE.withEncoder(codec).apply(playerData)
NbtIo.write(encodeResult.result().get() as CompoundTag, os)
os.flush()
os.close()
val fileTmp = filePath(playerData.uuid, TEMPORARY_FILE_EXTENSION)
fileTmp.parentFile.mkdirs()
val encodeResult = codec.encodeStart(NbtOps.INSTANCE, playerData)
NbtIo.write(encodeResult.result().get() as CompoundTag, fileTmp.toPath())
postSaveFileMoving(playerData)
}
override fun load(uuid: UUID): T {
val playerFile = filePath(uuid)
playerFile.parentFile.mkdirs()
return if (playerFile.exists() && playerFile.length() > 0L) {
val input = NbtIo.read(playerFile.toPath())
val decodeResult = NbtOps.INSTANCE.withDecoder(codec).apply(input)
decodeResult.getPartialOrThrow {
return loadWithFallback(uuid) {
val input = NbtIo.read(it.toPath())
val decodeResult = codec.decode(NbtOps.INSTANCE, input)
decodeResult.getOrThrow {
Cobblemon.LOGGER.error("Error decoding $subfolder for player uuid $uuid")
Cobblemon.LOGGER.error(it)
throw UnsupportedOperationException()
}.first
} else {
defaultData.invoke(uuid).also(::save)
}.also { it.initialize() }
}
}
}
@@ -68,6 +68,8 @@ class WinInstruction(val message: BattleMessage): InterpreterInstruction {
}
}
battle.dispatchGo {
battle.winners = winners
battle.losers = losers
battle.end()
CobblemonEvents.BATTLE_VICTORY.post(BattleVictoryEvent(battle, winners, losers, wasCaught))
ShowdownInterpreter.lastCauser.remove(battle.battleId)
@@ -21,18 +21,18 @@ import com.cobblemon.mod.common.net.messages.server.trade.OfferTradePacket
import com.cobblemon.mod.common.util.cobblemonResource
import com.google.common.collect.ArrayListMultimap
import com.google.common.collect.Multimap
import java.util.UUID
import net.minecraft.client.Minecraft
import net.minecraft.network.chat.Component
import java.util.*
import org.joml.Vector3f
fun createPokemonInteractGui(pokemonID: UUID, canMountShoulder: Boolean): InteractWheelGUI {
fun createPokemonInteractGui(pokemonID: UUID, canMountShoulder: Boolean, canRide: Boolean): InteractWheelGUI {
val mountShoulder = InteractWheelOption(
iconResource = cobblemonResource("textures/gui/interact/icon_shoulder.png"),
tooltipText = "cobblemon.ui.interact.mount.shoulder",
onPress = {
if (canMountShoulder) {
InteractPokemonPacket(pokemonID, true).sendToServer()
InteractPokemonPacket(pokemonID, true, false).sendToServer()
closeGUI()
}
}
@@ -41,15 +41,32 @@ fun createPokemonInteractGui(pokemonID: UUID, canMountShoulder: Boolean): Intera
iconResource = cobblemonResource("textures/gui/interact/icon_held_item.png"),
tooltipText = "cobblemon.ui.interact.give.item",
onPress = {
InteractPokemonPacket(pokemonID, false).sendToServer()
InteractPokemonPacket(pokemonID, false, false).sendToServer()
closeGUI()
}
)
val ride = InteractWheelOption(
iconResource = cobblemonResource("textures/gui/interact/icon_held_item.png"),
tooltipText = "cobblemon.ui.interact.ride",
onPress = {
if (canRide) {
InteractPokemonPacket(pokemonID, false, true).sendToServer()
closeGUI()
}
}
)
val options: Multimap<Orientation, InteractWheelOption> = ArrayListMultimap.create()
options.put(Orientation.TOP_RIGHT, giveItem)
if(canRide) {
options.put(Orientation.BOTTOM_LEFT, ride)
}
if (canMountShoulder) {
options.put(Orientation.TOP_LEFT, mountShoulder)
}
CobblemonEvents.POKEMON_INTERACTION_GUI_CREATION.post(PokemonInteractionGUICreationEvent(pokemonID, canMountShoulder, options))
return InteractWheelGUI(options, Component.translatable("cobblemon.ui.interact.pokemon"))
}
@@ -18,7 +18,7 @@ class GrabbedStorageSlot(
) : StorageSlot(x, y, parent, {}) {
init {
isSelected = true
isSlotSelected = true
}
override fun renderWidget(context: GuiGraphics, mouseX: Int, mouseY: Int, delta: Float) {
@@ -46,7 +46,7 @@ open class StorageSlot(
private val slotOverlayMoveIconResource = cobblemonResource("textures/gui/pasture/pc_slot_icon_move.png")
}
protected var isSelected = false;
protected var isSlotSelected = false;
override fun playDownSound(soundManager: SoundManager) {
}
@@ -84,7 +84,7 @@ open class StorageSlot(
context.disableScissor()
if (!isSelected) {
if (!isSlotSelected) {
// Ensure elements are not hidden behind Pokémon render
matrices.pushPose()
matrices.translate(0.0, 0.0, 100.0)
@@ -129,7 +129,7 @@ open class StorageSlot(
matrices.translate(0.0, 0.0, 500.0)
val config = parent.pcGui.configuration
if (pokemon.tetheringId != null && !isSelected) {
if (pokemon.tetheringId != null && !isSlotSelected) {
if (isStationary()) {
blitk(
matrixStack = matrices,
@@ -15,6 +15,6 @@ import net.minecraft.client.Minecraft
object InteractPokemonUIPacketHandler: ClientNetworkPacketHandler<InteractPokemonUIPacket> {
override fun handle(packet: InteractPokemonUIPacket, client: Minecraft) {
client.setScreen(createPokemonInteractGui(packet.pokemonID, packet.canMountShoulder))
client.setScreen(createPokemonInteractGui(packet.pokemonID, packet.canMountShoulder, packet.canRide))
}
}
@@ -204,8 +204,8 @@ class SnowstormParticle(
val spriteURange = sprite.u1 - sprite.u0
val spriteVRange = sprite.v1 - sprite.v0
val maxU = uvs.startU * spriteURange + sprite.u0
val minU = uvs.endU * spriteURange + sprite.u0
val minU = uvs.startU * spriteURange + sprite.u0
val maxU = uvs.endU * spriteURange + sprite.u0
val minV = uvs.startV * spriteVRange + sprite.v0
val maxV = uvs.endV * spriteVRange + sprite.v0
@@ -51,7 +51,7 @@ open class BedrockActiveAnimation(
headPitch: Float,
intensity: Float
): Boolean {
return animation.run(context, model, state, state.animationSeconds - startedSeconds, limbSwing, limbSwingAmount, ageInTicks, intensity).also {
return animation.run(model, state, state.animationSeconds - startedSeconds, limbSwing, limbSwingAmount, ageInTicks, intensity).also {
if (!it) {
afterAction(context, state)
}
@@ -14,15 +14,17 @@ import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.api.molang.ExpressionLike
import com.cobblemon.mod.common.api.snowstorm.BedrockParticleOptions
import com.cobblemon.mod.common.client.particle.ParticleStorm
import com.cobblemon.mod.common.client.render.MatrixWrapper
import com.cobblemon.mod.common.client.render.models.blockbench.PosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.PosableState
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Bone
import com.cobblemon.mod.common.client.render.models.blockbench.repository.RenderContext
import com.cobblemon.mod.common.util.effectiveName
import com.cobblemon.mod.common.util.genericRuntime
import com.cobblemon.mod.common.util.getString
import com.cobblemon.mod.common.util.math.geometry.toRadians
import com.cobblemon.mod.common.util.resolveDouble
import java.util.SortedMap
import java.util.TreeMap
import net.minecraft.CrashReport
import net.minecraft.ReportedException
import net.minecraft.client.Minecraft
@@ -33,8 +35,6 @@ import net.minecraft.resources.ResourceLocation
import net.minecraft.sounds.SoundEvent
import net.minecraft.world.entity.Entity
import net.minecraft.world.phys.Vec3
import org.joml.Matrix4f
import java.util.*
data class BedrockAnimationGroup(
val formatVersion: String,
@@ -149,7 +149,40 @@ data class BedrockAnimation(
/** Useful to have, gets set after loading the animation. */
var name: String = ""
fun run(context: RenderContext, model: PosableModel, state: PosableState, animationSeconds: Float, limbSwing: Float, limbSwingAmount: Float, ageInTicks: Float, intensity: Float): Boolean {
fun run(
model: PosableModel,
state: PosableState,
animationSeconds: Float,
limbSwing: Float,
limbSwingAmount: Float,
ageInTicks: Float,
intensity: Float
): Boolean {
return run(
model.context,
model.relevantPartsByName,
model.rootPart,
state,
animationSeconds,
limbSwing,
limbSwingAmount,
ageInTicks,
intensity
)
}
fun run(
context: RenderContext?,
relevantPartsByName: Map<String, ModelPart>,
rootPart: Bone?,
state: PosableState,
animationSeconds: Float,
limbSwing: Float,
limbSwingAmount: Float,
ageInTicks: Float,
intensity: Float
): Boolean {
var animationSeconds = animationSeconds
if (shouldLoop) {
animationSeconds %= animationLength.toFloat()
@@ -164,7 +197,7 @@ data class BedrockAnimation(
runtime.environment.setSimpleVariable("age_in_ticks", DoubleValue(ageInTicks.toDouble()))
boneTimelines.forEach { (boneName, timeline) ->
val part = model.relevantPartsByName[boneName] ?: if (boneName == "root_part") (model.rootPart as ModelPart) else null
val part = relevantPartsByName[boneName] ?: if (boneName == "root_part") (rootPart as? ModelPart) else null
if (part !== null) {
if (!timeline.position.isEmpty()) {
val position = timeline.position.resolve(animationSeconds.toDouble(), runtime).scale(intensity.toDouble())
@@ -184,7 +217,7 @@ data class BedrockAnimation(
zRot += rotation.z.toFloat().toRadians()
}
} catch (e: Exception) {
val exception = IllegalStateException("Bad animation for entity: ${(model.context.request(RenderContext.ENTITY))!!.effectiveName().string}", e)
val exception = IllegalStateException("Bad animation for entity: ${(context?.request(RenderContext.ENTITY))?.effectiveName()?.string ?: "unknown entity (riding animation?)"}", e)
val crash = CrashReport("Cobblemon encountered an unexpected crash", exception)
val section = crash.addCategory("Animation Details")
section.setDetail("Pose", state.currentPose!!)
@@ -34,7 +34,7 @@ class BedrockPoseAnimation(val animation: BedrockAnimation) : PoseAnimation() {
}
override fun setupAnim(context: RenderContext, model: PosableModel, state: PosableState, limbSwing: Float, limbSwingAmount: Float, ageInTicks: Float, headYaw: Float, headPitch: Float, intensity: Float) {
animation.run(context, model, state, state.animationSeconds, limbSwing, limbSwingAmount, ageInTicks, intensity)
animation.run(model, state, state.animationSeconds, limbSwing, limbSwingAmount, ageInTicks, intensity)
}
override fun applyEffects(entity: Entity?, state: PosableState, previousSeconds: Float, newSeconds: Float) {
@@ -1,49 +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.gen3
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
import net.minecraft.client.model.geom.ModelPart
import net.minecraft.world.phys.Vec3
class WhiscashModel (root: ModelPart) : PokemonPosableModel(root) {
override val rootPart = root.registerChildWithAllChildren("whiscash")
override var portraitScale = 0.8F
override var portraitTranslation = Vec3(-0.35, 0.4, 0.0)
override var profileScale = 0.6F
override var profileTranslation = Vec3(-0.1, 0.6, 0.0)
lateinit var standing: CobblemonPose
lateinit var walk: CobblemonPose
override val cryAnimation = CryProvider { bedrockStateful("whiscash", "cry") }
override fun registerPoses() {
standing = registerPose(
poseName = "standing",
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES,
animations = arrayOf(
bedrock("whiscash", "water_idle")
)
)
walk = registerPose(
poseName = "walk",
poseTypes = PoseType.MOVING_POSES,
animations = arrayOf(
bedrock("whiscash", "water_idle")
)
)
}
}
@@ -349,7 +349,6 @@ object PokemonModelRepository : VaryingModelRepository<PokemonPosableModel>() {
inbuilt("spewpa", ::SpewpaModel)
inbuilt("vivillon", ::VivillonModel)
inbuilt("barboach", ::BarboachModel)
inbuilt("whiscash", ::WhiscashModel)
inbuilt("combee", ::CombeeModel)
inbuilt("vespiquen", ::VespiquenModel)
inbuilt("lillipup", ::LillipupModel)
@@ -0,0 +1,109 @@
/*
* 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.player
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.client.entity.PokemonClientDelegate
import com.cobblemon.mod.common.client.render.models.blockbench.bedrock.animation.BedrockAnimationRepository
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.util.math.geometry.toRadians
import com.cobblemon.mod.common.util.withPlayerValue
import com.mojang.blaze3d.vertex.PoseStack
import net.minecraft.client.Minecraft
import net.minecraft.client.model.geom.ModelPart
import net.minecraft.client.player.AbstractClientPlayer
import net.minecraft.world.phys.Vec3
import org.joml.Matrix4f
import org.joml.Vector3f
/**
* @author landonjw
*/
object MountedPlayerRenderer {
fun render(player: AbstractClientPlayer, entity: PokemonEntity, stack: PoseStack) {
val camera = Minecraft.getInstance().gameRenderer.mainCamera
val yaw = camera.yRot.toRadians()
val isEntityFlying = false
val offset = getOffset(player, entity, isEntityFlying, yaw)
val matrix = stack.last().pose()
if (isEntityFlying) {
val cameraRotation = camera.rotation().get(Matrix4f())
matrix.mul(cameraRotation)
}
matrix.translate(offset)
if (isEntityFlying) matrix.rotateY(yaw)
player.yBodyRot = player.yHeadRot
}
private fun getOffset(
player: AbstractClientPlayer,
entity: PokemonEntity,
isEntityFlying: Boolean,
yaw: Float
): Vector3f {
val seats = entity.seats
val seatIndex = entity.passengers.indexOf(player).takeIf { it != -1 && it < seats.size } ?: return player.position().toVector3f()
val mountOrigin = (entity.delegate as PokemonClientDelegate).locatorStates["seat${seatIndex+1}"]?.getOrigin() ?: return Vector3f()
val playerOrigin = Vec3(player.x, player.y, player.z)
val offsetOrigin = mountOrigin.subtract(playerOrigin).subtract(0.0, 0.6, 0.0)
val offsetMatrix = Matrix4f()
if (isEntityFlying) offsetMatrix.rotateY(yaw)
offsetMatrix.translate(offsetOrigin.toVector3f())
return offsetMatrix.getTranslation(Vector3f())
}
fun animate(
pokemonEntity: PokemonEntity,
player: AbstractClientPlayer,
relevantPartsByName: Map<String, ModelPart>,
headYaw: Float,
headPitch: Float,
ageInTicks: Float,
limbSwing: Float,
limbSwingAmount: Float
) {
val seatIndex = pokemonEntity.passengers.indexOf(player).takeIf { it != -1 && it < pokemonEntity.seats.size } ?: return
val seat = pokemonEntity.seats[seatIndex]
val animations = seat.poseAnimations.firstOrNull { it.poseTypes.isEmpty() || it.poseTypes.contains(pokemonEntity.getCurrentPoseType()) }?.animations
?: return
val state = pokemonEntity.delegate as PokemonClientDelegate
relevantPartsByName.values.forEach {
it.xRot = 0F
it.yRot = 0F
it.zRot = 0F
}
state.runtime.environment.setSimpleVariable("age_in_ticks", DoubleValue(ageInTicks.toDouble()))
state.runtime.environment.setSimpleVariable("limb_swing", DoubleValue(limbSwing.toDouble()))
state.runtime.environment.setSimpleVariable("limb_swing_amount", DoubleValue(limbSwingAmount.toDouble()))
state.runtime.environment.setSimpleVariable("velocity", DoubleValue(pokemonEntity.deltaMovement.horizontalDistance()))
// TODO add the q.player reference, requires a cached thing or something on the client idk
for (animation in animations) {
val bedrockAnimation = BedrockAnimationRepository.getAnimationOrNull(animation.fileName, animation.animationName) ?: continue
bedrockAnimation.run(
context = null,
relevantPartsByName = relevantPartsByName,
rootPart = null,
state = state,
animationSeconds = state.animationSeconds,
limbSwing = limbSwing,
limbSwingAmount = limbSwingAmount,
ageInTicks = ageInTicks,
intensity = 1F
)
}
}
}
@@ -9,6 +9,7 @@
package com.cobblemon.mod.common.client.render.pokemon
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.Rollable
import com.cobblemon.mod.common.api.pokedex.PokedexEntryProgress
import com.cobblemon.mod.common.client.CobblemonClient
import com.cobblemon.mod.common.client.battle.ClientBallDisplay
@@ -41,7 +42,6 @@ import com.cobblemon.mod.common.util.math.geometry.toRadians
import com.cobblemon.mod.common.util.math.remap
import com.mojang.blaze3d.vertex.PoseStack
import com.mojang.math.Axis
import kotlin.math.*
import net.minecraft.ChatFormatting
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.Font.DisplayMode
@@ -57,10 +57,8 @@ import net.minecraft.resources.ResourceLocation
import net.minecraft.util.Mth
import net.minecraft.world.entity.Entity
import net.minecraft.world.phys.Vec3
import org.joml.Math
import org.joml.Quaternionf
import org.joml.Vector3f
import org.joml.Vector4f
import org.joml.*
import kotlin.math.*
class PokemonRenderer(
context: EntityRendererProvider.Context
@@ -81,6 +79,7 @@ class PokemonRenderer(
private const val SPACE = " "
private const val DISABLE_ROLLING_DEBUG = false
}
val ballContext = RenderContext().also {
@@ -141,7 +140,12 @@ class PokemonRenderer(
modelNow.setLayerContext(buffer, clientDelegate, PokemonModelRepository.getLayers(entity.pokemon.species.resourceIdentifier, clientDelegate))
super.render(entity, entityYaw, partialTicks, poseMatrix, buffer, packedLight)
if (entity.passengers.isNotEmpty()) {
renderRiding(entity, partialTicks, poseMatrix, buffer, packedLight)
}
else {
super.render(entity, entityYaw, partialTicks, poseMatrix, buffer, packedLight)
}
modelNow.green = 1F
modelNow.blue = 1F
@@ -152,6 +156,51 @@ class PokemonRenderer(
// Minecraft.getInstance().bufferBuilders.entityVertexConsumers.draw()
}
fun renderRiding(
entity: PokemonEntity,
partialTicks: Float,
poseMatrix: PoseStack,
buffer: MultiBufferSource,
packedLight: Int
) {
// TODO: This is all broken at the moment, need to figure out proper way to rotate the model according to camera
val driver = entity.firstPassenger ?: return
val rollable = driver as? Rollable ?: return
//val camera = Minecraft.getInstance().gameRenderer.mainCamera
//val isThirdPerson = camera.isDetached
//val vehicleOrigin = entity.position()
//val driverOrigin = if (isThirdPerson) driver.position() else driver.eyePosition
//val offset = driverOrigin.subtract(vehicleOrigin)
poseMatrix.pushPose()
if(!DISABLE_ROLLING_DEBUG && rollable.shouldRoll()){
val yaw = Mth.rotLerp(partialTicks, entity.yBodyRotO, entity.yBodyRot)
val matrix = poseMatrix.last().pose()
val center = Vector3f(0f, entity.bbHeight/2, 0f)
val transformationMatrix = Matrix4f()
transformationMatrix.translate(center)
transformationMatrix.rotate(180f.toRadians() - (rollable.yaw).toRadians(), rollable.upVector, transformationMatrix)
transformationMatrix.rotate((-rollable.pitch).toRadians(), rollable.leftVector, transformationMatrix)
transformationMatrix.rotate((-rollable.roll).toRadians(), rollable.forwardVector, transformationMatrix)
transformationMatrix.translate(center.negate(Vector3f()))
matrix.mul(transformationMatrix)
poseMatrix.mulPose(Axis.YP.rotationDegrees(-(180.0f - yaw)))
}
super.render(entity, 0f, partialTicks, poseMatrix, buffer, packedLight)
poseMatrix.popPose()
}
fun renderTransition(
modelNow: PosableModel,
beamMode: Int,
@@ -457,4 +506,4 @@ class PokemonRenderer(
matrixStack.popPose()
}
}
}
@@ -8,7 +8,9 @@
package com.cobblemon.mod.common.entity
import java.util.EnumSet
import com.cobblemon.mod.common.util.cobblemonResource
import java.util.*
import net.minecraft.resources.ResourceLocation
/**
* The type of a pose. Used for normalizing pose swapping for all models.
@@ -46,5 +48,11 @@ enum class PoseType {
val UI_POSES = EnumSet.of(PROFILE, PORTRAIT)
val MOVING_POSES = EnumSet.of(WALK, SWIM, FLY)
val STATIONARY_POSES = EnumSet.of(STAND, FLOAT, HOVER)
fun identified() : List<ResourceLocation> {
return ALL_POSES.stream()
.map { cobblemonResource(it.name.lowercase(Locale.getDefault())) }
.toList()
}
}
}
+256 -17
View File
@@ -13,6 +13,7 @@ import com.cobblemon.mod.common.CobblemonEntities
import com.cobblemon.mod.common.CobblemonItems
import com.cobblemon.mod.common.CobblemonNetwork.sendPacket
import com.cobblemon.mod.common.CobblemonSounds
import com.cobblemon.mod.common.Rollable
import com.cobblemon.mod.common.api.drop.DropTable
import com.cobblemon.mod.common.api.entity.Despawner
import com.cobblemon.mod.common.api.entity.PokemonSender
@@ -30,7 +31,6 @@ import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.net.serializers.PlatformTypeDataSerializer
import com.cobblemon.mod.common.api.net.serializers.PoseTypeDataSerializer
import com.cobblemon.mod.common.api.net.serializers.StringSetDataSerializer
import com.cobblemon.mod.common.api.pokemon.PokemonSpecies
import com.cobblemon.mod.common.api.pokemon.feature.ChoiceSpeciesFeatureProvider
import com.cobblemon.mod.common.api.pokemon.feature.FlagSpeciesFeature
import com.cobblemon.mod.common.api.pokemon.feature.SpeciesFeatures
@@ -38,6 +38,10 @@ import com.cobblemon.mod.common.api.pokemon.feature.StringSpeciesFeature
import com.cobblemon.mod.common.api.pokemon.status.Statuses
import com.cobblemon.mod.common.api.reactive.ObservableSubscription
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.api.riding.Rideable
import com.cobblemon.mod.common.api.riding.RidingManager
import com.cobblemon.mod.common.api.riding.Seat
import com.cobblemon.mod.common.api.riding.events.SelectDriverEvent
import com.cobblemon.mod.common.api.scheduling.Schedulable
import com.cobblemon.mod.common.api.scheduling.SchedulingTracker
import com.cobblemon.mod.common.api.scheduling.afterOnServer
@@ -80,12 +84,12 @@ import com.cobblemon.mod.common.pokemon.evolution.variants.ItemInteractionEvolut
import com.cobblemon.mod.common.pokemon.feature.StashHandler
import com.cobblemon.mod.common.pokemon.properties.UncatchableProperty
import com.cobblemon.mod.common.util.*
import com.cobblemon.mod.common.util.math.geometry.toRadians
import com.cobblemon.mod.common.world.gamerules.CobblemonGameRules
import com.mojang.serialization.Codec
import java.util.EnumSet
import java.util.Optional
import java.util.UUID
import java.util.*
import java.util.concurrent.CompletableFuture
import kotlin.math.PI
import net.minecraft.core.BlockPos
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.core.registries.Registries
@@ -111,7 +115,6 @@ import net.minecraft.sounds.SoundEvents
import net.minecraft.sounds.SoundSource
import net.minecraft.tags.FluidTags
import net.minecraft.util.Mth
import net.minecraft.util.Mth.clamp
import net.minecraft.world.InteractionHand
import net.minecraft.world.InteractionResult
import net.minecraft.world.damagesource.DamageSource
@@ -143,14 +146,17 @@ import net.minecraft.world.level.gameevent.GameEvent
import net.minecraft.world.level.material.FluidState
import net.minecraft.world.level.pathfinder.PathType
import net.minecraft.world.phys.AABB
import net.minecraft.world.phys.Vec2
import net.minecraft.world.phys.Vec3
import org.joml.Matrix3f
import org.joml.Vector3f
@Suppress("unused")
open class PokemonEntity(
world: Level,
pokemon: Pokemon = Pokemon().apply { isClient = world.isClientSide },
type: EntityType<out PokemonEntity> = CobblemonEntities.POKEMON,
) : ShoulderRidingEntity(type, world), PosableEntity, Shearable, Schedulable, ScannableEntity {
) : ShoulderRidingEntity(type, world), PosableEntity, Shearable, Schedulable, Rideable, ScannableEntity {
companion object {
@JvmStatic val SPECIES = SynchedEntityData.defineId(PokemonEntity::class.java, EntityDataSerializers.STRING)
@JvmStatic val NICKNAME = SynchedEntityData.defineId(PokemonEntity::class.java, EntityDataSerializers.COMPONENT)
@@ -178,7 +184,7 @@ open class PokemonEntity(
const val BATTLE_LOCK = "battle"
const val EVOLUTION_LOCK = "evolving"
fun createAttributes(): AttributeSupplier.Builder = LivingEntity.createLivingAttributes()
fun createAttributes(): AttributeSupplier.Builder = createLivingAttributes()
.add(Attributes.FOLLOW_RANGE)
.add(Attributes.ATTACK_KNOCKBACK)
}
@@ -228,6 +234,8 @@ open class PokemonEntity(
get() = entityData.get(BATTLE_ID).isPresent
val friendship: Int
get() = entityData.get(FRIENDSHIP)
val seats: List<Seat>
get() = form.riding.seats
var drops: DropTable? = null
@@ -237,6 +245,8 @@ open class PokemonEntity(
var enablePoseTypeRecalculation = true
override val riding: RidingManager = RidingManager(this)
/**
* The amount of steps this entity has traveled.
*/
@@ -340,7 +350,7 @@ open class PokemonEntity(
SPECIES -> refreshDimensions()
POSE_TYPE -> {
val value = entityData.get(data) as PoseType
if (value == PoseType.FLY || value == PoseType.HOVER) {
if ((value == PoseType.FLY || value == PoseType.HOVER) && passengers.isEmpty()) {
setNoGravity(true)
} else {
setNoGravity(false)
@@ -450,6 +460,9 @@ open class PokemonEntity(
this.tethering = null
this.pokemon.recall()
}
jumping = false
//This is so that pokemon in the pasture block are ALWAYS in sync with the pokemon box
//Before, pokemon entities in pastures would hold an old ref to a pokemon obj and changes to that would not appear to the underlying file
if (this.tethering != null && age % 20 == 0) {
@@ -522,10 +535,6 @@ open class PokemonEntity(
return super.isInvulnerableTo(damageSource)
}
override fun canRide(vehicle: Entity): Boolean {
return platform == PlatformType.NONE && super.canRide(vehicle)
}
/**
* A utility method that checks if this Pokémon has the [UncatchableProperty.uncatchable] property.
*
@@ -928,7 +937,7 @@ open class PokemonEntity(
if (hand == InteractionHand.MAIN_HAND && player is ServerPlayer && pokemon.getOwnerPlayer() == player) {
if (player.isShiftKeyDown) {
InteractPokemonUIPacket(this.getUUID(), canSitOnShoulder() && pokemon in player.party()).sendToPlayer(
InteractPokemonUIPacket(this.getUUID(), canSitOnShoulder() && pokemon in player.party(), this.canRide(player)).sendToPlayer(
player
)
} else {
@@ -1344,6 +1353,7 @@ open class PokemonEntity(
}
}
override fun travel(movementInput: Vec3) {
val prevBlockPos = this.blockPosition()
if (beamMode != 3) { // Don't let Pokémon move during recall
@@ -1432,8 +1442,7 @@ open class PokemonEntity(
*
* @return If the backing [pokemon] has a non-null [Pokemon.nickname].
*/
override fun hasCustomName(): Boolean =
pokemon.nickname != null && pokemon.nickname?.contents != PlainTextContents.EMPTY
override fun hasCustomName(): Boolean = pokemon.nickname != null && pokemon.nickname?.contents != PlainTextContents.EMPTY
/**
* This method toggles the visibility of the entity name,
@@ -1557,6 +1566,9 @@ open class PokemonEntity(
}
override fun canBeLeashed() = true
// override fun canBeLeashedBy(player: Player): Boolean {
// return this.ownerUuid == null || this.ownerUuid == player.uuid
// }
override fun setLeashedTo(entity: Entity, bl: Boolean) {
super.setLeashedTo(entity, bl)
@@ -1575,6 +1587,234 @@ open class PokemonEntity(
*/
private fun createSidedPokemon(): Pokemon = Pokemon().apply { isClient = this@PokemonEntity.level().isClientSide }
override fun canRide(entity: Entity): Boolean {
return platform == PlatformType.NONE && super.canRide(entity)
}
override fun canAddPassenger(passenger: Entity): Boolean {
return passengers.size < seats.size
}
fun getIsJumping() = jumping
fun setIsJumping(value: Boolean) {
jumping = value
}
override fun tickRidden(driver: Player, movementInput: Vec3) {
super.tickRidden(driver, movementInput)
this.riding.tick(this, driver, movementInput)
val rotation = this.getControlledRotation(driver)
setRot(rotation.y, rotation.x)
this.yHeadRot = this.yRot
this.yBodyRot = this.yRot
this.yRotO = this.yRot
if (this.riding.canJump(this, driver)) {
if (this.onGround()) {
if (this.jumpInputStrength > 0) {
// this.jump(this.jumpStrength, movementInput)
// this.jump()
val f = PI.toFloat() - this.yRot * PI.toFloat() / 180
val jumpVector = riding.jumpVelocity(this, driver, this.jumpInputStrength)
val velocity = jumpVector.yRot(f)
// Rotate the jump vector f degrees around the Y axis
// val velocity = Vec3d(-sin(f) * jumpVector.x, jumpVector.y, cos(f) * jumpVector.z)
this.addDeltaMovement(velocity)
hasImpulse = true
jumping = false
}
this.jumpInputStrength = 0
}
}
// val lookAngle: Vec3 = driver.getLookAngle()
// if (!driver.isNearGround() || lookAngle.y >= 0.3) {
// setBehaviourFlag(PokemonBehaviourFlag.FLYING, true)
// entityData.set(POSE_TYPE, PoseType.HOVER)
//
// val deltaMovement = this.deltaMovement
// this.setDeltaMovement(
// lookAngle.x * 0.1 + (lookAngle.x * 1.5 - deltaMovement.x) * 1,
// lookAngle.y * 0.1 + (lookAngle.y * 1.5 - deltaMovement.y) * 1,
// lookAngle.z * 0.1 + (lookAngle.z * 1.5 - deltaMovement.z) * 1
// )
// }
// else {
// setBehaviourFlag(PokemonBehaviourFlag.FLYING, false)
// this.setDeltaMovement(0.0, 0.0, 0.0)
// }
}
fun Entity.isNearGround(): Boolean {
val blockBelow: BlockPos = this.blockPosition().below()
return this.level().getBlockState(blockBelow).isSolid()
}
// override fun jump() {
//// val vec3d = this.velocity
////
////
////
//// this.setVelocity(vec3d.x, this.jumpVelocity.toDouble(), vec3d.z)
//// if (this.isSprinting) {
//// val f = this.yaw * 0.017453292f
//// this.velocity =
//// velocity.add((-MathHelper.sin(f) * 0.2f).toDouble(), 0.0, (MathHelper.cos(f) * 0.2f).toDouble())
//// }
////
//// this.velocityDirty = true
// }
private fun getControlledRotation(controller: LivingEntity): Vec2 {
return this.riding.controlledRotation(this, controller as Player)
}
override fun onPassengerTurned(entityToUpdate: Entity) {
return this.riding.clampPassengerRotation(this, entityToUpdate as? LivingEntity ?: return)
}
override fun positionRider(passenger: Entity, positionUpdater: MoveFunction) {
if (this.hasPassenger(passenger)) {
val index = passengers.indexOf(passenger).takeIf { it >= 0 && it < seats.size } ?: return
val seat = seats[index]
val seatOffset = seat.getOffset(getCurrentPoseType()).toVector3f()
val center = Vector3f(0f, this.bbHeight/2, 0f)
val seatToCenter = center.sub(seatOffset, Vector3f())
val orientation = (passengers.first() as Rollable).orientation ?: Matrix3f().rotate(-(180f + passenger.yRot).toRadians(), Vector3f(0f, 1f, 0f))
val rotatedOffset = orientation.transform(seatToCenter, Vector3f()).add(center).sub(Vector3f(0f, passenger.bbHeight/2, 0f))
positionUpdater.accept(passenger, this.x + rotatedOffset.x, this.y + rotatedOffset.y, this.z + rotatedOffset.z)
if (passenger is LivingEntity) {
this.riding.updatePassengerRotation(this, passenger)
this.riding.clampPassengerRotation(this, passenger)
}
}
}
override fun getControllingPassenger(): LivingEntity? {
val riders = this.passengers.filterIsInstance<LivingEntity>()
if (riders.isEmpty()) {
riding.states.clear()
return null
}
val event = SelectDriverEvent(riders.toSet())
val owner = riders.find { it.uuid == ownerUUID }
if (owner != null) {
event.suggest(owner, 0)
}
CobblemonEvents.SELECT_DRIVER.emit(event)
return event.result()
}
override fun getDismountLocationForPassenger(passenger: LivingEntity): Vec3 {
// val seat = this.riding.seats.firstOrNull { it.occupant() == passenger }
// seat?.dismount()
return super.getDismountLocationForPassenger(passenger)
}
override fun getRiddenInput(controller: Player, movementInput: Vec3): Vec3 {
return this.riding.velocity(this, controller, movementInput)
}
override fun getRiddenSpeed(controller: Player): Float {
return this.riding.speed(this, controller)
}
var jumpInputStrength: Int = 0 // move this
override fun onPlayerJump(strength: Int) {
// See if this controls the hot bar element
var strength = strength
if (strength < 0) {
strength = 0
} else {
// this.jumping = true
// update anger? hunwah
}
this.jumpInputStrength = strength
if (strength >= 90) {
// this.jumpStrength = 1.0f
} else {
// this.jumpStrength = 0.4f + 0.4f * strength.toFloat() / 90.0f
}
}
override fun canJump(): Boolean {
return true
}
override fun handleStartJump(height: Int) {
this.jumping = true
}
fun side() = if (delegate is PokemonServerDelegate) "SERVER" else "CLIENT"
override fun handleStopJump() {
jumping = false
// Set back to land pose type?
}
/*
These two functions (fluids and ground) need to become riding configurable and
dependent. Also, the onGround() function seems to affect quite a few spots in
code and would likely need to be changed to be something more robust instead of
just overriding this method.
*/
override fun isAffectedByFluids(): Boolean {
var fluidAffected = true
if( this.hasControllingPassenger() )
{
//Change this so it calls something from the controller to check
//if the specific controller wants to ignore fluid physics since
//not every single one will want to
fluidAffected = false
}
return fluidAffected
}
//this seems a bit hacky to me seeing as how many spots in the base classes its used.
//However, there are odd interactions with the controllers when they are meant to be
//flying or swimming but they are touching the ground and this needs to be prevented.
//Having it be able to be turned off by the flying or swimming controllers is the
//temp solution I have found.
override fun onGround() : Boolean
{
if( riding.turnOffOnGround( this ) )
{
return false
}
return super.onGround()
}
//I think already mentioned but should maybe be riding controller configurable
override fun dismountsUnderwater(): Boolean {
return false
}
override fun getDefaultGravity(): Double {
val regularGravity = super.getDefaultGravity()
if (this.passengers.isEmpty()) {
return regularGravity
}
return riding.gravity(this, regularGravity) ?: regularGravity
}
/**
* A utility method to resolve the [Codec] of [Pokemon] aware if the [world] is client sided or not.
*
@@ -1597,5 +1837,4 @@ open class PokemonEntity(
override fun resolveEntityScan(): LivingEntity {
return this
}
}
}
@@ -196,7 +196,7 @@ class PokemonServerDelegate : PokemonSideDelegate {
}
fun updatePoseType() {
if (!entity.enablePoseTypeRecalculation) {
if (!entity.enablePoseTypeRecalculation || entity.passengers.isNotEmpty()) {
return
}
@@ -0,0 +1,33 @@
/*
* 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.gametest
import com.cobblemon.mod.common.CobblemonEntities
import com.cobblemon.mod.common.api.pokemon.PokemonProperties.Companion.parse
import com.cobblemon.mod.common.api.pokemon.stats.Stats
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import net.minecraft.core.BlockPos
import net.minecraft.gametest.framework.GameTest
import net.minecraft.gametest.framework.GameTestHelper
class CobblemonGameTests {
@GameTest(template = "")
fun spawnBidoof(context: GameTestHelper) {
context.succeedWhen {
val bidoof = parse("bidoof").create()
bidoof.ivs[Stats.ATTACK] = 31
val target = BlockPos(context.relativePos(BlockPos(0, 0, 0)))
context.assertEntityPresent(CobblemonEntities.POKEMON)
context.assertEntityData(target, CobblemonEntities.POKEMON, PokemonEntity::pokemon, bidoof)
}
}
}
@@ -0,0 +1,34 @@
/*
* 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.orientation
import com.cobblemon.mod.common.api.net.NetworkPacket
import com.cobblemon.mod.common.util.*
import net.minecraft.network.RegistryFriendlyByteBuf
import org.joml.Matrix3f
class S2CUpdateOrientationPacket internal constructor(val entityId: Int, val orientation: Matrix3f?) : NetworkPacket<S2CUpdateOrientationPacket> {
override val id = ID
override fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeInt(entityId)
buffer.writeBoolean(orientation != null)
if (orientation != null) {
buffer.writeMatrix3f(orientation)
}
}
companion object {
val ID = cobblemonResource("s2c_update_orientation")
fun decode(buffer: RegistryFriendlyByteBuf): S2CUpdateOrientationPacket {
val entityId = buffer.readInt()
val orientation = if (buffer.readBoolean()) buffer.readMatrix3f() else null
return S2CUpdateOrientationPacket(entityId, orientation)
}
}
}
@@ -26,7 +26,7 @@ import net.minecraft.network.RegistryFriendlyByteBuf
* @author Hiroku
* @since June 20th, 2022
*/
class OpenPCPacket(val storeID: UUID, val box: Int = 1) : NetworkPacket<OpenPCPacket> {
class OpenPCPacket(val storeID: UUID, val box: Int = 0) : NetworkPacket<OpenPCPacket> {
override val id = ID
@@ -24,17 +24,18 @@ import java.util.UUID
* @author Village
* @since January 7th, 2023
*/
class InteractPokemonUIPacket(val pokemonID: UUID, val canMountShoulder: Boolean): NetworkPacket<InteractPokemonUIPacket> {
class InteractPokemonUIPacket(val pokemonID: UUID, val canMountShoulder: Boolean, val canRide: Boolean): NetworkPacket<InteractPokemonUIPacket> {
override val id = ID
override fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeUUID(pokemonID)
buffer.writeBoolean(canMountShoulder)
buffer.writeBoolean(canRide)
}
companion object {
val ID = cobblemonResource("interact_pokemon_ui")
fun decode(buffer: RegistryFriendlyByteBuf) = InteractPokemonUIPacket(buffer.readUUID(), buffer.readBoolean())
fun decode(buffer: RegistryFriendlyByteBuf) = InteractPokemonUIPacket(buffer.readUUID(), buffer.readBoolean(), buffer.readBoolean())
}
}
@@ -0,0 +1,34 @@
/*
* 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.orientation
import com.cobblemon.mod.common.api.net.NetworkPacket
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.readMatrix3f
import com.cobblemon.mod.common.util.writeMatrix3f
import net.minecraft.network.RegistryFriendlyByteBuf
import org.joml.Matrix3f
class C2SUpdateOrientationPacket internal constructor(val orientation: Matrix3f?) : NetworkPacket<C2SUpdateOrientationPacket> {
override val id = ID
override fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeBoolean(orientation != null)
if (orientation != null) {
buffer.writeMatrix3f(orientation)
}
}
companion object {
val ID = cobblemonResource("c2s_update_orientation")
fun decode(buffer: RegistryFriendlyByteBuf): C2SUpdateOrientationPacket {
val orientation = if (buffer.readBoolean()) buffer.readMatrix3f() else null
return C2SUpdateOrientationPacket(orientation)
}
}
}
@@ -24,14 +24,15 @@ import java.util.UUID
* @author Village
* @since January 7th, 2023
*/
class InteractPokemonPacket(val pokemonID: UUID, val mountShoulder: Boolean) : NetworkPacket<InteractPokemonPacket> {
class InteractPokemonPacket(val pokemonID: UUID, val mountShoulder: Boolean, val ride: Boolean) : NetworkPacket<InteractPokemonPacket> {
override val id = ID
override fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeUUID(pokemonID)
buffer.writeBoolean(mountShoulder)
buffer.writeBoolean(ride)
}
companion object {
val ID = cobblemonResource("interact_pokemon")
fun decode(buffer: RegistryFriendlyByteBuf) = InteractPokemonPacket(buffer.readUUID(), buffer.readBoolean())
fun decode(buffer: RegistryFriendlyByteBuf) = InteractPokemonPacket(buffer.readUUID(), buffer.readBoolean(), buffer.readBoolean())
}
}
@@ -0,0 +1,23 @@
/*
* 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.orientation
import com.cobblemon.mod.common.Rollable
import com.cobblemon.mod.common.api.net.ServerNetworkPacketHandler
import com.cobblemon.mod.common.net.messages.server.orientation.C2SUpdateOrientationPacket
import net.minecraft.server.MinecraftServer
import net.minecraft.server.level.ServerPlayer
object OrientationPacketHandler : ServerNetworkPacketHandler<C2SUpdateOrientationPacket> {
override fun handle(packet: C2SUpdateOrientationPacket, server: MinecraftServer, player: ServerPlayer) {
if (player is Rollable) {
player.updateOrientation { _ -> packet.orientation }
}
}
}
@@ -24,9 +24,11 @@ object InteractPokemonHandler : ServerNetworkPacketHandler<InteractPokemonPacket
return
}
pokemonEntity.tryMountingShoulder(player)
} else if (packet.ride) {
player.startRiding(pokemonEntity)
} else {
pokemonEntity.offerHeldItem(player, player.mainHandItem)
}
}
}
}
}
@@ -28,6 +28,7 @@ import com.cobblemon.mod.common.api.pokemon.experience.ExperienceGroup
import com.cobblemon.mod.common.api.pokemon.experience.ExperienceGroups
import com.cobblemon.mod.common.api.pokemon.moves.Learnset
import com.cobblemon.mod.common.api.pokemon.stats.Stat
import com.cobblemon.mod.common.api.riding.RidingProperties
import com.cobblemon.mod.common.api.types.ElementalType
import com.cobblemon.mod.common.api.types.ElementalTypes
import com.cobblemon.mod.common.entity.PoseType
@@ -96,6 +97,8 @@ class FormData(
private var _height: Float? = null,
@SerializedName("weight")
private var _weight: Float? = null,
@SerializedName("riding")
private var _riding: RidingProperties? = null,
val requiredMove: String? = null,
val requiredItem: String? = null,
/** For forms that can accept different items (e.g. Arceus-Grass: Meadow Plate or Grassium-Z). */
@@ -172,6 +175,8 @@ class FormData(
val eggGroups: Set<EggGroup>
get() = _eggGroups ?: species.eggGroups
val riding: RidingProperties
get() = _riding ?: species.riding
/**
* The height in decimeters
@@ -293,6 +298,7 @@ class FormData(
pb.writeString(ability.template.name)
}
}
buffer.writeNullable(_riding) { pb, riding -> riding.encode(buffer) }
}
override fun decode(buffer: RegistryFriendlyByteBuf) {
@@ -329,6 +335,7 @@ class FormData(
}.forEach { add(Priority.NORMAL, it) }
}
}
this._riding = buffer.readNullable { pb -> RidingProperties.decode(buffer) }
}
/**
@@ -9,6 +9,7 @@
package com.cobblemon.mod.common.pokemon
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.CobblemonBuildDetails
import com.cobblemon.mod.common.CobblemonNetwork.sendPacketToPlayers
import com.cobblemon.mod.common.CobblemonSounds
import com.cobblemon.mod.common.api.abilities.Abilities
@@ -58,6 +59,8 @@ import com.cobblemon.mod.common.api.reactive.Observable
import com.cobblemon.mod.common.api.reactive.SettableObservable
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.api.scheduling.afterOnServer
import com.cobblemon.mod.common.api.storage.InvalidSpeciesException
import com.cobblemon.mod.common.api.riding.RidingProperties
import com.cobblemon.mod.common.api.storage.StoreCoordinates
import com.cobblemon.mod.common.api.storage.party.NPCPartyStore
import com.cobblemon.mod.common.api.storage.party.PlayerPartyStore
@@ -539,6 +542,9 @@ open class Pokemon : ShowdownIdentifiable {
*/
internal var heldItem: ItemStack = ItemStack.EMPTY
val riding: RidingProperties
get() = this.form.riding
init {
storeCoordinates.subscribe { if (it != null && it.store !is PCStore && this.tetheringId != null) afterOnServer(seconds = 0.05F) { this.tetheringId = null } }
storeCoordinates.subscribe {
@@ -548,6 +554,7 @@ open class Pokemon : ShowdownIdentifiable {
}
}
open fun getStat(stat: Stat) = Cobblemon.statProvider.getStatForPokemon(this, stat)
/**
@@ -31,6 +31,7 @@ import com.cobblemon.mod.common.api.pokemon.experience.ExperienceGroups
import com.cobblemon.mod.common.api.pokemon.moves.Learnset
import com.cobblemon.mod.common.api.pokemon.stats.Stat
import com.cobblemon.mod.common.api.storage.InvalidSpeciesException
import com.cobblemon.mod.common.api.riding.RidingProperties
import com.cobblemon.mod.common.api.types.ElementalType
import com.cobblemon.mod.common.api.types.ElementalTypes
import com.cobblemon.mod.common.entity.PoseType.Companion.FLYING_POSES
@@ -123,6 +124,9 @@ class Species : ClientDataSynchronizer<Species>, ShowdownIdentifiable {
var forms = mutableListOf<FormData>()
private set
var riding: RidingProperties = RidingProperties()
private set
val standardForm by lazy { FormData(_evolutions = this.evolutions).initialize(this) }
var labels = hashSetOf<String>()
@@ -249,6 +253,8 @@ class Species : ClientDataSynchronizer<Species>, ShowdownIdentifiable {
pb.writeBoolean(ability is CommonAbility)
pb.writeString(ability.template.name)
}
this.riding.encode(buffer)
}
override fun decode(buffer: RegistryFriendlyByteBuf) {
@@ -290,6 +296,7 @@ class Species : ClientDataSynchronizer<Species>, ShowdownIdentifiable {
pool.add(Priority.NORMAL, it)
}
}
this.riding = RidingProperties.decode(buffer)
this.initialize()
}
@@ -0,0 +1,312 @@
/*
* 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.riding.controllers
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.Rollable
import com.cobblemon.mod.common.api.riding.controller.RideController
import com.cobblemon.mod.common.api.riding.controller.posing.PoseOption
import com.cobblemon.mod.common.api.riding.controller.posing.PoseProvider
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.pokemon.riding.controllers.HelicopterAirController.Companion.ROTATION_LIMIT
import com.cobblemon.mod.common.util.asExpression
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.resolveFloat
import com.cobblemon.mod.common.util.withQueryValue
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
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.*
class BirdAirController : RideController {
override val key = KEY
override val poseProvider = PoseProvider(PoseType.HOVER)
.with(PoseOption(PoseType.FLY) { it.deltaMovement.horizontalDistance() > 0.1 })
override val condition: (PokemonEntity) -> Boolean = { true }
var jumpVector = listOf("0".asExpression(), "0.3".asExpression(), "0".asExpression())
private set
var gravity: Expression = "0".asExpression()
private set
var horizontalAcceleration: Expression = "0.1".asExpression()
private set
var verticalAcceleration: Expression = "0.1".asExpression()
private set
var speed: Expression = "1.0".asExpression()
private set
var lastVelocity = Vec3(0.0,0.0,0.0)
private set
var maxSpeed = 0.0
private set
override fun speed(entity: PokemonEntity, driver: Player): Float {
var drivingForce = driver.zza
val maxPropelSpeed = 0.5
var maxGlideSpeed = 1.0
var glideSpeedChange = 0.01
//speed up and slow down based on input
if( drivingForce > 0 && maxSpeed < maxPropelSpeed)
{
maxSpeed += 0.02
}
else if ( drivingForce < 0)
{
maxSpeed = max( maxSpeed - 0.1, 0.0)
}
val rollable = driver as? Rollable
if ( rollable != null )
{
maxGlideSpeed *= abs(sin(Math.toRadians( rollable.pitch.toDouble() )))
//Larger speed change the larger the pitch is.
glideSpeedChange *= sin(Math.toRadians( rollable.pitch.toDouble() ))
//TODO: Possibly create a deadzone around parallel where speed isn't taken away from?
if( glideSpeedChange <= 0.0 )
{
//Ensures that a propelling force is still able to be applied when
//climbing in height
if( drivingForce <= 0 || maxSpeed > maxPropelSpeed )
{
//speed decrease should be 2x speed increase?
maxSpeed = max( maxSpeed + glideSpeedChange*2, 0.0)
}
}
else
{
// only add to the speed if it hasn't exceeded the current
//glide angles maximum amount of speed that it can give.
if( maxSpeed < maxGlideSpeed )
{
maxSpeed = max( maxSpeed + glideSpeedChange, maxGlideSpeed)
}
}
}
println(maxSpeed)
return 1.0f * maxSpeed.toFloat()
}
override fun rotation(entity: PokemonEntity, driver: LivingEntity): Vec2 {
return Vec2(driver.xRot * 0.5f, driver.yRot)
}
override fun velocity(entity: PokemonEntity, driver: Player, input: Vec3): Vec3 {
val f = driver.xxa * 0.2f
var drivingForce = driver.zza
//if (drivingForce < 0.0f) {
// drivingForce = -0.25f
//}
drivingForce = 1.0f
{
//Always push forward
drivingForce = 1.0f
}
/*
if (!entity.isInWater && !entity.isUnderWater)
{
lastVelocity = Vec3(lastVelocity.x, -1.0, lastVelocity.z)
return lastVelocity
}
*/
var leftForce = 0.0
var upForce = 0.0
var forwardForce = 0.0
val rollable = driver as? Rollable
if( rollable != null ) {
//Likely should just be a check of the speed/max_speed instead of mult by driving force
/*
if( drivingForce = 0.0 )
{
leftForce = -1.0 * drivingForce * sin(Math.toRadians( rollable.roll.toDouble() ) )
upForce
}*/
leftForce = -1.0 * drivingForce * sin(Math.toRadians( rollable.roll.toDouble() ) )
upForce = drivingForce * -1.0 * sin(Math.toRadians( rollable.pitch.toDouble() ))
//limit how fast you can descend?
upForce *= 1.0
forwardForce = drivingForce * cos(Math.toRadians( rollable.pitch.toDouble() ))
}
//TODO: Add in an upwards and downwards force when pressing space maybe?
//Leave out tap to flap right now
/*
var jumpVector = Vec3.ZERO
if (entity.jumpInputStrength > 0) {
val runtime = getRuntime(entity)
runtime.environment.query.addFunction("jump_strength") { DoubleValue(entity.jumpInputStrength.toDouble()) }
val jumpForces = this.jumpVector.map { runtime.resolveFloat(it) }
jumpVector = Vec3(jumpForces[0].toDouble(), jumpForces[1].toDouble(), jumpForces[2].toDouble())
entity.jumpInputStrength = 0
entity.addDeltaMovement(jumpVector)
}
*/
val velocity = Vec3(leftForce, upForce, forwardForce)
return velocity
}
override fun angRollVel(entity: PokemonEntity, driver: Player): Vec3 {
val rollable = driver as? Rollable
//In degrees per second? It was supposed to be I think but
//I have messed something up
val rotationChangeRate = 3.0
if( rollable != null ) {
var yawForce = rotationChangeRate * sin( Math.toRadians( rollable.roll.toDouble() ))
//for a bit of correction on the rolls limit it to a quarter the amount
var pitchForce = -0.25 * rotationChangeRate * abs(sin( Math.toRadians( rollable.roll.toDouble() )))
//limit rotation modulation when pitched up heavily or pitched down heavily
yawForce *= abs(cos( Math.toRadians( rollable.pitch.toDouble() )))
pitchForce *= abs(cos( Math.toRadians( rollable.pitch.toDouble() )))
//Create a deadzone for easier leveling out
if( rollable.roll <= 5.0 && rollable.roll >= -5.0)
{
yawForce = 0.0
pitchForce = 0.0
}
return Vec3( yawForce, pitchForce, 0.0)
}
/*
val rotLimit = 15.0
var rollForce = -1.0 * driver.xxa * rotationChangeRate
//TODO: Fix accumulated movement causing pitch and roll out of set bounds
if( rollable != null ) {
//If the roll or pitch have exceeded the limit then do not modulate that
//rotation in that direction further
val rotLim = 30.0
rollForce *= 1.0.pow(-1.0 * (abs(rollable.roll.toDouble()) / rotLimit))
if( rollable.roll >= rotLimit && rollForce > 0.0)
{
rollForce = 0.0;
}
if( rollable.roll <= -rotLimit && rollForce < 0.0)
{
rollForce = 0.0;
}
//Ignore x,y,z its angular velocity:
//yaw, pitch, roll
return Vec3( 0.0, 0.0, rollForce)
}
*/
return Vec3(0.0, 0.0, 0.0)
}
override fun rotationOnMouseXY( entity: PokemonEntity, driver: Player, yMouse: Double, xMouse: Double ){
if(driver !is Rollable) return
val rollable = driver as Rollable
val rotLimit = 65.0
val nextRollRot = rollable.roll + xMouse.toFloat()
if( xMouse > 0 )
{
if( rollable.roll > rotLimit / 3 )
{
val adjustedX = 0.5* xMouse * ( (rotLimit - rollable.roll) / ( rotLimit) )
rollable.rotate(0.0f, yMouse.toFloat(), adjustedX.toFloat() )
return
}
}else{
if( rollable.roll < -1.0 * rotLimit / 3 )
{
val adjustedX = 0.5* xMouse * ( (rotLimit + rollable.roll) / ( rotLimit) )
rollable.rotate(0.0f, yMouse.toFloat(), adjustedX.toFloat() )
return
}
}
//Ignore x,y,z its angular velocity:
//yaw, pitch, roll
rollable.rotate(0.0f, yMouse.toFloat(), 0.5f * xMouse.toFloat() )
}
override fun canJump(
entity: PokemonEntity,
driver: Player
): Boolean {
return true
}
override fun jumpForce(
entity: PokemonEntity,
driver: Player,
jumpStrength: Int
): Vec3 {
return Vec3.ZERO
}
//Going to use my own gravity calculations for now.
override fun gravity(entity: PokemonEntity, regularGravity: Double): Double {
return 0.0
}
override fun shouldRoll(entity: PokemonEntity) = true
override fun useMouseInputRoll(entity: PokemonEntity): Boolean = false
override fun encode(buffer: RegistryFriendlyByteBuf) {
super.encode(buffer)
buffer.writeString(gravity.toString())
buffer.writeString(horizontalAcceleration.toString())
buffer.writeString(verticalAcceleration.toString())
buffer.writeString(speed.toString())
buffer.writeDouble(maxSpeed)
buffer.writeDouble(this.lastVelocity.x)
buffer.writeDouble(this.lastVelocity.y)
buffer.writeDouble(this.lastVelocity.z)
}
override fun decode(buffer: RegistryFriendlyByteBuf) {
gravity = buffer.readString().asExpression()
horizontalAcceleration = buffer.readString().asExpression()
verticalAcceleration = buffer.readString().asExpression()
speed = buffer.readString().asExpression()
this.maxSpeed = buffer.readDouble()
val x = buffer.readDouble()
val y = buffer.readDouble()
val z = buffer.readDouble()
this.lastVelocity = Vec3(x, y, z)
}
companion object {
val KEY = cobblemonResource("air/bird")
}
}
@@ -0,0 +1,197 @@
/*
* 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.riding.controllers
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.Rollable
import com.cobblemon.mod.common.api.riding.controller.RideController
import com.cobblemon.mod.common.api.riding.controller.posing.PoseOption
import com.cobblemon.mod.common.api.riding.controller.posing.PoseProvider
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.pokemon.Pokemon
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
import net.minecraft.world.phys.Vec2
import net.minecraft.world.phys.Vec3
import net.minecraft.world.phys.shapes.Shapes
import kotlin.math.sin
import kotlin.math.sqrt
class DolphinController : RideController {
companion object {
val KEY: ResourceLocation = cobblemonResource("swim/dolphin")
}
var canJump = "true".asExpression()
private set
var jumpVector = listOf("0".asExpression(), "0.3".asExpression(), "0".asExpression())
private set
var speed = "1.0".asExpression()
private set
var driveFactor = "1.0".asExpression()
private set
var reverseDriveFactor = "0.25".asExpression()
private set
var strafeFactor = "0.2".asExpression()
private set
var lastVelocity = Vec3(0.0,0.0,0.0)
private set
private val rollSmoother = SmoothDouble()
override val key: ResourceLocation = KEY
override val poseProvider: PoseProvider = PoseProvider(PoseType.FLOAT)
.with(PoseOption(PoseType.SWIM) { it.entityData.get(PokemonEntity.MOVING) })
override val condition: (PokemonEntity) -> Boolean = { entity ->
//If there are only fluid blocks or air block below the ride
//or if the entity is in water then activate the controller
Shapes.create(entity.boundingBox).blockPositionsAsListRounded().any {
if (it.y.toDouble() == (entity.position().y)) {
val blockState = entity.level().getBlockState(it.below())
return@any (blockState.isAir || !blockState.fluidState.isEmpty ) ||
(entity.isInWater || entity.isUnderWater)
}
true
}
}
override fun speed(entity: PokemonEntity, driver: Player): Float {
return getRuntime(entity).resolveFloat(speed)
}
override fun rotation(entity: PokemonEntity, driver: LivingEntity): Vec2 {
return Vec2(driver.xRot * 0.5f, driver.yRot )
}
override fun gravity(entity: PokemonEntity, regularGravity: Double): Double? {
return 0.0
}
override fun velocity(entity: PokemonEntity, driver: Player, input: Vec3): Vec3 {
val runtime = getRuntime(entity)
if (!entity.isInWater && !entity.isUnderWater)
{
lastVelocity = Vec3(lastVelocity.x, -1.0, lastVelocity.z)
return lastVelocity
}
val driveFactor = runtime.resolveFloat(this.driveFactor)
val strafeFactor = runtime.resolveFloat(this.strafeFactor)
val f = driver.xxa * strafeFactor
var g = driver.zza * driveFactor
if (g <= 0.0f) {
g *= runtime.resolveFloat(this.reverseDriveFactor)
}
//Get current angle looking up or down
//to determine how much the entity rises
//or falls
val currXRot = driver.xRot.toDouble()
//has to be flipped
val yComp = -1.0f * g.toDouble() * sin(Math.toRadians(currXRot))
//Get roll to add a left and right strafe during roll
//Not sure if this is desired? Will need to mess around with this
//a bit more
var zComp = 0.0
val rollable = driver as? Rollable
val currRoll = rollable?.roll
if (currRoll != null)
{
zComp = -1.0 * g.toDouble() * sin(Math.toRadians( currRoll.toDouble() ) )
}
val currVelocity = Vec3(zComp, yComp , g.toDouble())
lastVelocity = currVelocity
return currVelocity
}
override fun angRollVel(entity: PokemonEntity, driver: Player): Vec3 {
if (!entity.isInWater && !entity.isUnderWater)
{
return Vec3(0.0, 0.0, 0.0)
}
val rollable = driver as? Rollable
//this should be changed to be speed maybe?
val movingForce = driver.zza
if( rollable != null ) {
var yawAngVel = 60 * sin(Math.toRadians(rollable.roll.toDouble())).toFloat()
var pitchAngVel = -20 * Math.abs(sin(Math.toRadians(rollable.roll.toDouble())).toFloat())
//if you are not pressing forward then don't turn
yawAngVel *= movingForce
//Ignore x,y,z its angular velocity:
//yaw, pitch, roll
return Vec3(yawAngVel.toDouble(), pitchAngVel.toDouble(), 0.0)
}
return Vec3(0.0, 0.0, 0.0)
}
override fun canJump(entity: PokemonEntity, driver: Player) = getRuntime(entity).resolveBoolean(canJump)
override fun jumpForce(entity: PokemonEntity, driver: Player, jumpStrength: Int): Vec3 {
val runtime = getRuntime(entity)
runtime.environment.query.addFunction("jump_strength") { DoubleValue(jumpStrength.toDouble()) }
val jumpVector = jumpVector.map { runtime.resolveFloat(it) }
return Vec3(jumpVector[0].toDouble(), jumpVector[1].toDouble(), jumpVector[2].toDouble())
}
override fun shouldRoll(entity: PokemonEntity) = true
override fun turnOffOnGround(entity: PokemonEntity): Boolean = true
override fun dismountOnShift(entity: PokemonEntity): Boolean = false
override fun encode(buffer: RegistryFriendlyByteBuf) {
super.encode(buffer)
buffer.writeString(this.speed.getString())
buffer.writeString(this.canJump.getString())
buffer.writeString(this.jumpVector[0].getString())
buffer.writeString(this.jumpVector[1].getString())
buffer.writeString(this.jumpVector[2].getString())
buffer.writeString(this.driveFactor.getString())
buffer.writeString(this.reverseDriveFactor.getString())
buffer.writeString(this.strafeFactor.getString())
buffer.writeDouble(this.lastVelocity.x)
buffer.writeDouble(this.lastVelocity.y)
buffer.writeDouble(this.lastVelocity.z)
}
override fun decode(buffer: RegistryFriendlyByteBuf) {
this.speed = buffer.readString().asExpression()
this.canJump = buffer.readString().asExpression()
this.jumpVector = listOf(
buffer.readString().asExpression(),
buffer.readString().asExpression(),
buffer.readString().asExpression()
)
this.driveFactor = buffer.readString().asExpression()
this.reverseDriveFactor = buffer.readString().asExpression()
this.strafeFactor = buffer.readString().asExpression()
this.strafeFactor = buffer.readString().asExpression()
val x = buffer.readDouble()
val y = buffer.readDouble()
val z = buffer.readDouble()
this.lastVelocity = Vec3(x, y, z)
}
}
@@ -0,0 +1,152 @@
/*
* 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.riding.controllers
import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.api.riding.controller.RideController
import com.cobblemon.mod.common.api.riding.controller.posing.PoseOption
import com.cobblemon.mod.common.api.riding.controller.posing.PoseProvider
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.pokemon.PokemonBehaviourFlag
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.pokemon.riding.states.CompositeState
import com.cobblemon.mod.common.util.adapters.riding.RideControllerAdapter
import com.cobblemon.mod.common.util.asExpression
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.getString
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.resolveFloat
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
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
class FallToFlightCompositeController : RideController {
override val key = KEY
override val poseProvider = PoseProvider(PoseType.STAND)
.with(PoseOption(PoseType.WALK) { it.entityData.get(PokemonEntity.MOVING) })
override val condition: (PokemonEntity) -> Boolean = { true }
var minimumForwardSpeed: Expression = "0.5".asExpression()
private set
var minimumFallSpeed: Expression = "0.5".asExpression()
private set
var landController: RideController = GenericLandController()
private set
var flightController: RideController = GliderAirController()
private set
override fun pose(entity: PokemonEntity): PoseType {
return getActiveController(entity).poseProvider.select(entity)
}
fun getActiveController(entity: PokemonEntity): RideController {
val state = getState(entity, ::CompositeState)
return state.activeController ?: let {
val controller = if (entity.getCurrentPoseType() in PoseType.FLYING_POSES) {
entity.setBehaviourFlag(PokemonBehaviourFlag.FLYING, true)
flightController
} else {
entity.setBehaviourFlag(PokemonBehaviourFlag.FLYING, false)
landController
}
state.activeController = controller
state.timeTransitioned = entity.level().gameTime
controller
}
}
fun checkShouldBeFlying(entity: PokemonEntity, isFlyingAlready: Boolean): Boolean {
val runtime = getRuntime(entity)
val minFallingSpeed = runtime.resolveFloat(minimumFallSpeed)
val minForwardSpeed = runtime.resolveFloat(minimumForwardSpeed)
val grounded = entity.onGround()
return if (isFlyingAlready) {
!grounded
} else {
entity.deltaMovement.y <= -minFallingSpeed && entity.deltaMovement.horizontalDistance() >= minForwardSpeed
}
}
override fun speed(
entity: PokemonEntity,
driver: Player
): Float {
val state = getState(entity, ::CompositeState)
val shouldBeFlying = checkShouldBeFlying(entity, state.activeController == flightController)
if (state.activeController == flightController && !shouldBeFlying) { // && entity.onGround() && state.timeTransitioned + 20 < entity.level().gameTime) {
state.activeController = landController
entity.setBehaviourFlag(PokemonBehaviourFlag.FLYING, false)
} else if (state.activeController == landController && shouldBeFlying) {
state.activeController = flightController
entity.setBehaviourFlag(PokemonBehaviourFlag.FLYING, true)
}
return getActiveController(entity).speed(entity, driver)
}
override fun rotation(entity: PokemonEntity, driver: LivingEntity): Vec2 {
return getActiveController(entity).rotation(entity, driver)
}
override fun velocity(
entity: PokemonEntity,
driver: Player,
input: Vec3
): Vec3 {
return getActiveController(entity).velocity(entity, driver, input)
}
override fun canJump(entity: PokemonEntity, driver: Player) = true
override fun jumpForce(
entity: PokemonEntity,
driver: Player,
jumpStrength: Int
): Vec3 {
val controller = getActiveController(entity)
return controller.jumpForce(entity, driver, jumpStrength)
}
override fun gravity(entity: PokemonEntity, regularGravity: Double): Double? {
return getActiveController(entity).gravity(entity, regularGravity)
}
override fun shouldRoll(entity: PokemonEntity): Boolean = getActiveController(entity).shouldRoll(entity)
override fun encode(buffer: RegistryFriendlyByteBuf) {
super.encode(buffer)
buffer.writeString(minimumForwardSpeed.getString())
buffer.writeString(minimumFallSpeed.getString())
landController.encode(buffer)
flightController.encode(buffer)
}
override fun decode(buffer: RegistryFriendlyByteBuf) {
minimumForwardSpeed = buffer.readString().asExpression()
minimumFallSpeed = buffer.readString().asExpression()
landController = buffer.readResourceLocation().let { key ->
val controller = RideControllerAdapter.types[key]?.getConstructor()?.newInstance() ?: error("Unknown controller key: $key")
controller.decode(buffer)
controller
}
flightController = buffer.readResourceLocation().let { key ->
val controller = RideControllerAdapter.types[key]?.getConstructor()?.newInstance() ?: error("Unknown controller key: $key")
controller.decode(buffer)
controller
}
}
companion object {
val KEY = cobblemonResource("composite/fall_to_flight")
}
}
@@ -0,0 +1,132 @@
/*
* 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.riding.controllers
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.api.riding.controller.RideController
import com.cobblemon.mod.common.api.riding.controller.posing.PoseOption
import com.cobblemon.mod.common.api.riding.controller.posing.PoseProvider
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.util.asExpression
import com.cobblemon.mod.common.util.blockPositionsAsListRounded
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.getString
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.resolveBoolean
import com.cobblemon.mod.common.util.resolveFloat
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
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
class GenericLandController : RideController {
companion object {
val KEY: ResourceLocation = cobblemonResource("land/generic")
}
// private var previousVelocity = Vec3d.ZERO
var canJump = "true".asExpression()
private set
var jumpVector = listOf("0".asExpression(), "0.3".asExpression(), "0".asExpression())
private set
var speed = "1.0".asExpression()
private set
var driveFactor = "1.0".asExpression()
private set
var reverseDriveFactor = "0.25".asExpression()
private set
var strafeFactor = "0.2".asExpression()
private set
@Transient
override val key: ResourceLocation = KEY
@Transient
override val poseProvider: PoseProvider = PoseProvider(PoseType.STAND).with(PoseOption(PoseType.WALK) { it.deltaMovement.horizontalDistance() > 0.1 })
@Transient
override val condition: (PokemonEntity) -> Boolean = { entity ->
// Are there any blocks under the mon that aren't air or fluid
// Cant just check one block since some mons may be more than one block big
// This should be changed so that the any predicate is only ran on blocks under the mon
Shapes.create(entity.boundingBox).blockPositionsAsListRounded().any {
//Need to check other fluids
if (entity.isInWater || entity.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() == (entity.position().y)) {
val blockState = entity.level().getBlockState(it.below())
return@any !blockState.isAir && blockState.fluidState.isEmpty
}
true
}
}
override fun speed(entity: PokemonEntity, driver: Player): Float {
return getRuntime(entity).resolveFloat(speed)
}
override fun rotation(entity: PokemonEntity, driver: LivingEntity): Vec2 {
return Vec2(driver.xRot * 0.5f, driver.yRot)
}
override fun velocity(entity: PokemonEntity, driver: Player, input: Vec3): Vec3 {
val runtime = getRuntime(entity)
val driveFactor = runtime.resolveFloat(this.driveFactor)
val strafeFactor = runtime.resolveFloat(this.strafeFactor)
val f = driver.xxa * strafeFactor
var g = driver.zza * driveFactor
if (g <= 0.0f) {
g *= runtime.resolveFloat(this.reverseDriveFactor)
}
val velocity = Vec3(f.toDouble(), 0.0, g.toDouble())
return velocity
}
override fun canJump(entity: PokemonEntity, driver: Player) = getRuntime(entity).resolveBoolean(canJump)
override fun jumpForce(entity: PokemonEntity, driver: Player, jumpStrength: Int): Vec3 {
val runtime = getRuntime(entity)
runtime.environment.query.addFunction("jump_strength") { DoubleValue(jumpStrength.toDouble()) }
val jumpVector = jumpVector.map { runtime.resolveFloat(it) }
return Vec3(jumpVector[0].toDouble(), jumpVector[1].toDouble(), jumpVector[2].toDouble())
}
override fun encode(buffer: RegistryFriendlyByteBuf) {
super.encode(buffer)
buffer.writeString(this.speed.getString())
buffer.writeString(this.canJump.getString())
buffer.writeString(this.jumpVector[0].getString())
buffer.writeString(this.jumpVector[1].getString())
buffer.writeString(this.jumpVector[2].getString())
buffer.writeString(this.driveFactor.getString())
buffer.writeString(this.reverseDriveFactor.getString())
buffer.writeString(this.strafeFactor.getString())
}
override fun decode(buffer: RegistryFriendlyByteBuf) {
this.speed = buffer.readString().asExpression()
this.canJump = buffer.readString().asExpression()
this.jumpVector = listOf(
buffer.readString().asExpression(),
buffer.readString().asExpression(),
buffer.readString().asExpression()
)
this.driveFactor = buffer.readString().asExpression()
this.reverseDriveFactor = buffer.readString().asExpression()
this.strafeFactor = buffer.readString().asExpression()
}
}
@@ -0,0 +1,123 @@
/*
* 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.riding.controllers
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.api.riding.controller.RideController
import com.cobblemon.mod.common.api.riding.controller.posing.PoseOption
import com.cobblemon.mod.common.api.riding.controller.posing.PoseProvider
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.util.asExpression
import com.cobblemon.mod.common.util.blockPositionsAsListRounded
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.getString
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.resolveBoolean
import com.cobblemon.mod.common.util.resolveFloat
import com.cobblemon.mod.common.util.writeString
import kotlin.math.max
import kotlin.math.min
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
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
class GenericLiquidController : RideController {
companion object {
val KEY: ResourceLocation = cobblemonResource("swim/generic")
}
var canJump = "true".asExpression()
private set
var jumpVector = listOf("0".asExpression(), "0.3".asExpression(), "0".asExpression())
private set
var speed = "1.0".asExpression()
private set
var driveFactor = "1.0".asExpression()
private set
var reverseDriveFactor = "0.25".asExpression()
private set
var strafeFactor = "0.2".asExpression()
private set
override val key: ResourceLocation = KEY
override val poseProvider: PoseProvider = PoseProvider(PoseType.FLOAT)
.with(PoseOption(PoseType.SWIM) { it.isSwimming && it.entityData.get(PokemonEntity.MOVING) })
override val condition: (PokemonEntity) -> Boolean = { entity ->
//This could be kinda weird... what if the top of the mon is in a fluid but the bottom isnt?
Shapes.create(entity.boundingBox).blockPositionsAsListRounded().any {
if (entity.isInWater || entity.isUnderWater) {
return@any true
}
val blockState = entity.level().getBlockState(it)
return@any !blockState.fluidState.isEmpty
}
}
override fun speed(entity: PokemonEntity, driver: Player): Float {
return getRuntime(entity).resolveFloat(speed)
}
override fun rotation(entity: PokemonEntity, driver: LivingEntity): Vec2 {
return Vec2(driver.xRot * 0.5f, driver.yRot)
}
override fun velocity(entity: PokemonEntity, driver: Player, input: Vec3): Vec3 {
val runtime = getRuntime(entity)
val driveFactor = runtime.resolveFloat(this.driveFactor)
val strafeFactor = runtime.resolveFloat(this.strafeFactor)
val f = driver.xxa * strafeFactor
var g = driver.zza * driveFactor
if (g <= 0.0f) {
g *= runtime.resolveFloat(this.reverseDriveFactor)
}
val velocity = Vec3(f.toDouble(), 0.0, g.toDouble())
return velocity
}
override fun canJump(entity: PokemonEntity, driver: Player) = getRuntime(entity).resolveBoolean(canJump)
override fun jumpForce(entity: PokemonEntity, driver: Player, jumpStrength: Int): Vec3 {
val runtime = getRuntime(entity)
runtime.environment.query.addFunction("jump_strength") { DoubleValue(jumpStrength.toDouble()) }
val jumpVector = jumpVector.map { runtime.resolveFloat(it) }
return Vec3(jumpVector[0].toDouble(), jumpVector[1].toDouble(), jumpVector[2].toDouble())
}
override fun encode(buffer: RegistryFriendlyByteBuf) {
super.encode(buffer)
buffer.writeString(this.speed.getString())
buffer.writeString(this.canJump.getString())
buffer.writeString(this.jumpVector[0].getString())
buffer.writeString(this.jumpVector[1].getString())
buffer.writeString(this.jumpVector[2].getString())
buffer.writeString(this.driveFactor.getString())
buffer.writeString(this.reverseDriveFactor.getString())
buffer.writeString(this.strafeFactor.getString())
}
override fun decode(buffer: RegistryFriendlyByteBuf) {
this.speed = buffer.readString().asExpression()
this.canJump = buffer.readString().asExpression()
this.jumpVector = listOf(
buffer.readString().asExpression(),
buffer.readString().asExpression(),
buffer.readString().asExpression()
)
this.driveFactor = buffer.readString().asExpression()
this.reverseDriveFactor = buffer.readString().asExpression()
this.strafeFactor = buffer.readString().asExpression()
}
}
@@ -0,0 +1,84 @@
/*
* 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.riding.controllers
import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.api.riding.controller.RideController
import com.cobblemon.mod.common.api.riding.controller.posing.PoseOption
import com.cobblemon.mod.common.api.riding.controller.posing.PoseProvider
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.util.asExpression
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.getString
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.resolveBoolean
import com.cobblemon.mod.common.util.resolveDouble
import com.cobblemon.mod.common.util.resolveFloat
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
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
class GliderAirController : RideController {
override val key = KEY
override val poseProvider = PoseProvider(PoseType.HOVER)
.with(PoseOption(PoseType.FLY) { it.deltaMovement.horizontalDistance() > 0.1 })
override val condition: (PokemonEntity) -> Boolean = { true }
var glideSpeed: Expression = "0.1".asExpression()
private set
var speed: Expression = "1.0".asExpression()
private set
var canStrafe: Expression = "false".asExpression()
private set
override fun speed(entity: PokemonEntity, driver: Player): Float {
return getRuntime(entity).resolveFloat(speed)
}
override fun rotation(entity: PokemonEntity, driver: LivingEntity): Vec2 {
return Vec2(driver.xRot, driver.yRot)
}
override fun velocity(entity: PokemonEntity, driver: Player, input: Vec3): Vec3 {
val xVector = if (getRuntime(entity).resolveBoolean(canStrafe)) driver.xxa.toDouble() else 0.0
val yVector = -getRuntime(entity).resolveDouble(glideSpeed)
val zVector = driver.zza.toDouble()
return Vec3(xVector, yVector, zVector)
}
override fun gravity(entity: PokemonEntity, regularGravity: Double): Double? {
return 0.0
}
override fun canJump(entity: PokemonEntity, driver: Player): Boolean {
return false
}
override fun jumpForce(entity: PokemonEntity, driver: Player, jumpStrength: Int) = Vec3.ZERO
override fun encode(buffer: RegistryFriendlyByteBuf) {
super.encode(buffer)
buffer.writeString(glideSpeed.toString())
buffer.writeString(speed.toString())
}
override fun decode(buffer: RegistryFriendlyByteBuf) {
glideSpeed = buffer.readString().asExpression()
speed = buffer.readString().asExpression()
}
companion object {
val KEY: ResourceLocation = cobblemonResource("air/glider")
}
}
@@ -0,0 +1,209 @@
/*
* 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.riding.controllers
import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.Rollable
import com.cobblemon.mod.common.api.riding.controller.RideController
import com.cobblemon.mod.common.api.riding.controller.posing.PoseOption
import com.cobblemon.mod.common.api.riding.controller.posing.PoseProvider
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.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 java.lang.Math.pow
import kotlin.math.*
/**
* Allows for flight like a bird controller, except you don't have to do any "flapping" motion,
* you can just go up and down like creative
*
* @author Apion/Jackowes
* @since January 1, 2025
*/
class HelicopterAirController : RideController {
override val key = KEY
override val poseProvider = PoseProvider(PoseType.HOVER)
.with(PoseOption(PoseType.FLY) { it.deltaMovement.horizontalDistance() > 0.1 })
//If there are only fluid blocks or air block below the ride
//then activate the controller. If it is in water the ride will
//dismount accordingly
override val condition: (PokemonEntity) -> Boolean = { entity ->
Shapes.create(entity.boundingBox).blockPositionsAsListRounded().any {
if (it.y.toDouble() == (entity.position().y)) {
val blockState = entity.level().getBlockState(it.below())
return@any (blockState.isAir || !blockState.fluidState.isEmpty )
}
true
}
}
var gravity: Expression = "1.0".asExpression()
private set
var horizontalAcceleration: Expression = "0.1".asExpression()
private set
var verticalVelocity: Expression = "1.0".asExpression()
private set
var speed: Expression = "1.0".asExpression()
private set
override fun speed(entity: PokemonEntity, driver: Player): Float {
//Increased max speed to exaggerate movement.
//This likely just needs to be a static number if it really is just
//the scalar for the velocity vector
return getRuntime(entity).resolveFloat(speed)*4
}
override fun rotation(entity: PokemonEntity, driver: LivingEntity): Vec2 {
return Vec2(driver.xRot * 0.5f, driver.yRot)
}
override fun velocity(entity: PokemonEntity, driver: Player, input: Vec3): Vec3 {
val runtime = getRuntime(entity)
//If the player is not modulating height then hover
var yVel = if (driver.jumping) runtime.resolveDouble(verticalVelocity)
else if (driver.isShiftKeyDown) -runtime.resolveDouble(verticalVelocity)
else (0.0)
yVel *= 0.25
var xVel = 0.0
var zVel = 0.0
val rollable = driver as? Rollable
//Horizontal velocity is based on pitch and roll
if( rollable != null ) {
xVel = -1.0 * sin(Math.toRadians(rollable.roll.toDouble()))
zVel = sin(Math.toRadians(rollable.pitch.toDouble()))
}
return Vec3(xVel, yVel, zVel)
}
override fun angRollVel(entity: PokemonEntity, driver: Player): Vec3 {
val rollable = driver as? Rollable
//In degrees per second? It was supposed to be I think but
//I have messed something up
val rotationChangeRate = 2.0
val rotLimit = 30.0
var pitchForce = driver.zza * rotationChangeRate
var rollForce = -1.0 * driver.xxa * rotationChangeRate
//TODO: Fix accumulated movement causing pitch and roll out of set bounds
if( rollable != null ) {
//If the roll or pitch have exceeded the limit then do not modulate that
//rotation in that direction further
//modulate the forces so that they trend towards 0 as they approach rotation limit.
//The current function has it drop off very quickly which may not be ideal.
//Prev function:
// pitchForce = pitchForce * max(rotLim - abs( rollable.pitch.toDouble() ), 0.0)
//The three denotes that the force will be 1/3 what it would have been at
//the rotation limit
rollForce *= 2.0.pow(-1.0 * (abs(rollable.roll.toDouble()) / ROTATION_LIMIT))
pitchForce *= 2.0.pow(-1.0 * (abs(rollable.pitch.toDouble()) / ROTATION_LIMIT))
if( rollable.roll >= ROTATION_LIMIT && rollForce > 0.0)
{
rollForce = 0.0;
}
if( rollable.roll <= -ROTATION_LIMIT && rollForce < 0.0)
{
rollForce = 0.0;
}
if( rollable.pitch >= ROTATION_LIMIT && pitchForce > 0.0 )
{
pitchForce = 0.0;
}
if( rollable.pitch <= -ROTATION_LIMIT && pitchForce < 0.0 )
{
pitchForce = 0.0;
}
//Ignore x,y,z its angular velocity:
//yaw, pitch, roll
return Vec3( 0.0, pitchForce.toDouble(), rollForce)
}
return Vec3(0.0, 0.0, 0.0)
}
override fun canJump(
entity: PokemonEntity,
driver: Player
): Boolean {
return false
}
override fun jumpForce(
entity: PokemonEntity,
driver: Player,
jumpStrength: Int
): Vec3 {
return Vec3.ZERO
}
override fun shouldRoll(entity: PokemonEntity): Boolean = true
override fun rotationOnMouseXY( entity: PokemonEntity, driver: Player, yMouse: Double, xMouse: Double ){
if(driver !is Rollable) return
val rollable = driver as Rollable
//Ignore x,y,z its angular velocity:
//yaw, pitch, roll
rollable.rotate(xMouse.toFloat(), 0.0f, 0.0f )
}
override fun gravity(entity: PokemonEntity, regularGravity: Double): Double {
return 0.0
}
//Need to ensure that crouching lowers altitude and doesn't eject the player
override fun dismountOnShift(entity: PokemonEntity): Boolean = false
override fun encode(buffer: RegistryFriendlyByteBuf) {
super.encode(buffer)
buffer.writeString(gravity.toString())
buffer.writeString(horizontalAcceleration.toString())
buffer.writeString(verticalVelocity.toString())
buffer.writeString(speed.toString())
}
override fun decode(buffer: RegistryFriendlyByteBuf) {
gravity = buffer.readString().asExpression()
horizontalAcceleration = buffer.readString().asExpression()
verticalVelocity = buffer.readString().asExpression()
speed = buffer.readString().asExpression()
}
companion object {
val KEY = cobblemonResource("air/helicopter")
val ROTATION_LIMIT = 30.0f
}
}
@@ -0,0 +1,155 @@
/*
* 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.riding.controllers
import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.api.riding.controller.RideController
import com.cobblemon.mod.common.api.riding.controller.posing.PoseOption
import com.cobblemon.mod.common.api.riding.controller.posing.PoseProvider
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.pokemon.PokemonBehaviourFlag
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.pokemon.riding.states.CompositeState
import com.cobblemon.mod.common.util.adapters.riding.RideControllerAdapter
import com.cobblemon.mod.common.util.asExpression
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.getString
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.resolveInt
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
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
class RunUpToFlightCompositeController : RideController {
override val key = KEY
override val poseProvider = PoseProvider(PoseType.STAND)
.with(PoseOption(PoseType.WALK) { it.entityData.get(PokemonEntity.MOVING) })
override val condition: (PokemonEntity) -> Boolean = { true }
var minimumSpeed: Expression = "0.5".asExpression()
private set
var minimumJump: Expression = "0.5".asExpression()
private set
var landController: RideController = GenericLandController()
private set
var flightController: RideController = BirdAirController()
private set
override fun pose(entity: PokemonEntity): PoseType {
return getActiveController(entity).poseProvider.select(entity)
}
fun getActiveController(entity: PokemonEntity): RideController {
val state = getState(entity, ::CompositeState)
return state.activeController ?: let {
val controller = if (entity.getCurrentPoseType() in PoseType.FLYING_POSES) {
entity.setBehaviourFlag(PokemonBehaviourFlag.FLYING, true)
flightController
} else {
entity.setBehaviourFlag(PokemonBehaviourFlag.FLYING, false)
landController
}
state.activeController = controller
state.timeTransitioned = entity.level().gameTime
controller
}
}
override fun speed(
entity: PokemonEntity,
driver: Player
): Float {
val state = getState(entity, ::CompositeState)
if (state.activeController == flightController && entity.onGround() && state.timeTransitioned + 20 < entity.level().gameTime) {
getState(entity, ::CompositeState).activeController = landController
entity.setBehaviourFlag(PokemonBehaviourFlag.FLYING, false)
}
return getActiveController(entity).speed(entity, driver)
}
override fun rotation(entity: PokemonEntity, driver: LivingEntity): Vec2 {
return getActiveController(entity).rotation(entity, driver)
}
override fun velocity(
entity: PokemonEntity,
driver: Player,
input: Vec3
): Vec3 {
return getActiveController(entity).velocity(entity, driver, input)
}
override fun angRollVel(entity: PokemonEntity, driver: Player): Vec3 {
return getActiveController(entity).angRollVel(entity, driver)
}
override fun canJump(entity: PokemonEntity, driver: Player) = true
override fun jumpForce(
entity: PokemonEntity,
driver: Player,
jumpStrength: Int
): Vec3 {
val controller = getActiveController(entity)
if (controller == landController && jumpStrength >= getRuntime(entity).resolveInt(minimumJump)) {
getState(entity, ::CompositeState).let {
it.activeController = flightController
entity.setBehaviourFlag(PokemonBehaviourFlag.FLYING, true)
it.timeTransitioned = entity.level().gameTime
}
}
return controller.jumpForce(entity, driver, jumpStrength)
}
override fun gravity(entity: PokemonEntity, regularGravity: Double): Double? {
return getActiveController(entity).gravity(entity, regularGravity)
}
override fun shouldRoll(entity: PokemonEntity): Boolean = getActiveController(entity).shouldRoll(entity)
override fun useMouseInputRoll(entity: PokemonEntity): Boolean = getActiveController(entity).useMouseInputRoll(entity)
override fun rotationOnMouseXY( entity: PokemonEntity, driver: Player, yMouse: Double, xMouse: Double ){
getActiveController(entity).rotationOnMouseXY( entity, driver, yMouse, xMouse )
}
override fun dismountOnShift(entity: PokemonEntity): Boolean = getActiveController(entity).dismountOnShift(entity)
override fun encode(buffer: RegistryFriendlyByteBuf) {
super.encode(buffer)
buffer.writeString(minimumSpeed.getString())
buffer.writeString(minimumJump.getString())
landController.encode(buffer)
flightController.encode(buffer)
}
override fun decode(buffer: RegistryFriendlyByteBuf) {
minimumSpeed = buffer.readString().asExpression()
minimumJump = buffer.readString().asExpression()
landController = buffer.readResourceLocation().let { key ->
val controller = RideControllerAdapter.types[key]?.getConstructor()?.newInstance() ?: error("Unknown controller key: $key")
controller.decode(buffer)
controller
}
flightController = buffer.readResourceLocation().let { key ->
val controller = RideControllerAdapter.types[key]?.getConstructor()?.newInstance() ?: error("Unknown controller key: $key")
controller.decode(buffer)
controller
}
}
companion object {
val KEY = cobblemonResource("composite/run_up_to_flight")
}
}
@@ -0,0 +1,94 @@
/*
* 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.riding.controllers
import com.cobblemon.mod.common.api.riding.controller.RideController
import com.cobblemon.mod.common.api.riding.controller.posing.PoseOption
import com.cobblemon.mod.common.api.riding.controller.posing.PoseProvider
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 net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
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
class SwimDashController : RideController {
companion object {
val KEY: ResourceLocation = cobblemonResource("swim/dash")
const val DASH_TICKS: Int = 60
}
var dashSpeed = 1F
private set
override val key: ResourceLocation = KEY
override val poseProvider: PoseProvider = PoseProvider(PoseType.FLOAT).with(PoseOption(PoseType.SWIM) { it.isSwimming && it.entityData.get(PokemonEntity.MOVING) })
override val condition: (PokemonEntity) -> Boolean = { entity ->
//This could be kinda weird... what if the top of the mon is in a fluid but the bottom isnt?
Shapes.create(entity.boundingBox).blockPositionsAsListRounded().any {
if (entity.isInWater || entity.isUnderWater) {
return@any true
}
val blockState = entity.level().getBlockState(it)
return@any !blockState.fluidState.isEmpty
}
}
/** Indicates that we are currently enacting a dash, and that further movement inputs should be ignored */
private var dashing = false
private var ticks = 0
override fun speed(entity: PokemonEntity, driver: Player): Float {
if(this.dashing) {
if(this.ticks++ >= DASH_TICKS) {
this.dashing = false
}
return 0.0F
}
this.dashing = true
return this.dashSpeed
}
override fun rotation(entity: PokemonEntity, driver: LivingEntity): Vec2 {
return Vec2(driver.xRot * 0.5f, driver.yRot)
}
override fun velocity(entity: PokemonEntity, driver: Player, input: Vec3): Vec3 {
val f = driver.xxa * 0.05f
var g = driver.zza * 0.6f
if (g <= 0.0f) {
g *= 0.25f
}
return Vec3(f.toDouble(), 0.0, g.toDouble())
}
override fun canJump(entity: PokemonEntity, driver: Player): Boolean {
TODO("Not yet implemented")
}
override fun jumpForce(entity: PokemonEntity, driver: Player, jumpStrength: Int): Vec3 {
TODO("Not yet implemented")
}
override fun encode(buffer: RegistryFriendlyByteBuf) {
super.encode(buffer)
buffer.writeFloat(this.dashSpeed)
}
override fun decode(buffer: RegistryFriendlyByteBuf) {
this.dashSpeed = buffer.readFloat()
}
}
@@ -0,0 +1,158 @@
/*
* 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.riding.controllers
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.api.riding.controller.RideController
import com.cobblemon.mod.common.api.riding.controller.posing.PoseOption
import com.cobblemon.mod.common.api.riding.controller.posing.PoseProvider
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.util.asExpression
import com.cobblemon.mod.common.util.blockPositionsAsListRounded
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.getString
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.resolveBoolean
import com.cobblemon.mod.common.util.resolveFloat
import com.cobblemon.mod.common.util.writeString
import kotlin.math.absoluteValue
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.Mth
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
class VehicleLandController : RideController {
companion object {
val KEY: ResourceLocation = cobblemonResource("land/vehicle")
}
var canJump = "true".asExpression()
private set
var jumpVector = listOf("0".asExpression(), "0.3".asExpression(), "0".asExpression())
private set
var speed = "0.3".asExpression()
private set
var driveFactor = "1.0".asExpression()
private set
var reverseDriveFactor = "0.25".asExpression()
private set
var minimumSpeedToTurn = "0.1".asExpression()
private set
var rotationSpeed = "45/20".asExpression()
private set
var lookYawLimit = "101".asExpression()
private set
@Transient
override val key: ResourceLocation = KEY
@Transient
override val poseProvider: PoseProvider = PoseProvider(PoseType.STAND).with(PoseOption(PoseType.WALK) { it.deltaMovement.horizontalDistance() > 0.1 })
@Transient
override val condition: (PokemonEntity) -> Boolean = { entity ->
// Are there any blocks under the mon that aren't air or fluid
// Cant just check one block since some mons may be more than one block big
// This should be changed so that the any predicate is only ran on blocks under the mon
Shapes.create(entity.boundingBox).blockPositionsAsListRounded().any {
//Need to check other fluids
if (entity.isInWater || entity.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() == (entity.position().y)) {
val blockState = entity.level().getBlockState(it.below())
return@any !(!blockState.isAir && blockState.fluidState.isEmpty)
}
true
}
}
override fun speed(entity: PokemonEntity, driver: Player): Float {
return getRuntime(entity).resolveFloat(speed)
}
override fun rotation(entity: PokemonEntity, driver: LivingEntity): Vec2 {
val rotationDegrees = driver.xxa * getRuntime(entity).resolveFloat(this.rotationSpeed)
return Vec2(driver.xRot, entity.yRot - rotationDegrees)
}
override fun velocity(entity: PokemonEntity, driver: Player, input: Vec3): Vec3 {
val runtime = getRuntime(entity)
val driveFactor = runtime.resolveFloat(this.driveFactor)
var g = driver.zza * driveFactor
if (g <= 0.0f) {
g *= runtime.resolveFloat(this.reverseDriveFactor)
}
if (driver.xxa != 0F && g.absoluteValue < runtime.resolveFloat(this.minimumSpeedToTurn)) {
driver.xxa = 0F
}
val velocity = Vec3(0.0 /* Maybe do drifting here later */, 0.0, g.toDouble())
return velocity
}
override fun updatePassengerRotation(entity: PokemonEntity, driver: LivingEntity) {
driver.yRot += (entity.riding.deltaRotation.y)
driver.setYHeadRot(driver.yHeadRot + (entity.riding.deltaRotation.y))
}
override fun clampPassengerRotation(entity: PokemonEntity, driver: LivingEntity) {
val f = Mth.wrapDegrees(driver.yRot - entity.yRot)
val runtime = getRuntime(entity)
val lookYawLimit = runtime.resolveFloat(this.lookYawLimit)
val g = Mth.clamp(f, -lookYawLimit, lookYawLimit)
driver.yRotO += g - f
driver.yRot = driver.yRot + g - f
driver.setYHeadRot(driver.yRot)
}
override fun canJump(entity: PokemonEntity, driver: Player) = getRuntime(entity).resolveBoolean(canJump)
override fun jumpForce(entity: PokemonEntity, driver: Player, jumpStrength: Int): Vec3 {
val runtime = getRuntime(entity)
runtime.environment.query.addFunction("jump_strength") { DoubleValue(jumpStrength.toDouble()) }
val jumpVector = jumpVector.map { runtime.resolveFloat(it) }
return Vec3(jumpVector[0].toDouble(), jumpVector[1].toDouble(), jumpVector[2].toDouble())
}
override fun encode(buffer: RegistryFriendlyByteBuf) {
super.encode(buffer)
buffer.writeString(this.speed.getString())
buffer.writeString(this.canJump.getString())
buffer.writeString(this.jumpVector[0].getString())
buffer.writeString(this.jumpVector[1].getString())
buffer.writeString(this.jumpVector[2].getString())
buffer.writeString(this.driveFactor.getString())
buffer.writeString(this.reverseDriveFactor.getString())
buffer.writeString(this.minimumSpeedToTurn.getString())
buffer.writeString(this.rotationSpeed.getString())
buffer.writeString(this.lookYawLimit.getString())
}
override fun decode(buffer: RegistryFriendlyByteBuf) {
this.speed = buffer.readString().asExpression()
this.canJump = buffer.readString().asExpression()
this.jumpVector = listOf(
buffer.readString().asExpression(),
buffer.readString().asExpression(),
buffer.readString().asExpression()
)
this.driveFactor = buffer.readString().asExpression()
this.reverseDriveFactor = buffer.readString().asExpression()
this.minimumSpeedToTurn = buffer.readString().asExpression()
this.rotationSpeed = buffer.readString().asExpression()
this.lookYawLimit = buffer.readString().asExpression()
}
}
@@ -0,0 +1,18 @@
/*
* 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.riding.states
import com.cobblemon.mod.common.api.riding.RidingState
import com.cobblemon.mod.common.api.riding.controller.RideController
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
open class CompositeState(pokemonEntity: PokemonEntity) : RidingState {
var activeController: RideController? = null
var timeTransitioned = -100L
}
@@ -30,6 +30,7 @@ import net.minecraft.resources.ResourceLocation
import net.minecraft.util.Mth
import net.minecraft.world.entity.EntityDimensions
import net.minecraft.world.item.ItemStack
import org.joml.Matrix3f
import java.io.IOException
import java.util.*
@@ -234,4 +235,22 @@ fun ByteBuf.readBitSet(size: Int): BitSet {
return BitSet.valueOf(bs)
}
//fun
fun ByteBuf.writeMatrix3f(matrix: Matrix3f) {
this.writeFloat(matrix.m00)
this.writeFloat(matrix.m01)
this.writeFloat(matrix.m02)
this.writeFloat(matrix.m10)
this.writeFloat(matrix.m11)
this.writeFloat(matrix.m12)
this.writeFloat(matrix.m20)
this.writeFloat(matrix.m21)
this.writeFloat(matrix.m22)
}
fun ByteBuf.readMatrix3f(): Matrix3f {
return Matrix3f(
readFloat(), readFloat(), readFloat(),
readFloat(), readFloat(), readFloat(),
readFloat(), readFloat(), readFloat(),
)
}
@@ -18,6 +18,8 @@ import net.minecraft.client.gui.screens.Screen
import java.util.UUID
import java.util.concurrent.CompletableFuture
import java.util.function.Consumer
import kotlin.math.ceil
import kotlin.math.floor
import kotlin.math.min
import kotlin.random.Random
import net.minecraft.client.resources.model.ModelResourceLocation
@@ -85,6 +87,21 @@ fun isUuid(string: String) : Boolean {
return Regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\$").matches(string)
}
fun VoxelShape.blockPositionsAsListRounded(): List<BlockPos> {
val result = mutableListOf<BlockPos>()
forAllBoxes { minX, minY, minZ, maxX, maxY, maxZ ->
for (x in floor(minX).toInt() until ceil(maxX).toInt()) {
for (y in floor(minY).toInt() until ceil(maxY).toInt()) {
for (z in floor(minZ).toInt() until ceil(maxZ).toInt()) {
result.add(BlockPos(x, y, z))
}
}
}
}
return result
}
fun VoxelShape.blockPositionsAsList(): List<BlockPos> {
val result = mutableListOf<BlockPos>()
forAllBoxes { minX, minY, minZ, maxX, maxY, maxZ ->
@@ -0,0 +1,46 @@
/*
* 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.util.adapters.riding
import com.cobblemon.mod.common.api.riding.controller.RideController
import com.cobblemon.mod.common.pokemon.riding.controllers.*
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
import net.minecraft.resources.ResourceLocation
import java.lang.reflect.Type
/**
* Adapter for deserializing [RideController] types.
*
* @author Hiroku
* @since April 30th, 2024
*/
object RideControllerAdapter : JsonDeserializer<RideController> {
val types: MutableMap<ResourceLocation, Class<out RideController>> = mutableMapOf(
GenericLandController.KEY to GenericLandController::class.java,
GenericLiquidController.KEY to GenericLiquidController::class.java,
SwimDashController.KEY to SwimDashController::class.java,
RunUpToFlightCompositeController.KEY to RunUpToFlightCompositeController::class.java,
BirdAirController.KEY to BirdAirController::class.java,
HelicopterAirController.KEY to HelicopterAirController::class.java,
GliderAirController.KEY to GliderAirController::class.java,
FallToFlightCompositeController.KEY to FallToFlightCompositeController::class.java,
VehicleLandController.KEY to VehicleLandController::class.java,
DolphinController.KEY to DolphinController::class.java
)
override fun deserialize(element: JsonElement, type: Type, context: JsonDeserializationContext): RideController {
val root = element.asJsonObject
val key = root.get("key").asString
val controllerType = types[key.asIdentifierDefaultingNamespace()] ?: throw IllegalArgumentException("Unknown controller: $key")
return context.deserialize(element, controllerType)
}
}
@@ -6,26 +6,32 @@
"bones": {
"arm_left": {
"rotation": [
"math.r2d(-math.cos(v.limb_swing * 38.17) * v.limb_swing_amount - math.sin(v.age_in_ticks * 5.16) * 0.05)",
0,
"-math.r2d(math.cos(v.age_in_ticks * 5.16) * 0.05 + 0.05)"
"-23.2941+math.r2d(-math.cos(v.limb_swing * 38.17) * v.limb_swing_amount - math.sin(v.age_in_ticks * 5.16) * 0.05)",
3.57079,
"6.5998-math.r2d(math.cos(v.age_in_ticks * 5.16) * 0.05 + 0.05)"
]
},
"arm_right": {
"rotation": [
"math.r2d(math.cos(v.limb_swing * 38.17) * v.limb_swing_amount + math.sin(v.age_in_ticks * 5.16) * 0.05)",
0,
"math.r2d(math.cos(v.age_in_ticks * 5.16) * 0.05 + 0.05)"
"-20.8359+math.r2d(math.cos(v.limb_swing * 38.17) * v.limb_swing_amount + math.sin(v.age_in_ticks * 5.16) * 0.05)",
-2.68108,
"-7.007+math.r2d(math.cos(v.age_in_ticks * 5.16) * 0.05 + 0.05)"
]
},
"pokeball": {
"scale": 0
},
"leg_right": {
"rotation": ["math.r2d(math.cos(v.limb_swing * 38.17 + 180) * v.limb_swing_amount * 1.4)", 0, 0]
"rotation": ["-87.8218+math.r2d(math.cos(v.limb_swing * 38.17 + 180) * v.limb_swing_amount * 1.4)", 8.11827, 0.65893]
},
"leg_left": {
"rotation": ["math.r2d(math.cos(v.limb_swing * 38.17) * v.limb_swing_amount * 1.4)", 0, 0]
"rotation": ["-88.8357+math.r2d(math.cos(v.limb_swing * 38.17) * v.limb_swing_amount * 1.4)", -8.23239, 1.90829]
},
"body": {
"rotation": [0, 0, 0]
},
"head": {
"rotation": ["7.5-v.velocity*10", 0, 0]
}
}
},
@@ -124,8 +130,14 @@
},
"pokeball": {
"scale": {
"0.4583": {"pre": [0, 0, 0], "post": [0.3, 0.3, 0.3]},
"0.5417": {"pre": [0.3, 0.3, 0.3], "post": [0.3, 0.3, 0.3]},
"0.4583": {
"pre": [0, 0, 0],
"post": [0.3, 0.3, 0.3]
},
"0.5417": {
"pre": [0.3, 0.3, 0.3],
"post": [0.3, 0.3, 0.3]
},
"0.7083": [1, 1, 1]
}
},
@@ -622,12 +634,21 @@
},
"pokeball": {
"scale": {
"0.9375": {"pre": [0, 0, 0], "post": [0.3, 0.3, 0.3]},
"1.0": {"pre": [0.3, 0.3, 0.3], "post": [0.3, 0.3, 0.3]},
"0.9375": {
"pre": [0, 0, 0],
"post": [0.3, 0.3, 0.3]
},
"1.0": {
"pre": [0.3, 0.3, 0.3],
"post": [0.3, 0.3, 0.3]
},
"1.1875": [1, 1, 1],
"3.0625": [1, 1, 1],
"3.25": [0.4, 0.4, 0.4],
"3.375": {"pre": [0.4, 0.4, 0.4], "post": [0, 0, 0]}
"3.375": {
"pre": [0.4, 0.4, 0.4],
"post": [0, 0, 0]
}
}
},
"leg_right": {
@@ -26,7 +26,10 @@
"pivot": [0, 7.75, -0.5],
"cubes": [
{"origin": [-4, 4.25, -4], "size": [8, 8, 7], "uv": [0, 44]}
]
],
"locators": {
"seat1": [0, 12, -4]
}
},
{
"name": "upper_torso",
@@ -7,8 +7,8 @@
"texture_width": 128,
"texture_height": 128,
"visible_bounds_width": 9,
"visible_bounds_height": 2.5,
"visible_bounds_offset": [0, 0.75, 0]
"visible_bounds_height": 3,
"visible_bounds_offset": [0, 0.5, 0]
},
"bones": [
{
@@ -27,7 +27,11 @@
"cubes": [
{"origin": [-12, 0, -20], "size": [24, 16, 23], "uv": [0, 0]},
{"origin": [-11, 6, -22.5], "size": [22, 2, 3], "inflate": 0.01, "uv": [50, 44]}
]
],
"locators": {
"seat": [7, 16, -3],
"seat1": [0, 16, -11]
}
},
{
"name": "whisker_right",
@@ -236,7 +240,6 @@
"name": "tail",
"parent": "torso",
"pivot": [0, 6, 1],
"rotation": [0, 0, 0],
"cubes": [
{"origin": [-8, 0.5, 1], "size": [16, 11, 9], "uv": [0, 39]}
]
@@ -261,7 +264,6 @@
"name": "tail4",
"parent": "tail3",
"pivot": [0, 5, 18],
"rotation": [0, 0, 0],
"cubes": [
{"origin": [-6.5, 5, 17], "size": [13, 0, 8], "uv": [42, 49]}
]
@@ -0,0 +1,62 @@
{
"portraitScale": 1.14,
"portraitTranslation": [-0.66, 1.91, 0],
"profileScale": 0.48,
"profileTranslation": [0, 0.99, 0],
"rootBone": "whiscash",
"animations": {
"cry": "q.bedrock_stateful('whiscash', 'cry')",
"recoil": "q.bedrock_stateful('whiscash', 'recoil')"
},
"poses": {
"battle-standing": {
"poseTypes": ["STAND"],
"isBattle": true,
"isTouchingWater": false,
"animations": ["q.bedrock('whiscash', 'ground_idle')"],
"quirks": ["q.bedrock_quirk('whiscash', 'blink')"]
},
"underwater-battle-standing": {
"poseTypes": ["FLOAT"],
"isBattle": true,
"isTouchingWater": true,
"isUnderWater": true,
"animations": ["q.bedrock('whiscash', 'water_idle')"],
"quirks": ["q.bedrock_quirk('whiscash', 'blink')"]
},
"standing": {
"poseTypes": ["STAND", "NONE", "PORTRAIT", "PROFILE"],
"isBattle": false,
"isTouchingWater": false,
"animations": ["q.look('head')", "q.bedrock('whiscash', 'ground_idle')"],
"quirks": [
"q.bedrock_quirk('whiscash', 'blink')"
]
},
"walking": {
"poseTypes": ["WALK"],
"isTouchingWater": false,
"animations": ["q.bedrock('whiscash', 'ground_walk')"],
"quirks": ["q.bedrock_quirk('whiscash', 'blink')"]
},
"swim": {
"poseTypes": ["SWIM"],
"isTouchingWater": true,
"isUnderWater": true,
"animations": ["q.bedrock('whiscash', 'water_swim')"],
"quirks": ["q.bedrock_quirk('whiscash', 'blink')"]
},
"sleep": {
"poseTypes": ["SLEEP"],
"isTouchingWater": false,
"animations": ["q.bedrock('whiscash', 'ground_sleep')"]
},
"underwater-sleep": {
"poseTypes": ["SLEEP"],
"poseName": ["water-sleep"],
"isTouchingWater": true,
"isUnderWater": true,
"animations": ["q.bedrock('whiscash', 'water_sleep')"]
}
}
}
@@ -0,0 +1,62 @@
{
"portraitScale": 1.14,
"portraitTranslation": [-0.66, 1.91, 0],
"profileScale": 0.48,
"profileTranslation": [0, 0.99, 0],
"rootBone": "whiscash_nero",
"animations": {
"cry": "q.bedrock_stateful('whiscash_nero', 'cry')",
"recoil": "q.bedrock_stateful('whiscash_nero', 'recoil')"
},
"poses": {
"battle-standing": {
"poseTypes": ["STAND"],
"isBattle": true,
"isTouchingWater": false,
"animations": ["q.bedrock('whiscash_nero', 'ground_idle')"],
"quirks": ["q.bedrock_quirk('whiscash_nero', 'blink')"]
},
"underwater-battle-standing": {
"poseTypes": ["FLOAT"],
"isBattle": true,
"isTouchingWater": true,
"isUnderWater": true,
"animations": ["q.bedrock('whiscash_nero', 'water_battle_idle')"],
"quirks": ["q.bedrock_quirk('whiscash_nero', 'blink')"]
},
"standing": {
"poseTypes": ["STAND", "NONE", "PORTRAIT", "PROFILE"],
"isBattle": false,
"isTouchingWater": false,
"animations": ["q.look('head')", "q.bedrock('whiscash_nero', 'ground_idle')"],
"quirks": [
"q.bedrock_quirk('whiscash_nero', 'blink')"
]
},
"walking": {
"poseTypes": ["WALK"],
"isTouchingWater": false,
"animations": ["q.bedrock('whiscash_nero', 'ground_walk')"],
"quirks": ["q.bedrock_quirk('whiscash_nero', 'blink')"]
},
"swim": {
"poseTypes": ["SWIM"],
"isTouchingWater": true,
"isUnderWater": true,
"animations": ["q.bedrock('whiscash_nero', 'water_swim')"],
"quirks": ["q.bedrock_quirk('whiscash_nero', 'blink')"]
},
"sleep": {
"poseTypes": ["SLEEP"],
"isTouchingWater": false,
"animations": ["q.bedrock('whiscash_nero', 'ground_sleep')"]
},
"underwater-sleep": {
"poseTypes": ["SLEEP"],
"poseName": ["water-sleep"],
"isTouchingWater": true,
"isUnderWater": true,
"animations": ["q.bedrock('whiscash_nero', 'water_sleep')"]
}
}
}
@@ -11,6 +11,7 @@
},
{
"aspects": ["whiscash_nero"],
"poser": "cobblemon:whiscash",
"model": "cobblemon:whiscash_nero.geo",
"texture": "cobblemon:textures/pokemon/0340_whiscash/whiscash_nero.png"
},
@@ -1027,6 +1027,7 @@
"cobblemon.ui.interact.decline": "Decline",
"cobblemon.ui.interact.failed": "Target is obstructed or too far away.",
"cobblemon.ui.interact.mount.shoulder": "Shoulder",
"cobblemon.ui.interact.ride": "Ride",
"cobblemon.ui.interact.team_leave": "Abandon team",
"cobblemon.ui.interact.team_request": "Team up",
"cobblemon.ui.interact.too_far": "Target is too far away!",
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

@@ -111,4 +111,7 @@ transitive-extendable method net/minecraft/world/entity/LivingEntity getDimensio
#String name, VertexFormat vertexFormat, VertexFormat.DrawMode drawMode, int expectedBufferSize, boolean hasCrumbling, boolean translucent, MultiPhaseParameters phases
transitive-accessible field net/minecraft/world/level/material/MapColor MATERIAL_COLORS [Lnet/minecraft/world/level/material/MapColor;
transitive-accessible field net/minecraft/client/Minecraft textureManager Lnet/minecraft/client/renderer/texture/TextureManager;
transitive-accessible field net/minecraft/client/Minecraft textureManager Lnet/minecraft/client/renderer/texture/TextureManager;
transitive-accessible field net/minecraft/world/entity/LivingEntity jumping Z
transitive-accessible field net/minecraft/world/entity/Entity FLAG_SHIFT_KEY_DOWN I
transitive-accessible field net/minecraft/world/entity/Entity DATA_SHARED_FLAGS_ID Lnet/minecraft/network/syncher/EntityDataAccessor;
@@ -50,6 +50,54 @@
"height": 1,
"fixed": false
},
"riding": {
"controller": {
"key": "cobblemon:composite/run_up_to_flight",
"minimumSpeed": "0.2",
"minimumJump": "80",
"landController": {
"key": "cobblemon:land/generic",
"speed": "Math.clamp(q.entity.velocity.horizontal_magnitude + 0.33, 0, 1)",
"jumpVector": [0, "0.3*q.jump_strength/50", "-1 * 0.5*q.jump_strength/50"]
},
"flightController": {
"key": "cobblemon:air/helicopter",
"gravity": "q.gravity * (0.1 + (q.passenger_count - 1) * 0.1)",
"speed": "Math.clamp(q.entity.velocity.horizontal_magnitude + 0.33, 0, 1)"
}
},
"seats": [
{
"offset": {
"x": 0,
"y": 0.5,
"z": -0.5
},
"poseOffsets": [
{
"poseTypes": [
"HOVER"
],
"offset": {
"x": 0,
"y": 0,
"z": 0
}
},
{
"poseTypes": [
"FLY"
],
"offset": {
"x": 0,
"y": 0,
"z": 0
}
}
]
}
]
},
"behaviour": {
"moving": {
"fly": {
@@ -49,6 +49,84 @@
"height": 2.65,
"fixed": false
},
"riding": {
"controller": {
"key": "cobblemon:composite/run_up_to_flight",
"minimumSpeed": "0.2",
"minimumJump": "80",
"landController": {
"key": "cobblemon:land/generic",
"speed": "Math.clamp(q.entity.velocity.horizontal_magnitude + 0.33, 0, 1)",
"jumpVector": [0, "0.3*q.jump_strength/50", "-1 * 0.5*q.jump_strength/50"]
},
"flightController": {
"key": "cobblemon:air/bird",
"gravity": "q.gravity * (0.1 + (q.passenger_count - 1) * 0.1)",
"speed": "Math.clamp(q.entity.velocity.horizontal_magnitude + 0.33, 0, 1)",
"jumpVector": [0, "0.3*q.jump_strength/50", 0]
}
},
"seats": [
{
"offset": {
"x": 0,
"y": 1.5,
"z": -0.5
},
"poseOffsets": [
{
"poseTypes": [
"HOVER"
],
"offset": {
"x": 0,
"y": 0.7,
"z": 1
}
},
{
"poseTypes": [
"FLY"
],
"offset": {
"x": 0,
"y": 0.2,
"z": 1
}
}
]
},
{
"offset": {
"x": 0,
"y": 1.5,
"z": -1.5
},
"poseOffsets": [
{
"poseTypes": [
"HOVER"
],
"offset": {
"x": 0,
"y": 0.4,
"z": 1
}
},
{
"poseTypes": [
"FLY"
],
"offset": {
"x": 0,
"y": 0.2,
"z": 0.2
}
}
]
}
]
},
"behaviour": {
"resting": {
"canSleep": true,
@@ -50,6 +50,39 @@
"height": 2.8,
"fixed": false
},
"riding": {
"controller": {
"key": "cobblemon:land/generic",
"speed": "Math.clamp(q.entity.velocity.horizontal_magnitude + 0.07, 0, 0.08)",
"jumpVector": [0, "0.3*q.jump_strength/50", "-1 * 0.5*q.jump_strength/50"]
},
"seats": [
{
"offset": {
"x": 0.0,
"y": 0.4,
"z": 0.0
},
"poseAnimations": [
{
"animations": [
{
"fileName": "trainer_generic",
"animationName": "animation.trainer_generic.idle"
}
]
}
]
},
{
"offset": {
"x": 0.0,
"y": 0.7,
"z": -1.0
}
}
]
},
"behaviour": {
"moving": {
"swim": {
@@ -49,6 +49,39 @@
"height": 1,
"fixed": false
},
"riding": {
"controller": {
"key": "cobblemon:swim/dolphin",
"speed": "Math.clamp(q.entity.velocity.horizontal_magnitude + 0.5, 0, 3)",
"jumpVector": [0, "0.3*q.jump_strength/50", "-1 * 0.5*q.jump_strength/50"]
},
"seats": [
{
"offset": {
"x": 0.0,
"y": 0.4,
"z": 0.0
},
"poseAnimations": [
{
"animations": [
{
"fileName": "trainer_generic",
"animationName": "animation.trainer_generic.idle"
}
]
}
]
},
{
"offset": {
"x": 0.0,
"y": 0.7,
"z": -1.0
}
}
]
},
"behaviour": {
"moving": {
"walk": {
@@ -44,6 +44,35 @@
"eggCycles": 20,
"baseFriendship": 50,
"baseScale": 0.9,
"riding": {
"controller": {
"key": "cobblemon:composite/fall_to_flight",
"minimumForwardSpeed": "0.0",
"minimumFallSpeed": "0.55",
"landController": {
"key": "cobblemon:land/generic",
"speed": "0.15",
"jumpVector": [0, "0.3*q.jump_strength/50", 0],
"driveFactor": 1.0,
"strafeFactor": 0.2
},
"flightController": {
"key": "cobblemon:air/glider",
"canStrafe": false,
"speed": 0.75
}
},
"seats": [
{
"offset": {
"x": 0.0,
"y": 0.0,
"z": 0.0
}
}
]
},
"hitbox": {
"width": 0.9,
"height": 1.5,
@@ -42,6 +42,20 @@
"catchRate": 75,
"eggCycles": 20,
"baseFriendship": 50,
"riding": {
"controller": {
"key": "cobblemon:land/vehicle"
},
"seats": [
{
"offset": {
"x": 0.0,
"y": 0.0,
"z": 0.0
}
}
]
},
"behaviour": {
"resting": {
"canSleep": true,
@@ -5,8 +5,10 @@
"minVersion": "0.8",
"client": [
"BuiltinModelItemRendererMixin",
"CameraMixin",
"EntityRenderDispatcherMixin",
"GameRendererMixin",
"HumanoidModelMixin",
"ItemInHandRendererMixin",
"ItemPropertiesMixin",
"ItemRendererMixin",
@@ -23,7 +25,11 @@
"accessor.KeyBindingAccessor",
"client.AbstractClientPlayerMixin",
"client.EntryListWidgetMixin",
"invoker.ClientPlayNetworkHandlerInvoker"
"client.LocalPlayerMixin",
"invoker.ClientPlayNetworkHandlerInvoker",
"renderer.LivingEntityRendererMixin",
"renderer.PlayerEntityRendererMixin",
"riding.JetMixin"
],
"mixins": [
"ChunkStorageMixin",
@@ -51,10 +57,12 @@
"accessor.BoatEntityAccessor",
"accessor.EntryListWidgetAccessor",
"accessor.StatusEffectInstanceAccessor",
"entity.EntityMixin",
"entity.TameableEntityMixin",
"invoker.AdornRegisterInvoker",
"invoker.BlocksInvoker",
"invoker.BooleanRuleInvoker",
"invoker.ClientPlayNetworkHandlerInvoker",
"invoker.DoorBlockInvoker",
"invoker.FireBlockInvoker",
"invoker.PressurePlateBlockInvoker",
@@ -7,7 +7,8 @@ This file contains tags related to different biomes in cobblemon, as well as som
<details>
<summary><b>Tag:</b> #biome:is_arid</summary>
- #cobblemon:is_sandy
- #cobblemon:is_badlands
- #cobblemon:is_desert
- #cobblemon:is_savanna
</details>
@@ -1039,15 +1040,164 @@ This file contains tags related to different biomes in cobblemon, as well as som
</details>
<details>
<summary><b>Tag:</b> #evolution:alolan</summary>
<summary><b>Tag:</b> #regional:bergmite_hisuibiome</summary>
- #cobblemon:is_tropical_island
- #minecraft:is_beach
- #cobblemon:is_freezing
- #cobblemon:is_hills
</details>
<details>
<summary><b>Tag:</b> #evolution:cyndaquil_quilava_hisui_bias</summary>
<summary><b>Tag:</b> #regional:bergmite_kalosbiome</summary>
- #cobblemon:is_frozen_ocean
</details>
<details>
<summary><b>Tag:</b> #regional:cubone_alolabiome</summary>
- #cobblemon:is_beach
- #cobblemon:is_volcanic
</details>
<details>
<summary><b>Tag:</b> #regional:cubone_kantobiome</summary>
- #cobblemon:is_arid
</details>
<details>
<summary><b>Tag:</b> #regional:dartrix_alolabiome</summary>
- #cobblemon:is_beach
- #cobblemon:is_ocean
- #cobblemon:is_tropical_island
</details>
<details>
<summary><b>Tag:</b> #regional:dartrix_hisuibiome</summary>
- #cobblemon:is_freezing
- #cobblemon:is_hills
</details>
<details>
<summary><b>Tag:</b> #regional:dewott_hisuibiome</summary>
- #cobblemon:is_coast
- #cobblemon:is_cold_ocean
- minecraft:snowy_beach
</details>
<details>
<summary><b>Tag:</b> #regional:dewott_unovabiome</summary>
- #cobblemon:is_beach
- #cobblemon:is_ocean
- #cobblemon:is_tropical_island
</details>
<details>
<summary><b>Tag:</b> #regional:exeggcute_alolabiome</summary>
- #cobblemon:is_beach
- #cobblemon:is_tropical_island
</details>
<details>
<summary><b>Tag:</b> #regional:exeggcute_kantobiome</summary>
- #cobblemon:is_jungle
- #cobblemon:is_savanna
</details>
<details>
<summary><b>Tag:</b> #regional:goomy_hisuibiome</summary>
- #cobblemon:is_dripstone
- #cobblemon:is_lush
</details>
<details>
<summary><b>Tag:</b> #regional:goomy_kalosbiome</summary>
- #cobblemon:is_overworld
- #cobblemon:is_swamp
</details>
<details>
<summary><b>Tag:</b> #regional:koffing_galarbiome</summary>
- #cobblemon:is_mushroom
</details>
<details>
<summary><b>Tag:</b> #regional:koffing_kantobiome</summary>
- #cobblemon:nether/is_toxic
</details>
<details>
<summary><b>Tag:</b> #regional:mimejr_galarbiome</summary>
- #cobblemon:is_freezing
</details>
<details>
<summary><b>Tag:</b> #regional:mimejr_sinnohbiome</summary>
- #cobblemon:is_temperate
</details>
<details>
<summary><b>Tag:</b> #regional:petilil_hisuibiome</summary>
- #cobblemon:is_freezing
- #cobblemon:is_hills
</details>
<details>
<summary><b>Tag:</b> #regional:petilil_unovabiome</summary>
- #cobblemon:is_floral
- #cobblemon:is_forest
- #cobblemon:is_tropical_island
</details>
<details>
<summary><b>Tag:</b> #regional:pikachu_alolabiome</summary>
- #cobblemon:is_beach
- #cobblemon:is_tropical_island
</details>
<details>
<summary><b>Tag:</b> #regional:pikachu_kantobiome</summary>
- #cobblemon:is_forest
</details>
<details>
<summary><b>Tag:</b> #regional:quilava_hisuibiome</summary>
- #cobblemon:is_taiga
- #cobblemon:nether/is_crimson
@@ -1057,60 +1207,62 @@ This file contains tags related to different biomes in cobblemon, as well as som
</details>
<details>
<summary><b>Tag:</b> #evolution:lilligant_unovan</summary>
<summary><b>Tag:</b> #regional:quilava_johtobiome</summary>
- #cobblemon:is_temperate
</details>
<details>
<summary><b>Tag:</b> #regional:rufflet_hisuibiome</summary>
- #cobblemon:is_freezing
- #cobblemon:is_hills
</details>
<details>
<summary><b>Tag:</b> #regional:rufflet_unovabiome</summary>
- #cobblemon:is_temperate
</details>
<details>
<summary><b>Tag:</b> #vivillon:archipelago</summary>
- #cobblemon:is_mushroom
</details>
<details>
<summary><b>Tag:</b> #vivillon:archipelago_anti</summary>
- #cobblemon:is_magical
- #cobblemon:is_spooky
- #cobblemon:is_swamp
</details>
<details>
<summary><b>Tag:</b> #vivillon:continental</summary>
- #cobblemon:is_plains
</details>
<details>
<summary><b>Tag:</b> #vivillon:continental_anti</summary>
- #cobblemon:is_floral
- #cobblemon:is_forest
- #cobblemon:is_tropical_island
- #cobblemon:is_mushroom
- #cobblemon:is_savanna
- minecraft:sunflower_plains
</details>
<details>
<summary><b>Tag:</b> #evolution:oshawott_dewott_hisui_bias</summary>
- #c:stony_shores
- minecraft:snowy_beach
- minecraft:stony_shore
- terralith:basalt_cliffs
- terralith:granite_cliffs
- terralith:white_cliffs
- wythers:calcite_coast
- wythers:cold_island
- wythers:cold_stony_shore
- wythers:deepslate_shore
- wythers:frigid_island
- wythers:frozen_island
- wythers:gravelly_beach
- wythers:icy_shore
</details>
<details>
<summary><b>Tag:</b> #evolution:rowlet_dartrix_alolan</summary>
- #cobblemon:is_forest
- #cobblemon:is_taiga
</details>
<details>
<summary><b>Tag:</b> #evolution:rowlet_dartrix_hisui_bias</summary>
- #cobblemon:is_snowy_forest
- #cobblemon:is_snowy_taiga
</details>
<details>
<summary><b>Tag:</b> #evolution:sliggoo_hisuian</summary>
- #cobblemon:is_dripstone
- #cobblemon:is_lush
</details>
<details>
<summary><b>Tag:</b> #evolution:vivillon_elegant</summary>
<summary><b>Tag:</b> #vivillon:elegant</summary>
- #cobblemon:is_magical
- #cobblemon:is_spooky
@@ -1118,7 +1270,123 @@ This file contains tags related to different biomes in cobblemon, as well as som
</details>
<details>
<summary><b>Tag:</b> #evolution:vivillon_monsoon</summary>
<summary><b>Tag:</b> #vivillon:elegant_anti</summary>
- #cobblemon:is_mountain
</details>
<details>
<summary><b>Tag:</b> #vivillon:fancy</summary>
- #cobblemon:is_cherry_blossom
</details>
<details>
<summary><b>Tag:</b> #vivillon:forsaken</summary>
- #cobblemon:is_deep_dark
</details>
<details>
<summary><b>Tag:</b> #vivillon:garden</summary>
- #cobblemon:is_forest
</details>
<details>
<summary><b>Tag:</b> #vivillon:garden_anti</summary>
- #cobblemon:is_cherry_blossom
- #cobblemon:is_floral
- #cobblemon:is_jungle
- #cobblemon:is_magical
- #cobblemon:is_mountain
- #cobblemon:is_mushroom
- #cobblemon:is_plains
- #cobblemon:is_spooky
- #cobblemon:is_swamp
</details>
<details>
<summary><b>Tag:</b> #vivillon:high_plains</summary>
- #cobblemon:is_badlands
</details>
<details>
<summary><b>Tag:</b> #vivillon:icy_snow</summary>
- #cobblemon:is_taiga
</details>
<details>
<summary><b>Tag:</b> #vivillon:icy_snow_anti</summary>
- #cobblemon:is_mountain
</details>
<details>
<summary><b>Tag:</b> #vivillon:inferno</summary>
- #minecraft:is_nether
</details>
<details>
<summary><b>Tag:</b> #vivillon:jungle</summary>
- #cobblemon:is_jungle
</details>
<details>
<summary><b>Tag:</b> #vivillon:jungle_anti</summary>
- #cobblemon:is_mountain
</details>
<details>
<summary><b>Tag:</b> #vivillon:marine</summary>
- #cobblemon:is_ocean
</details>
<details>
<summary><b>Tag:</b> #vivillon:marine_anti</summary>
- #cobblemon:is_frozen_ocean
- #cobblemon:is_warm_ocean
</details>
<details>
<summary><b>Tag:</b> #vivillon:meadow</summary>
- #cobblemon:is_floral
</details>
<details>
<summary><b>Tag:</b> #vivillon:meadow_anti</summary>
- #cobblemon:is_cherry_blossom
- #cobblemon:is_magical
- minecraft:sunflower_plains
</details>
<details>
<summary><b>Tag:</b> #vivillon:monsoon</summary>
- #cobblemon:is_mountain
- #cobblemon:is_peak
@@ -1126,7 +1394,18 @@ This file contains tags related to different biomes in cobblemon, as well as som
</details>
<details>
<summary><b>Tag:</b> #evolution:vivillon_ocean</summary>
<summary><b>Tag:</b> #vivillon:monsoon_anti</summary>
- #cobblemon:is_badlands
- #cobblemon:is_desert
- #cobblemon:is_floral
- #cobblemon:is_mushroom
- #cobblemon:is_tropical_island
</details>
<details>
<summary><b>Tag:</b> #vivillon:ocean</summary>
- #cobblemon:is_coast
- #cobblemon:is_warm_ocean
@@ -1134,7 +1413,24 @@ This file contains tags related to different biomes in cobblemon, as well as som
</details>
<details>
<summary><b>Tag:</b> #evolution:vivillon_river</summary>
<summary><b>Tag:</b> #vivillon:ocean_anti</summary>
- #cobblemon:is_cold_ocean
- #cobblemon:is_frozen_ocean
- #cobblemon:is_lukewarm_ocean
- #cobblemon:is_temperate_ocean
</details>
<details>
<summary><b>Tag:</b> #vivillon:polar</summary>
- #cobblemon:is_frozen_ocean
</details>
<details>
<summary><b>Tag:</b> #vivillon:river</summary>
- #cobblemon:is_river
- #cobblemon:is_swamp
@@ -1142,7 +1438,48 @@ This file contains tags related to different biomes in cobblemon, as well as som
</details>
<details>
<summary><b>Tag:</b> #evolution:vivillon_sun</summary>
<summary><b>Tag:</b> #vivillon:river_anti</summary>
- #cobblemon:is_forest
- #cobblemon:is_jungle
- #cobblemon:is_magical
- #cobblemon:is_spooky
</details>
<details>
<summary><b>Tag:</b> #vivillon:sandstorm</summary>
- #cobblemon:is_desert
</details>
<details>
<summary><b>Tag:</b> #vivillon:sandstorm_anti</summary>
- #cobblemon:is_badlands
</details>
<details>
<summary><b>Tag:</b> #vivillon:savanna</summary>
- #cobblemon:is_savanna
</details>
<details>
<summary><b>Tag:</b> #vivillon:savanna_anti</summary>
- #cobblemon:is_badlands
- #cobblemon:is_desert
- #cobblemon:is_floral
- #cobblemon:is_mountain
</details>
<details>
<summary><b>Tag:</b> #vivillon:sun</summary>
- #cobblemon:is_sky
- #cobblemon:is_volcanic
@@ -1151,7 +1488,7 @@ This file contains tags related to different biomes in cobblemon, as well as som
</details>
<details>
<summary><b>Tag:</b> #evolution:vivillon_tundra</summary>
<summary><b>Tag:</b> #vivillon:tundra</summary>
- #cobblemon:is_glacial
- #cobblemon:is_snowy_forest
@@ -1159,6 +1496,20 @@ This file contains tags related to different biomes in cobblemon, as well as som
</details>
<details>
<summary><b>Tag:</b> #vivillon:tundra_anti</summary>
- #cobblemon:is_mountain
</details>
<details>
<summary><b>Tag:</b> #vivillon:void</summary>
- #minecraft:is_end
</details>
<details>
<summary><b>Tag:</b> #has_density:dense</summary>
@@ -1439,6 +1790,7 @@ This file contains tags related to different biomes in cobblemon, as well as som
<details>
<summary><b>Tag:</b> #has_season:spring</summary>
- #aether:is_aether
- #cobblemon:is_floral
- #cobblemon:is_lukewarm_ocean
- #cobblemon:is_magical
@@ -1666,60 +2018,109 @@ This file contains tags related to different biomes in cobblemon, as well as som
</details>
<details>
<summary><b>Tag:</b> #regional_bias_evolutions:alolan</summary>
<summary><b>Tag:</b> #space:is_fiery</summary>
- #cobblemon:is_tropical_island
- #minecraft:is_beach
- #stellaris:mercury_biomes
- space:mercury_hotspot
- space:mercury_plains
- space:venus_highlands
- space:venus_lava_caves
- space:venus_lowlands
- space:venus_midlands
- space:venus_volcanic_plains
- stellaris:infernal_venus_barrens
</details>
<details>
<summary><b>Tag:</b> #regional_bias_evolutions:cyndaquil_quilava_hisui_bias</summary>
<summary><b>Tag:</b> #space:is_icy</summary>
- #cobblemon:is_taiga
- #cobblemon:nether/is_crimson
- #cobblemon:nether/is_forest
- #cobblemon:nether/is_overgrowth
- #space:ice_craters
- stellaris:mars_ice_spikes
</details>
<details>
<summary><b>Tag:</b> #regional_bias_evolutions:oshawott_dewott_hisui_bias</summary>
<summary><b>Tag:</b> #space:is_mars</summary>
- #c:stony_shores
- minecraft:snowy_beach
- minecraft:stony_shore
- terralith:basalt_cliffs
- terralith:granite_cliffs
- terralith:white_cliffs
- wythers:calcite_coast
- wythers:coastal_mangroves
- wythers:cold_island
- wythers:cold_stony_shore
- wythers:deepslate_shore
- wythers:frigid_island
- wythers:frozen_island
- wythers:gravelly_beach
- wythers:icy_shore
- wythers:mediterranean_island
- wythers:temperate_island
- wythers:tropical_island
- wythers:warm_stony_shore
- #stellaris:mars_biomes
- #stellaris:mars_biomes
- #stellaris:mars_biomes
- space:mars_dripstone
- space:mars_highlands
- space:mars_ice
- space:mars_lowlands
- space:mars_lush_caves
- space:mars_midlands
</details>
<details>
<summary><b>Tag:</b> #regional_bias_evolutions:rowlet_dartrix_alolan</summary>
<summary><b>Tag:</b> #space:is_mercury</summary>
- #cobblemon:is_forest
- #cobblemon:is_taiga
- #stellaris:mercury_biomes
- space:mercury_hotspot
- space:mercury_ice
- space:mercury_plains
</details>
<details>
<summary><b>Tag:</b> #regional_bias_evolutions:rowlet_dartrix_hisui_bias</summary>
<summary><b>Tag:</b> #space:is_moon</summary>
- #cobblemon:is_snowy_forest
- #cobblemon:is_snowy_taiga
- #stellaris:moon_biomes
- space:moon_highlands
- space:moon_ice
- space:moon_lowlands
- space:moon_midlands
- space:moon_rocks
- swe:moon
</details>
<details>
<summary><b>Tag:</b> #space:is_space</summary>
- #stellaris:mars_biomes
- #stellaris:mercury_biomes
- #stellaris:moon_biomes
- #stellaris:venus_biomes
- space:mars_dripstone
- space:mars_highlands
- space:mars_ice
- space:mars_lowlands
- space:mars_lush_caves
- space:mars_midlands
- space:mercury_hotspot
- space:mercury_ice
- space:mercury_plains
- space:moon_highlands
- space:moon_ice
- space:moon_lowlands
- space:moon_midlands
- space:moon_rocks
- space:space
- space:venus_highlands
- space:venus_lava_caves
- space:venus_lowlands
- space:venus_midlands
- space:venus_plankton_bloom
- space:venus_sky
- space:venus_volcanic_plains
- swe:moon
</details>
<details>
<summary><b>Tag:</b> #space:is_venus</summary>
- #stellaris:venus_biomes
- space:venus_highlands
- space:venus_lava_caves
- space:venus_lowlands
- space:venus_midlands
- space:venus_plankton_bloom
- space:venus_sky
- space:venus_volcanic_plains
</details>
@@ -186,6 +186,7 @@ This file contains tags related to block in cobblemon.
- #c:farmland
- #c:farmlands
- aether:aether_farmland
- minecraft:farmland
</details>
@@ -465,6 +466,19 @@ This file contains tags related to block in cobblemon.
</details>
<details>
<summary><b>Tag:</b> #block:gilded_chests</summary>
- cobblemon:black_gilded_chest
- cobblemon:blue_gilded_chest
- cobblemon:gilded_chest
- cobblemon:green_gilded_chest
- cobblemon:pink_gilded_chest
- cobblemon:white_gilded_chest
- cobblemon:yellow_gilded_chest
</details>
<details>
<summary><b>Tag:</b> #block:glazed_terracotta_blocks</summary>
@@ -1172,6 +1186,7 @@ This file contains tags related to block in cobblemon.
- botania:white_floating_flower
- botania:white_mystical_flower
- botania:white_shiny_flower
- cobblemon:pep_up_flower
- deep_aether:enchanted_blossom
- farmersdelight:wild_carrots
- minecraft:azure_bluet
@@ -1863,10 +1878,7 @@ This file contains tags related to block in cobblemon.
<details>
<summary><b>Tag:</b> #block:logs</summary>
- cobblemon:apricorn_log
- cobblemon:apricorn_wood
- cobblemon:stripped_apricorn_log
- cobblemon:stripped_apricorn_wood
- #cobblemon:apricorn_logs
</details>
@@ -229,14 +229,6 @@ This file contains tags related to items in cobblemon.
</details>
<details>
<summary><b>Tag:</b> #item:cobblemon_seeds</summary>
- #cobblemon:mint_seeds
- cobblemon:vivichoke_seeds
</details>
<details>
<summary><b>Tag:</b> #item:cooked_meat</summary>
@@ -329,6 +321,7 @@ This file contains tags related to items in cobblemon.
- cobblemon:reaper_cloth
- cobblemon:ribbon_sweet
- cobblemon:sachet
- cobblemon:shell_helmet
- cobblemon:star_sweet
- cobblemon:strawberry_sweet
- cobblemon:sweet_apple
@@ -433,6 +426,19 @@ This file contains tags related to items in cobblemon.
</details>
<details>
<summary><b>Tag:</b> #item:gilded_chests</summary>
- cobblemon:black_gilded_chest
- cobblemon:blue_gilded_chest
- cobblemon:gilded_chest
- cobblemon:green_gilded_chest
- cobblemon:pink_gilded_chest
- cobblemon:white_gilded_chest
- cobblemon:yellow_gilded_chest
</details>
<details>
<summary><b>Tag:</b> #item:hanging_signs</summary>
@@ -590,9 +596,9 @@ This file contains tags related to items in cobblemon.
- #cobblemon:apricorn_sprouts
- #cobblemon:apricorns
- #cobblemon:berries
- #cobblemon:cobblemon_seeds
- #cobblemon:herbs
- #cobblemon:mint_leaf
- #cobblemon:seeds
- cobblemon:big_root
- cobblemon:energy_root
- cobblemon:medicinal_leek
@@ -820,12 +826,9 @@ This file contains tags related to items in cobblemon.
<details>
<summary><b>Tag:</b> #item:seeds</summary>
- #cobblemon:cobblemon_seeds
- minecraft:beetroot_seeds
- minecraft:melon_seeds
- minecraft:pumpkin_seeds
- minecraft:torchflower_seeds
- minecraft:wheat_seeds
- #cobblemon:held/terrain_seeds
- #cobblemon:mint_seeds
- cobblemon:vivichoke_seeds
</details>
@@ -882,6 +885,7 @@ This file contains tags related to items in cobblemon.
- cobblemon:deepslate_sun_stone_ore
- cobblemon:sun_stone_ore
- cobblemon:terracotta_sun_stone_ore
</details>
@@ -949,7 +953,7 @@ This file contains tags related to items in cobblemon.
<details>
<summary><b>Tag:</b> #item:tier_1_poke_ball_materials</summary>
- minecraft:copper_ingot
- #c:ingots/copper
</details>
@@ -977,7 +981,7 @@ This file contains tags related to items in cobblemon.
<details>
<summary><b>Tag:</b> #item:tier_2_poke_ball_materials</summary>
- minecraft:iron_ingot
- #c:ingots/iron
</details>
@@ -1000,7 +1004,7 @@ This file contains tags related to items in cobblemon.
<details>
<summary><b>Tag:</b> #item:tier_3_poke_ball_materials</summary>
- minecraft:gold_ingot
- #c:ingots/gold
</details>
@@ -1015,7 +1019,7 @@ This file contains tags related to items in cobblemon.
<details>
<summary><b>Tag:</b> #item:tier_4_poke_ball_materials</summary>
- minecraft:diamond
- #c:gems/diamond
</details>
@@ -1345,6 +1349,13 @@ This file contains tags related to items in cobblemon.
</details>
<details>
<summary><b>Tag:</b> #item:bookshelf_books</summary>
- #cobblemon:pokedex
</details>
<details>
<summary><b>Tag:</b> #item:chest_boats</summary>
@@ -1397,26 +1408,28 @@ This file contains tags related to items in cobblemon.
<details>
<summary><b>Tag:</b> #item:logs</summary>
- cobblemon:apricorn_log
- cobblemon:apricorn_wood
- cobblemon:stripped_apricorn_log
- cobblemon:stripped_apricorn_wood
- #cobblemon:apricorn_logs
</details>
<details>
<summary><b>Tag:</b> #item:logs_that_burn</summary>
- cobblemon:apricorn_log
- cobblemon:apricorn_wood
- cobblemon:stripped_apricorn_log
- cobblemon:stripped_apricorn_wood
- #cobblemon:apricorn_logs
</details>
<details>
<summary><b>Tag:</b> #item:parrot_food</summary>
- #cobblemon:seeds
</details>
<details>
<summary><b>Tag:</b> #item:piglin_loved</summary>
- #cobblemon:gilded_chests
- cobblemon:relic_coin
- cobblemon:relic_coin_pouch
- cobblemon:relic_coin_sack
Loaded 100 of 104 files, more files were not shown because too many files have changed in this diff. Show more