Compare commits

...
Author SHA1 Message Date
Polymeta 4f5799e5df yet another seasoning codec tweak
Signed-off-by: Polymeta <40173118+Polymeta@users.noreply.github.com>
2025-05-30 00:39:13 +01:00
Polymeta 54ea4903ba Merge branch 'cooking-tooltip-overhaul' into 'main'
Cooking tooltip overhaul

See merge request cable-mc/cobblemon!1687
2025-05-29 22:07:13 +00:00
Plastered_CrabandPolymeta 28ad0cce83 Cooking tooltip overhaul 2025-05-29 22:07:13 +00:00
Polymeta 7fe1929609 Merge branch 'hyper_trained_ivs' into 'main'
Hyper Trained Stat IVs

See merge request cable-mc/cobblemon!1614
2025-05-29 15:53:12 +00:00
Konoha DandPolymeta e03082a75e Hyper Trained Stat IVs 2025-05-29 15:53:11 +00:00
Polymeta 8d0c27f0e4 [skip-ci] changelog
Signed-off-by: Polymeta <40173118+Polymeta@users.noreply.github.com>
2025-05-29 16:47:14 +01:00
Polymeta 91fc2dc896 Merge branch 'spawn-rules-npc-gisketch' into 'main'
Make Spawn Rules affect NPC spawns

See merge request cable-mc/cobblemon!1682
2025-05-29 15:43:12 +00:00
Ghegi Jimenez ab1ca295a3 Make Spawn Rules affect NPC spawns
- Update NPCSpawnDetail to have autoLabel() function similar to
  PokemonSpawnDetail to support spawn rules

Ref: https://gitlab.com/cable-mc/cobblemon/-/issues/1559
2025-05-29 09:36:37 +08:00
Polymeta 5cbe937e23 Merge branch 'tatami' into 'main'
Tatami Mats

See merge request cable-mc/cobblemon!1684
2025-05-28 09:27:00 +00:00
dhi_holoandPolymeta 4fa196da94 Tatami Mats 2025-05-28 09:27:00 +00:00
Polymeta d35db46c1b Merge branch 'Add-pc-take-and-search-commands' into 'main'
Add PC Search and PC Take Commands

See merge request cable-mc/cobblemon!1677
2025-05-26 21:25:15 +00:00
Polymeta b8a6c94fcb Merge branch 'boat-behaviour' into 'main'
Add boat water behaviour

See merge request cable-mc/cobblemon!1638
2025-05-25 00:26:09 +00:00
Ghegi Jimenez b069e448c1 Add PC Search and PC Take Commands
- Add pcsearch command to search through target's PC and display pokemon info with box slots
- Add pctake command to take pokemon from target's box slot
- Pokemon are removed when using pctake on self or as server
2025-05-25 08:07:17 +08:00
Polymeta 18f41407c8 fix merge conflicts
Signed-off-by: Polymeta <40173118+Polymeta@users.noreply.github.com>
2025-05-25 00:46:35 +01:00
Polymeta b659a662a2 Merge branch 'refs/heads/main' into boat-behaviour
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
2025-05-25 00:23:15 +01:00
Polymeta dbb2e45e14 Merge branch 'spicy-molang' into 'main'
Added `play_sound_on_server` and `run_molang_after` as available MoLang functions

See merge request cable-mc/cobblemon!1615
2025-05-24 23:20:14 +00:00
SpicyandPolymeta da491015a6 Added play_sound_on_server and run_molang_after as available MoLang functions 2025-05-24 23:20:14 +00:00
Polymeta 55db0d8af1 Merge branch 'battle-side-start-lang-position' into 'main'
Update battle sidestart langkeys formatting

See merge request cable-mc/cobblemon!1678
2025-05-24 23:11:38 +00:00
Ghegi Jimenez 211821bc0f Update battle sidestart langkeys formatting
This commit updates the SideStartInstruction.kt and
SideEndInstruction.kt files to use
position-specific language keys for battle side effects,
improving grammatical consistency.

**The changes**:

1. Modified SideStartInstruction.kt to use separate
language keys for ally and opponent sides

2. Updated en_us.json with new position-specific language keys
for all side effects

3. Added changelog entry documenting the improvement

This approach eliminates grammatical issues that occurred with the
previous implementation where "%1$s" was used in different positions
in sentences, making translations awkward.

The new format uses "sidestart.ally.[effect]" and
"sidestart.opponent.[effect]" keys, allowing for more natural language
in all cases.

Ref: https://gitlab.com/cable-mc/cobblemon/-/issues/984
2025-05-25 06:58:36 +08:00
Polymeta 16a21f9d2e Merge branch 'remedying-remedies' into 'main'
Remedy Rebalance

Closes #1570

See merge request cable-mc/cobblemon!1680
2025-05-24 07:46:50 +00:00
Polymeta e69060bde6 Merge branch 'fossilized-improvement' into 'main'
Fossilized Improvement (with major tangents)

Closes #1548

See merge request cable-mc/cobblemon!1673
2025-05-24 07:45:15 +00:00
dhi_holo ebdbbd5176 Indentation fixed
Looks identical to me in IntelliJ, but it's apparently different
2025-05-24 15:28:46 +10:00
dhi_holo 6e163d08f0 Merge branch 'main' into fossilized-improvement 2025-05-24 15:19:30 +10:00
dhi_holo 13c7b75b19 finished
That's the whole thing done!
2025-05-24 11:03:43 +10:00
Polymeta 1ad36e39c5 change the remedies.json layout to accommodate for individual friendshipDrops
Signed-off-by: Polymeta <40173118+Polymeta@users.noreply.github.com>
2025-05-23 23:43:58 +01:00
Polymeta f4d67b9b64 some rootblock fixes (energy root is shearable now) and energy roots run through same spreading RNG as big roots
Signed-off-by: Polymeta <40173118+Polymeta@users.noreply.github.com>
2025-05-23 22:40:16 +01:00
Polymeta 3c84afb95d Merge branch 'RestorationTankHopperFix' into 'main'
Restoration tank hopper fix

Closes #1569

See merge request cable-mc/cobblemon!1679
2025-05-23 20:43:26 +00:00
JazzMcNade 0fc1239c77 Update CHANGELOG.md 2025-05-23 13:19:40 -05:00
JazzMcNade 38a0d149c5 Update RestorationTankBlockEntity.kt 2025-05-23 13:17:42 -05:00
dhi_holo 8fee0e7f91 Begun Rebalance
Relevant conversation: https://discord.com/channels/725110639554592879/725619428384964678/1375306792523005962

Resolves #1570 indirectly
2025-05-23 13:13:07 +10:00
dhi_holo 7985aed6bf Update en_us.json
Added the three newest tags to the lang file
2025-05-23 11:02:58 +10:00
dhi_holo 5543b8a660 Merge branch 'main' into fossilized-improvement 2025-05-23 10:45:28 +10:00
Polymeta d7d855adc2 small cleanup for structure mixin
Signed-off-by: Polymeta <40173118+Polymeta@users.noreply.github.com>
2025-05-21 14:17:06 +01:00
Hiroku 4fd50b8d2b Merge branch 'y-limit-structures' into 'main'
On request of Slippy, I created a check to make sure certain structures will not spawn below the Sea Level

See merge request cable-mc/cobblemon!1672
2025-05-21 12:28:53 +00:00
Aram 53749e014b License 2025-05-21 12:22:02 +02:00
Aram b4cdf371fe It now checks for Sea Level in stead of hardcoded 65 2025-05-21 12:22:02 +02:00
Aram e0e30e7e11 Updated the Structure Check to also take StructurePieces into account 2025-05-21 12:22:02 +02:00
Aram cfec4e10cb Created a Mixin that prevents certain Structures from generating below a specific Y Level 2025-05-21 12:22:02 +02:00
Polymeta 614799cfcb Merge branch 'feature/improved-filters' into 'main'
improved filter by Name

See merge request cable-mc/cobblemon!1670
2025-05-21 09:06:34 +00:00
DavidandPolymeta ec367fd4df improved filter by Name 2025-05-21 09:06:34 +00:00
dhi_holo e415b281ee Merge branch 'main' into fossilized-improvement 2025-05-20 22:14:12 +10:00
dhi_holo d77cb36149 Merge branch 'main' into fossilized-improvement 2025-05-20 08:37:01 +10:00
Polymeta 5a3e9bb236 some tidying up and fixing upper half of rice block not growing with the lower half
Signed-off-by: Polymeta <40173118+Polymeta@users.noreply.github.com>
2025-05-19 11:17:56 +01:00
dhi_holo 2fce916f05 >:D
I feel like rice isn't as good at absorbing a fall's energy, so I think this is a fun little tweak to it
2025-05-19 16:31:29 +10:00
dhi_holo 52c4c35c0d Who up Hearting they Grains
Gotta get the top half growing in sync with the bottom half (currently doesn't grow at all once it spawns in), but progress is progress
2025-05-19 15:14:44 +10:00
dhi_holo 40f4f80d6e we're graining now
hearty grains block assets all nice and pretty
2025-05-19 12:20:33 +10:00
dhi_holo 721025281f Tags+ 2025-05-18 20:31:56 +10:00
dhi_holo 08e6f68693 Merge branch 'main' into fossilized-improvement 2025-05-18 19:55:42 +10:00
dhi_holo 1e3fcf3e84 Update hearty_grains.json 2025-05-18 19:43:47 +10:00
dhi_holo 92a67ca0ca Grain Bale
Hearty Grain Bale implemented fully
2025-05-18 19:27:58 +10:00
dhi_holo 42600fc840 Graining
Attempted to improve hearty grain for the purposes of adding the assets. Top state isn't working properly, not aging, not bonemealable, etc, but it has the right state count now!
2025-05-18 16:23:13 +10:00
dhi_holo b5e2f69207 Update candied_apple_from_cooking_pot.json
I can see things I swear
2025-05-17 18:16:08 +10:00
dhi_holo c6c83c065b Update candied_apple_from_cooking_pot.json
forgot a thing
2025-05-17 18:03:31 +10:00
dhi_holo 687381dc1b Stick it to the fruit
Candied Apples and Berries are now held by their sticks
2025-05-17 17:23:39 +10:00
dhi_holo f088dd62bc Bands (plus tweak)
Focus, Choice, and Muscle Bands now use an optimised model and new textures, and EXP Share animated texture is now a bit stronger
2025-05-17 16:45:57 +10:00
dhi_holo 3d1f9458f6 Campfire Pot Recipies
I dislike how these items are named but I'm not about to go around dealing with renaming them to the standard format of `COLOUR_campfire_pot`
2025-05-17 13:46:40 +10:00
dhi_holo 470d3807f1 Wearable Upgrades
Glasses, EXP Share, and Rocky Helmet improved upon
2025-05-17 13:35:53 +10:00
dhi_holo 57c1201ad0 a p p l e (and tagging)
Improved tagging for a couple things, made Candied Apples able to leave Leftovers
2025-05-16 15:18:10 +10:00
dhi_holo 4637bef5d2 Recipes and Tabs
Revised type boosting item recipes, and added some cooking items to relevant creative tabs
2025-05-16 14:19:30 +10:00
dhi_holo 6207a01ae3 Merge branch 'main' into fossilized-improvement 2025-05-16 10:49:21 +10:00
dhi_holo cf90bf0b0f Pots!
+ Allowed all 7 Apricorn Sprouts and Saccharine Sapling to be put in Flower Pots
+ Added all 9 of our potted blocks to the `#minecraft:flower_pots` block tag
+ Minor fix to the Potted Pep-Up Flower loot table
+ Fixed the texture name for Pep-Up Flower block
2025-05-15 16:44:34 +10:00
dhi_holo b109ff6edf Merge branch 'main' into fossilized-improvement 2025-05-15 14:45:42 +10:00
dhi_holo 06e4783f16 Update resurrect_pokemon.json 2025-05-13 16:11:40 +10:00
dhi_holo fe83b9d58e Merge branch 'main' into fossilized-improvement 2025-05-13 13:26:11 +10:00
dhi_holo 874a5d2e8f Update CHANGELOG.md
forgot one sentence, whoopsie daisies
2025-05-03 16:37:08 +10:00
dhi_holo 70e49bbbdb More Tweaks
Eject Pack was fixed at some point, so I readded the recipe, loaded dice was tweaked, and started tweaking the consumed tags
2025-05-03 16:06:42 +10:00
dhi_holo 39fce8ca06 Cupping
Cups are now craftable for real, too, praise the drinkingssiah
2025-05-03 15:21:50 +10:00
dhi_holo d288fe46da Replace Pot Recipes
They were weird, now they're slightly less weird and feel more reasonable imo
2025-05-03 14:47:16 +10:00
dhi_holo cefc97320a Merge branch 'main' into fossilized-improvement 2025-05-03 14:38:35 +10:00
dhi_holo 374fc44089 Fossil Analyzer Visual Tweak
the top texture is now good
2025-05-02 18:30:30 +10:00
dhi_holo f7664a04db L-L-L-Lava
Wrong brainrot, ah well, funny achievement as it should be

Also changed the advancement icon for the galar fossils so it isn't just the same as the regular fossil resurrection advancement
2025-05-02 17:47:25 +10:00
dhi_holo 2d772f5bf7 Update resurrect_galar_fossil.json
Should make one issue of the advancement no longer present, but the advancement itself doesn't work, pls fix Moe
2025-05-02 09:26:23 +10:00
dhi_holo 63af1713b9 Merge branch 'main' into fossilized-improvement 2025-05-01 15:39:28 +10:00
dhi_holo 8fecb12829 Three and a fix or two
Added Metal Alloy, Scroll of Darkness, and Scroll of Waters
Changed instances of `Hearty_Grains` to `HEARTY_GRAINS` to match conventions
Changed the Kings Rock wearable model to Gest's plane version
2025-05-01 15:15:26 +10:00
dhi_holo d0b50a1ee0 Sprites!
Clear Amulet, Grip Claw, Lagging Tail, and Luminous Moss now have sprites! Praise Vera!
2025-05-01 13:45:41 +10:00
dhi_holo a71bad07bd One. Year. Later.
Re-enabled the commented out held items, which almost resolves #1548, as they are still awaiting textures. But, I wanted to work with jsons, so this commit was made.
I also cleaned up/improved some recipe advancement jsons to be more accurate when reasonable
2025-04-29 20:37:22 +10:00
Hiroku 1769af7385 Merge branch 'main' into 'boat-behaviour'
# Conflicts:
#   common/src/main/kotlin/com/cobblemon/mod/common/util/adapters/RidingBehaviourSettingsAdapter.kt
2025-04-27 08:54:17 +00:00
Landon Wills 88e38bfa1a Remove additional references to submarine behaviour 2025-04-26 11:48:09 -04:00
Landon Wills 507a9a54b5 Remove submarine behaviour 2025-04-26 11:47:20 -04:00
Landon Wills 0b72a072bd Fix merge issues 2025-04-26 11:40:44 -04:00
Landon Wills c927cae609 Merge branch 'refs/heads/main' into water-mount-behaviours
# Conflicts:
#	common/src/main/java/com/cobblemon/mod/common/mixin/client/CameraMixin.java
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/behaviour/types/GenericSwimBehaviour.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/behaviour/types/air/BirdBehaviour.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/behaviour/types/air/GliderBehaviour.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/behaviour/types/air/JetBehaviour.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/riding/behaviour/types/land/HorseBehaviour.kt
2025-04-26 11:21:33 -04:00
dhi_holo 10bf69a79b Minor Ball Recipe Tweaks
Just cleans up three recipes
2025-04-25 17:11:16 +10:00
dhi_holo 172293c813 Merge branch 'main' into fossilized-improvement 2025-04-25 17:08:43 +10:00
dhi_holo 9bb653b8b7 Update resurrect_galar_fossil.json
should match upcoming clean up
2025-04-25 17:08:28 +10:00
Landon Wills a7b55e5d03 Add submarine behaviour 2025-04-23 05:47:56 -04:00
Landon Wills 28db655376 Fix issues with third person camera offsets 2025-04-23 05:47:40 -04:00
Landon Wills 006736cd71 Refactor behaviour names, hook up max up step to riding controller 2025-04-23 03:09:57 -04:00
Landon Wills f240dc1963 Prevent auto step for boat behaviour 2025-04-22 10:46:20 -04:00
Landon Wills 535c5f2e67 Rename to boat behaviour 2025-04-22 09:55:39 -04:00
Landon Wills 8b209e081b Hook up skill and stamina 2025-04-22 09:29:26 -04:00
Landon Wills f7f276ecfb Clean things up, add acceleration logic 2025-04-22 08:37:32 -04:00
dhi_holo fc0cd0dac4 improvement phase 1
new advancement to trigger when reviving galar hybrid fossils, to help inform players of the combinations needed for it
It doesn't work yet, as the conditions don't actually exist, but I'm just making a commit for it to complain using
2025-04-21 07:46:41 +10:00
Landon Wills 019245472f Add riding stat calcs for jump and speed, some experimenting with fov 2025-04-20 07:55:14 -04:00
Landon Wills cefb502f10 Prevent 360 look on boat controller, add jump, add momentum logic when transitioning from forward/backwards input 2025-04-20 07:11:37 -04:00
Landon Wills ee5e4d33b2 Fix merge issues 2025-04-19 23:14:08 -04:00
Landon Wills 0fd954ffa5 Merge branch 'refs/heads/riding-debug-ui' into water-mount-behaviours 2025-04-19 23:10:49 -04:00
Landon Wills 60d3d737f9 Merge branch 'refs/heads/main' into water-mount-behaviours 2025-04-19 23:10:36 -04:00
Landon Wills 1caf963323 Start implementing boat behaviour 2025-04-14 00:43:47 -04:00
Landon Wills bb94f872a9 Fix player shrinking when riding pokemon that's getting retrieved to pokeball 2025-04-13 21:44:06 -04:00
355 changed files with 5265 additions and 2865 deletions
+1
View File
@@ -7,6 +7,7 @@
- Added `/changewallpaper <player> <boxNumber> <wallpaper>` command to change a box wallpaper through commands.
- Added `/renamebox <player> <boxNumber> <name>` command to rename a PC box through commands.
- Added IVs and EVs stat displays in PC.
- improved filter by Name, now is available search by exact names or partial matches, for example "cha" will show Charmander, Charmeleon and Charizard among others that match.
### Developer
- Added `RenamePCBoxEvent.Pre` and `RenamePCBoxEvent.Post` events to prevent players from renaming a box or changing their input.
+27 -3
View File
@@ -21,8 +21,15 @@
- Fixed Moon Ball moon phase logic to actually work correctly
- Added `translucent_cull` boolean option into resolver's layer to allow for translucent textures with culling
- Added [LambDynamicLights](https://modrinth.com/mod/lambdynamiclights) support for items held by Pokémon.
- Added the Clear Amulet, Grip Claw, Lagging Tail, Luminous Moss, Metal Alloy, Scroll of Darkness, Scroll of Waters
- Added Recipes for Masterpiece Cup, Eject Pack
- Added modification to Minecraft Creative Inventory search to account for item names that contain `poké` when input contains `poke`.
- Added Campfire Pot as well as loads of new food items (Poke Puffs, Ponigiri, Sinister Tea, etc)
- Added Hearty Grains, a new crop used in the new cooking mechanic
- Added Tatami blocks and Tatami Mat blocks, made from Hearty Grain, for decorating builds
- Added `/pcsearch <player> <pokemonProperties>` command that searches for a specific Pokémon within a player's PC.
- Added `/pctake <player> <box> <slot>` command that takes a specific Pokémon from a player's PC. Removes the pokemon if target is self or ran from the server.
- Added Hyper Training items (IV Modification) as well as some additional candy items to do so (Health Candy, Sickly Candy)
### Pokémon Added
@@ -116,12 +123,13 @@
- Made Blocks of Gold count as Big Nuggets when held by a Pokémon (for Fling functionality)
- Players can now eat Sweet and Tart Apples, Whipped Dreams, and the Alcremie Sweets.
- Updated Sweet and Tart Apple sprites
- Updated the following recipes: Air Balloon, Assault Vest, Binding Band, Black Belt, Blunder Policy, Choice Band, Choice Scarf, Cleanse Tag, Covert Cloak, Destiny Knot, Eject Button, Expert Belt, Focus Band, Focus Sash, Magnet, Metronome, Muscle Band, Power Anklet, Power Band, Power Belt, Power Bracer, Power Lens, Power Weight, Protective Pads, Protein, Punching Glove, Reaper Cloth, Rocky Helmet, Room Service, Sachet, Safety Goggles, Silk Scarf, Spell Tag, Utility Umbrella, Weakness Policy, Zinc
- Added alternate ingredient options to the following recipes: Cell Battery, Charcoal Stick, Dragon Fang, Miracle Seed, Mystic Water, Never Melt Ice, Twisted Spoon, Damp Rock, Heat Rock, Icy Rock, Smooth Rock
- Updated the following recipes: Air Balloon, Assault Vest, Binding Band, Black Belt, Blunder Policy, Choice Band, Choice Scarf, Cleanse Tag, Covert Cloak, Destiny Knot, Eject Button, Expert Belt, Focus Band, Focus Sash, Magnet, Metronome, Muscle Band, Power Anklet, Power Band, Power Belt, Power Bracer, Power Lens, Power Weight, Protective Pads, Protein, Punching Glove, Reaper Cloth, Rocky Helmet, Room Service, Sachet, Safety Goggles, Silk Scarf, Spell Tag, Utility Umbrella, Weakness Policy, Zinc, Chipped Pot, Cracked Pot, Unremarkable Cup, Loaded Dice, Charcoal Stick, Dragon Fang, Miracle Seed, Mystic Water, Never Melt Ice, Twisted Spoon, Black Glasses, Fairy Feather, Hard Stone, Silver Powder, Soft Sand
- Added alternate ingredient options to the following recipes: Cell Battery, Damp Rock, Heat Rock, Icy Rock, Smooth Rock
- Grouped together some recipes within the Recipe Book. Groups include: the seven basic Poké Balls, the seven basic Ancient Poké Balls, Gilded Chests, Pokedexes, and the Weather Rocks.
- Updated some item tags to better integrate behaviours between Cobblemon, Vanilla Minecraft, and other mods
- Removed Cooked Meat, Raw Meat, Protein Ingredients, and Zinc Ingredients, the first two are now using `c` namespace tags, the latter have better integrated use of tags within their recipes which removes need for custom tags.
- Added our seeds tag into `#c:seeds`, which is now made use of for the Miracle Seed recipe.
- Added our seeds tag into `#c:seeds`, which is now made use of for the Miracle Seed recipe.
- Added herbs and snowballs to the consumable in PvE and Wild battle tags
- Tweaked the Natural Materials Vanilla file to fit with the changes to tags
- Substantially optimised spawning checks mainly by front-loading biome filtering.
- When using the `cobblemon` or `generation_9` capture calculators a critical capture with a single shake will always play for successful captures when you've already registered the Pokémon as caught in your Pokédex.
@@ -136,10 +144,15 @@
- Improved parity with vanilla mobs' drop behavior; loot and XP drop on death instead of after the entire death sequence finishes.
- Quirk animations no longer play in the battle GUI since they were pretty distracting.
- A number of Pokemon that float above the ground visually (Gastly, Klingklang, etc.) are no longer considered to be touching the ground
- Changed the recipes for Level, Lure, and Moon Balls to be cleaner
- Renamed `pokemonId` and `type` to `species` in relevant Advancement triggers for conformity, this is a breaking change.
- Added a separate `species` argument to the `pick_starter`, `pasture_use` and `resurrect_pokemon` Advancement triggers.
- Made `CobblemonAgingDespawner` thresholds configurable via the config file.
- Tweaked Berry flavor data to balance cooking pot mechanics
- Made Red, Yellow, Green, Blue, Pink, Black, and White Apricorn Sprout and Saccharine Sapling able to be placed into flower pots.
- Added all Potted Apricorn Sprouts, Potted Saccharine Saplings, and Potted Pep-Up Flowers to the `#minecraft:flower_pots` block tag
- Corrected the healing values of the remedies and energy root, and reintroduced the friendship lowering mechanics for them, revivl herb, and heal powder
- Updated battle language keys for side effects to use position-specific formats, improving grammatical consistency
### Fixes
- Fixed Particles sometimes facing the wrong direction (looking at you, Swords Dance)
@@ -180,6 +193,10 @@
- Fixed the `dimensions` spawning condition using the incorrect ResourceLocation, causing it to not function properly.
- Fix issue where locator X axis was not aligned with blockbench.
- Fix issue where particle effects that play on frame 1 on sendout would never play (Gastly)
- Fixed the block texture name for the Pep-Up Flower being inaccurate
- Fixed issue where the restoration tank would not accept valid items from a hopper.
- Fixed energy root not being shearable
- Fixed energy root always spreading into more energy roots instead of by chance (same as big root)
### Developer
- A finished battle now has winners and losers set inside of `PokemonBattle` instead of them always being empty.
@@ -206,6 +223,8 @@
}
}
`
- The IVs class has now been extended to include Hyper Trained values.
- Added `Pokemon#hyperTrainIV()` and `IVs#setHyperTrainedIV(Stat, Int)`
### MoLang & Datapacks
- The following usages for item predicates can now use item conditions like advancements do, you can learn about them in the [Minecraft wiki](https://minecraft.wiki/w/Advancement_definition#minecraft:filled_bucket)
@@ -225,9 +244,14 @@
- Fixed `heldItem` property inside spawn files not working and causing crashes
- Fixed `spawn_bedrock_particles` MoLang causing crashes when used in a server environment
- The Pokédex form lang key definition now follows `cobblemon.ui.pokedex.info.form.{species}-{formname}` instead of `cobblemon.ui.pokedex.info.form.{formname}`.
- Added `play_sound_on_server` as an available Molang function for the `worldHolder` & `player` functions.
- Added `run_molang_after` as an available Molang function for the `entity` functions when schedulable.
- Added an optional parameter for `run_molang` to schedule the function.
- Added `labels` & `has_label` as available Molang functions for the `speciesFunctions`
- Added datapack-defined starter categories via `data/<namespace>/starters/*.json`, with built-in fallback and `useConfigStarters` merge option.
- The format of the `remedies.json` file has changed to allow for individual friendshipDrop amounts per remedy
- Fixed `entity.find_nearby_block` causing crashes when attempting to use a block tag
- Spawn Filters can now access `v.spawn.class` to get the identifier of an NPC class for when trying to influence NPC spawns
## [1.6.1 (January 26th, 2025)](#1-6-1)
@@ -0,0 +1,67 @@
/*
* 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.world.CobblemonStructureIDs;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.core.Holder;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.LevelHeightAccessor;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeSource;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.RandomState;
import net.minecraft.world.level.levelgen.structure.Structure;
import net.minecraft.world.level.levelgen.structure.StructurePiece;
import net.minecraft.world.level.levelgen.structure.StructureStart;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager;
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.CallbackInfoReturnable;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Predicate;
@Mixin(Structure.class)
public abstract class StructureMixin {
// Define a set of structures that should not spawn below Sea Level
@Unique
private static final Set<ResourceLocation> RESTRICTED_STRUCTURES = new HashSet<>(Arrays.asList(
CobblemonStructureIDs.STONJOURNER_HENGE,
CobblemonStructureIDs.LUNA_HENGE,
CobblemonStructureIDs.SOL_HENGE
));
@Inject(method = "generate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/levelgen/structure/StructureStart;isValid()Z"),
cancellable = true)
public void cobblemon$isValid(RegistryAccess registryAccess, ChunkGenerator chunkGenerator, BiomeSource biomeSource,
RandomState randomState, StructureTemplateManager structureTemplateManager, long seed,
ChunkPos chunkPos, int references, LevelHeightAccessor heightAccessor,
Predicate<Holder<Biome>> validBiome,
CallbackInfoReturnable<StructureStart> cir,
@Local StructureStart structureStart) {
ResourceLocation structureKey = registryAccess.registryOrThrow(Registries.STRUCTURE).getKey((Structure) (Object) this);
if(!RESTRICTED_STRUCTURES.contains(structureKey)) {
return;
}
for (StructurePiece piece : structureStart.getPieces()) {
if (piece.getBoundingBox().minY() < chunkGenerator.getSeaLevel()) {
cir.setReturnValue(StructureStart.INVALID_START);
return;
}
}
}
}
@@ -515,6 +515,30 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
@JvmField
val HEARTY_GRAINS = this.create("hearty_grains", HeartyGrainsBlock(BlockBehaviour.Properties.of().pushReaction(PushReaction.DESTROY).ignitedByLava().mapColor(MapColor.PLANT).noCollission().randomTicks().instabreak().sound(CobblemonSounds.VIVICHOKE_SOUNDS)))
@JvmField
val POTTED_RED_APRICORN_SAPLING = this.create("potted_red_apricorn_sapling", BlocksInvoker.createFlowerPotBlock(RED_APRICORN_SAPLING))
@JvmField
val POTTED_YELLOW_APRICORN_SAPLING = this.create("potted_yellow_apricorn_sapling", BlocksInvoker.createFlowerPotBlock(YELLOW_APRICORN_SAPLING))
@JvmField
val POTTED_GREEN_APRICORN_SAPLING = this.create("potted_green_apricorn_sapling", BlocksInvoker.createFlowerPotBlock(GREEN_APRICORN_SAPLING))
@JvmField
val POTTED_BLUE_APRICORN_SAPLING = this.create("potted_blue_apricorn_sapling", BlocksInvoker.createFlowerPotBlock(BLUE_APRICORN_SAPLING))
@JvmField
val POTTED_PINK_APRICORN_SAPLING = this.create("potted_pink_apricorn_sapling", BlocksInvoker.createFlowerPotBlock(PINK_APRICORN_SAPLING))
@JvmField
val POTTED_BLACK_APRICORN_SAPLING = this.create("potted_black_apricorn_sapling", BlocksInvoker.createFlowerPotBlock(BLACK_APRICORN_SAPLING))
@JvmField
val POTTED_WHITE_APRICORN_SAPLING = this.create("potted_white_apricorn_sapling", BlocksInvoker.createFlowerPotBlock(WHITE_APRICORN_SAPLING))
@JvmField
val POTTED_SACCHARINE_SAPLING = this.create("potted_saccharine_sapling", BlocksInvoker.createFlowerPotBlock(SACCHARINE_SAPLING))
@JvmField
val HEARTY_GRAIN_BALE = this.create("hearty_grain_bale", HeartyGrainBaleBlock(BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).instrument(NoteBlockInstrument.BANJO).strength(0.5F).sound(SoundType.GRASS)))
@JvmField
val TATAMI_BLOCK = this.create("tatami_block", TatamiBlock(BlockBehaviour.Properties.of().ignitedByLava().mapColor(MapColor.PLANT).sound(SoundType.GRASS)))
@JvmField
val TATAMI_MAT = this.create("tatami_mat", TatamiMatBlock(BlockBehaviour.Properties.of().ignitedByLava().mapColor(MapColor.PLANT).sound(SoundType.GRASS)))
/**
* Returns a map of all the blocks that can be stripped with an axe in the format of input - output.
*
@@ -68,6 +68,8 @@ object CobblemonCommands {
MarkGiveCommand.register(dispatcher)
MarkTakeCommand.register(dispatcher)
MarkGiveAllCommand.register(dispatcher)
PcSearchCommand.register(dispatcher)
PcTakeCommand.register(dispatcher)
// Possibly lock down registration if and only if under dev environment or running in an environment
// with a certain system environment variable set
@@ -11,10 +11,12 @@ package com.cobblemon.mod.common
import com.cobblemon.mod.common.block.PotComponent
import com.cobblemon.mod.common.item.components.*
import com.cobblemon.mod.common.platform.PlatformRegistry
import com.mojang.serialization.Codec
import net.minecraft.core.Registry
import net.minecraft.core.component.DataComponentType
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.core.registries.Registries
import net.minecraft.network.codec.ByteBufCodecs
import net.minecraft.resources.ResourceKey
import net.minecraft.resources.ResourceLocation
@@ -70,6 +72,11 @@ object CobblemonItemComponents : PlatformRegistry<Registry<DataComponentType<*>>
.networkSynchronized(MobEffectsComponent.PACKET_CODEC)
.build())
val CRAFTED: DataComponentType<Boolean> = create("crafted", DataComponentType.builder<Boolean>()
.persistent(Codec.BOOL)
.networkSynchronized(ByteBufCodecs.BOOL)
.build())
fun register() {
Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, ResourceLocation.parse("cobblemon:pokemon_item"), POKEMON_ITEM)
Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, ResourceLocation.parse("cobblemon:bait"), BAIT)
@@ -13,6 +13,7 @@ import com.cobblemon.mod.common.api.item.ability.AbilityChanger
import com.cobblemon.mod.common.api.mulch.MulchVariant
import com.cobblemon.mod.common.api.pokeball.PokeBalls
import com.cobblemon.mod.common.api.pokemon.Natures
import com.cobblemon.mod.common.api.pokemon.stats.Stat
import com.cobblemon.mod.common.api.pokemon.stats.Stats
import com.cobblemon.mod.common.api.pokemon.status.Statuses
import com.cobblemon.mod.common.api.text.blue
@@ -40,6 +41,7 @@ import com.cobblemon.mod.common.item.interactive.*
import com.cobblemon.mod.common.item.interactive.ability.AbilityChangeItem
import com.cobblemon.mod.common.platform.PlatformRegistry
import com.cobblemon.mod.common.pokeball.PokeBall
import com.cobblemon.mod.common.pokemon.IVs
import com.cobblemon.mod.common.pokemon.helditem.CobblemonHeldItemManager
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.core.Registry
@@ -204,7 +206,14 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
val CAMPFIRE_POT_YELLOW = campfirePotItem(CobblemonBlocks.YELLOW_CAMPFIRE_POT, "yellow")
@JvmField
val Hearty_Grains = compostableItem("hearty_grains", HeartyGrainsItem(CobblemonBlocks.HEARTY_GRAINS))
val HEARTY_GRAINS = compostableItem("hearty_grains", HeartyGrainsItem(CobblemonBlocks.HEARTY_GRAINS))
@JvmField
val HEARTY_GRAIN_BALE = compostableBlockItem("hearty_grain_bale", CobblemonBlocks.HEARTY_GRAIN_BALE, 0.85f)
@JvmField
val TATAMI_BLOCK = blockItem("tatami_block", CobblemonBlocks.TATAMI_BLOCK)
@JvmField
val TATAMI_MAT = blockItem("tatami_mat", CobblemonBlocks.TATAMI_MAT)
@JvmField
val VIVICHOKE = compostableItem("vivichoke")
@@ -351,19 +360,19 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
val aprijuices = mutableListOf<AprijuiceItem>()
@JvmField
val APRIJUICE_BLACK = aprijuiceItem(Apricorn.BLACK)
@JvmField
val APRIJUICE_RED = aprijuiceItem(Apricorn.RED)
@JvmField
val APRIJUICE_BLUE = aprijuiceItem(Apricorn.BLUE)
@JvmField
val APRIJUICE_GREEN = aprijuiceItem(Apricorn.GREEN)
@JvmField
val APRIJUICE_YELLOW = aprijuiceItem(Apricorn.YELLOW)
@JvmField
val APRIJUICE_WHITE = aprijuiceItem(Apricorn.WHITE)
val APRIJUICE_GREEN = aprijuiceItem(Apricorn.GREEN)
@JvmField
val APRIJUICE_BLUE = aprijuiceItem(Apricorn.BLUE)
@JvmField
val APRIJUICE_PINK = aprijuiceItem(Apricorn.PINK)
@JvmField
val APRIJUICE_BLACK = aprijuiceItem(Apricorn.BLACK)
@JvmField
val APRIJUICE_WHITE = aprijuiceItem(Apricorn.WHITE)
@JvmField
val PONIGIRI = create("ponigiri", PonigiriItem())
@@ -513,6 +522,9 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
@JvmField val AUSPICIOUS_ARMOR = heldItem("auspicious_armor")
@JvmField val MALICIOUS_ARMOR = heldItem("malicious_armor")
@JvmField val SHELL_HELMET = heldItem("shell_helmet")
@JvmField val METAL_ALLOY = noSettingsItem("metal_alloy")
@JvmField val SCROLL_OF_DARKNESS = noSettingsItem("scroll_of_darkness")
@JvmField val SCROLL_OF_WATERS = noSettingsItem("scroll_of_waters")
private val berries = mutableMapOf<ResourceLocation, BerryItem>()
// Plants
@@ -591,6 +603,33 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
@JvmField
val GALARICA_NUTS = create("galarica_nuts", GalaricaNutItem())
// Hyper Training Items
val hyperTrainingItems = mutableListOf<HyperTrainingItem>()
@JvmField
val HEALTH_CANDY = hyperTrainingItem("health_candy", 1, setOf(Stats.HP), 0..IVs.MAX_VALUE)
@JvmField
val MIGHTY_CANDY = hyperTrainingItem("mighty_candy", 1, setOf(Stats.ATTACK), 0..IVs.MAX_VALUE)
@JvmField
val TOUGH_CANDY = hyperTrainingItem("tough_candy", 1, setOf(Stats.DEFENCE), 0..IVs.MAX_VALUE)
@JvmField
val SMART_CANDY = hyperTrainingItem("smart_candy", 1, setOf(Stats.SPECIAL_ATTACK), 0..IVs.MAX_VALUE)
@JvmField
val COURAGE_CANDY = hyperTrainingItem("courage_candy", 1, setOf(Stats.SPECIAL_DEFENCE), 0..IVs.MAX_VALUE)
@JvmField
val QUICK_CANDY = hyperTrainingItem("quick_candy", 1, setOf(Stats.SPEED), 0..IVs.MAX_VALUE)
@JvmField
val SICKLY_CANDY = hyperTrainingItem("sickly_candy", -1, setOf(Stats.HP), 0..IVs.MAX_VALUE)
@JvmField
val WEAK_CANDY = hyperTrainingItem("weak_candy", -1, setOf(Stats.ATTACK), 0..IVs.MAX_VALUE)
@JvmField
val BRITTLE_CANDY = hyperTrainingItem("brittle_candy", -1, setOf(Stats.DEFENCE), 0..IVs.MAX_VALUE)
@JvmField
val NUMB_CANDY = hyperTrainingItem("numb_candy", -1, setOf(Stats.SPECIAL_ATTACK), 0..IVs.MAX_VALUE)
@JvmField
val COWARD_CANDY = hyperTrainingItem("coward_candy", -1, setOf(Stats.SPECIAL_DEFENCE), 0..IVs.MAX_VALUE)
@JvmField
val SLOW_CANDY = hyperTrainingItem("slow_candy", -1, setOf(Stats.SPEED), 0..IVs.MAX_VALUE)
// Medicine
@JvmField
val RARE_CANDY = candyItem("rare_candy", Rarity.RARE) { _, pokemon -> pokemon.getExperienceToNextLevel() }
@@ -912,8 +951,8 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
val CHOICE_SCARF = heldItem("choice_scarf")
@JvmField
val CLEANSE_TAG = heldItem("cleanse_tag")
// @JvmField
// val CLEAR_AMULET = heldItem("clear_amulet")
@JvmField
val CLEAR_AMULET = heldItem("clear_amulet")
@JvmField
val COVERT_CLOAK = heldItem("covert_cloak")
@JvmField
@@ -942,16 +981,16 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
val FOCUS_SASH = heldItem("focus_sash")
@JvmField
val GRASSY_SEED = heldItem("grassy_seed")
// @JvmField
// val GRIP_CLAW = heldItem("grip_claw")
@JvmField
val GRIP_CLAW = heldItem("grip_claw")
@JvmField
val HARD_STONE = heldItem("hard_stone")
@JvmField
val HEAVY_DUTY_BOOTS = heldItem("heavy_duty_boots")
@JvmField
val IRON_BALL = heldItem("iron_ball")
// @JvmField
// val LAGGING_TAIL = heldItem("lagging_tail")
@JvmField
val LAGGING_TAIL = heldItem("lagging_tail")
@JvmField
val LEFTOVERS = heldItem("leftovers")
@JvmField
@@ -964,8 +1003,8 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
val LOADED_DICE = heldItem("loaded_dice")
@JvmField
val LUCKY_EGG = heldItem("lucky_egg")
// @JvmField
// val LUMINOUS_MOSS = heldItem("luminous_moss")
@JvmField
val LUMINOUS_MOSS = heldItem("luminous_moss")
@JvmField
val MAGNET = heldItem("magnet")
@JvmField
@@ -1575,6 +1614,12 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
return item
}
private fun hyperTrainingItem(name: String, increaseAmount: Int, targetStats: Set<Stat>, validRange: IntRange): HyperTrainingItem {
val item = this.create(name, HyperTrainingItem(increaseAmount, targetStats, validRange))
hyperTrainingItems.add(item)
return item
}
private fun apricornItem(name: String, apricornItem: ApricornItem): ApricornItem {
val finalName = "${name}_apricorn"
val item = this.create(finalName, apricornItem)
@@ -29,9 +29,12 @@ private val bubbleColourMap = mapOf(
fun getColourMixFromSeasonings(seasonings: List<ItemStack>, forBubbles: Boolean = false): Int? {
val flavors = seasonings
.flatMap { Seasonings.getFlavoursFromItemStack(it).entries }
.groupingBy { it.key }
.fold(0) { acc, entry -> acc + entry.value }
.mapNotNull { Seasonings.getFlavoursFromItemStack(it) }
.flatMap { it.entries }
.groupingBy { it.key }
.fold(0) { acc, entry -> acc + entry.value }
if (flavors.isEmpty()) return null
val maxFlavorValue = flavors.values.maxOrNull()
val dominantFlavors = flavors.filter { it.value == maxFlavorValue }.map { it.key }
@@ -52,21 +52,6 @@ object MobEffectUtils {
}
private fun mergeAmplifiers(amplifiers: List<Int>): Int {
if (amplifiers.isEmpty()) return 0
val sorted = amplifiers.sortedDescending()
var result = 0.0
for ((index, value) in sorted.withIndex()) {
val multiplier = when (index) {
0 -> 1.0
1 -> 0.75
2 -> 0.5
else -> 0.25
}
result += (value + 1) * multiplier
}
return ceil(result).toInt() - 1
return amplifiers.maxOrNull() ?: 0 // we do not want the power of the effects to combine, just take the highest one used of that type
}
}
@@ -21,6 +21,8 @@ import net.minecraft.network.codec.ByteBufCodecs
import net.minecraft.network.codec.StreamCodec
import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.Item
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
data class Seasoning(
val ingredient: RegistryLikeCondition<Item>,
@@ -39,23 +41,23 @@ data class Seasoning(
val CODEC: Codec<Seasoning> = RecordCodecBuilder.create { builder ->
builder.group(
ITEM_REGISTRY_LIKE_CODEC.fieldOf("ingredient").forGetter { it.ingredient },
Codec.unboundedMap(Flavour.CODEC, Codec.INT).optionalFieldOf("flavours", null).forGetter { it.flavours },
Codec.unboundedMap(Flavour.CODEC, Codec.INT).optionalFieldOf("flavours").forGetter { Optional.ofNullable(it.flavours) },
DyeColor.CODEC.fieldOf("colour").forGetter { it.colour },
SpawnBait.Effect.CODEC.listOf().optionalFieldOf("baitEffects", null).forGetter { it.baitEffects },
Food.CODEC.optionalFieldOf("food", null).forGetter { it.food },
SerializableMobEffectInstance.CODEC.listOf().optionalFieldOf("mobEffects", null).forGetter { it.mobEffects }
).apply(builder, ::Seasoning)
SpawnBait.Effect.CODEC.listOf().optionalFieldOf("baitEffects").forGetter { Optional.ofNullable(it.baitEffects) },
Food.CODEC.optionalFieldOf("food").forGetter { Optional.ofNullable(it.food) },
SerializableMobEffectInstance.CODEC.listOf().optionalFieldOf("mobEffects").forGetter { Optional.ofNullable(it.mobEffects) }
).apply(builder) { item, flavours, colour, baitEffects, food, mobEffects ->
Seasoning(
item,
flavours.getOrNull(),
colour,
baitEffects.getOrNull(),
food.getOrNull(),
mobEffects.getOrNull()
)
}
}
val STREAM_CODEC: StreamCodec<ByteBuf, Seasoning> = ByteBufCodecs.fromCodec(CODEC)
val BLANK_SEASONING = Seasoning(
ingredient = RegistryLikeIdentifierCondition<Item>(cobblemonResource("blank")),
flavours = Flavour.entries.associateWith { 0 },
colour = DyeColor.WHITE,
baitEffects = emptyList(),
food = Food(),
mobEffects = emptyList()
)
}
}
@@ -12,10 +12,12 @@ import com.cobblemon.mod.common.CobblemonItemComponents
import com.cobblemon.mod.common.api.berry.Berries
import com.cobblemon.mod.common.api.conditional.RegistryLikeCondition
import com.cobblemon.mod.common.api.conditional.RegistryLikeIdentifierCondition
import com.cobblemon.mod.common.api.cooking.Seasoning.Companion.BLANK_SEASONING
import com.cobblemon.mod.common.api.data.JsonDataRegistry
import com.cobblemon.mod.common.api.fishing.SpawnBait
import com.cobblemon.mod.common.api.fishing.SpawnBaitEffects
import com.cobblemon.mod.common.api.fishing.SpawnBaitUtils
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.item.components.FoodComponent
import com.cobblemon.mod.common.net.messages.client.cooking.SeasoningRegistrySyncPacket
import com.cobblemon.mod.common.util.adapters.IdentifierAdapter
import com.cobblemon.mod.common.util.adapters.ItemLikeConditionAdapter
@@ -69,19 +71,27 @@ object Seasonings : JsonDataRegistry<Seasoning> {
this.seasonings.addAll(seasonings)
}
fun getFlavoursFromItemStack(stack: ItemStack): Map<Flavour, Int> {
fun getFlavoursFromItemStack(stack: ItemStack): Map<Flavour, Int>? {
val holder = stack.itemHolder
val seasoning = seasonings.find { it.ingredient.fits(holder) } ?: BLANK_SEASONING
val inherentFlavours = stack.get(CobblemonItemComponents.FLAVOUR)?.flavours ?: emptyMap()
val seasoningFlavours = seasoning.flavours ?: emptyMap()
val seasoning = seasonings.find { it.ingredient.fits(holder) }
val inherentFlavours = stack.get(CobblemonItemComponents.FLAVOUR)?.flavours
val seasoningFlavours = seasoning?.flavours
return seasoningFlavours.mapValues { (flavour, value) ->
inherentFlavours.getOrDefault(flavour, 0) + value
if (seasoningFlavours.isNullOrEmpty() && inherentFlavours.isNullOrEmpty())
return null
return (seasoningFlavours ?: emptyMap()).mapValues { (flavour, value) ->
value + (inherentFlavours?.getOrDefault(flavour, 0) ?: 0)
}
}
fun getFoodFromItemStack(stack: ItemStack): Food? {
return getFromItemStack(stack)?.food
fun hasFlavors(stack: ItemStack): Boolean {
val flavors = getFlavoursFromItemStack(stack)
return !flavors.isNullOrEmpty() && flavors.any { it.value != 0 }
}
fun getFoodComponentFromItemStack(stack: ItemStack): FoodComponent? {
return getFromItemStack(stack)?.food?.toComponent()
}
fun hasFood(stack: ItemStack): Boolean {
@@ -98,7 +108,17 @@ object Seasonings : JsonDataRegistry<Seasoning> {
}
fun getBaitEffectsFromItemStack(stack: ItemStack): List<SpawnBait.Effect> {
return getFromItemStack(stack)?.baitEffects ?: emptyList()
val primaryEffects = SpawnBaitEffects.getEffectsFromItemStack(stack)
return if (primaryEffects.isNotEmpty()) {
primaryEffects
} else {
getFromItemStack(stack)?.baitEffects ?: emptyList()
}
}
fun hasBaitEffects(stack: ItemStack): Boolean {
return SpawnBaitEffects.getEffectsFromItemStack(stack).isNotEmpty() ||
!(getFromItemStack(stack)?.baitEffects.isNullOrEmpty())
}
fun getFromItemStack(stack: ItemStack): Seasoning? {
@@ -11,6 +11,7 @@ package com.cobblemon.mod.common.api.fishing
import com.cobblemon.mod.common.CobblemonItemComponents
import com.cobblemon.mod.common.api.conditional.RegistryLikeCondition
import com.cobblemon.mod.common.api.conditional.RegistryLikeIdentifierCondition
import com.cobblemon.mod.common.api.cooking.Seasonings
import com.cobblemon.mod.common.api.data.JsonDataRegistry
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.net.messages.client.data.SpawnBaitRegistrySyncPacket
@@ -96,8 +97,9 @@ object SpawnBaitEffects : JsonDataRegistry<SpawnBait> {
return null
}
// if it has bait effects and is not listed as a seasoning then it is a bait
fun isFishingBait(stack: ItemStack): Boolean {
val holder = stack.itemHolder
return stack.has(CobblemonItemComponents.BAIT_EFFECTS) || effectsMap.values.any { it.item.fits(holder) }
return effectsMap.values.any { it.item.fits(holder) }
}
}
@@ -22,6 +22,7 @@ import com.cobblemon.mod.common.CobblemonActivities
import com.cobblemon.mod.common.CobblemonBlockEntities
import com.cobblemon.mod.common.CobblemonMemories
import com.cobblemon.mod.common.CobblemonUnlockableWallpapers
import com.cobblemon.mod.common.Environment
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.battles.model.actor.ActorType
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor
@@ -45,6 +46,9 @@ import com.cobblemon.mod.common.api.pokedex.SeenPercent
import com.cobblemon.mod.common.api.pokemon.PokemonProperties
import com.cobblemon.mod.common.api.pokemon.evolution.Evolution
import com.cobblemon.mod.common.api.pokemon.stats.Stats
import com.cobblemon.mod.common.api.scheduling.ClientTaskTracker
import com.cobblemon.mod.common.api.scheduling.Schedulable
import com.cobblemon.mod.common.api.scheduling.ServerTaskTracker
import com.cobblemon.mod.common.api.scripting.CobblemonScripts
import com.cobblemon.mod.common.api.spawning.position.SpawnablePosition
import com.cobblemon.mod.common.api.storage.PokemonStore
@@ -69,6 +73,7 @@ import com.cobblemon.mod.common.net.messages.client.animation.PlayPosableAnimati
import com.cobblemon.mod.common.net.messages.client.effect.RunPosableMoLangPacket
import com.cobblemon.mod.common.net.messages.client.effect.SpawnSnowstormEntityParticlePacket
import com.cobblemon.mod.common.net.messages.client.effect.SpawnSnowstormParticlePacket
import com.cobblemon.mod.common.net.messages.client.sound.UnvalidatedPlaySoundS2CPacket
import com.cobblemon.mod.common.pokemon.Gender
import com.cobblemon.mod.common.pokemon.Pokemon
import com.cobblemon.mod.common.pokemon.Species
@@ -97,6 +102,7 @@ import net.minecraft.resources.ResourceLocation
import net.minecraft.server.MinecraftServer
import net.minecraft.server.level.ServerLevel
import net.minecraft.server.level.ServerPlayer
import net.minecraft.sounds.SoundSource
import net.minecraft.tags.TagKey
import net.minecraft.world.damagesource.DamageSource
import net.minecraft.world.damagesource.DamageTypes
@@ -198,7 +204,15 @@ object MoLangFunctions {
runtime.environment.variable = params.environment.variable
runtime.environment.context = params.environment.context
val expression = params.getString(0).asExpressionLike()
runtime.resolve(expression)
val delayInSeconds = params.getDoubleOrNull(1)?.toFloat() ?: 0.0f
if (delayInSeconds > 0.0f) {
val tracker = if (Cobblemon.implementation.environment() == Environment.SERVER) ServerTaskTracker else ClientTaskTracker
tracker.after(delayInSeconds) {
runtime.resolve(expression)
}
} else {
runtime.resolve(expression)
}
},
"system_time_millis" to java.util.function.Function { _ ->
DoubleValue(System.currentTimeMillis())
@@ -345,6 +359,27 @@ object MoLangFunctions {
return@put DoubleValue.ZERO
}
}
map.put("play_sound_on_server") { params ->
val sound = params.getString(0).asResource()
val soundSource = params.getString(1).uppercase()
val x = params.getDouble(2)
val y = params.getDouble(3)
val z = params.getDouble(4)
val player = params.getOrNull<MoValue>(5)?.let {
if (it is StringValue) world.getPlayerByUUID(UUID.fromString(it.value))
else if (it is ObjectValue<*>) it.obj
else null
} as? ServerPlayer
val volume = params.getDoubleOrNull(6)?.toFloat() ?: 1.0f
val pitch = params.getDoubleOrNull(7)?.toFloat() ?: 1.0f
val packet = UnvalidatedPlaySoundS2CPacket(sound, SoundSource.valueOf(soundSource), x, y, z, volume, pitch)
if (player != null) {
packet.sendToPlayer(player)
} else {
packet.sendToPlayersAround(x, y, z, 16.0, world.dimension())
}
}
map.put("get_entities_around") { params ->
val x = params.getDouble(0)
val y = params.getDouble(1)
@@ -405,6 +440,15 @@ object MoLangFunctions {
val command = params.getString(0)
player.server.commands.performPrefixedCommand(player.createCommandSourceStack(), command)
}
map.put("play_sound_on_server") { params ->
val sound = params.getString(0).asResource()
val soundSource = SoundSource.valueOf(params.getString(1).uppercase())
val volume = params.getDoubleOrNull(2)?.toFloat() ?: 1.0f
val pitch = params.getDoubleOrNull(3)?.toFloat() ?: 1.0f
val packet = UnvalidatedPlaySoundS2CPacket(sound, soundSource, player.x, player.y, player.z, volume, pitch)
packet.sendToPlayer(player)
}
map.put("is_party_at_full_health") { _ ->
DoubleValue(player.party().none(Pokemon::canBeHealed)) }
map.put("can_heal_at_healer") { params ->
@@ -677,6 +721,17 @@ object MoLangFunctions {
}
}
}
if (entity is Schedulable) {
map.put("run_molang_after") { params ->
val expression = params.getString(0).asExpressionLike()
val delayInSeconds = params.getDouble(1).toFloat()
val runtime = MoLangRuntime()
runtime.environment.cloneFrom(params.environment)
entity.after(delayInSeconds) {
runtime.resolve(expression)
}
}
}
// q.entity.spawn_bedrock_particles(effect, locator, [player]) - sends to everyone nearby or just to the player if they're set. Locator is necessary even if unused on non-posables.
map.put("spawn_bedrock_particles") { params ->
val particle = params.getString(0).asResource()
@@ -0,0 +1,56 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves
import com.cobblemon.mod.common.api.pokemon.stats.Stats
import com.cobblemon.mod.common.api.types.ElementalType
import com.cobblemon.mod.common.api.types.ElementalTypes
import com.cobblemon.mod.common.pokemon.Pokemon
object HiddenPowerUtil {
val hiddenPowerTable = arrayOf(
ElementalTypes.FIGHTING,
ElementalTypes.FLYING,
ElementalTypes.POISON,
ElementalTypes.GROUND,
ElementalTypes.ROCK,
ElementalTypes.BUG,
ElementalTypes.GHOST,
ElementalTypes.STEEL,
ElementalTypes.FIRE,
ElementalTypes.WATER,
ElementalTypes.GRASS,
ElementalTypes.ELECTRIC,
ElementalTypes.PSYCHIC,
ElementalTypes.ICE,
ElementalTypes.DRAGON,
ElementalTypes.DARK
)
fun getHiddenPowerType(pokemon: Pokemon?): ElementalType {
if (pokemon == null) {
return ElementalTypes.NORMAL
}
val ivs = pokemon.ivs
val ivArray = arrayOf(
ivs[Stats.HP],
ivs[Stats.ATTACK],
ivs[Stats.DEFENCE],
ivs[Stats.SPEED],
ivs[Stats.SPECIAL_ATTACK],
ivs[Stats.SPECIAL_DEFENCE]
).map { it ?: return@getHiddenPowerType ElementalTypes.NORMAL }
var tableIndex = 0
ivArray.forEachIndexed { index, it ->
tableIndex += (it % 2) shl index
}
tableIndex = tableIndex * 15 / 63
return hiddenPowerTable[tableIndex.coerceAtMost(hiddenPowerTable.size - 1)]
}
}
@@ -15,7 +15,6 @@ import com.bedrockk.molang.runtime.value.StringValue
import com.cobblemon.mod.common.api.moves.animations.ActionEffectTimeline
import com.cobblemon.mod.common.api.moves.categories.DamageCategories
import com.cobblemon.mod.common.api.moves.categories.DamageCategory
import com.cobblemon.mod.common.api.pokemon.stats.Stats
import com.cobblemon.mod.common.api.types.ElementalType
import com.cobblemon.mod.common.api.types.ElementalTypes
import com.cobblemon.mod.common.battles.MoveTarget
@@ -100,24 +99,6 @@ open class MoveTemplate(
Moves::getByName,
MoveTemplate::name
) { id -> "No MoveTemplate for ID $id" }
val hiddenPowerTable = arrayOf(
ElementalTypes.FIGHTING,
ElementalTypes.FLYING,
ElementalTypes.POISON,
ElementalTypes.GROUND,
ElementalTypes.ROCK,
ElementalTypes.BUG,
ElementalTypes.GHOST,
ElementalTypes.STEEL,
ElementalTypes.FIRE,
ElementalTypes.WATER,
ElementalTypes.GRASS,
ElementalTypes.ELECTRIC,
ElementalTypes.PSYCHIC,
ElementalTypes.ICE,
ElementalTypes.DRAGON,
ElementalTypes.DARK
)
}
/**
@@ -146,21 +127,7 @@ open class MoveTemplate(
return this.elementalType
}
if (name == "hiddenpower") {
val ivs = pokemon.ivs
val ivArray = arrayOf(
ivs[Stats.HP],
ivs[Stats.ATTACK],
ivs[Stats.DEFENCE],
ivs[Stats.SPEED],
ivs[Stats.SPECIAL_ATTACK],
ivs[Stats.SPECIAL_DEFENCE]
).map { it ?: return@getEffectiveElementalType ElementalTypes.NORMAL }
var tableIndex = 0
ivArray.forEachIndexed { index, it ->
tableIndex += (it % 2) shl index
}
tableIndex = tableIndex * 15 / 63
return hiddenPowerTable[tableIndex.coerceAtMost(hiddenPowerTable.size - 1)]
return HiddenPowerUtil.getHiddenPowerType(pokemon)
}
// TODO: Handle ability suppression: clientactivebattlepokemon needs data about volatiles
// TODO: Handle Liquid Voice: need to know what moves have the sound flag
@@ -96,6 +96,8 @@ object CobblemonPermissions {
@JvmStatic
val PC = this.create("${COMMAND_PREFIX}pc", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
@JvmStatic
val PC_SEARCH = this.create("${COMMAND_PREFIX}pcsearch", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
@JvmStatic
val POKEBOX = this.create("${COMMAND_PREFIX}pokebox", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
@JvmStatic
@@ -43,6 +43,7 @@ import com.google.gson.JsonArray
import com.google.gson.JsonObject
import com.mojang.brigadier.StringReader
import com.mojang.serialization.Codec
import com.mojang.serialization.JsonOps
import java.util.UUID
import kotlin.math.min
import kotlin.random.Random
@@ -51,6 +52,7 @@ import net.minecraft.commands.arguments.item.ItemParser
import net.minecraft.core.HolderLookup
import net.minecraft.nbt.CompoundTag
import net.minecraft.nbt.ListTag
import net.minecraft.nbt.NbtOps
import net.minecraft.nbt.StringTag
import net.minecraft.nbt.Tag
import net.minecraft.network.chat.Component
@@ -59,6 +61,7 @@ import net.minecraft.resources.ResourceLocation
import net.minecraft.server.level.ServerPlayer
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.Level
import kotlin.jvm.optionals.getOrNull
/**
* A grouping of typical, selectable properties for a Pokémon. This is serializable
@@ -402,6 +405,9 @@ open class PokemonProperties {
ivs.forEach { stat ->
pokemon.setIV(stat.key, stat.value)
}
ivs.hyperTrainedIVs.forEach { stat ->
pokemon.hyperTrainIV(stat.key, stat.value)
}
}
evs?.let { evs ->
evs.forEach { stat ->
@@ -633,8 +639,8 @@ open class PokemonProperties {
nature?.let { nbt.putString(DataKeys.POKEMON_NATURE, it) }
ability?.let { nbt.putString(DataKeys.POKEMON_ABILITY, it) }
status?.let { nbt.putString(DataKeys.POKEMON_STATUS_NAME, it) }
ivs?.let { nbt.put(DataKeys.POKEMON_IVS, it.saveToNBT(CompoundTag())) }
evs?.let { nbt.put(DataKeys.POKEMON_EVS, it.saveToNBT(CompoundTag())) }
ivs?.let { nbt.put(DataKeys.POKEMON_IVS, IVs.CODEC.encodeStart(NbtOps.INSTANCE, it).result().get()) }
evs?.let { nbt.put(DataKeys.POKEMON_EVS, EVs.CODEC.encodeStart(NbtOps.INSTANCE, it).result().get()) }
type?.let { nbt.putString(DataKeys.ELEMENTAL_TYPE, it) }
teraType?.let { nbt.putString(DataKeys.POKEMON_TERA_TYPE, it) }
dmaxLevel?.let { nbt.putInt(DataKeys.POKEMON_DMAX_LEVEL, it) }
@@ -664,8 +670,8 @@ open class PokemonProperties {
nature = if (tag.contains(DataKeys.POKEMON_NATURE)) tag.getString(DataKeys.POKEMON_NATURE) else null
ability = if (tag.contains(DataKeys.POKEMON_ABILITY)) tag.getString(DataKeys.POKEMON_ABILITY) else null
status = if (tag.contains(DataKeys.POKEMON_STATUS_NAME)) tag.getString(DataKeys.POKEMON_STATUS_NAME) else null
ivs = if (tag.contains(DataKeys.POKEMON_IVS)) IVs().loadFromNBT(tag.getCompound(DataKeys.POKEMON_IVS)) as IVs else null
evs = if (tag.contains(DataKeys.POKEMON_EVS)) EVs().loadFromNBT(tag.getCompound(DataKeys.POKEMON_EVS)) as EVs else null
ivs = if (tag.contains(DataKeys.POKEMON_IVS)) IVs.CODEC.decode(NbtOps.INSTANCE, tag.getCompound(DataKeys.POKEMON_IVS)).result().getOrNull()?.first else null
evs = if (tag.contains(DataKeys.POKEMON_EVS)) EVs.CODEC.decode(NbtOps.INSTANCE, tag.getCompound(DataKeys.POKEMON_EVS)).result().getOrNull()?.first else null
type = if (tag.contains(DataKeys.ELEMENTAL_TYPE)) tag.getString(DataKeys.ELEMENTAL_TYPE) else null
teraType = if (tag.contains(DataKeys.POKEMON_TERA_TYPE)) tag.getString(DataKeys.POKEMON_TERA_TYPE) else null
dmaxLevel = if (tag.contains(DataKeys.POKEMON_DMAX_LEVEL)) tag.getInt(DataKeys.POKEMON_DMAX_LEVEL) else null
@@ -697,8 +703,8 @@ open class PokemonProperties {
nature?.let { json.addProperty(DataKeys.POKEMON_NATURE, it) }
ability?.let { json.addProperty(DataKeys.POKEMON_ABILITY, it) }
status?.let { json.addProperty(DataKeys.POKEMON_STATUS_NAME, it) }
ivs?.let { json.add(DataKeys.POKEMON_IVS, it.saveToJSON(JsonObject())) }
evs?.let { json.add(DataKeys.POKEMON_EVS, it.saveToJSON(JsonObject())) }
ivs?.let { json.add(DataKeys.POKEMON_IVS, IVs.CODEC.encodeStart(JsonOps.INSTANCE, it).result().get()) }
evs?.let { json.add(DataKeys.POKEMON_EVS, EVs.CODEC.encodeStart(JsonOps.INSTANCE, it).result().get()) }
type?.let { json.addProperty(DataKeys.ELEMENTAL_TYPE, it) }
teraType?.let { json.addProperty(DataKeys.POKEMON_TERA_TYPE, it) }
dmaxLevel?.let { json.addProperty(DataKeys.POKEMON_DMAX_LEVEL, it) }
@@ -729,8 +735,8 @@ open class PokemonProperties {
nature = json.get(DataKeys.POKEMON_NATURE)?.asString
ability = json.get(DataKeys.POKEMON_ABILITY)?.asString
status = json.get(DataKeys.POKEMON_STATUS_NAME)?.asString
ivs = json.getAsJsonObject(DataKeys.POKEMON_IVS)?.let { IVs().loadFromJSON(it) } as? IVs
evs = json.getAsJsonObject(DataKeys.POKEMON_EVS)?.let { EVs().loadFromJSON(it) } as? EVs
ivs = json.getAsJsonObject(DataKeys.POKEMON_IVS)?.let { IVs.CODEC.decode(JsonOps.INSTANCE, it).result().getOrNull()?.first }
evs = json.getAsJsonObject(DataKeys.POKEMON_EVS)?.let { EVs.CODEC.decode(JsonOps.INSTANCE, it).result().getOrNull()?.first }
type = json.get(DataKeys.ELEMENTAL_TYPE)?.asString
teraType = json.get(DataKeys.POKEMON_TERA_TYPE)?.asString
dmaxLevel = json.get(DataKeys.POKEMON_DMAX_LEVEL)?.asInt
@@ -39,9 +39,9 @@ interface RidingBehaviour<Settings : RidingBehaviourSettings, State : RidingBeha
fun speed(settings: Settings, state: State, vehicle: PokemonEntity, driver: Player): Float
fun clampPassengerRotation(settings: Settings, state: State, entity: PokemonEntity, driver: LivingEntity) {}
fun clampPassengerRotation(settings: Settings, state: State, vehicle: PokemonEntity, driver: LivingEntity) {}
fun updatePassengerRotation(settings: Settings, state: State, entity: PokemonEntity, driver: LivingEntity) {}
fun updatePassengerRotation(settings: Settings, state: State, vehicle: PokemonEntity, driver: LivingEntity) {}
fun rotation(settings: Settings, state: State, vehicle: PokemonEntity, driver: LivingEntity): Vec2
@@ -88,6 +88,8 @@ interface RidingBehaviour<Settings : RidingBehaviourSettings, State : RidingBeha
fun shouldRotatePlayerHead(settings: Settings, state: State, vehicle: PokemonEntity): Boolean
fun maxUpStep(settings: Settings, state: State, vehicle: PokemonEntity): Float? = null
fun createDefaultState(settings: Settings): State
}
@@ -23,8 +23,8 @@ import net.minecraft.world.phys.Vec3
* @author landonjw
*/
open class RidingBehaviourState {
open val rideVelocity: SidedRidingState<Vec3> = ridingState(Vec3.ZERO, Side.BOTH)
open val stamina: SidedRidingState<Float> = ridingState(1.0F, Side.BOTH)
open val rideVelocity: SidedRidingState<Vec3> = ridingState(Vec3.ZERO, Side.CLIENT)
open val stamina: SidedRidingState<Float> = ridingState(1.0F, Side.CLIENT)
open fun reset() {
rideVelocity.set(Vec3.ZERO, true)
@@ -8,23 +8,28 @@
package com.cobblemon.mod.common.api.riding.behaviour
import com.cobblemon.mod.common.api.riding.behaviour.types.*
import com.cobblemon.mod.common.api.riding.behaviour.types.air.*
import com.cobblemon.mod.common.api.riding.behaviour.types.composite.CompositeBehaviour
import com.cobblemon.mod.common.api.riding.behaviour.types.land.HorseBehaviour
import com.cobblemon.mod.common.api.riding.behaviour.types.land.VehicleBehaviour
import com.cobblemon.mod.common.api.riding.behaviour.types.liquid.BoatBehaviour
import com.cobblemon.mod.common.api.riding.behaviour.types.liquid.BurstBehaviour
import com.cobblemon.mod.common.api.riding.behaviour.types.liquid.DolphinBehaviour
import net.minecraft.resources.ResourceLocation
object RidingBehaviours {
val behaviours = mutableMapOf<ResourceLocation, RidingBehaviour<RidingBehaviourSettings, RidingBehaviourState>>()
init {
register(BirdAirBehaviour.KEY, BirdAirBehaviour())
register(BirdBehaviour.KEY, BirdBehaviour())
register(DolphinBehaviour.KEY, DolphinBehaviour())
register(GenericLandBehaviour.KEY, GenericLandBehaviour())
register(GenericSwimBehaviour.KEY, GenericSwimBehaviour())
register(GliderAirBehaviour.KEY, GliderAirBehaviour())
register(HorseBehaviour.KEY, HorseBehaviour())
register(BoatBehaviour.KEY, BoatBehaviour())
register(GliderBehaviour.KEY, GliderBehaviour())
register(HelicopterBehaviour.KEY, HelicopterBehaviour())
register(JetAirBehaviour.KEY, JetAirBehaviour())
register(SwimDashBehaviour.KEY, SwimDashBehaviour())
register(VehicleLandBehaviour.KEY, VehicleLandBehaviour())
register(JetBehaviour.KEY, JetBehaviour())
register(BurstBehaviour.KEY, BurstBehaviour())
register(VehicleBehaviour.KEY, VehicleBehaviour())
register(HoverBehaviour.KEY, HoverBehaviour())
register(CompositeBehaviour.KEY, CompositeBehaviour())
}
@@ -26,7 +26,7 @@ import net.minecraft.world.phys.Vec3
class RidingController<Settings : RidingBehaviourSettings, State : RidingBehaviourState>(val behaviour: RidingBehaviour<Settings, State>) : RidingBehaviour<Settings, State> {
override val key = behaviour.key
override fun getRidingStyle(settings: Settings, state: State): RidingStyle {
return behaviour.getRidingStyle(settings, state)
}
@@ -45,6 +45,16 @@ class RidingController<Settings : RidingBehaviourSettings, State : RidingBehavio
return behaviour.speed(settings, state, vehicle, driver)
}
override fun updatePassengerRotation(
settings: Settings,
state: State,
vehicle: PokemonEntity,
driver: LivingEntity
) {
if (!isActive(settings, state, vehicle)) return
return behaviour.updatePassengerRotation(settings, state, vehicle, driver)
}
override fun clampPassengerRotation(settings: Settings, state: State, vehicle: PokemonEntity, driver: LivingEntity) {
if (!isActive(settings, state, vehicle)) return
return behaviour.clampPassengerRotation(settings, state, vehicle, driver)
@@ -175,6 +185,11 @@ class RidingController<Settings : RidingBehaviourSettings, State : RidingBehavio
return behaviour.setRideBar(settings, state, vehicle, driver)
}
override fun maxUpStep(settings: Settings, state: State, vehicle: PokemonEntity): Float? {
if (!isActive(settings, state, vehicle)) return null
return behaviour.maxUpStep(settings, state, vehicle)
}
override fun createDefaultState(settings: Settings): State {
return behaviour.createDefaultState(settings)
}
@@ -1,267 +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.api.riding.behaviour.types
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.OrientationControllable
import com.cobblemon.mod.common.api.riding.RidingStyle
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviourState
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviour
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviourSettings
import com.cobblemon.mod.common.api.riding.posing.PoseOption
import com.cobblemon.mod.common.api.riding.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.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
class GenericSwimBehaviour : RidingBehaviour<GenericSwimSettings, RidingBehaviourState> {
companion object {
val KEY = cobblemonResource("swim/generic")
}
override val key = KEY
override fun getRidingStyle(settings: GenericSwimSettings, state: RidingBehaviourState): RidingStyle {
return RidingStyle.LIQUID
}
val poseProvider = PoseProvider<GenericSwimSettings, RidingBehaviourState>(PoseType.FLOAT)
.with(PoseOption(PoseType.SWIM) { _, _, entity -> entity.isSwimming && entity.entityData.get(PokemonEntity.MOVING) })
override fun isActive(settings: GenericSwimSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
return Shapes.create(vehicle.boundingBox).blockPositionsAsListRounded().any {
if (vehicle.isInWater || vehicle.isUnderWater) {
return@any true
}
val blockState = vehicle.level().getBlockState(it)
return@any !blockState.fluidState.isEmpty
}
}
override fun pose(settings: GenericSwimSettings, state: RidingBehaviourState, vehicle: PokemonEntity): PoseType {
return poseProvider.select(settings, state, vehicle)
}
override fun speed(settings: GenericSwimSettings, state: RidingBehaviourState, vehicle: PokemonEntity, driver: Player): Float {
return vehicle.runtime.resolveFloat(settings.speed)
}
override fun rotation(
settings: GenericSwimSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: LivingEntity
): Vec2 {
return Vec2(driver.xRot * 0.5f, driver.yRot)
}
override fun velocity(
settings: GenericSwimSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player,
input: Vec3
): Vec3 {
val runtime = vehicle.runtime
val driveFactor = runtime.resolveFloat(settings.driveFactor)
val strafeFactor = runtime.resolveFloat(settings.strafeFactor)
val f = driver.xxa * strafeFactor
var g = driver.zza * driveFactor
if (g <= 0.0f) {
g *= runtime.resolveFloat(settings.reverseDriveFactor)
}
val velocity = Vec3(f.toDouble(), 0.0, g.toDouble())
return velocity
}
override fun angRollVel(
settings: GenericSwimSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player,
deltaTime: Double
): Vec3 {
return Vec3.ZERO
}
override fun rotationOnMouseXY(
settings: GenericSwimSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player,
mouseY: Double,
mouseX: Double,
mouseYSmoother: SmoothDouble,
mouseXSmoother: SmoothDouble,
sensitivity: Double,
deltaTime: Double
): Vec3 {
if (driver !is OrientationControllable) return Vec3.ZERO
//Might need to add the smoothing here for default.
val invertRoll = if (Cobblemon.config.invertRoll) -1 else 1
val invertPitch = if (Cobblemon.config.invertPitch) -1 else 1
return Vec3(0.0, mouseY * invertPitch, mouseX * invertRoll)
}
override fun canJump(
settings: GenericSwimSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player
): Boolean {
return vehicle.runtime.resolveBoolean(settings.canJump)
}
override fun setRideBar(
settings: GenericSwimSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player
): Float {
return 0.0f
}
override fun jumpForce(
settings: GenericSwimSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player,
jumpStrength: Int
): Vec3 {
val runtime = vehicle.runtime
runtime.environment.query.addFunction("jump_strength") { DoubleValue(jumpStrength.toDouble()) }
val jumpVector = settings.jumpVector.map { runtime.resolveFloat(it) }
return Vec3(jumpVector[0].toDouble(), jumpVector[1].toDouble(), jumpVector[2].toDouble())
}
override fun gravity(
settings: GenericSwimSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
regularGravity: Double
): Double {
return regularGravity
}
override fun rideFovMultiplier(
settings: GenericSwimSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player
): Float {
return 1.0f
}
override fun useAngVelSmoothing(settings: GenericSwimSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
return false
}
override fun useRidingAltPose(
settings: GenericSwimSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
return cobblemonResource("no_pose")
}
override fun inertia(settings: GenericSwimSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Double {
return 0.5
}
override fun shouldRoll(settings: GenericSwimSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
return false
}
override fun turnOffOnGround(settings: GenericSwimSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
return false
}
override fun dismountOnShift(settings: GenericSwimSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
return false
}
override fun shouldRotatePokemonHead(
settings: GenericSwimSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun shouldRotatePlayerHead(
settings: GenericSwimSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun createDefaultState(settings: GenericSwimSettings) = RidingBehaviourState()
}
class GenericSwimSettings : RidingBehaviourSettings {
override val key = GenericSwimBehaviour.KEY
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 fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeResourceLocation(key)
buffer.writeExpression(canJump)
buffer.writeExpression(jumpVector[0])
buffer.writeExpression(jumpVector[1])
buffer.writeExpression(jumpVector[2])
buffer.writeExpression(speed)
buffer.writeExpression(driveFactor)
buffer.writeExpression(reverseDriveFactor)
buffer.writeExpression(strafeFactor)
}
override fun decode(buffer: RegistryFriendlyByteBuf) {
canJump = buffer.readExpression()
jumpVector = listOf(
buffer.readExpression(),
buffer.readExpression(),
buffer.readExpression()
)
speed = buffer.readExpression()
driveFactor = buffer.readExpression()
reverseDriveFactor = buffer.readExpression()
strafeFactor = buffer.readExpression()
}
}
@@ -6,7 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.riding.behaviour.types
package com.cobblemon.mod.common.api.riding.behaviour.types.air
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.MoLangMath.lerp
@@ -33,31 +33,31 @@ import net.minecraft.world.phys.Vec3
import org.joml.Vector3f
import kotlin.math.*
class BirdAirBehaviour : RidingBehaviour<BirdAirSettings, BirdAirState> {
class BirdBehaviour : RidingBehaviour<BirdSettings, BirdState> {
companion object {
val KEY = cobblemonResource("air/bird")
}
override val key: ResourceLocation = KEY
override fun getRidingStyle(settings: BirdAirSettings, state: BirdAirState): RidingStyle {
override fun getRidingStyle(settings: BirdSettings, state: BirdState): RidingStyle {
return RidingStyle.AIR
}
val poseProvider = PoseProvider<BirdAirSettings, BirdAirState>(PoseType.HOVER)
val poseProvider = PoseProvider<BirdSettings, BirdState>(PoseType.HOVER)
.with(PoseOption(PoseType.FLY) { _, state, _ -> state.rideVelocity.get().z > 0.2 })
override fun isActive(settings: BirdAirSettings, state: BirdAirState, vehicle: PokemonEntity): Boolean {
override fun isActive(settings: BirdSettings, state: BirdState, vehicle: PokemonEntity): Boolean {
return true
}
override fun pose(settings: BirdAirSettings, state: BirdAirState, vehicle: PokemonEntity): PoseType {
override fun pose(settings: BirdSettings, state: BirdState, vehicle: PokemonEntity): PoseType {
return poseProvider.select(settings, state, vehicle)
}
override fun speed(
settings: BirdAirSettings,
state: BirdAirState,
settings: BirdSettings,
state: BirdState,
vehicle: PokemonEntity,
driver: Player
): Float {
@@ -65,8 +65,8 @@ class BirdAirBehaviour : RidingBehaviour<BirdAirSettings, BirdAirState> {
}
override fun rotation(
settings: BirdAirSettings,
state: BirdAirState,
settings: BirdSettings,
state: BirdState,
vehicle: PokemonEntity,
driver: LivingEntity
): Vec2 {
@@ -74,8 +74,8 @@ class BirdAirBehaviour : RidingBehaviour<BirdAirSettings, BirdAirState> {
}
override fun velocity(
settings: BirdAirSettings,
state: BirdAirState,
settings: BirdSettings,
state: BirdState,
vehicle: PokemonEntity,
driver: Player,
input: Vec3
@@ -122,7 +122,7 @@ class BirdAirBehaviour : RidingBehaviour<BirdAirSettings, BirdAirState> {
/*
* Calculates the change in the ride space vector due to player input and ride state
*/
fun calculateRideSpaceVel(settings: BirdAirSettings, state: BirdAirState, vehicle: PokemonEntity, driver: Player) {
fun calculateRideSpaceVel(settings: BirdSettings, state: BirdState, vehicle: PokemonEntity, driver: Player) {
//retrieve stats
val topSpeed = vehicle.runtime.resolveDouble(settings.speedExpr)
val glideTopSpeed = vehicle.runtime.resolveDouble(settings.glidespeedExpr)
@@ -240,8 +240,8 @@ class BirdAirBehaviour : RidingBehaviour<BirdAirSettings, BirdAirState> {
}
override fun angRollVel(
settings: BirdAirSettings,
state: BirdAirState,
settings: BirdSettings,
state: BirdState,
vehicle: PokemonEntity,
driver: Player,
deltaTime: Double
@@ -282,8 +282,8 @@ class BirdAirBehaviour : RidingBehaviour<BirdAirSettings, BirdAirState> {
}
override fun rotationOnMouseXY(
settings: BirdAirSettings,
state: BirdAirState,
settings: BirdSettings,
state: BirdState,
vehicle: PokemonEntity,
driver: Player,
mouseY: Double,
@@ -367,8 +367,8 @@ class BirdAirBehaviour : RidingBehaviour<BirdAirSettings, BirdAirState> {
}
override fun canJump(
settings: BirdAirSettings,
state: BirdAirState,
settings: BirdSettings,
state: BirdState,
vehicle: PokemonEntity,
driver: Player
): Boolean {
@@ -376,8 +376,8 @@ class BirdAirBehaviour : RidingBehaviour<BirdAirSettings, BirdAirState> {
}
override fun setRideBar(
settings: BirdAirSettings,
state: BirdAirState,
settings: BirdSettings,
state: BirdState,
vehicle: PokemonEntity,
driver: Player
): Float {
@@ -385,8 +385,8 @@ class BirdAirBehaviour : RidingBehaviour<BirdAirSettings, BirdAirState> {
}
override fun jumpForce(
settings: BirdAirSettings,
state: BirdAirState,
settings: BirdSettings,
state: BirdState,
vehicle: PokemonEntity,
driver: Player,
jumpStrength: Int
@@ -395,8 +395,8 @@ class BirdAirBehaviour : RidingBehaviour<BirdAirSettings, BirdAirState> {
}
override fun gravity(
settings: BirdAirSettings,
state: BirdAirState,
settings: BirdSettings,
state: BirdState,
vehicle: PokemonEntity,
regularGravity: Double
): Double {
@@ -404,8 +404,8 @@ class BirdAirBehaviour : RidingBehaviour<BirdAirSettings, BirdAirState> {
}
override fun rideFovMultiplier(
settings: BirdAirSettings,
state: BirdAirState,
settings: BirdSettings,
state: BirdState,
vehicle: PokemonEntity,
driver: Player
): Float {
@@ -420,16 +420,16 @@ class BirdAirBehaviour : RidingBehaviour<BirdAirSettings, BirdAirState> {
}
override fun useAngVelSmoothing(
settings: BirdAirSettings,
state: BirdAirState,
settings: BirdSettings,
state: BirdState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun useRidingAltPose(
settings: BirdAirSettings,
state: BirdAirState,
settings: BirdSettings,
state: BirdState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
@@ -439,44 +439,44 @@ class BirdAirBehaviour : RidingBehaviour<BirdAirSettings, BirdAirState> {
return cobblemonResource("no_pose")
}
override fun inertia(settings: BirdAirSettings, state: BirdAirState, vehicle: PokemonEntity): Double {
override fun inertia(settings: BirdSettings, state: BirdState, vehicle: PokemonEntity): Double {
return 0.5
}
override fun shouldRoll(settings: BirdAirSettings, state: BirdAirState, vehicle: PokemonEntity): Boolean {
override fun shouldRoll(settings: BirdSettings, state: BirdState, vehicle: PokemonEntity): Boolean {
return true
}
override fun turnOffOnGround(settings: BirdAirSettings, state: BirdAirState, vehicle: PokemonEntity): Boolean {
override fun turnOffOnGround(settings: BirdSettings, state: BirdState, vehicle: PokemonEntity): Boolean {
return false
}
override fun dismountOnShift(settings: BirdAirSettings, state: BirdAirState, vehicle: PokemonEntity): Boolean {
override fun dismountOnShift(settings: BirdSettings, state: BirdState, vehicle: PokemonEntity): Boolean {
return false
}
override fun shouldRotatePokemonHead(
settings: BirdAirSettings,
state: BirdAirState,
settings: BirdSettings,
state: BirdState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun shouldRotatePlayerHead(
settings: BirdAirSettings,
state: BirdAirState,
settings: BirdSettings,
state: BirdState,
vehicle: PokemonEntity
): Boolean {
return true
}
override fun createDefaultState(settings: BirdAirSettings) = BirdAirState()
override fun createDefaultState(settings: BirdSettings) = BirdState()
}
class BirdAirSettings : RidingBehaviourSettings {
override val key = BirdAirBehaviour.KEY
class BirdSettings : RidingBehaviourSettings {
override val key = BirdBehaviour.KEY
var infiniteAltitude: Expression = "false".asExpression()
private set
@@ -518,7 +518,7 @@ class BirdAirSettings : RidingBehaviourSettings {
}
}
class BirdAirState : RidingBehaviourState() {
class BirdState : RidingBehaviourState() {
var gliding = ridingState(false, Side.CLIENT)
var lastGlide = ridingState(-100L, Side.CLIENT)
var currRollCorrectionForce = ridingState(0.0, Side.CLIENT)
@@ -542,10 +542,10 @@ class BirdAirState : RidingBehaviourState() {
}
override fun toString(): String {
return "BirdAirState(rideVelocity=${rideVelocity.get()}, stamina=${stamina.get()}, gliding=${gliding.get()})"
return "BirdState(rideVelocity=${rideVelocity.get()}, stamina=${stamina.get()}, gliding=${gliding.get()})"
}
override fun copy() = BirdAirState().also {
override fun copy() = BirdState().also {
it.rideVelocity.set(this.rideVelocity.get(), forced = true)
it.stamina.set(this.stamina.get(), forced = true)
it.gliding.set(this.gliding.get(), forced = true)
@@ -554,7 +554,7 @@ class BirdAirState : RidingBehaviourState() {
}
override fun shouldSync(previous: RidingBehaviourState): Boolean {
if (previous !is BirdAirState) return false
if (previous !is BirdState) return false
if (previous.gliding.get() != gliding.get()) return true
return super.shouldSync(previous)
}
@@ -6,7 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.riding.behaviour.types
package com.cobblemon.mod.common.api.riding.behaviour.types.air
import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.Cobblemon
@@ -29,34 +29,34 @@ import net.minecraft.world.entity.player.Player
import net.minecraft.world.phys.Vec2
import net.minecraft.world.phys.Vec3
class GliderAirBehaviour : RidingBehaviour<GliderAirSettings, RidingBehaviourState> {
class GliderBehaviour : RidingBehaviour<GliderSettings, RidingBehaviourState> {
companion object {
val KEY = cobblemonResource("air/glider")
}
override val key = KEY
override fun getRidingStyle(settings: GliderAirSettings, state: RidingBehaviourState): RidingStyle {
override fun getRidingStyle(settings: GliderSettings, state: RidingBehaviourState): RidingStyle {
return RidingStyle.AIR
}
val poseProvider = PoseProvider<GliderAirSettings, RidingBehaviourState>(PoseType.HOVER)
val poseProvider = PoseProvider<GliderSettings, RidingBehaviourState>(PoseType.HOVER)
.with(PoseOption(PoseType.FLY) { _, _, entity -> entity.entityData.get(PokemonEntity.MOVING) })
override fun isActive(settings: GliderAirSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
override fun isActive(settings: GliderSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
return true
}
override fun pose(settings: GliderAirSettings, state: RidingBehaviourState, vehicle: PokemonEntity): PoseType {
override fun pose(settings: GliderSettings, state: RidingBehaviourState, vehicle: PokemonEntity): PoseType {
return poseProvider.select(settings, state, vehicle)
}
override fun speed(settings: GliderAirSettings, state: RidingBehaviourState, vehicle: PokemonEntity, driver: Player): Float {
override fun speed(settings: GliderSettings, state: RidingBehaviourState, vehicle: PokemonEntity, driver: Player): Float {
return vehicle.runtime.resolveFloat(settings.speed)
}
override fun rotation(
settings: GliderAirSettings,
settings: GliderSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: LivingEntity
@@ -65,7 +65,7 @@ class GliderAirBehaviour : RidingBehaviour<GliderAirSettings, RidingBehaviourSta
}
override fun velocity(
settings: GliderAirSettings,
settings: GliderSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player,
@@ -80,7 +80,7 @@ class GliderAirBehaviour : RidingBehaviour<GliderAirSettings, RidingBehaviourSta
}
override fun angRollVel(
settings: GliderAirSettings,
settings: GliderSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player,
@@ -90,7 +90,7 @@ class GliderAirBehaviour : RidingBehaviour<GliderAirSettings, RidingBehaviourSta
}
override fun rotationOnMouseXY(
settings: GliderAirSettings,
settings: GliderSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player,
@@ -109,12 +109,12 @@ class GliderAirBehaviour : RidingBehaviour<GliderAirSettings, RidingBehaviourSta
return Vec3(0.0, mouseY * invertPitch, mouseX * invertRoll)
}
override fun canJump(settings: GliderAirSettings, state: RidingBehaviourState, vehicle: PokemonEntity, driver: Player): Boolean {
override fun canJump(settings: GliderSettings, state: RidingBehaviourState, vehicle: PokemonEntity, driver: Player): Boolean {
return false
}
override fun setRideBar(
settings: GliderAirSettings,
settings: GliderSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player
@@ -123,7 +123,7 @@ class GliderAirBehaviour : RidingBehaviour<GliderAirSettings, RidingBehaviourSta
}
override fun jumpForce(
settings: GliderAirSettings,
settings: GliderSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player,
@@ -133,7 +133,7 @@ class GliderAirBehaviour : RidingBehaviour<GliderAirSettings, RidingBehaviourSta
}
override fun gravity(
settings: GliderAirSettings,
settings: GliderSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
regularGravity: Double
@@ -142,7 +142,7 @@ class GliderAirBehaviour : RidingBehaviour<GliderAirSettings, RidingBehaviourSta
}
override fun rideFovMultiplier(
settings: GliderAirSettings,
settings: GliderSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player
@@ -150,12 +150,12 @@ class GliderAirBehaviour : RidingBehaviour<GliderAirSettings, RidingBehaviourSta
return 1.0f
}
override fun useAngVelSmoothing(settings: GliderAirSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
override fun useAngVelSmoothing(settings: GliderSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
return false
}
override fun useRidingAltPose(
settings: GliderAirSettings,
settings: GliderSettings,
state: RidingBehaviourState,
vehicle: PokemonEntity,
driver: Player
@@ -163,35 +163,35 @@ class GliderAirBehaviour : RidingBehaviour<GliderAirSettings, RidingBehaviourSta
return cobblemonResource("no_pose")
}
override fun inertia(settings: GliderAirSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Double {
override fun inertia(settings: GliderSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Double {
return 0.5
}
override fun shouldRoll(settings: GliderAirSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
override fun shouldRoll(settings: GliderSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
return false
}
override fun turnOffOnGround(settings: GliderAirSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
override fun turnOffOnGround(settings: GliderSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
return false
}
override fun dismountOnShift(settings: GliderAirSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
override fun dismountOnShift(settings: GliderSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
return false
}
override fun shouldRotatePokemonHead(settings: GliderAirSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
override fun shouldRotatePokemonHead(settings: GliderSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
return false
}
override fun shouldRotatePlayerHead(settings: GliderAirSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
override fun shouldRotatePlayerHead(settings: GliderSettings, state: RidingBehaviourState, vehicle: PokemonEntity): Boolean {
return false
}
override fun createDefaultState(settings: GliderAirSettings) = RidingBehaviourState()
override fun createDefaultState(settings: GliderSettings) = RidingBehaviourState()
}
class GliderAirSettings : RidingBehaviourSettings {
override val key = GliderAirBehaviour.KEY
class GliderSettings : RidingBehaviourSettings {
override val key = GliderBehaviour.KEY
var glideSpeed: Expression = "0.1".asExpression()
private set
@@ -6,7 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.riding.behaviour.types
package com.cobblemon.mod.common.api.riding.behaviour.types.air
import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.Cobblemon
@@ -6,7 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.riding.behaviour.types
package com.cobblemon.mod.common.api.riding.behaviour.types.air
import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.api.riding.RidingStyle
@@ -6,7 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.riding.behaviour.types
package com.cobblemon.mod.common.api.riding.behaviour.types.air
import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.Cobblemon
@@ -30,21 +30,21 @@ import net.minecraft.world.phys.Vec3
import net.minecraft.world.phys.shapes.Shapes
import kotlin.math.*
class JetAirBehaviour : RidingBehaviour<JetAirSettings, JetAirState> {
class JetBehaviour : RidingBehaviour<JetSettings, JetState> {
companion object {
val KEY = cobblemonResource("air/jet")
}
override val key = KEY
override fun getRidingStyle(settings: JetAirSettings, state: JetAirState): RidingStyle {
override fun getRidingStyle(settings: JetSettings, state: JetState): RidingStyle {
return RidingStyle.AIR
}
val poseProvider = PoseProvider<JetAirSettings, JetAirState>(PoseType.HOVER)
val poseProvider = PoseProvider<JetSettings, JetState>(PoseType.HOVER)
.with(PoseOption(PoseType.FLY) { _, state, _ -> state.rideVelocity.get().z > 0.1 })
override fun isActive(settings: JetAirSettings, state: JetAirState, vehicle: PokemonEntity): Boolean {
override fun isActive(settings: JetSettings, state: JetState, vehicle: PokemonEntity): Boolean {
return Shapes.create(vehicle.boundingBox).blockPositionsAsListRounded().any {
//Need to check other fluids
if (vehicle.isInWater || vehicle.isUnderWater) {
@@ -59,11 +59,11 @@ class JetAirBehaviour : RidingBehaviour<JetAirSettings, JetAirState> {
}
}
override fun pose(settings: JetAirSettings, state: JetAirState, vehicle: PokemonEntity): PoseType {
override fun pose(settings: JetSettings, state: JetState, vehicle: PokemonEntity): PoseType {
return poseProvider.select(settings, state, vehicle)
}
override fun speed(settings: JetAirSettings, state: JetAirState, vehicle: PokemonEntity, driver: Player): Float {
override fun speed(settings: JetSettings, state: JetState, vehicle: PokemonEntity, driver: Player): Float {
//retrieve stats
val topSpeed = vehicle.runtime.resolveDouble(settings.speedExpr)
val staminaStat = vehicle.runtime.resolveDouble(settings.staminaExpr)
@@ -104,8 +104,8 @@ class JetAirBehaviour : RidingBehaviour<JetAirSettings, JetAirState> {
}
override fun rotation(
settings: JetAirSettings,
state: JetAirState,
settings: JetSettings,
state: JetState,
vehicle: PokemonEntity,
driver: LivingEntity
): Vec2 {
@@ -113,8 +113,8 @@ class JetAirBehaviour : RidingBehaviour<JetAirSettings, JetAirState> {
}
override fun velocity(
settings: JetAirSettings,
state: JetAirState,
settings: JetSettings,
state: JetState,
vehicle: PokemonEntity,
driver: Player,
input: Vec3
@@ -153,8 +153,8 @@ class JetAirBehaviour : RidingBehaviour<JetAirSettings, JetAirState> {
* Calculates the change in the ride space vector due to player input and ride state
*/
private fun calculateRideSpaceVel(
settings: JetAirSettings,
state: JetAirState,
settings: JetSettings,
state: JetState,
vehicle: PokemonEntity,
driver: Player
) {
@@ -186,8 +186,8 @@ class JetAirBehaviour : RidingBehaviour<JetAirSettings, JetAirState> {
}
override fun angRollVel(
settings: JetAirSettings,
state: JetAirState,
settings: JetSettings,
state: JetState,
vehicle: PokemonEntity,
driver: Player,
deltaTime: Double
@@ -211,8 +211,8 @@ class JetAirBehaviour : RidingBehaviour<JetAirSettings, JetAirState> {
}
override fun rotationOnMouseXY(
settings: JetAirSettings,
state: JetAirState,
settings: JetSettings,
state: JetState,
vehicle: PokemonEntity,
driver: Player,
mouseY: Double,
@@ -273,8 +273,8 @@ class JetAirBehaviour : RidingBehaviour<JetAirSettings, JetAirState> {
}
override fun canJump(
settings: JetAirSettings,
state: JetAirState,
settings: JetSettings,
state: JetState,
vehicle: PokemonEntity,
driver: Player
): Boolean {
@@ -282,8 +282,8 @@ class JetAirBehaviour : RidingBehaviour<JetAirSettings, JetAirState> {
}
override fun setRideBar(
settings: JetAirSettings,
state: JetAirState,
settings: JetSettings,
state: JetState,
vehicle: PokemonEntity,
driver: Player
): Float {
@@ -291,8 +291,8 @@ class JetAirBehaviour : RidingBehaviour<JetAirSettings, JetAirState> {
}
override fun jumpForce(
settings: JetAirSettings,
state: JetAirState,
settings: JetSettings,
state: JetState,
vehicle: PokemonEntity,
driver: Player,
jumpStrength: Int
@@ -301,8 +301,8 @@ class JetAirBehaviour : RidingBehaviour<JetAirSettings, JetAirState> {
}
override fun gravity(
settings: JetAirSettings,
state: JetAirState,
settings: JetSettings,
state: JetState,
vehicle: PokemonEntity,
regularGravity: Double
): Double {
@@ -310,8 +310,8 @@ class JetAirBehaviour : RidingBehaviour<JetAirSettings, JetAirState> {
}
override fun rideFovMultiplier(
settings: JetAirSettings,
state: JetAirState,
settings: JetSettings,
state: JetState,
vehicle: PokemonEntity,
driver: Player
): Float {
@@ -326,52 +326,52 @@ class JetAirBehaviour : RidingBehaviour<JetAirSettings, JetAirState> {
return 1.0f + normalizedSpeed.pow(2).toFloat() * 0.2f
}
override fun useAngVelSmoothing(settings: JetAirSettings, state: JetAirState, vehicle: PokemonEntity): Boolean {
override fun useAngVelSmoothing(settings: JetSettings, state: JetState, vehicle: PokemonEntity): Boolean {
return true
}
override fun useRidingAltPose(
settings: JetAirSettings,
state: JetAirState,
settings: JetSettings,
state: JetState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
return cobblemonResource("no_pose")
}
override fun inertia(settings: JetAirSettings, state: JetAirState, vehicle: PokemonEntity): Double {
override fun inertia(settings: JetSettings, state: JetState, vehicle: PokemonEntity): Double {
return 1.0
}
override fun shouldRoll(settings: JetAirSettings, state: JetAirState, vehicle: PokemonEntity): Boolean {
override fun shouldRoll(settings: JetSettings, state: JetState, vehicle: PokemonEntity): Boolean {
return true
}
override fun turnOffOnGround(settings: JetAirSettings, state: JetAirState, vehicle: PokemonEntity): Boolean {
override fun turnOffOnGround(settings: JetSettings, state: JetState, vehicle: PokemonEntity): Boolean {
return false
}
override fun dismountOnShift(settings: JetAirSettings, state: JetAirState, vehicle: PokemonEntity): Boolean {
override fun dismountOnShift(settings: JetSettings, state: JetState, vehicle: PokemonEntity): Boolean {
return false
}
override fun shouldRotatePokemonHead(
settings: JetAirSettings,
state: JetAirState,
settings: JetSettings,
state: JetState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun shouldRotatePlayerHead(settings: JetAirSettings, state: JetAirState, vehicle: PokemonEntity): Boolean {
override fun shouldRotatePlayerHead(settings: JetSettings, state: JetState, vehicle: PokemonEntity): Boolean {
return false
}
override fun createDefaultState(settings: JetAirSettings) = JetAirState()
override fun createDefaultState(settings: JetSettings) = JetState()
}
class JetAirSettings : RidingBehaviourSettings {
override val key = JetAirBehaviour.KEY
class JetSettings : RidingBehaviourSettings {
override val key = JetBehaviour.KEY
var gravity: Expression = "0".asExpression()
private set
@@ -428,7 +428,7 @@ class JetAirSettings : RidingBehaviourSettings {
}
}
class JetAirState : RidingBehaviourState() {
class JetState : RidingBehaviourState() {
var currSpeed = ridingState(0.0, Side.CLIENT)
var currMouseXForce = ridingState(0.0, Side.CLIENT)
var currMouseYForce = ridingState(0.0, Side.CLIENT)
@@ -451,7 +451,7 @@ class JetAirState : RidingBehaviourState() {
currMouseYForce.set(0.0, forced = true)
}
override fun copy() = JetAirState().also {
override fun copy() = JetState().also {
it.currSpeed.set(currSpeed.get(), forced = true)
it.stamina.set(stamina.get(), forced = true)
it.rideVelocity.set(rideVelocity.get(), forced = true)
@@ -460,7 +460,7 @@ class JetAirState : RidingBehaviourState() {
}
override fun shouldSync(previous: RidingBehaviourState): Boolean {
if (previous !is JetAirState) return false
if (previous !is JetState) return false
if (previous.currSpeed != currSpeed) return true
return super.shouldSync(previous)
}
@@ -6,7 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.riding.behaviour.types
package com.cobblemon.mod.common.api.riding.behaviour.types.land
import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.api.riding.RidingStyle
@@ -30,25 +30,25 @@ import net.minecraft.world.phys.Vec3
import net.minecraft.world.phys.shapes.Shapes
import kotlin.math.*
class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandState> {
class HorseBehaviour : RidingBehaviour<HorseSettings, HorseState> {
companion object {
val KEY = cobblemonResource("land/generic")
val KEY = cobblemonResource("land/horse")
}
override val key = KEY
override fun getRidingStyle(settings: GenericLandSettings, state: GenericLandState): RidingStyle {
override fun getRidingStyle(settings: HorseSettings, state: HorseState): RidingStyle {
return RidingStyle.LAND
}
val poseProvider = PoseProvider<GenericLandSettings, GenericLandState>(PoseType.STAND)
val poseProvider = PoseProvider<HorseSettings, HorseState>(PoseType.STAND)
.with(PoseOption(PoseType.WALK) { _, state, _ ->
return@PoseOption abs(state.rideVelocity.get().z) > 0.0
})
override fun isActive(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity
): Boolean {
return Shapes.create(vehicle.boundingBox).blockPositionsAsListRounded().any {
@@ -66,16 +66,16 @@ class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandSta
}
override fun pose(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity
): PoseType {
return this.poseProvider.select(settings, state, vehicle)
}
override fun speed(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity,
driver: Player
): Float {
@@ -102,8 +102,8 @@ class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandSta
}
override fun updatePassengerRotation(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity,
driver: LivingEntity
) {
@@ -128,8 +128,8 @@ class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandSta
}
override fun clampPassengerRotation(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity,
driver: LivingEntity
) {
@@ -143,8 +143,8 @@ class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandSta
override fun rotation(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity,
driver: LivingEntity
): Vec2 {
@@ -161,8 +161,8 @@ class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandSta
* without it being instant.
*/
fun calcRotAmount(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity,
driver: LivingEntity
): Float {
@@ -198,8 +198,8 @@ class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandSta
override fun velocity(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity,
driver: Player,
input: Vec3
@@ -209,8 +209,8 @@ class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandSta
}
private fun calculateRideSpaceVel(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity,
driver: Player
): Vec3 {
@@ -293,8 +293,8 @@ class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandSta
}
override fun angRollVel(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity,
driver: Player,
deltaTime: Double
@@ -303,8 +303,8 @@ class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandSta
}
override fun rotationOnMouseXY(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity,
driver: Player,
mouseY: Double,
@@ -324,8 +324,8 @@ class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandSta
}
override fun canJump(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity,
driver: Player
): Boolean {
@@ -333,8 +333,8 @@ class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandSta
}
override fun setRideBar(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity,
driver: Player
): Float {
@@ -343,8 +343,8 @@ class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandSta
}
override fun jumpForce(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity,
driver: Player,
jumpStrength: Int
@@ -353,8 +353,8 @@ class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandSta
}
override fun gravity(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity,
regularGravity: Double
): Double {
@@ -362,8 +362,8 @@ class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandSta
}
override fun rideFovMultiplier(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity,
driver: Player
): Float {
@@ -371,16 +371,16 @@ class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandSta
}
override fun useAngVelSmoothing(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun useRidingAltPose(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
@@ -392,58 +392,58 @@ class GenericLandBehaviour : RidingBehaviour<GenericLandSettings, GenericLandSta
}
override fun inertia(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity
): Double {
return 1.0
}
override fun shouldRoll(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun turnOffOnGround(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun dismountOnShift(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun shouldRotatePokemonHead(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun shouldRotatePlayerHead(
settings: GenericLandSettings,
state: GenericLandState,
settings: HorseSettings,
state: HorseState,
vehicle: PokemonEntity
): Boolean {
return true
}
override fun createDefaultState(settings: GenericLandSettings) = GenericLandState()
override fun createDefaultState(settings: HorseSettings) = HorseState()
}
class GenericLandSettings : RidingBehaviourSettings {
override val key = GenericLandBehaviour.KEY
class HorseSettings : RidingBehaviourSettings {
override val key = HorseBehaviour.KEY
var canJump = "true".asExpression()
private set
@@ -486,7 +486,7 @@ class GenericLandSettings : RidingBehaviourSettings {
}
class GenericLandState : RidingBehaviourState() {
class HorseState : RidingBehaviourState() {
var sprinting = ridingState(false, Side.CLIENT)
var inAir = ridingState(false, Side.CLIENT)
@@ -508,7 +508,7 @@ class GenericLandState : RidingBehaviourState() {
inAir.set(false, forced = true)
}
override fun copy() = GenericLandState().also {
override fun copy() = HorseState().also {
it.rideVelocity.set(this.rideVelocity.get(), forced = true)
it.stamina.set(this.stamina.get(), forced = true)
it.sprinting.set(this.sprinting.get(), forced = true)
@@ -516,7 +516,7 @@ class GenericLandState : RidingBehaviourState() {
}
override fun shouldSync(previous: RidingBehaviourState): Boolean {
if (previous !is GenericLandState) return false
if (previous !is HorseState) return false
if (previous.sprinting.get() != sprinting.get()) return true
if (previous.inAir.get() != inAir.get()) return true
return super.shouldSync(previous)
@@ -6,7 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.riding.behaviour.types
package com.cobblemon.mod.common.api.riding.behaviour.types.land
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.Cobblemon
@@ -31,7 +31,7 @@ import kotlin.math.absoluteValue
import kotlin.math.max
import kotlin.math.min
class VehicleLandBehaviour : RidingBehaviour<VehicleLandSettings, VehicleLandState> {
class VehicleBehaviour : RidingBehaviour<VehicleSettings, VehicleState> {
companion object {
val KEY = cobblemonResource("land/vehicle")
@@ -54,14 +54,14 @@ class VehicleLandBehaviour : RidingBehaviour<VehicleLandSettings, VehicleLandSta
override val key = KEY
override fun getRidingStyle(settings: VehicleLandSettings, state: VehicleLandState): RidingStyle {
override fun getRidingStyle(settings: VehicleSettings, state: VehicleState): RidingStyle {
return RidingStyle.LAND
}
val poseProvider = PoseProvider<VehicleLandSettings, VehicleLandState>(PoseType.STAND)
val poseProvider = PoseProvider<VehicleSettings, VehicleState>(PoseType.STAND)
.with(PoseOption(PoseType.WALK) { _, _, entity -> entity.entityData.get(PokemonEntity.MOVING) })
override fun isActive(settings: VehicleLandSettings, state: VehicleLandState, vehicle: PokemonEntity): Boolean {
override fun isActive(settings: VehicleSettings, state: VehicleState, vehicle: PokemonEntity): Boolean {
return Shapes.create(vehicle.boundingBox).blockPositionsAsListRounded().any {
//Need to check other fluids
if (vehicle.isInWater || vehicle.isUnderWater) {
@@ -76,13 +76,13 @@ class VehicleLandBehaviour : RidingBehaviour<VehicleLandSettings, VehicleLandSta
}
}
override fun pose(settings: VehicleLandSettings, state: VehicleLandState, vehicle: PokemonEntity): PoseType {
override fun pose(settings: VehicleSettings, state: VehicleState, vehicle: PokemonEntity): PoseType {
return poseProvider.select(settings, state, vehicle)
}
override fun speed(
settings: VehicleLandSettings,
state: VehicleLandState,
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity,
driver: Player
): Float {
@@ -101,8 +101,8 @@ class VehicleLandBehaviour : RidingBehaviour<VehicleLandSettings, VehicleLandSta
}
override fun rotation(
settings: VehicleLandSettings,
state: VehicleLandState,
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity,
driver: LivingEntity
): Vec2 {
@@ -113,8 +113,8 @@ class VehicleLandBehaviour : RidingBehaviour<VehicleLandSettings, VehicleLandSta
}
override fun velocity(
settings: VehicleLandSettings,
state: VehicleLandState,
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity,
driver: Player,
input: Vec3
@@ -134,8 +134,8 @@ class VehicleLandBehaviour : RidingBehaviour<VehicleLandSettings, VehicleLandSta
}
override fun angRollVel(
settings: VehicleLandSettings,
state: VehicleLandState,
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity,
driver: Player,
deltaTime: Double
@@ -144,8 +144,8 @@ class VehicleLandBehaviour : RidingBehaviour<VehicleLandSettings, VehicleLandSta
}
override fun rotationOnMouseXY(
settings: VehicleLandSettings,
state: VehicleLandState,
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity,
driver: Player,
mouseY: Double,
@@ -164,8 +164,8 @@ class VehicleLandBehaviour : RidingBehaviour<VehicleLandSettings, VehicleLandSta
}
override fun canJump(
settings: VehicleLandSettings,
state: VehicleLandState,
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity,
driver: Player
): Boolean {
@@ -173,8 +173,8 @@ class VehicleLandBehaviour : RidingBehaviour<VehicleLandSettings, VehicleLandSta
}
override fun setRideBar(
settings: VehicleLandSettings,
state: VehicleLandState,
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity,
driver: Player
): Float {
@@ -182,8 +182,8 @@ class VehicleLandBehaviour : RidingBehaviour<VehicleLandSettings, VehicleLandSta
}
override fun jumpForce(
settings: VehicleLandSettings,
state: VehicleLandState,
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity,
driver: Player,
jumpStrength: Int
@@ -195,8 +195,8 @@ class VehicleLandBehaviour : RidingBehaviour<VehicleLandSettings, VehicleLandSta
}
override fun gravity(
settings: VehicleLandSettings,
state: VehicleLandState,
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity,
regularGravity: Double
): Double {
@@ -204,8 +204,8 @@ class VehicleLandBehaviour : RidingBehaviour<VehicleLandSettings, VehicleLandSta
}
override fun rideFovMultiplier(
settings: VehicleLandSettings,
state: VehicleLandState,
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity,
driver: Player
): Float {
@@ -213,67 +213,67 @@ class VehicleLandBehaviour : RidingBehaviour<VehicleLandSettings, VehicleLandSta
}
override fun useAngVelSmoothing(
settings: VehicleLandSettings,
state: VehicleLandState,
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun useRidingAltPose(
settings: VehicleLandSettings,
state: VehicleLandState,
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
return cobblemonResource("no_pose")
}
override fun inertia(settings: VehicleLandSettings, state: VehicleLandState, vehicle: PokemonEntity): Double {
override fun inertia(settings: VehicleSettings, state: VehicleState, vehicle: PokemonEntity): Double {
return 0.5
}
override fun shouldRoll(settings: VehicleLandSettings, state: VehicleLandState, vehicle: PokemonEntity): Boolean {
override fun shouldRoll(settings: VehicleSettings, state: VehicleState, vehicle: PokemonEntity): Boolean {
return false
}
override fun turnOffOnGround(
settings: VehicleLandSettings,
state: VehicleLandState,
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun dismountOnShift(
settings: VehicleLandSettings,
state: VehicleLandState,
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun shouldRotatePokemonHead(
settings: VehicleLandSettings,
state: VehicleLandState,
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun shouldRotatePlayerHead(
settings: VehicleLandSettings,
state: VehicleLandState,
settings: VehicleSettings,
state: VehicleState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun createDefaultState(settings: VehicleLandSettings) = VehicleLandState()
override fun createDefaultState(settings: VehicleSettings) = VehicleState()
}
class VehicleLandSettings : RidingBehaviourSettings {
override val key = VehicleLandBehaviour.KEY
class VehicleSettings : RidingBehaviourSettings {
override val key = VehicleBehaviour.KEY
var canJump = "true".asExpression()
private set
@@ -329,7 +329,7 @@ class VehicleLandSettings : RidingBehaviourSettings {
}
}
class VehicleLandState : RidingBehaviourState() {
class VehicleState : RidingBehaviourState() {
var currSpeed = ridingState(0.0, Side.BOTH)
var deltaRotation = ridingState(Vec2.ZERO, Side.BOTH)
@@ -340,10 +340,10 @@ class VehicleLandState : RidingBehaviourState() {
}
override fun toString(): String {
return "VehicleLandState(currSpeed=${currSpeed.get()}, deltaRotation=${deltaRotation.get()})"
return "VehicleState(currSpeed=${currSpeed.get()}, deltaRotation=${deltaRotation.get()})"
}
override fun copy() = VehicleLandState().also {
override fun copy() = VehicleState().also {
it.rideVelocity.set(rideVelocity.get(), forced = true)
it.stamina.set(stamina.get(), forced = true)
it.currSpeed.set(currSpeed.get(), forced = true)
@@ -0,0 +1,383 @@
/*
* 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.behaviour.types.liquid
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.OrientationControllable
import com.cobblemon.mod.common.api.riding.RidingStyle
import com.cobblemon.mod.common.api.riding.behaviour.*
import com.cobblemon.mod.common.api.riding.posing.PoseOption
import com.cobblemon.mod.common.api.riding.posing.PoseProvider
import com.cobblemon.mod.common.api.riding.stats.RidingStat
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.util.*
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.Mth
import net.minecraft.util.SmoothDouble
import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.player.Player
import net.minecraft.world.phys.Vec2
import net.minecraft.world.phys.Vec3
import net.minecraft.world.phys.shapes.Shapes
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min
class BoatBehaviour : RidingBehaviour<BoatSettings, BoatState> {
companion object {
val KEY = cobblemonResource("liquid/boat")
val TOP_SPEED = 2.0
}
override val key = KEY
override fun getRidingStyle(settings: BoatSettings, state: BoatState): RidingStyle {
return RidingStyle.LIQUID
}
val poseProvider = PoseProvider<BoatSettings, BoatState>(PoseType.FLOAT)
.with(PoseOption(PoseType.SWIM) { _, _, entity -> entity.isSwimming && entity.entityData.get(PokemonEntity.MOVING) })
override fun isActive(settings: BoatSettings, state: BoatState, vehicle: PokemonEntity): Boolean {
if (state.jumpBuffer.get() != -1) {
return true
}
return Shapes.create(vehicle.boundingBox).blockPositionsAsListRounded().any {
if (vehicle.isInWater || vehicle.isUnderWater) {
return@any true
}
val blockState = vehicle.level().getBlockState(it)
return@any !blockState.fluidState.isEmpty
}
}
override fun tick(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity,
driver: Player,
input: Vec3
) {
if (state.jumpBuffer.get() > 5) {
if ((vehicle.isInWater || vehicle.isUnderWater || vehicle.onGround())) {
state.jumpBuffer.set(-1)
}
}
else if (state.jumpBuffer.get() > -1) {
state.jumpBuffer.set(state.jumpBuffer.get() + 1)
}
if (driver.zza == 0f && (vehicle.isInWater || vehicle.isUnderWater)) {
if (state.staminaBuffer.get() >= 20) {
val staminaIncrease = vehicle.getRideStat(RidingStat.STAMINA, RidingStyle.LIQUID, 1.0, 2.0)
state.stamina.set(min(1.0f, state.stamina.get() + 0.01f * staminaIncrease.toFloat()))
}
}
else if (abs(state.rideVelocity.get().z) > 0.1) {
consumeStamina(vehicle, state, 0.01f)
}
state.staminaBuffer.set(state.staminaBuffer.get() + 1)
super.tick(settings, state, vehicle, driver, input)
}
override fun pose(settings: BoatSettings, state: BoatState, vehicle: PokemonEntity): PoseType {
return poseProvider.select(settings, state, vehicle)
}
override fun speed(settings: BoatSettings, state: BoatState, vehicle: PokemonEntity, driver: Player): Float {
return state.rideVelocity.get().length().toFloat()
}
override fun rotation(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity,
driver: LivingEntity
): Vec2 {
state.deltaRotation.set(state.deltaRotation.get() * 0.8)
return Vec2(vehicle.xRot, vehicle.yRot + state.deltaRotation.get().toFloat())
}
override fun velocity(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity,
driver: Player,
input: Vec3
): Vec3 {
applyStrafeRotation(vehicle, driver, state)
var velocity = state.rideVelocity.get()
velocity = applyVelocityFromInput(velocity, vehicle, driver, state)
velocity = applyGravity(velocity, vehicle, settings, state)
velocity = applyJump(velocity, vehicle, driver, state)
state.rideVelocity.set(velocity)
return state.rideVelocity.get()
}
private fun applyVelocityFromInput(velocity: Vec3, vehicle: PokemonEntity, driver: Player, state: BoatState): Vec3 {
val speed = vehicle.getRideStat(RidingStat.SPEED, RidingStyle.LIQUID, 0.8, TOP_SPEED)
val acceleration = vehicle.getRideStat(RidingStat.ACCELERATION, RidingStyle.LIQUID, 0.05, 0.5)
if (state.jumpBuffer.get() != -1 || !(vehicle.isInWater || vehicle.isUnderWater)) {
return velocity
}
val forwardInput = driver.zza.toDouble()
val delta = when {
!hasStamina(state) || forwardInput == 0.0 -> -velocity.z * 0.04
forwardInput < 0.0 -> when {
velocity.z < 0.0 -> forwardInput * acceleration * 0.5
else -> min(forwardInput * acceleration * 0.5, -velocity.z * 0.04) // We never want it to be slower to reverse than no input
}
else -> forwardInput * acceleration
}
return Vec3(
velocity.x,
velocity.y,
Mth.clamp(velocity.z + delta, -speed * 0.25, speed)
)
}
private fun applyJump(velocity: Vec3, vehicle: PokemonEntity, driver: Player, state: BoatState): Vec3 {
if (!driver.jumping) return velocity // Not jumping
if (state.jumpBuffer.get() != -1) return velocity // Already jumped very recently
if (!hasStamina(state)) return velocity // Has no stamina
val jumpStrength = vehicle.getRideStat(RidingStat.JUMP, RidingStyle.LIQUID, 1.0, 2.5)
state.jumpBuffer.set(0)
consumeStamina(vehicle, state, 0.05f)
return Vec3(velocity.x, velocity.y + jumpStrength, velocity.z)
}
private fun applyGravity(velocity: Vec3, vehicle: PokemonEntity, settings: BoatSettings, state: BoatState): Vec3 {
if (state.jumpBuffer.get() == -1 && vehicle.isInWater || vehicle.isUnderWater) {
return Vec3(velocity.x, -0.05, velocity.z)
}
val terminalVelocity = vehicle.runtime.resolveDouble(settings.terminalVelocity)
val gravity = (9.8 / ( 20.0)) * 0.2
return Vec3(velocity.x, max(velocity.y - gravity, terminalVelocity), velocity.z)
}
private fun applyStrafeRotation(vehicle: PokemonEntity, driver: Player, state: BoatState) {
val skill = vehicle.getRideStat(RidingStat.SKILL, RidingStyle.LIQUID, 0.5, 1.5)
val strafe = driver.xxa
if (abs(strafe) > 0) {
val increase = if (strafe > 0) -1 else 1
state.deltaRotation.set(state.deltaRotation.get() + increase * skill)
}
}
private fun hasStamina(state: BoatState): Boolean {
return state.stamina.get() != 0f
}
private fun consumeStamina(vehicle: PokemonEntity, state: BoatState, drain: Float) {
val stamina = vehicle.getRideStat(RidingStat.STAMINA, RidingStyle.LIQUID, 1.0, 5.0)
state.stamina.set(max(0f, state.stamina.get() - drain / stamina.toFloat()))
state.staminaBuffer.set(0)
}
override fun updatePassengerRotation(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity,
driver: LivingEntity
) {
driver.yRot += state.deltaRotation.get().toFloat() * 0.887f
driver.yHeadRot += state.deltaRotation.get().toFloat() * 0.887f
clampPassengerRotation(settings, state, vehicle, driver)
}
override fun clampPassengerRotation(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity,
driver: LivingEntity
) {
driver.setYBodyRot(vehicle.yRot)
val f: Float = Mth.wrapDegrees(driver.yRot - vehicle.yRot)
val g = Mth.clamp(f, -105.0f, 105.0f)
driver.yRotO += g - f
driver.yRot = driver.yRot + g - f
driver.setYHeadRot(driver.yRot)
vehicle.setYHeadRot(driver.yRot)
}
override fun angRollVel(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity,
driver: Player,
deltaTime: Double
): Vec3 {
return Vec3.ZERO
}
override fun rotationOnMouseXY(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity,
driver: Player,
mouseY: Double,
mouseX: Double,
mouseYSmoother: SmoothDouble,
mouseXSmoother: SmoothDouble,
sensitivity: Double,
deltaTime: Double
): Vec3 {
if (driver !is OrientationControllable) return Vec3.ZERO
//Might need to add the smoothing here for default.
val invertRoll = if (Cobblemon.config.invertRoll) -1 else 1
val invertPitch = if (Cobblemon.config.invertPitch) -1 else 1
return Vec3(0.0, mouseY * invertPitch, mouseX * invertRoll)
}
override fun canJump(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity,
driver: Player
): Boolean {
return false
}
override fun setRideBar(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity,
driver: Player
): Float {
return (state.stamina.get() / 1.0f)
}
override fun jumpForce(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity,
driver: Player,
jumpStrength: Int
): Vec3 {
return Vec3.ZERO
}
override fun gravity(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity,
regularGravity: Double
): Double {
return 0.0
}
override fun rideFovMultiplier(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity,
driver: Player
): Float {
if (state.rideVelocity.get().z > TOP_SPEED * 0.8) {
return Mth.lerp((state.rideVelocity.get().z - (TOP_SPEED * 0.8)) / (TOP_SPEED * 0.2), 1.0, 1.2).toFloat()
}
return 1.0f
}
override fun useAngVelSmoothing(settings: BoatSettings, state: BoatState, vehicle: PokemonEntity): Boolean {
return false
}
override fun useRidingAltPose(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
return cobblemonResource("no_pose")
}
override fun inertia(settings: BoatSettings, state: BoatState, vehicle: PokemonEntity): Double {
return 0.5
}
override fun shouldRoll(settings: BoatSettings, state: BoatState, vehicle: PokemonEntity): Boolean {
return false
}
override fun turnOffOnGround(settings: BoatSettings, state: BoatState, vehicle: PokemonEntity): Boolean {
return false
}
override fun dismountOnShift(settings: BoatSettings, state: BoatState, vehicle: PokemonEntity): Boolean {
return false
}
override fun shouldRotatePokemonHead(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity
): Boolean {
return vehicle.runtime.resolveBoolean(settings.rotatePokemonHead)
}
override fun shouldRotatePlayerHead(
settings: BoatSettings,
state: BoatState,
vehicle: PokemonEntity
): Boolean {
return true
}
override fun maxUpStep(settings: BoatSettings, state: BoatState, vehicle: PokemonEntity) = 0f
override fun createDefaultState(settings: BoatSettings) = BoatState()
}
class BoatSettings : RidingBehaviourSettings {
override val key = BoatBehaviour.KEY
var terminalVelocity = "-2.0".asExpression()
private set
var rotatePokemonHead = "true".asExpression()
private set
override fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeResourceLocation(key)
buffer.writeExpression(terminalVelocity)
}
override fun decode(buffer: RegistryFriendlyByteBuf) {
terminalVelocity = buffer.readExpression()
}
}
class BoatState : RidingBehaviourState() {
val deltaRotation = ridingState(0.0, Side.CLIENT)
val jumpBuffer = ridingState(-1, Side.CLIENT)
val staminaBuffer = ridingState(0, Side.CLIENT)
override fun copy() = BoatState().also {
it.deltaRotation.set(deltaRotation.get(), true)
it.rideVelocity.set(rideVelocity.get(), true)
it.stamina.set(stamina.get(), true)
it.jumpBuffer.set(jumpBuffer.get(), true)
it.staminaBuffer.set(staminaBuffer.get(), true)
}
override fun shouldSync(previous: RidingBehaviourState): Boolean {
if (previous !is BoatState) return false
return super.shouldSync(previous)
}
}
@@ -6,7 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.riding.behaviour.types
package com.cobblemon.mod.common.api.riding.behaviour.types.liquid
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.OrientationControllable
@@ -27,22 +27,22 @@ import net.minecraft.world.phys.Vec2
import net.minecraft.world.phys.Vec3
import net.minecraft.world.phys.shapes.Shapes
class SwimDashBehaviour : RidingBehaviour<SwimDashSettings, SwimDashState> {
class BurstBehaviour : RidingBehaviour<BurstSettings, BurstState> {
companion object {
val KEY = cobblemonResource("swim/dash")
val KEY = cobblemonResource("liquid/burst")
const val DASH_TICKS: Int = 60
}
override val key = KEY
override fun getRidingStyle(settings: SwimDashSettings, state: SwimDashState): RidingStyle {
override fun getRidingStyle(settings: BurstSettings, state: BurstState): RidingStyle {
return RidingStyle.LIQUID
}
val poseProvider = PoseProvider<SwimDashSettings, SwimDashState>(PoseType.FLOAT)
val poseProvider = PoseProvider<BurstSettings, BurstState>(PoseType.FLOAT)
.with(PoseOption(PoseType.SWIM) { _, _, entity -> entity.isSwimming && entity.entityData.get(PokemonEntity.MOVING) })
override fun isActive(settings: SwimDashSettings, state: SwimDashState, vehicle: PokemonEntity): Boolean {
override fun isActive(settings: BurstSettings, state: BurstState, vehicle: PokemonEntity): Boolean {
//This could be kinda weird... what if the top of the mon is in a fluid but the bottom isnt?
return Shapes.create(vehicle.boundingBox).blockPositionsAsListRounded().any {
if (vehicle.isInWater || vehicle.isUnderWater) {
@@ -53,13 +53,13 @@ class SwimDashBehaviour : RidingBehaviour<SwimDashSettings, SwimDashState> {
}
}
override fun pose(settings: SwimDashSettings, state: SwimDashState, vehicle: PokemonEntity): PoseType {
override fun pose(settings: BurstSettings, state: BurstState, vehicle: PokemonEntity): PoseType {
return poseProvider.select(settings, state, vehicle)
}
override fun speed(
settings: SwimDashSettings,
state: SwimDashState,
settings: BurstSettings,
state: BurstState,
vehicle: PokemonEntity,
driver: Player
): Float {
@@ -77,8 +77,8 @@ class SwimDashBehaviour : RidingBehaviour<SwimDashSettings, SwimDashState> {
}
override fun rotation(
settings: SwimDashSettings,
state: SwimDashState,
settings: BurstSettings,
state: BurstState,
vehicle: PokemonEntity,
driver: LivingEntity
): Vec2 {
@@ -86,8 +86,8 @@ class SwimDashBehaviour : RidingBehaviour<SwimDashSettings, SwimDashState> {
}
override fun velocity(
settings: SwimDashSettings,
state: SwimDashState,
settings: BurstSettings,
state: BurstState,
vehicle: PokemonEntity,
driver: Player,
input: Vec3
@@ -102,8 +102,8 @@ class SwimDashBehaviour : RidingBehaviour<SwimDashSettings, SwimDashState> {
}
override fun angRollVel(
settings: SwimDashSettings,
state: SwimDashState,
settings: BurstSettings,
state: BurstState,
vehicle: PokemonEntity,
driver: Player,
deltaTime: Double
@@ -112,8 +112,8 @@ class SwimDashBehaviour : RidingBehaviour<SwimDashSettings, SwimDashState> {
}
override fun rotationOnMouseXY(
settings: SwimDashSettings,
state: SwimDashState,
settings: BurstSettings,
state: BurstState,
vehicle: PokemonEntity,
driver: Player,
mouseY: Double,
@@ -132,8 +132,8 @@ class SwimDashBehaviour : RidingBehaviour<SwimDashSettings, SwimDashState> {
}
override fun canJump(
settings: SwimDashSettings,
state: SwimDashState,
settings: BurstSettings,
state: BurstState,
vehicle: PokemonEntity,
driver: Player
): Boolean {
@@ -141,8 +141,8 @@ class SwimDashBehaviour : RidingBehaviour<SwimDashSettings, SwimDashState> {
}
override fun setRideBar(
settings: SwimDashSettings,
state: SwimDashState,
settings: BurstSettings,
state: BurstState,
vehicle: PokemonEntity,
driver: Player
): Float {
@@ -150,8 +150,8 @@ class SwimDashBehaviour : RidingBehaviour<SwimDashSettings, SwimDashState> {
}
override fun jumpForce(
settings: SwimDashSettings,
state: SwimDashState,
settings: BurstSettings,
state: BurstState,
vehicle: PokemonEntity,
driver: Player,
jumpStrength: Int
@@ -160,8 +160,8 @@ class SwimDashBehaviour : RidingBehaviour<SwimDashSettings, SwimDashState> {
}
override fun gravity(
settings: SwimDashSettings,
state: SwimDashState,
settings: BurstSettings,
state: BurstState,
vehicle: PokemonEntity,
regularGravity: Double
): Double {
@@ -169,64 +169,64 @@ class SwimDashBehaviour : RidingBehaviour<SwimDashSettings, SwimDashState> {
}
override fun rideFovMultiplier(
settings: SwimDashSettings,
state: SwimDashState,
settings: BurstSettings,
state: BurstState,
vehicle: PokemonEntity,
driver: Player
): Float {
return 1.0f
}
override fun useAngVelSmoothing(settings: SwimDashSettings, state: SwimDashState, vehicle: PokemonEntity): Boolean {
override fun useAngVelSmoothing(settings: BurstSettings, state: BurstState, vehicle: PokemonEntity): Boolean {
return false
}
override fun useRidingAltPose(
settings: SwimDashSettings,
state: SwimDashState,
settings: BurstSettings,
state: BurstState,
vehicle: PokemonEntity,
driver: Player
): ResourceLocation {
return cobblemonResource("no_pose")
}
override fun inertia(settings: SwimDashSettings, state: SwimDashState, vehicle: PokemonEntity): Double {
override fun inertia(settings: BurstSettings, state: BurstState, vehicle: PokemonEntity): Double {
return 0.5
}
override fun shouldRoll(settings: SwimDashSettings, state: SwimDashState, vehicle: PokemonEntity): Boolean {
override fun shouldRoll(settings: BurstSettings, state: BurstState, vehicle: PokemonEntity): Boolean {
return false
}
override fun turnOffOnGround(settings: SwimDashSettings, state: SwimDashState, vehicle: PokemonEntity): Boolean {
override fun turnOffOnGround(settings: BurstSettings, state: BurstState, vehicle: PokemonEntity): Boolean {
return false
}
override fun dismountOnShift(settings: SwimDashSettings, state: SwimDashState, vehicle: PokemonEntity): Boolean {
override fun dismountOnShift(settings: BurstSettings, state: BurstState, vehicle: PokemonEntity): Boolean {
return false
}
override fun shouldRotatePokemonHead(
settings: SwimDashSettings,
state: SwimDashState,
settings: BurstSettings,
state: BurstState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun shouldRotatePlayerHead(
settings: SwimDashSettings,
state: SwimDashState,
settings: BurstSettings,
state: BurstState,
vehicle: PokemonEntity
): Boolean {
return false
}
override fun createDefaultState(settings: SwimDashSettings) = SwimDashState()
override fun createDefaultState(settings: BurstSettings) = BurstState()
}
class SwimDashSettings : RidingBehaviourSettings {
override val key = SwimDashBehaviour.KEY
class BurstSettings : RidingBehaviourSettings {
override val key = BurstBehaviour.KEY
var dashSpeed = 1F
private set
@@ -241,7 +241,7 @@ class SwimDashSettings : RidingBehaviourSettings {
}
}
class SwimDashState : RidingBehaviourState() {
class BurstState : RidingBehaviourState() {
var dashing = ridingState(false, Side.BOTH)
var ticks = ridingState(0, Side.BOTH)
@@ -252,10 +252,10 @@ class SwimDashState : RidingBehaviourState() {
}
override fun toString(): String {
return "SwimDashState(dashing=${dashing.get()}, ticks=${ticks.get()})"
return "BurstState(dashing=${dashing.get()}, ticks=${ticks.get()})"
}
override fun copy() = SwimDashState().also {
override fun copy() = BurstState().also {
it.rideVelocity.set(rideVelocity.get(), forced = true)
it.stamina.set(stamina.get(), forced = true)
it.dashing.set(dashing.get(), forced = true)
@@ -6,7 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.riding.behaviour.types
package com.cobblemon.mod.common.api.riding.behaviour.types.liquid
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.Cobblemon
@@ -32,7 +32,7 @@ import kotlin.math.sin
class DolphinBehaviour : RidingBehaviour<DolphinSettings, DolphinState> {
companion object {
val KEY = cobblemonResource("swim/dolphin")
val KEY = cobblemonResource("liquid/dolphin")
}
override val key = KEY
@@ -9,6 +9,7 @@
package com.cobblemon.mod.common.api.spawning.detail
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.value.StringValue
import com.cobblemon.mod.common.api.npc.NPCClass
import com.cobblemon.mod.common.api.spawning.SpawnBucket
import com.cobblemon.mod.common.api.spawning.position.SpawnablePosition
@@ -16,6 +17,7 @@ import com.cobblemon.mod.common.api.spawning.selection.SpawnSelectionData
import com.cobblemon.mod.common.entity.npc.NPCEntity
import com.cobblemon.mod.common.util.asExpression
import com.google.gson.annotations.SerializedName
import kotlin.math.ceil
/**
* A [SpawnDetail] describing an [NPCEntity] spawn.
@@ -37,6 +39,16 @@ class NPCSpawnDetail : SpawnDetail() {
val minLevel: Expression = "1".asExpression()
val maxLevel: Expression = "100".asExpression()
override fun autoLabel() {
val npcClass = this.npcClass
struct.addFunction("class") { StringValue(npcClass.resourceIdentifier.toString()) }
labels.add(npcClass.resourceIdentifier.toString())
super.autoLabel()
}
override fun createSpawnAction(
spawnablePosition: SpawnablePosition,
bucket: SpawnBucket,
@@ -44,7 +44,17 @@ class Search(
"legendary" -> PokemonFilter { pokemon -> pokemon.isLegendary() }
"mythical" -> PokemonFilter { pokemon -> pokemon.isMythical() }
"ultrabeast", "ultra_beast" -> PokemonFilter { pokemon -> pokemon.isUltraBeast() }
else -> PokemonFilter { pokemon -> PokemonProperties.parse(filter).matches(pokemon) }
else -> {
val nameFilter = filter.lowercase(Locale.ROOT)
PokemonFilter { pokemon ->
// search by partial name
if (pokemon.species.resourceIdentifier.path.contains(nameFilter)) {
return@PokemonFilter true
}
// search by exactly match in different props
return@PokemonFilter PokemonProperties.parse(filter).matches(pokemon)
}
}
}
if (inverted) {
@@ -13,6 +13,7 @@ import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.events.CobblemonEvents
import com.cobblemon.mod.common.api.events.battles.BattleStartedPostEvent
import com.cobblemon.mod.common.api.events.battles.BattleStartedPreEvent
import com.cobblemon.mod.common.api.moves.HiddenPowerUtil
import com.cobblemon.mod.common.api.pokemon.helditem.HeldItemProvider
import com.cobblemon.mod.common.api.pokemon.stats.Stats
import com.cobblemon.mod.common.api.pokemon.status.Statuses
@@ -96,7 +97,7 @@ object BattleRegistry {
// Gender
packedTeamBuilder.append("${pk.gender.showdownName}|")
// IVs
val ivsInOrder = Stats.PERMANENT.map { pk.ivs.getOrDefault(it) }.joinToString(separator = ",")
val ivsInOrder = Stats.PERMANENT.map { pk.ivs.getEffectiveBattleIV(it) }.joinToString(separator = ",")
packedTeamBuilder.append("$ivsInOrder|")
// Shiny
packedTeamBuilder.append("${if (pk.shiny) "S" else ""}|")
@@ -111,7 +112,9 @@ object BattleRegistry {
val pokeball = pokemon.effectedPokemon.caughtBall.name.path.replace("_", "")
packedTeamBuilder.append("$pokeball,")
// Hidden Power Type
packedTeamBuilder.append(",")
// This is empty if the pokemon is not Hyper Trained, and the provided type corresponds to base IVs and not battle IVs.
val hiddenPowerType = if (pk.ivs.hyperTrainedIVs.any()) HiddenPowerUtil.getHiddenPowerType(pk).name.replaceFirstChar { it.uppercase() } else ""
packedTeamBuilder.append("$hiddenPowerType,")
// Gigantamax
packedTeamBuilder.append("${if (pk.gmaxFactor) "G" else ""},")
// DynamaxLevel
@@ -28,8 +28,10 @@ class SideEndInstruction(val message: BattleMessage): InterpreterInstruction {
val side = if (message.argumentAt(0)?.get(1) == '1') battle.side1 else battle.side2
val effect = message.effectAt(1) ?: return@dispatchWaiting
battle.sides.forEach {
val subject = if (it == side) battleLang("side_subject.ally") else battleLang("side_subject.opponent")
val lang = battleLang("sideend.${effect.id}", subject)
val isAllySide = it == side
val positionSpecificKey = if (isAllySide) "sideend.ally.${effect.id}" else "sideend.opponent.${effect.id}"
val lang = battleLang(positionSpecificKey)
it.broadcastChatMessage(lang)
}
@@ -29,8 +29,10 @@ class SideStartInstruction(val message: BattleMessage): InterpreterInstruction {
val side = if (message.argumentAt(0)?.get(1) == '1') battle.side1 else battle.side2
val effect = message.effectAt(1) ?: return@dispatchWaiting
battle.sides.forEach {
val subject = if (it == side) battleLang("side_subject.ally") else battleLang("side_subject.opponent")
val lang = battleLang("sidestart.${effect.id}", subject)
val isAllySide = it == side
val positionSpecificKey = if (isAllySide) "sidestart.ally.${effect.id}" else "sidestart.opponent.${effect.id}"
val lang = battleLang(positionSpecificKey)
it.broadcastChatMessage(lang)
}
@@ -10,18 +10,12 @@ package com.cobblemon.mod.common.block
import com.mojang.serialization.MapCodec
import net.minecraft.core.BlockPos
import net.minecraft.world.InteractionHand
import net.minecraft.world.InteractionResult
import net.minecraft.world.entity.EquipmentSlot
import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items
import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.Level
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.Blocks
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.phys.BlockHitResult
import net.minecraft.world.phys.shapes.CollisionContext
import net.minecraft.world.phys.shapes.Shapes
import net.minecraft.world.phys.shapes.VoxelShape
@@ -30,24 +24,6 @@ import net.minecraft.world.phys.shapes.VoxelShape
class BigRootBlock(settings: Properties) : RootBlock(settings) {
override fun getShape(state: BlockState, world: BlockGetter, pos: BlockPos, context: CollisionContext): VoxelShape = AABB
override fun useWithoutItem(
state: BlockState,
world: Level,
pos: BlockPos,
player: Player,
blockHitResult: BlockHitResult
): InteractionResult {
val stack = player.getItemInHand(InteractionHand.MAIN_HAND)
if (stack.`is`(Items.SHEARS)) {
this.attemptShear(world, state, pos) {
player.onEquippedItemBroken(stack.item, EquipmentSlot.MAINHAND)
stack.hurtAndBreak(1, player, EquipmentSlot.MAINHAND)
}
return InteractionResult.sidedSuccess(world.isClientSide)
}
return super.useWithoutItem(state, world, pos, player, blockHitResult)
}
override fun shearedResultingState(): BlockState = Blocks.HANGING_ROOTS.defaultBlockState()
override fun shearedDrop(): ItemStack = Items.STRING.defaultInstance
@@ -0,0 +1,104 @@
/*
* 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.block
import net.minecraft.core.BlockPos
import net.minecraft.core.Direction
import net.minecraft.world.entity.Entity
import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.Level
import net.minecraft.world.level.LevelAccessor
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.Blocks
import net.minecraft.world.level.block.RotatedPillarBlock
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.block.state.StateDefinition
import net.minecraft.world.level.block.state.properties.BlockStateProperties
import net.minecraft.world.level.block.state.properties.EnumProperty
import net.minecraft.world.level.pathfinder.PathComputationType
import net.minecraft.world.phys.shapes.CollisionContext
import net.minecraft.world.phys.shapes.Shapes
import net.minecraft.world.phys.shapes.VoxelShape
class HeartyGrainBaleBlock(properties: Properties) : RotatedPillarBlock(properties) {
private var owner: LivingEntity? = null
init {
this.registerDefaultState(
this.stateDefinition.any()
.setValue(AXIS, Direction.Axis.Y)
)
}
override fun setPlacedBy(
level: Level,
pos: BlockPos,
state: BlockState,
placer: LivingEntity?,
itemStack: ItemStack
) {
owner = placer
super.setPlacedBy(level, pos, state, placer, itemStack)
}
override fun getShape(
state: BlockState,
level: BlockGetter,
pos: BlockPos,
context: CollisionContext
): VoxelShape {
return SHAPE
}
override fun getCollisionShape(
state: BlockState,
level: BlockGetter,
pos: BlockPos,
context: CollisionContext
): VoxelShape {
return super.getCollisionShape(state, level, pos, context)
}
override fun updateShape(
state: BlockState,
direction: Direction,
neighborState: BlockState,
level: LevelAccessor,
pos: BlockPos,
neighborPos: BlockPos
): BlockState {
return if (!state.canSurvive(level, pos)) {
Blocks.AIR.defaultBlockState()
} else {
super.updateShape(state, direction, neighborState, level, pos, neighborPos)
}
}
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
builder.add(AXIS)
}
override fun isPathfindable(
state: BlockState,
type: PathComputationType
): Boolean = false
companion object {
val AXIS: EnumProperty<Direction.Axis> = BlockStateProperties.AXIS
private val SHAPE: VoxelShape = Shapes.block()
}
override fun fallOn(level: Level, state: BlockState, pos: BlockPos, entity: Entity, fallDistance: Float) {
entity.causeFallDamage(fallDistance, 0.3f, level.damageSources().fall())
}
}
@@ -8,6 +8,7 @@
package com.cobblemon.mod.common.block
import com.cobblemon.mod.common.CobblemonBlocks
import com.cobblemon.mod.common.CobblemonItems
import com.cobblemon.mod.common.api.tags.CobblemonBlockTags
import com.mojang.serialization.MapCodec
@@ -16,9 +17,7 @@ import net.minecraft.core.Direction
import net.minecraft.server.level.ServerLevel
import net.minecraft.tags.FluidTags
import net.minecraft.util.RandomSource
import net.minecraft.util.StringRepresentable
import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.ItemLike
import net.minecraft.world.level.Level
@@ -31,6 +30,7 @@ import net.minecraft.world.level.block.SimpleWaterloggedBlock
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.block.state.StateDefinition
import net.minecraft.world.level.block.state.properties.BlockStateProperties
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf
import net.minecraft.world.level.block.state.properties.EnumProperty
import net.minecraft.world.level.block.state.properties.IntegerProperty
import net.minecraft.world.level.material.FluidState
@@ -45,13 +45,13 @@ class HeartyGrainsBlock(settings: Properties) : CropBlock(settings), SimpleWater
override fun getMaxAge(): Int = MATURE_AGE
private val ageAfterHarvest = 3
private val ageAfterHarvest = 4
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
builder.add(AGE, PART, WATERLOGGED)
builder.add(AGE, HALF, WATERLOGGED)
}
override fun getBaseSeedId(): ItemLike = CobblemonItems.Hearty_Grains
override fun getBaseSeedId(): ItemLike = CobblemonItems.HEARTY_GRAINS
override fun getShape(state: BlockState, world: BlockGetter, pos: BlockPos, context: CollisionContext): VoxelShape {
return AGE_TO_SHAPE[this.getAge(state)]
@@ -62,45 +62,39 @@ class HeartyGrainsBlock(settings: Properties) : CropBlock(settings), SimpleWater
}
override fun randomTick(state: BlockState, world: ServerLevel, pos: BlockPos, random: RandomSource) {
if (state.getValue(PART) == Part.UPPER || this.isMaxAge(state) || !canGrow(world, pos)) return
if (state.getValue(HALF) == DoubleBlockHalf.UPPER || !canGrow(world, pos, state)) return
val lightLevel = world.getMaxLocalRawBrightness(pos)
if (lightLevel >= 9 && random.nextInt(7) == 0) {
val newAge = state.getValue(AGE) + 1
world.setBlock(pos, state.setValue(AGE, newAge), UPDATE_CLIENTS)
if (newAge == MATURE_AGE) {
val abovePos = pos.above()
if (world.getBlockState(abovePos).isAir) {
world.setBlock(
abovePos,
this.defaultBlockState().setValue(AGE, newAge).setValue(PART, Part.UPPER),
UPDATE_CLIENTS
)
}
}
if (hasSufficientLight(world, pos) && random.nextInt(7) == 0) {
grow(world, pos, state, 1)
}
}
private fun canGrow(world: LevelReader, pos: BlockPos): Boolean {
return canSurvive(defaultBlockState().setValue(PART, Part.LOWER), world, pos)
private fun canGrow(world: LevelReader, pos: BlockPos, state: BlockState): Boolean {
return !this.isMaxAge(state) && canSurvive(state, world, pos) && (state.getValue(HALF) == DoubleBlockHalf.UPPER || canGrowInto(world, pos.above()))
}
private fun canGrowInto(world: LevelReader, pos: BlockPos): Boolean {
val blockState = world.getBlockState(pos)
return blockState.isAir || blockState.`is`(CobblemonBlocks.HEARTY_GRAINS)
}
override fun playerWillDestroy(world: Level, pos: BlockPos, state: BlockState, player: Player): BlockState {
if (state.getValue(PART) == Part.UPPER && state.block is HeartyGrainsBlock) {
val belowPos = pos.below()
val belowState = world.getBlockState(belowPos)
world.destroyBlock(pos, true) // Break the lower block without drops
world.setBlock(
belowPos,
belowState.setValue(AGE, ageAfterHarvest), // Reset age to simulate regrowth preparation
UPDATE_CLIENTS
)
} else if (state.getValue(PART) == Part.LOWER) {
val abovePos = pos.above()
val aboveState = world.getBlockState(abovePos)
if (aboveState.block is HeartyGrainsBlock && aboveState.getValue(PART) == Part.UPPER) {
world.destroyBlock(abovePos, true) // Break the upper block without drops
if (!world.isClientSide) {
if (state.getValue(HALF) == DoubleBlockHalf.UPPER) {
val belowPos = pos.below()
val belowState = world.getBlockState(belowPos)
world.destroyBlock(pos, true) // Break the lower block without drops
world.setBlock(
belowPos,
belowState.setValue(AGE, ageAfterHarvest), // Reset age to simulate regrowth preparation
UPDATE_CLIENTS
)
} else if (state.getValue(HALF) == DoubleBlockHalf.LOWER) {
val abovePos = pos.above()
val aboveState = world.getBlockState(abovePos)
if (aboveState.block is HeartyGrainsBlock && aboveState.getValue(HALF) == DoubleBlockHalf.UPPER) {
world.destroyBlock(abovePos, true) // Break the upper block without drops
}
}
}
return super.playerWillDestroy(world, pos, state, player)
@@ -127,22 +121,42 @@ class HeartyGrainsBlock(settings: Properties) : CropBlock(settings), SimpleWater
)
}
override fun isValidBonemealTarget(world: LevelReader, pos: BlockPos, state: BlockState): Boolean {
return !this.isMaxAge(state) && state.getValue(PART) == Part.LOWER
override fun isValidBonemealTarget(level: LevelReader, pos: BlockPos, state: BlockState): Boolean {
val posAndState = getLowerHalf(level, pos, state)
return if (posAndState == null) false else this.canGrow(
level,
posAndState.first,
posAndState.second
)
}
override fun growCrops(world: Level, pos: BlockPos, state: BlockState) {
if (!canGrow(world, pos)) return
override fun performBonemeal(level: ServerLevel, random: RandomSource, pos: BlockPos, state: BlockState) {
val posAndState = getLowerHalf(level, pos, state)
if (posAndState != null) {
grow(level, posAndState.first, posAndState.second, getBonemealAgeIncrease(level))
}
}
val newAge = (this.getAge(state) + this.getBonemealAgeIncrease(world)).coerceAtMost(this.maxAge)
fun grow(world: Level, pos: BlockPos, state: BlockState, increment: Int) {
if (!canGrow(world, pos, state)) return
val newAge = (this.getAge(state) + increment).coerceAtMost(this.maxAge)
world.setBlock(pos, state.setValue(this.ageProperty, newAge), UPDATE_CLIENTS)
if (newAge == MATURE_AGE && state.getValue(PART) == Part.LOWER) {
if (newAge >= 5) {
val abovePos = pos.above()
if (world.getBlockState(abovePos).isAir) {
val stateAbove = world.getBlockState(abovePos)
if (stateAbove.isAir) {
world.setBlock(
abovePos,
this.defaultBlockState().setValue(AGE, newAge).setValue(PART, Part.UPPER),
this.defaultBlockState().setValue(AGE, newAge).setValue(HALF, DoubleBlockHalf.UPPER),
UPDATE_CLIENTS
)
}
else if (stateAbove.getValue(HALF) == DoubleBlockHalf.UPPER) {
world.setBlock(
abovePos,
stateAbove.setValue(AGE, newAge),
UPDATE_CLIENTS
)
}
@@ -152,8 +166,8 @@ class HeartyGrainsBlock(settings: Properties) : CropBlock(settings), SimpleWater
override fun getBonemealAgeIncrease(world: Level): Int = 1
override fun canSurvive(state: BlockState, world: LevelReader, pos: BlockPos): Boolean {
return when (state.getValue(PART)) {
Part.LOWER -> {
return when (state.getValue(HALF)) {
DoubleBlockHalf.LOWER -> {
val floor = world.getBlockState(pos.below())
val fluidState = world.getFluidState(pos)
@@ -170,45 +184,57 @@ class HeartyGrainsBlock(settings: Properties) : CropBlock(settings), SimpleWater
// Check for valid soil or survival conditions
isSubmergedInWater || isWaterlogged || isNearWater || floor.`is`(CobblemonBlockTags.HEARTY_GRAINS_PLANTABLE) || floor.`is`(Blocks.MUD) || floor.`is`(Blocks.FARMLAND)
}
Part.UPPER -> {
val below = world.getBlockState(pos.below())
below.block is HeartyGrainsBlock && below.getValue(PART) == Part.LOWER
DoubleBlockHalf.UPPER -> {
getLowerHalf(world, pos, state) != null
// Upper part survives only if the lower part is valid
}
}
}
private fun getLowerHalf(level: LevelReader, pos: BlockPos, state: BlockState): Pair<BlockPos, BlockState>? {
if (isLower(state)) {
return Pair(pos, state)
} else {
val blockPos = pos.below()
val blockState = level.getBlockState(blockPos)
return if (isLower(blockState)) Pair(
blockPos,
blockState
) else null
}
}
private fun isLower(state: BlockState): Boolean =
state.`is`(CobblemonBlocks.HEARTY_GRAINS) && state.getValue(HALF) == DoubleBlockHalf.LOWER
override fun codec(): MapCodec<out CropBlock> = CODEC
companion object {
val CODEC = simpleCodec(::HeartyGrainsBlock)
const val MATURE_AGE = 4
const val MATURE_AGE = 7
val WATERLOGGED = BlockStateProperties.WATERLOGGED
val AGE: IntegerProperty = BlockStateProperties.AGE_4
val PART: EnumProperty<Part> = EnumProperty.create("part", Part::class.java)
val AGE: IntegerProperty = BlockStateProperties.AGE_7
val HALF: EnumProperty<DoubleBlockHalf> = BlockStateProperties.DOUBLE_BLOCK_HALF
val AGE_TO_SHAPE = arrayOf(
box(2.0, 0.0, 0.0, 16.0, 17.0, 16.0), // Stage 1
box(2.0, 0.0, 0.0, 16.0, 17.0, 16.0), // Stage 2
box(2.0, 0.0, 0.0, 16.0, 17.0, 16.0), // Stage 3
box(2.0, 0.0, 0.0, 16.0, 17.0, 16.0), // Stage 4 (Bottom)
box(2.0, 0.0, 0.0, 16.0, 17.0, 16.0) // Stage 5 (Bottom)
box(0.0, 0.0, 0.0, 16.0, 3.0, 16.0), // Stage 0
box(0.0, 0.0, 0.0, 16.0, 5.0, 16.0), // Stage 1
box(0.0, 0.0, 0.0, 16.0, 8.0, 16.0), // Stage 2
box(0.0, 0.0, 0.0, 16.0, 10.0, 16.0), // Stage 3
box(0.0, 0.0, 0.0, 16.0, 16.0, 16.0), // Stage 4
box(0.0, 0.0, 0.0, 16.0, 16.0, 16.0), // Stage 5
box(0.0, 0.0, 0.0, 16.0, 16.0, 16.0), // Stage 6
box(0.0, 0.0, 0.0, 16.0, 16.0, 16.0) // Stage 7
)
}
enum class Part : StringRepresentable {
LOWER, UPPER;
override fun getSerializedName(): String = name.lowercase()
}
init {
this.registerDefaultState(
this.stateDefinition.any()
.setValue(AGE, 0)
.setValue(PART, Part.LOWER)
.setValue(HALF, DoubleBlockHalf.LOWER)
.setValue(WATERLOGGED, false)
)
}
@@ -19,7 +19,12 @@ import net.minecraft.server.level.ServerLevel
import net.minecraft.sounds.SoundEvents
import net.minecraft.sounds.SoundSource
import net.minecraft.util.RandomSource
import net.minecraft.world.InteractionHand
import net.minecraft.world.InteractionResult
import net.minecraft.world.entity.EquipmentSlot
import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items
import net.minecraft.world.level.Level
import net.minecraft.world.level.LevelAccessor
import net.minecraft.world.level.LevelReader
@@ -29,6 +34,7 @@ import net.minecraft.world.level.block.BonemealableBlock
import net.minecraft.world.level.block.RenderShape
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.gameevent.GameEvent
import net.minecraft.world.phys.BlockHitResult
@Suppress("OVERRIDE_DEPRECATION", "UNUSED_PARAMETER", "MemberVisibilityCanBePrivate", "DEPRECATION")
abstract class RootBlock(settings: Properties) : Block(settings), BonemealableBlock, ShearableBlock {
@@ -42,6 +48,23 @@ abstract class RootBlock(settings: Properties) : Block(settings), BonemealableBl
}
}
override fun useWithoutItem(
state: BlockState,
world: Level,
pos: BlockPos,
player: Player,
blockHitResult: BlockHitResult
): InteractionResult {
val stack = player.getItemInHand(InteractionHand.MAIN_HAND)
if (stack.`is`(Items.SHEARS)) {
this.attemptShear(world, state, pos) {
stack.hurtAndBreak(1, player, EquipmentSlot.MAINHAND)
}
return InteractionResult.sidedSuccess(world.isClientSide)
}
return super.useWithoutItem(state, world, pos, player, blockHitResult)
}
fun hasReachedSpreadCap(world: Level, pos: BlockPos): Boolean {
var nearby = 0
val nearbyPositions = BlockPos.betweenClosed(pos.offset(-4, -1, -4), pos.offset(4, 1, 4)).iterator()
@@ -67,7 +90,8 @@ abstract class RootBlock(settings: Properties) : Block(settings), BonemealableBl
pos: BlockPos,
neighborPos: BlockPos
): BlockState {
return if (direction == Direction.UP && !this.canSurvive(state, world, pos)) Blocks.AIR.defaultBlockState() else super.updateShape(state, direction, neighborState, world, pos, neighborPos)
return if (direction == Direction.UP && !this.canSurvive(state, world, pos)) Blocks.AIR.defaultBlockState()
else super.updateShape(state, direction, neighborState, world, pos, neighborPos)
}
override fun isValidBonemealTarget(world: LevelReader, pos: BlockPos, state: BlockState) = this.canSpread(world, pos, state)
@@ -117,6 +141,7 @@ abstract class RootBlock(settings: Properties) : Block(settings), BonemealableBl
popResource(world, pos, shearedDrop)
}
world.gameEvent(null, GameEvent.SHEAR, pos)
successCallback.invoke()
return true
}
@@ -150,12 +175,12 @@ abstract class RootBlock(settings: Properties) : Block(settings), BonemealableBl
/**
* Picks the [BlockState] that results from a spread of this block.
*
* @param random The [Random] instance used during a spread attempt.
* @param random The [RandomSource] instance used during a spread attempt.
* @return The [BlockState] that will represent the spread root.
*/
protected fun spreadingRoot(random: RandomSource): BlockState =
if (random.nextFloat() < Cobblemon.config.energyRootChance) CobblemonBlocks.ENERGY_ROOT.defaultBlockState()
else this.defaultBlockState()
else CobblemonBlocks.BIG_ROOT.defaultBlockState()
/**
* Checks if the given coordinates allow for a root to be placed with some context.
@@ -169,7 +194,7 @@ abstract class RootBlock(settings: Properties) : Block(settings), BonemealableBl
protected fun canGoOn(state: BlockState, world: LevelReader, pos: BlockPos, ceilingValidator: (ceiling: BlockState) -> Boolean): Boolean {
val up = pos.above()
val upState = world.getBlockState(up)
return upState.isFaceSturdy(world, up, Direction.DOWN) && ceilingValidator(upState) // todo (techdaan): ensure this is the right mapping
return upState.isFaceSturdy(world, up, Direction.DOWN) && ceilingValidator(upState)
}
/**
@@ -0,0 +1,65 @@
/*
* 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.block
import com.mojang.serialization.MapCodec
import net.minecraft.core.BlockPos
import net.minecraft.core.Direction
import net.minecraft.world.item.context.BlockPlaceContext
import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.Rotation
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.block.state.StateDefinition
import net.minecraft.world.level.block.state.properties.BlockStateProperties.HORIZONTAL_FACING
import net.minecraft.world.level.pathfinder.PathComputationType
import net.minecraft.world.phys.shapes.CollisionContext
import net.minecraft.world.phys.shapes.Shapes
import net.minecraft.world.phys.shapes.VoxelShape
import net.minecraft.world.level.block.CarpetBlock
class TatamiBlock(settings: Properties) : Block(settings) {
init {
registerDefaultState(stateDefinition.any()
.setValue(HORIZONTAL_FACING, Direction.NORTH))
}
override fun getStateForPlacement(blockPlaceContext: BlockPlaceContext): BlockState {
return defaultBlockState().setValue(HORIZONTAL_FACING, blockPlaceContext.horizontalDirection)
}
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
builder.add(HORIZONTAL_FACING)
}
override fun getShape(
state: BlockState,
blockGetter: BlockGetter,
pos: BlockPos,
collisionContext: CollisionContext
): VoxelShape {
return HITBOX
}
@Deprecated("Deprecated in Java")
override fun rotate(state: BlockState, rotation: Rotation): BlockState {
return state.setValue(HORIZONTAL_FACING, rotation.rotate(state.getValue(HORIZONTAL_FACING)))
}
@Deprecated("Deprecated in Java")
override fun isPathfindable(state: BlockState, type: PathComputationType): Boolean {
return false
}
companion object {
val CODEC = simpleCodec(::TatamiBlock)
val HITBOX = Shapes.box(0.0, 0.0, 0.0, 1.0, 1.0, 1.0)
}
}
@@ -0,0 +1,65 @@
/*
* 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.block
import com.mojang.serialization.MapCodec
import net.minecraft.core.BlockPos
import net.minecraft.core.Direction
import net.minecraft.world.item.context.BlockPlaceContext
import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.Rotation
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.block.state.StateDefinition
import net.minecraft.world.level.block.state.properties.BlockStateProperties.HORIZONTAL_FACING
import net.minecraft.world.level.pathfinder.PathComputationType
import net.minecraft.world.phys.shapes.CollisionContext
import net.minecraft.world.phys.shapes.Shapes
import net.minecraft.world.phys.shapes.VoxelShape
import net.minecraft.world.level.block.CarpetBlock
class TatamiMatBlock(settings: Properties) : CarpetBlock(settings) {
init {
registerDefaultState(stateDefinition.any()
.setValue(HORIZONTAL_FACING, Direction.NORTH))
}
override fun getStateForPlacement(blockPlaceContext: BlockPlaceContext): BlockState {
return defaultBlockState().setValue(HORIZONTAL_FACING, blockPlaceContext.horizontalDirection)
}
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
builder.add(HORIZONTAL_FACING)
}
override fun getShape(
state: BlockState,
blockGetter: BlockGetter,
pos: BlockPos,
collisionContext: CollisionContext
): VoxelShape {
return HITBOX
}
@Deprecated("Deprecated in Java")
override fun rotate(state: BlockState, rotation: Rotation): BlockState {
return state.setValue(HORIZONTAL_FACING, rotation.rotate(state.getValue(HORIZONTAL_FACING)))
}
@Deprecated("Deprecated in Java")
override fun isPathfindable(state: BlockState, type: PathComputationType): Boolean {
return false
}
companion object {
val CODEC = simpleCodec(::TatamiMatBlock)
val HITBOX = Shapes.box(0.0, 0.0, 0.0, 1.0, 0.0625, 1.0)
}
}
@@ -12,6 +12,7 @@ import com.cobblemon.mod.common.CobblemonMenuType
import com.cobblemon.mod.common.CobblemonRecipeTypes
import com.cobblemon.mod.common.api.cooking.Seasonings
import com.cobblemon.mod.common.block.entity.CampfireBlockEntity
import com.cobblemon.mod.common.client.tooltips.itemTakesSeasoningData
import com.cobblemon.mod.common.item.crafting.CookingPotRecipe
import com.cobblemon.mod.common.item.crafting.CookingPotRecipeBase
import net.minecraft.recipebook.ServerPlaceRecipe
@@ -109,11 +110,15 @@ class CookingPotMenu : RecipeBookMenu<CraftingInput, CookingPotRecipeBase>, Cont
}
override fun handlePlacement(placeAll: Boolean, recipe: RecipeHolder<*>, player: ServerPlayer) {
// Check if the recipe value implements CookingPotRecipeBase
val recipeValue = recipe.value()
if (recipeValue is CookingPotRecipeBase) {
@Suppress("UNCHECKED_CAST")
val castedRecipe = recipe as RecipeHolder<CookingPotRecipeBase>
// Save seasoning contents in case the next recipe absorbs seasoning data
val seasoningSlots = CampfireBlockEntity.SEASONING_SLOTS
val preservedSeasonings = seasoningSlots.map { container.getItem(it).copy() }
this.beginPlacingRecipe()
try {
val serverPlaceRecipe = ServerPlaceRecipe(this)
@@ -121,6 +126,15 @@ class CookingPotMenu : RecipeBookMenu<CraftingInput, CookingPotRecipeBase>, Cont
} finally {
this.finishPlacingRecipe(castedRecipe)
}
// Check if new result item supports seasoning
val result = castedRecipe.value().result
if (itemTakesSeasoningData(result)) {
seasoningSlots.forEachIndexed { index, slot ->
container.setItem(slot, preservedSeasonings[index])
}
}
} else {
throw IllegalArgumentException("Unsupported recipe type: ${recipeValue::class.java.name}")
}
@@ -8,6 +8,7 @@
package com.cobblemon.mod.common.block.campfirepot
import com.cobblemon.mod.common.CobblemonItemComponents
import com.cobblemon.mod.common.CobblemonSounds
import net.minecraft.sounds.SoundSource
import net.minecraft.world.entity.player.Player
@@ -23,8 +24,9 @@ class CookingPotResultSlot(
) : Slot(container, index, x, y) {
override fun onTake(player: Player, stack: ItemStack) {
val menu = player.containerMenu
stack.set(CobblemonItemComponents.CRAFTED, true)
val menu = player.containerMenu
if (menu is CookingPotMenu) {
menu.broadcastChanges()
player.playNotifySound(CobblemonSounds.CAMPFIRE_POT_USE, SoundSource.MASTER, 1.0f, 1.0f)
@@ -118,17 +118,17 @@ class RestorationTankBlockEntity(
}
override fun getSlotsForFace(side: Direction): IntArray {
return if (side == Direction.DOWN) intArrayOf(0, 1, 2, 3, 4, 5, 6, 7) else intArrayOf()
return intArrayOf(0, 1, 2, 3, 4, 5, 6, 7)
}
override fun canPlaceItemThroughFace(slot: Int, stack: ItemStack, direction: Direction?): Boolean {
if (tankEntity.multiblockStructure is FossilMultiblockStructure) {
if (direction != Direction.DOWN) {
val structure = tankEntity.multiblockStructure as FossilMultiblockStructure
val canUtilize = stack?.let { NaturalMaterials.isNaturalMaterial(it) } == true
val canUtilize = stack.let { NaturalMaterials.isNaturalMaterial(it) }
&& structure.organicMaterialInside < FossilMultiblockStructure.MATERIAL_TO_START
&& structure.hasCreatedPokemon
val returnItem = NaturalMaterials.getReturnItem(stack!!) ?: return canUtilize
&& !structure.hasCreatedPokemon
val returnItem = NaturalMaterials.getReturnItem(stack) ?: return canUtilize
if (canUtilize) {
// See if there's room
for (i in items.indices) {
@@ -170,13 +170,12 @@ object CobblemonClient {
private fun registerTooltipManagers() {
TooltipManager.registerTooltipGenerator(CobblemonTooltipGenerator)
TooltipManager.registerTooltipGenerator(RecipeSeasoningAbsorbtionTooltipGenerator)
TooltipManager.registerTooltipGenerator(FishingBaitTooltipGenerator)
TooltipManager.registerTooltipGenerator(FishingRodTooltipGenerator)
TooltipManager.registerTooltipGenerator(SeasoningTooltipGenerator)
TooltipManager.registerTooltipGenerator(FishingRodTooltipGenerator)
TooltipManager.registerTooltipGenerator(AprijuiceTooltipGenerator)
TooltipManager.registerTooltipGenerator(PokePuffTooltipGenerator)
TooltipManager.registerTooltipGenerator(FoodTooltipGenerator)
TooltipManager.registerTooltipGenerator(MobEffectTooltipGenerator)
}
fun registerFlywheelRenderers() {
@@ -219,6 +218,13 @@ object CobblemonClient {
CobblemonBlocks.RED_APRICORN_SAPLING,
CobblemonBlocks.WHITE_APRICORN_SAPLING,
CobblemonBlocks.YELLOW_APRICORN_SAPLING,
CobblemonBlocks.POTTED_BLACK_APRICORN_SAPLING,
CobblemonBlocks.POTTED_BLUE_APRICORN_SAPLING,
CobblemonBlocks.POTTED_GREEN_APRICORN_SAPLING,
CobblemonBlocks.POTTED_PINK_APRICORN_SAPLING,
CobblemonBlocks.POTTED_RED_APRICORN_SAPLING,
CobblemonBlocks.POTTED_WHITE_APRICORN_SAPLING,
CobblemonBlocks.POTTED_YELLOW_APRICORN_SAPLING,
CobblemonBlocks.BLACK_APRICORN,
CobblemonBlocks.BLUE_APRICORN,
CobblemonBlocks.GREEN_APRICORN,
@@ -268,6 +274,7 @@ object CobblemonClient {
CobblemonBlocks.SACCHARINE_HANGING_SIGN,
CobblemonBlocks.SACCHARINE_WALL_HANGING_SIGN,
CobblemonBlocks.SACCHARINE_SAPLING,
CobblemonBlocks.POTTED_SACCHARINE_SAPLING,
CobblemonBlocks.LURE_CAKE,
CobblemonBlocks.POKE_CAKE,
CobblemonBlocks.LECTERN,
@@ -15,6 +15,8 @@ import com.cobblemon.mod.common.api.pokemon.feature.SynchronizedSpeciesFeaturePr
import com.cobblemon.mod.common.api.pokemon.stats.Stat
import com.cobblemon.mod.common.api.pokemon.stats.Stats
import com.cobblemon.mod.common.api.text.bold
import com.cobblemon.mod.common.api.text.italicise
import com.cobblemon.mod.common.api.text.onHover
import com.cobblemon.mod.common.api.text.text
import com.cobblemon.mod.common.client.CobblemonResources
import com.cobblemon.mod.common.client.gui.summary.widgets.SoundlessWidget
@@ -88,6 +90,10 @@ class StatWidget(
private val speedLabel = lang("ui.stats.speed")
}
var effectiveBattleIVs: Map<Stat, Int> = Stats.PERMANENT.associateWith { stat ->
pokemon.ivs.getEffectiveBattleIV(stat)
}
var statTabIndex = tabIndex
val renderableFeatures = SpeciesFeatures
.getFeaturesFor(pokemon.species)
@@ -351,7 +357,6 @@ class StatWidget(
scale = SCALE
)
}
when (statOptions.get(statTabIndex)) {
STATS -> drawStatHexagon(
mapOf(
@@ -366,7 +371,7 @@ class StatWidget(
maximum = 400
)
IV -> drawStatHexagon(
pokemon.ivs.associate { it.key to it.value },
effectiveBattleIVs,
colour = Vector3f(216F/255, 100F/255, 1F),
maximum = 31
)
@@ -494,9 +499,9 @@ class StatWidget(
}
private fun getStatValueAsText(stat: Stat): MutableComponent {
val value = when(statOptions.get(statTabIndex)) {
val value = when (statOptions.get(statTabIndex)) {
STATS -> if (stat == Stats.HP) "${pokemon.currentHealth} / ${pokemon.maxHealth}" else pokemon.getStat(stat).toString()
IV -> pokemon.ivs.getOrDefault(stat).toString()
IV -> if (pokemon.ivs.isHyperTrained(stat)) "${pokemon.ivs[stat]} (${pokemon.ivs.hyperTrainedIVs[stat]})" else pokemon.ivs[stat].toString()
EV -> pokemon.evs.getOrDefault(stat).toString()
else -> "0"
}
@@ -102,4 +102,4 @@ class WailordModel(root: ModelPart) : PokemonPosableModel(root) {
override fun getFaintAnimation(state: PosableState) = if (state.isPosedIn(standing, walk, sleep, battleidle)) bedrockStateful("wailord", "faint") else
if (state.isPosedIn(floating, swimming)) bedrockStateful("wailord", "faint_water")
else null
}
}
@@ -58,8 +58,10 @@ object MountedPlayerRenderer {
val offset = Vector3f(0f, player.bbHeight / 2, 0f).mul(-1f)
matrix.rotate(locator.matrix.getRotation(AxisAngle4f()))
matrix.rotate(Axis.YP.rotationDegrees(180 + yBodyRot))
if (entity.beamMode == 0) {
matrix.rotate(locator.matrix.getRotation(AxisAngle4f()))
matrix.rotate(Axis.YP.rotationDegrees(180 + yBodyRot))
}
matrix.translate(offset)
matrix.translate(Vector3f(0f, 0.35f, 0f))
@@ -144,7 +144,7 @@ class PokemonRenderer(
if (entity.passengers.isNotEmpty()) {
renderRiding(entity, partialTicks, poseMatrix, buffer, packedLight)
renderRiding(entity, entityYaw, partialTicks, poseMatrix, buffer, packedLight)
}
else {
super.render(entity, entityYaw, partialTicks, poseMatrix, buffer, packedLight)
@@ -173,6 +173,7 @@ class PokemonRenderer(
fun renderRiding(
entity: PokemonEntity,
entityYaw: Float,
partialTicks: Float,
poseMatrix: PoseStack,
buffer: MultiBufferSource,
@@ -200,7 +201,7 @@ class PokemonRenderer(
matrix.mul(transformationMatrix)
}
super.render(entity, 0f, partialTicks, poseMatrix, buffer, packedLight)
super.render(entity, entityYaw, partialTicks, poseMatrix, buffer, packedLight)
poseMatrix.popPose()
}
@@ -9,17 +9,14 @@
package com.cobblemon.mod.common.client.tooltips
import com.cobblemon.mod.common.CobblemonItemComponents
import com.cobblemon.mod.common.api.text.blue
import com.cobblemon.mod.common.api.text.gray
import com.cobblemon.mod.common.item.AprijuiceItem
import com.cobblemon.mod.common.util.lang
import net.minecraft.network.chat.Component
import net.minecraft.world.item.ItemStack
object AprijuiceTooltipGenerator : TooltipGenerator() {
override fun generateCategoryTooltip(stack: ItemStack, lines: MutableList<Component>): MutableList<Component>? {
if (stack.item !is AprijuiceItem) return null
return mutableListOf(seasoningHeader)
}
override fun generateAdditionalTooltip(stack: ItemStack, lines: MutableList<Component>): MutableList<Component>? {
if (stack.item !is AprijuiceItem) return null
@@ -30,7 +27,7 @@ object AprijuiceTooltipGenerator : TooltipGenerator() {
val quality = flavourComponent.getQuality()
resultLines.add(lang("cooking.cooking_quality", quality.getLang()))
resultLines.addAll(generateAdditionalFlavorTooltip(flavourComponent.flavours))
SeasoningTooltipGenerator.generateAdditionalTooltip(stack, lines)
return resultLines
}
@@ -28,15 +28,8 @@ import net.minecraft.network.chat.Component
import net.minecraft.world.item.ItemStack
object FishingBaitTooltipGenerator : TooltipGenerator() {
private val fishingBaitHeader by lazy { lang("fishing_bait_effect_header").blue() }
private val fishingBaitItemClass by lazy { lang("item_class.fishing_bait").blue() }
private val Genders = mapOf<Gender, Component>(
Gender.MALE to lang("gender.male"),
Gender.FEMALE to lang("gender.female"),
Gender.GENDERLESS to lang("gender.genderless"),
)
override fun generateCategoryTooltip(stack: ItemStack, lines: MutableList<Component>): MutableList<Component>? {
if (stack.get(DataComponents.HIDE_ADDITIONAL_TOOLTIP) != null) {
return null
@@ -53,77 +46,7 @@ object FishingBaitTooltipGenerator : TooltipGenerator() {
}
val resultLines = mutableListOf<Component>()
// Determine the FishingBait or combined effects from poke_bait
val rawEffects = mutableListOf<SpawnBait.Effect>().apply {
if (stack.item is PokerodItem) {
addAll(SpawnBaitEffects.getEffectsFromRodItemStack(stack))
} else {
addAll(SpawnBaitEffects.getEffectsFromItemStack(stack))
}
// Check for Seasoning-based Bait effects
if (Seasonings.isSeasoning(stack)) {
val seasoningEffects = Seasonings.getBaitEffectsFromItemStack(stack)
if (seasoningEffects.isNotEmpty()) {
addAll(seasoningEffects)
}
}
}
val baitEffects = SpawnBaitUtils.mergeEffects(rawEffects)
if (baitEffects.isEmpty()) return null
resultLines.add(this.fishingBaitHeader)
val formatter = DecimalFormat("0.##")
baitEffects.forEach { effect ->
val effectType = effect.type.path.toString()
val effectSubcategory = effect.subcategory?.path
val effectChance = effect.chance * 100
var effectValue = when (effectType) {
"bite_time" -> (effect.value * 100).toInt()
else -> effect.value.toInt()
}
val subcategoryString: Component = if (effectSubcategory != null) {
when (effectType) {
"nature", "ev", "iv" -> com.cobblemon.mod.common.api.pokemon.stats.Stats.getStat(
effectSubcategory
).displayName
"gender_chance" -> Genders[Gender.valueOf(effectSubcategory.toUpperCase())]
"typing" -> ElementalTypes.get(effectSubcategory)?.displayName
"egg_group" -> {
val effectSubcategory = effect.subcategory.path
val eggGroup = effectSubcategory?.let { EggGroup.fromIdentifier(it) }
eggGroup?.let {
val langKey = "egg_group.${it.name.lowercase()}"
lang(langKey)
} ?: Component.literal(effectSubcategory ?: "Unknown").gold()
}
else -> Component.empty()
} ?: Component.literal("cursed").obfuscate()
} else Component.literal("cursed").obfuscate()
// Adjust shiny chance effectValue
if (effectType == "shiny_reroll") {
effectValue++
}
resultLines.add(
lang(
"fishing_bait_effects.$effectType.tooltip",
Component.literal(formatter.format(effectChance)).yellow(),
subcategoryString.copy().gold(),
Component.literal(formatter.format(effectValue)).green()
)
)
}
if (SpawnBaitEffects.isFishingBait(stack)) resultLines.add(this.fishingBaitItemClass)
return resultLines
}
@@ -1,36 +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.tooltips
import com.cobblemon.mod.common.api.cooking.Flavour
import com.cobblemon.mod.common.api.text.*
import com.cobblemon.mod.common.util.lang
import net.minecraft.network.chat.Component
val seasoningHeader by lazy { lang("item_class.seasoning").blue() }
private val flavorSubHeader by lazy { lang("seasoning_flavor_header").blue() }
fun generateAdditionalFlavorTooltip(flavours: Map<Flavour, Int>): MutableList<Component> {
val resultLines = mutableListOf<Component>()
resultLines.add(flavorSubHeader)
val combinedFlavorsLine = Component.literal("")
flavours.filter { it.key != Flavour.MILD }.forEach { (flavour, value) ->
var flavourText = lang("seasoning_flavor.${flavour.name.lowercase()}").withStyle(flavour.chatFormatting)
if (combinedFlavorsLine.string.isNotEmpty()) {
combinedFlavorsLine.append(" ")
}
combinedFlavorsLine.append(flavourText).append(" $value")
}
resultLines.add(combinedFlavorsLine)
return resultLines
}
@@ -1,35 +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.tooltips
import com.cobblemon.mod.common.CobblemonItemComponents
import com.cobblemon.mod.common.api.text.blue
import com.cobblemon.mod.common.api.text.green
import com.cobblemon.mod.common.api.text.yellow
import com.cobblemon.mod.common.util.lang
import net.minecraft.network.chat.Component
import net.minecraft.world.item.ItemStack
object FoodTooltipGenerator : TooltipGenerator() {
private val foodHeader by lazy { lang("item_class.food").blue() }
override fun generateCategoryTooltip(stack: ItemStack, lines: MutableList<Component>): MutableList<Component>? {
val food = stack.get(CobblemonItemComponents.FOOD) ?: return null
return mutableListOf(foodHeader)
}
override fun generateAdditionalTooltip(stack: ItemStack, lines: MutableList<Component>): MutableList<Component>? {
val food = stack.get(CobblemonItemComponents.FOOD) ?: return null
return mutableListOf(
lang("tooltip.food.hunger", Component.literal("${food.hunger}").yellow()),
lang("tooltip.food.saturation", Component.literal("%.2f".format(food.saturation)).green())
)
}
}
@@ -1,89 +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.tooltips
import com.cobblemon.mod.common.CobblemonItemComponents
import com.cobblemon.mod.common.api.text.blue
import com.cobblemon.mod.common.api.text.green
import com.cobblemon.mod.common.api.text.yellow
import com.cobblemon.mod.common.util.lang
import net.minecraft.client.Minecraft
import net.minecraft.network.chat.Component
import net.minecraft.world.effect.MobEffectInstance
import net.minecraft.world.item.ItemStack
import net.minecraft.world.effect.MobEffectUtil
object MobEffectTooltipGenerator : TooltipGenerator() {
private val effectHeader by lazy { lang("item_class.mob_effect").blue() }
override fun generateCategoryTooltip(stack: ItemStack, lines: MutableList<Component>): MutableList<Component>? {
val effects = stack.get(CobblemonItemComponents.MOB_EFFECTS)?.mobEffects ?: return null
return if (effects.isNotEmpty()) mutableListOf(effectHeader) else null
}
override fun generateAdditionalTooltip(stack: ItemStack, lines: MutableList<Component>): MutableList<Component>? {
val effects = stack.get(CobblemonItemComponents.MOB_EFFECTS)?.mobEffects ?: return null
if (effects.isEmpty()) return null
val tickRate = Minecraft.getInstance().level?.tickRateManager()?.tickrate() ?: 20.0f
val result = mutableListOf<Component>()
// Always add the header FIRST, even for additional tooltip
result.add(effectHeader)
for (instance in effects) {
val name = instance.effect.value().descriptionId
val duration = MobEffectUtil.formatDuration(instance, 1.0f, tickRate) // Already a Component
val amplifierRoman = getRomanNumeral(instance.amplifier + 1)
result.add(
lang(
"tooltip.mob_effect_entry",
Component.translatable(name).yellow(),
Component.literal(amplifierRoman).green(),
duration.string.green()
)
)
}
return result
}
private fun getRomanNumeral(number: Int): String {
if (number <= 0) return number.toString() // no Roman numeral for zero or negatives
val numerals = listOf(
1000 to "M",
900 to "CM",
500 to "D",
400 to "CD",
100 to "C",
90 to "XC",
50 to "L",
40 to "XL",
10 to "X",
9 to "IX",
5 to "V",
4 to "IV",
1 to "I"
)
var remaining = number
val result = StringBuilder()
for ((value, numeral) in numerals) {
while (remaining >= value) {
result.append(numeral)
remaining -= value
}
}
return result.toString()
}
}
@@ -28,11 +28,8 @@ object PokePuffTooltipGenerator : TooltipGenerator() {
override fun generateAdditionalTooltip(stack: ItemStack, lines: MutableList<Component>): MutableList<Component>? {
if (stack.item !is PokePuffItem) return null
// val flavourComponent = stack.get(CobblemonItemComponents.FLAVOUR) ?: return null
val resultLines = mutableListOf<Component>()
// resultLines.addAll(generateAdditionalFlavorTooltip(flavourComponent.flavours))
val dominantFlavour = PokePuffUtils.getDominantFlavour(stack)
if (dominantFlavour != null) {
val friendshipLiked = PokePuffUtils.getFriendshipChangeLiked(stack)
@@ -0,0 +1,41 @@
/*
* 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.tooltips
import com.cobblemon.mod.common.CobblemonItemComponents
import com.cobblemon.mod.common.api.text.blue
import com.cobblemon.mod.common.api.text.gray
import com.cobblemon.mod.common.item.AprijuiceItem
import com.cobblemon.mod.common.util.lang
import net.minecraft.network.chat.Component
import net.minecraft.world.item.ItemStack
object RecipeSeasoningAbsorbtionTooltipGenerator : TooltipGenerator() {
override fun generateCategoryTooltip(stack: ItemStack, lines: MutableList<Component>): MutableList<Component>? {
// Skip if this is a crafting result preview. Vera wanted to be able to give extra context to things not fully crafted for added guidance in crafting UIs
if (stack.get(CobblemonItemComponents.CRAFTED) == true) {
return mutableListOf()
}
if (itemTakesSeasoningData(stack)) {
val accepted = mutableListOf<Component>()
if (recipeUsesFlavor(stack)) accepted.add(flavorHeader)
if (recipeUsesFood(stack)) accepted.add(foodHeader)
if (recipeUsesMobEffect(stack)) accepted.add(mobEffectHeader)
if (recipeUsesBaitEffect(stack)) accepted.add(baitEffectHeader)
if (accepted.isNotEmpty()) {
return mutableListOf(generateSeasoningAbsorbtionTooltip(accepted))
}
}
return null
}
}
@@ -8,21 +8,97 @@
package com.cobblemon.mod.common.client.tooltips
import com.cobblemon.mod.common.CobblemonItemComponents
import com.cobblemon.mod.common.api.cooking.Seasonings
import com.cobblemon.mod.common.api.text.blue
import com.cobblemon.mod.common.api.text.gray
import com.cobblemon.mod.common.util.lang
import net.minecraft.core.component.DataComponents
import net.minecraft.network.chat.Component
import net.minecraft.world.item.ItemStack
object SeasoningTooltipGenerator : TooltipGenerator() {
override fun generateCategoryTooltip(stack: ItemStack, lines: MutableList<Component>): MutableList<Component>? {
if (!Seasonings.isSeasoning(stack)) return null
return mutableListOf(seasoningHeader)
val isSeasoningIngredient = Seasonings.isSeasoning(stack)
val flavors = stack.get(CobblemonItemComponents.FLAVOUR)?.flavours
val food = stack.get(CobblemonItemComponents.FOOD)
val baitEffects = stack.get(CobblemonItemComponents.BAIT_EFFECTS)?.effects
val mobEffects = stack.get(CobblemonItemComponents.MOB_EFFECTS)?.mobEffects
val result = mutableListOf<Component>()
if (!isSeasoningIngredient && flavors == null && food == null && baitEffects == null && mobEffects == null) return null // exit early if there is nothing to show to save time
// This is where we label something as either an ingredient OR an item with Seasoning data. To help users know if something can be used IN the Pot or came FROM a pot at a glance
if (isSeasoningIngredient) {
// Flavor
if (Seasonings.hasFlavors(stack)) result.add(flavorSeasoningHeader)
// Food
if (Seasonings.hasFood(stack)) result.add(foodSeasoningHeader)
// Mob Effects
if (Seasonings.hasMobEffect(stack)) result.add(mobEffectSeasoningHeader)
// Bait Effects
if (Seasonings.hasBaitEffects(stack)) result.add(baitEffectSeasoningHeader)
} else { // these are output items that have Seasoning Component data on them
// Flavor
if (!flavors.isNullOrEmpty()) result.add(lang("seasoning_flavor_header").blue())
// Food
if (food != null) result.add(lang("seasoning_food_header").blue())
// Mob Effects
if (!mobEffects.isNullOrEmpty()) result.add(lang("seasoning_mob_effect_header").blue())
// Bait Effects
if (!baitEffects.isNullOrEmpty()) result.add(lang("seasoning_bait_effect_header").blue())
}
return if (result.isNotEmpty()) result else null
}
override fun generateAdditionalTooltip(stack: ItemStack, lines: MutableList<Component>): MutableList<Component>? {
val flavors = Seasonings.getFlavoursFromItemStack(stack)
if (flavors.all { it.value == 0 }) {
if (stack.get(DataComponents.HIDE_ADDITIONAL_TOOLTIP) != null) {
return null
}
return generateAdditionalFlavorTooltip(flavors)
val isSeasoningIngredient = Seasonings.isSeasoning(stack)
val flavors = stack.get(CobblemonItemComponents.FLAVOUR)?.flavours
val food = stack.get(CobblemonItemComponents.FOOD)
val baitEffects = stack.get(CobblemonItemComponents.BAIT_EFFECTS)?.effects
val mobEffects = stack.get(CobblemonItemComponents.MOB_EFFECTS)?.mobEffects
if (!isSeasoningIngredient && flavors == null && food == null && baitEffects == null && mobEffects == null) return null // exit early if there is nothing to show to save time
val result = mutableListOf<Component>()
// this is where we want to replace the headers with the info and data for each seasoning category we want to show
// Flavor
val flavorData = Seasonings.getFlavoursFromItemStack(stack).takeIf { !it.isNullOrEmpty() } ?: flavors
if (flavorData != null && flavorData.any { it.value != 0 }) {
result.addAll(generateAdditionalFlavorTooltip(flavorData))
}
// Food
if (Seasonings.hasFood(stack) || food != null) {
result.addAll(generateAdditionalFoodTooltip(stack))
}
// Mob Effects
if (Seasonings.hasMobEffect(stack) || mobEffects != null) {
result.addAll(generateAdditionalMobEffectTooltip(stack))
}
// Bait Effects
if (Seasonings.hasBaitEffects(stack) || baitEffects != null) {
result.addAll(generateAdditionalBaitEffectTooltip(stack))
}
return if (result.isNotEmpty()) result else null
}
}
@@ -0,0 +1,301 @@
/*
* 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.tooltips
import com.cobblemon.mod.common.CobblemonItemComponents
import com.cobblemon.mod.common.CobblemonRecipeTypes
import com.cobblemon.mod.common.api.cooking.Flavour
import com.cobblemon.mod.common.api.cooking.Food
import com.cobblemon.mod.common.api.cooking.PokePuffUtils
import com.cobblemon.mod.common.api.cooking.Seasonings
import com.cobblemon.mod.common.api.fishing.SpawnBait
import com.cobblemon.mod.common.api.fishing.SpawnBaitEffects
import com.cobblemon.mod.common.api.fishing.SpawnBaitUtils
import com.cobblemon.mod.common.api.pokemon.egg.EggGroup
import com.cobblemon.mod.common.api.text.*
import com.cobblemon.mod.common.api.types.ElementalTypes
import com.cobblemon.mod.common.item.components.FoodComponent
import com.cobblemon.mod.common.item.crafting.CookingPotRecipe
import com.cobblemon.mod.common.item.crafting.CookingPotRecipeBase
import com.cobblemon.mod.common.item.interactive.PokerodItem
import com.cobblemon.mod.common.pokemon.Gender
import com.cobblemon.mod.common.util.lang
import net.minecraft.ChatFormatting
import net.minecraft.client.Minecraft
import net.minecraft.network.chat.Component
import net.minecraft.world.effect.MobEffectInstance
import net.minecraft.world.effect.MobEffectUtil
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.crafting.RecipeManager
import net.minecraft.world.level.Level
import java.text.DecimalFormat
val cookingPotRecipeAbsorbHeader by lazy { lang("item_class.cooking_pot_recipe_absorbs").gray() }
val seasoningsHeader by lazy { lang("item_class.seasonings").gray() }
val flavorSeasoningHeader by lazy { lang("item_class.flavor_seasoning").blue() }
val flavorHeader by lazy { lang("seasoning_flavor_header").gray() }
val flavorInfoSubHeader by lazy { lang("seasoning_flavor_info_header").blue() }
val baitEffectSeasoningHeader by lazy { lang("item_class.bait_effect_seasoning").blue() }
val baitEffectHeader by lazy { lang("seasoning_bait_effect_header").gray() }
val baitEffectInfoSubHeader by lazy { lang("seasoning_bait_effect_info_header").blue() }
val foodSeasoningHeader by lazy { lang("item_class.food_seasoning").blue() }
val foodHeader by lazy { lang("seasoning_food_header").gray() }
val foodInfoSubHeader by lazy { lang("seasoning_food_info_header").blue() }
val mobEffectSeasoningHeader by lazy { lang("item_class.mob_effect_seasoning").blue() }
val mobEffectHeader by lazy { lang("seasoning_mob_effect_header").gray() }
val mobEffectInfoSubHeader by lazy { lang("seasoning_mob_effect_info_header").blue() }
private fun recipeUsesProcessor(stack: ItemStack, processorType: String): Boolean {
val level = Minecraft.getInstance().level ?: return false
val recipeManager = level.recipeManager
val allCookingRecipes = recipeManager.getAllRecipesFor(CobblemonRecipeTypes.COOKING_POT_COOKING) +
recipeManager.getAllRecipesFor(CobblemonRecipeTypes.COOKING_POT_SHAPELESS)
return allCookingRecipes
.any { recipe ->
stack.item == recipe.value.result.item &&
recipe.value.seasoningProcessors.any { it.type == processorType }
}
}
fun itemTakesSeasoningData(stack: ItemStack): Boolean {
return recipeUsesFlavor(stack) || recipeUsesFood(stack) || recipeUsesMobEffect(stack) || recipeUsesBaitEffect(stack)
}
fun recipeUsesFlavor(stack: ItemStack): Boolean {
return recipeUsesProcessor(stack, "flavour")
}
fun recipeUsesFood(stack: ItemStack): Boolean {
return recipeUsesProcessor(stack, "food")
}
fun recipeUsesMobEffect(stack: ItemStack): Boolean {
return recipeUsesProcessor(stack, "mob_effects")
}
fun recipeUsesBaitEffect(stack: ItemStack): Boolean {
return recipeUsesProcessor(stack, "spawn_bait")
}
fun generateSeasoningAbsorbtionTooltip(accepted: List<Component>): Component {
if (accepted.isEmpty()) return Component.empty()
if (accepted.size == 1) return lang("item_class.cooking_pot_recipe_absorbs")
.append(" ").append(accepted[0]).append(" ")
.append(seasoningsHeader).gray()
val result = Component.literal("")
result.append(lang("item_class.cooking_pot_recipe_absorbs")).append(" ").gray()
for ((index, component) in accepted.withIndex()) {
when (index) {
accepted.lastIndex -> {
result.append("and ").append(component)
}
accepted.lastIndex - 1 -> {
result.append(component).append(", ")
}
else -> {
result.append(component).append(", ")
}
}
if (index == accepted.lastIndex) {
result.append(" ").append(seasoningsHeader).gray()
}
}
return result
}
fun generateAdditionalFlavorTooltip(flavours: Map<Flavour, Int>): MutableList<Component> {
val resultLines = mutableListOf<Component>()
resultLines.add(flavorInfoSubHeader)
val combinedFlavorsLine = Component.literal("")
flavours.filter { it.key != Flavour.MILD }.forEach { (flavour, value) ->
var flavourText = lang("seasoning_flavor.${flavour.name.lowercase()}").withStyle(flavour.chatFormatting)
if (combinedFlavorsLine.string.isNotEmpty()) {
combinedFlavorsLine.append(" ")
}
combinedFlavorsLine.append(flavourText).append(" $value")
}
resultLines.add(combinedFlavorsLine)
return resultLines
}
fun generateAdditionalMobEffectTooltip(stack: ItemStack): MutableList<Component> {
val effects: List<MobEffectInstance> =
Seasonings.getMobEffectsFromItemStack(stack)
.takeIf { it.isNotEmpty() }
?.map { it.toInstance() }
?: stack.get(CobblemonItemComponents.MOB_EFFECTS)?.mobEffects
?: return mutableListOf()
val tickRate = Minecraft.getInstance().level?.tickRateManager()?.tickrate() ?: 20.0f
val resultLines = mutableListOf<Component>()
resultLines.add(mobEffectInfoSubHeader)
for (instance in effects) {
val effect = instance.effect.value()
val name = Component.translatable(effect.descriptionId)
val color = if (effect.isBeneficial) ChatFormatting.AQUA else ChatFormatting.RED
val duration = MobEffectUtil.formatDuration(instance, 1.0f, tickRate)
val amplifierRoman = getRomanNumeral(instance.amplifier + 1)
resultLines.add(
lang(
"tooltip.mob_effect_entry",
name.copy().withStyle(color),
Component.literal(amplifierRoman).withStyle(color),
duration.string.green()
)
)
}
return resultLines
}
fun generateAdditionalFoodTooltip(stack: ItemStack): MutableList<Component> {
val food = Seasonings.getFoodComponentFromItemStack(stack) ?: stack.get(CobblemonItemComponents.FOOD)
val resultLines = mutableListOf<Component>()
if (food != null) {
resultLines.add(foodInfoSubHeader)
resultLines.add(
lang("tooltip.food.hunger", Component.literal("${food.hunger}").yellow())
)
resultLines.add(
lang("tooltip.food.saturation", Component.literal("%.2f".format(food.saturation)).green())
)
}
return resultLines
}
fun generateAdditionalBaitEffectTooltip(stack: ItemStack): MutableList<Component> {
val resultLines = mutableListOf<Component>()
val rawEffects = mutableListOf<SpawnBait.Effect>().apply {
if (stack.item is PokerodItem) {
addAll(SpawnBaitEffects.getEffectsFromRodItemStack(stack))
} else {
addAll(SpawnBaitEffects.getEffectsFromItemStack(stack))
}
if (Seasonings.isSeasoning(stack)) {
val seasoningEffects = Seasonings.getBaitEffectsFromItemStack(stack)
if (seasoningEffects.isNotEmpty()) {
addAll(seasoningEffects)
}
}
}
val baitEffects = SpawnBaitUtils.mergeEffects(rawEffects)
if (baitEffects.isNotEmpty()) {
resultLines.add(baitEffectInfoSubHeader)
val formatter = DecimalFormat("0.##")
val genders = mapOf(
Gender.MALE to lang("gender.male"),
Gender.FEMALE to lang("gender.female"),
Gender.GENDERLESS to lang("gender.genderless")
)
for (effect in baitEffects) {
val effectType = effect.type.path
val effectSubcategory = effect.subcategory?.path
val effectChance = effect.chance * 100
var effectValue = when (effectType) {
"bite_time" -> (effect.value * 100).toInt()
else -> effect.value.toInt()
}
val subcategoryString: Component = if (effectSubcategory != null) {
when (effectType) {
"nature", "ev", "iv" ->
com.cobblemon.mod.common.api.pokemon.stats.Stats.getStat(effectSubcategory).displayName
"gender_chance" ->
genders[Gender.valueOf(effectSubcategory.uppercase())]
"typing" ->
ElementalTypes.get(effectSubcategory)?.displayName
"egg_group" -> {
val eggGroup = EggGroup.fromIdentifier(effectSubcategory)
eggGroup?.let {
lang("egg_group.${it.name.lowercase()}")
} ?: Component.literal(effectSubcategory).gold()
}
else -> Component.empty()
} ?: Component.literal("cursed").obfuscate()
} else Component.literal("cursed").obfuscate()
if (effectType == "shiny_reroll") {
effectValue++
}
resultLines.add(
lang(
"fishing_bait_effects.$effectType.tooltip",
Component.literal(formatter.format(effectChance)).yellow(),
subcategoryString.copy().gold(),
Component.literal(formatter.format(effectValue)).green()
)
)
}
}
return resultLines
}
private fun getRomanNumeral(number: Int): String {
if (number <= 0) return number.toString()
val numerals = listOf(
1000 to "M",
900 to "CM",
500 to "D",
400 to "CD",
100 to "C",
90 to "XC",
50 to "L",
40 to "XL",
10 to "X",
9 to "IX",
5 to "V",
4 to "IV",
1 to "I"
)
var remaining = number
val result = StringBuilder()
for ((value, numeral) in numerals) {
while (remaining >= value) {
result.append(numeral)
remaining -= value
}
}
return result.toString()
}
@@ -0,0 +1,120 @@
/*
* 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.command
import com.cobblemon.mod.common.api.permission.CobblemonPermissions
import com.cobblemon.mod.common.api.text.*
import com.cobblemon.mod.common.command.argument.PokemonPropertiesArgumentType
import com.cobblemon.mod.common.util.*
import com.mojang.brigadier.Command
import com.mojang.brigadier.CommandDispatcher
import com.mojang.brigadier.context.CommandContext
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType
import net.minecraft.commands.CommandSourceStack
import net.minecraft.commands.Commands.literal
import net.minecraft.commands.Commands.argument
import net.minecraft.commands.arguments.EntityArgument
import net.minecraft.network.chat.Component
import net.minecraft.network.chat.MutableComponent
import net.minecraft.server.level.ServerPlayer
import com.cobblemon.mod.common.api.pokemon.stats.Stats
object PcSearchCommand {
private const val NAME = "pcsearch"
private const val PROPERTIES = "properties"
private const val OTHER = "other"
private val IN_BATTLE_EXCEPTION = SimpleCommandExceptionType(lang("pc.inbattle").red())
fun register(dispatcher: CommandDispatcher<CommandSourceStack>) {
dispatcher.register(
literal(NAME)
.permission(CobblemonPermissions.PC_SEARCH)
.then(
argument(PROPERTIES, PokemonPropertiesArgumentType.properties())
.executes { execute(it, it.source.playerOrException) }
)
.then(
literal("other")
.then(
argument(OTHER, EntityArgument.player())
.then(
argument(PROPERTIES, PokemonPropertiesArgumentType.properties())
.executes { execute(it, EntityArgument.getPlayer(it, OTHER)) }
)
)
)
)
}
private fun formatField(label: MutableComponent, value: MutableComponent): MutableComponent {
return label.add(": ").aqua().add(value.yellow())
}
private fun execute(context: CommandContext<CommandSourceStack>, player: ServerPlayer): Int {
if (player.isInBattle()) {
throw IN_BATTLE_EXCEPTION.create()
}
val pokemonProperties = PokemonPropertiesArgumentType.getPokemonProperties(context, PROPERTIES)
val pc = player.pc()
val matchingPokemon = mutableListOf<MutableComponent>()
pc.boxes.forEachIndexed { boxIndex, box ->
val nonEmptySlots = box.getNonEmptySlots()
for ((slotIndex, pokemon) in nonEmptySlots) {
if (pokemonProperties.matches(pokemon)) {
val boxNumber = boxIndex + 1
val displayName = pokemon.species.translatedName
val level = pokemon.level
val baseText = commandLang("pcsearch.entry", displayName, lang("label.lv", level)).yellow()
val hoverText = Component.literal("")
.add(formatField(lang("ui.info.species"), displayName))
.add(" ").add(lang("label.lv", level))
.add("\n").add(formatField(lang("ui.info.gender"), lang("gender.${pokemon.gender.name.lowercase()}")))
.add("\n").add(formatField(lang("ui.info.nature"), pokemon.nature.displayName.asTranslated()))
.add("\n").add(formatField(lang("ui.info.ability"), pokemon.ability.displayName.asTranslated()))
.add("\n").add(lang("ui.stats.ivs").add(": ").aqua().add(
"${pokemon.ivs[Stats.HP]}/${pokemon.ivs[Stats.ATTACK]}/${pokemon.ivs[Stats.DEFENCE]}/${pokemon.ivs[Stats.SPEED]}/${pokemon.ivs[Stats.SPECIAL_ATTACK]}/${pokemon.ivs[Stats.SPECIAL_DEFENCE]}".yellow()
))
.add("\n").add(lang("ui.stats.evs").add(": ").aqua().add(
"${pokemon.evs[Stats.HP]}/${pokemon.evs[Stats.ATTACK]}/${pokemon.evs[Stats.DEFENCE]}/${pokemon.evs[Stats.SPEED]}/${pokemon.evs[Stats.SPECIAL_ATTACK]}/${pokemon.evs[Stats.SPECIAL_DEFENCE]}".yellow()
))
if (pokemon.shiny) {
hoverText.add("\n").add(commandLang("pcsearch.tooltip.shiny").gold())
}
baseText.onHover(hoverText)
val locationText = commandLang("pcsearch.location", boxNumber, slotIndex + 1).green()
.onHover(commandLang("pcsearch.takepokemon"))
.suggest("/pctake ${player.name.string} $boxNumber ${slotIndex + 1}")
matchingPokemon.add(baseText.add(locationText))
}
}
}
if (matchingPokemon.isEmpty()) {
context.source.sendSystemMessage(commandLang("pcsearch.nomatch", pokemonProperties.originalString, player.name.string))
} else {
context.source.sendSystemMessage(commandLang("pcsearch.found", player.name.string))
matchingPokemon.forEach { result ->
context.source.sendSystemMessage(result)
}
}
return Command.SINGLE_SUCCESS
}
}
@@ -0,0 +1,98 @@
/*
* 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.command
import com.cobblemon.mod.common.api.permission.CobblemonPermissions
import com.cobblemon.mod.common.api.storage.pc.PCPosition
import com.cobblemon.mod.common.api.storage.pc.POKEMON_PER_BOX
import com.cobblemon.mod.common.api.text.red
import com.cobblemon.mod.common.api.text.text
import com.cobblemon.mod.common.util.*
import com.mojang.brigadier.Command
import com.mojang.brigadier.CommandDispatcher
import com.mojang.brigadier.arguments.IntegerArgumentType
import com.mojang.brigadier.context.CommandContext
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType
import net.minecraft.commands.CommandSourceStack
import net.minecraft.commands.Commands
import net.minecraft.commands.arguments.EntityArgument
import net.minecraft.server.level.ServerPlayer
object PcTakeCommand {
private val IN_BATTLE_EXCEPTION = SimpleCommandExceptionType(lang("pc.inbattle").red())
fun register(dispatcher : CommandDispatcher<CommandSourceStack>) {
val command = Commands.literal("pctake")
.permission(CobblemonPermissions.TAKE_POKEMON)
.then(
Commands.argument("player", EntityArgument.player())
.then(
Commands.argument("box", IntegerArgumentType.integer(1))
.then(
Commands.argument("slot", IntegerArgumentType.integer(1, 30))
.executes(::execute)
)
)
)
dispatcher.register(command)
}
private fun execute(context: CommandContext<CommandSourceStack>) : Int {
val executor = context.source.entity as? ServerPlayer
val target = EntityArgument.getPlayer(context, "player")
return executeWithTarget(context, target, executor)
}
private fun executeWithTarget(context: CommandContext<CommandSourceStack>, target: ServerPlayer, executor: ServerPlayer?) : Int {
try {
if (target.isInBattle()) {
throw IN_BATTLE_EXCEPTION.create()
}
val box = IntegerArgumentType.getInteger(context, "box")
val slot = IntegerArgumentType.getInteger(context, "slot")
val pc = target.pc()
if (box > POKEMON_PER_BOX) {
context.source.sendFailure(commandLang("pctake.too_many_boxes", POKEMON_PER_BOX))
return 0
}
val boxIndex = box - 1
val slotIndex = slot - 1
if (slotIndex < 0 || slotIndex >= POKEMON_PER_BOX) {
context.source.sendFailure(commandLang("pctake.invalid_slot"))
return 0
}
val pokemon = pc.boxes[boxIndex][slotIndex]
if (pokemon == null) {
context.source.sendFailure(commandLang("pctake.no_pokemon", box, slot))
return 0
}
pc.remove(PCPosition(boxIndex, slotIndex))
if (executor != null && executor != target) {
val toParty = executor.party()
toParty.add(pokemon)
context.source.sendSuccess({ commandLang("pctake.taken_other", pokemon.species.name, target.name.string) }, true)
return Command.SINGLE_SUCCESS
}
context.source.sendSuccess({ commandLang("pctake.removed", pokemon.species.name, box, slot) }, true)
return Command.SINGLE_SUCCESS
} catch (e: Exception) {
e.printStackTrace()
}
return Command.SINGLE_SUCCESS
}
}
@@ -16,6 +16,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder
import com.mojang.datafixers.DSL.TypeReference
import com.mojang.datafixers.DataFixer
import com.mojang.datafixers.DataFixerBuilder
import com.mojang.datafixers.schemas.Schema
import com.mojang.datafixers.util.Pair
import com.mojang.serialization.Codec
import com.mojang.serialization.DataResult
@@ -26,10 +27,10 @@ import java.util.concurrent.Executors
@Suppress("MemberVisibilityCanBePrivate", "unused")
object CobblemonSchemas {
private val SAME: (Int, Schema) -> Schema = ::Schema
private val RESULT: DataFixerBuilder.Result = this.create()
const val DATA_VERSION = 1
const val DATA_VERSION = 2
/**
* The Cobblemon [DataFixer].
@@ -82,6 +83,8 @@ object CobblemonSchemas {
builder.addFixer(ShoulderStateJsonFix(schema1))
builder.addFixer(NicknameFix(schema1))
builder.addFixer(RaisedPPStagesFix(schema1))
val schema2 = builder.addSchema(2, SAME)
builder.addFixer(HypertrainIVFix(schema2))
}
private class CobblemonDataFixerCodec<R>(private val baseCodec: Codec<R>, private val typeReference: TypeReference) : Codec<R> {
@@ -0,0 +1,27 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.datafixer.fix
import com.cobblemon.mod.common.util.DataKeys
import com.mojang.datafixers.schemas.Schema
import com.mojang.serialization.Dynamic
import kotlin.jvm.optionals.getOrNull
class HypertrainIVFix(outputSchema: Schema) : PokemonFix(outputSchema) {
override fun fixPokemonData(dynamic: Dynamic<*>): Dynamic<*> {
var baseDynamic = dynamic
val oldIVs = baseDynamic.get(DataKeys.POKEMON_IVS).get().result().getOrNull() ?: return baseDynamic
baseDynamic = baseDynamic.remove(DataKeys.POKEMON_IVS)
val newIVs = baseDynamic.createMap(mapOf(baseDynamic.createString(DataKeys.POKEMON_IVS_BASE) to oldIVs,
baseDynamic.createString(DataKeys.POKEMON_IVS_HYPERTRAINED) to baseDynamic.createMap(emptyMap())))
baseDynamic = baseDynamic.set(DataKeys.POKEMON_IVS, newIVs)
return baseDynamic
}
}
@@ -158,6 +158,7 @@ import net.minecraft.world.item.ItemUtils
import net.minecraft.world.item.Items
import net.minecraft.world.level.Level
import net.minecraft.world.level.LightLayer
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.gameevent.GameEvent
import net.minecraft.world.level.material.FluidState
import net.minecraft.world.level.pathfinder.PathType
@@ -2090,6 +2091,13 @@ open class PokemonEntity(
}
}
override fun maxUpStep(): Float {
val upStep = ifRidingAvailableSupply(fallback = null) { behaviour, settings, state ->
behaviour.maxUpStep(settings, state, this)
}
return upStep ?: super.maxUpStep()
}
override fun getRiddenSpeed(controller: Player): Float {
return ifRidingAvailableSupply(fallback = 0.05f) { behaviour, settings, state ->
behaviour.speed(settings, state,this, controller)
@@ -48,7 +48,7 @@ class RevivalHerbItem(block: RevivalHerbBlock) : ItemNameBlockItem(block, Proper
override val returnItem = Items.AIR
override fun canUse(stack: ItemStack, battle: PokemonBattle, target: BattlePokemon) = target.health <= 0
override fun getShowdownInput(actor: BattleActor, battlePokemon: BattlePokemon, data: String?): String {
battlePokemon.effectedPokemon.decrementFriendship(CobblemonMechanics.remedies.getFriendshipDrop(runtime))
battlePokemon.effectedPokemon.decrementFriendship(CobblemonMechanics.remedies.getFriendshipDrop("revival_herb", runtime))
return "revive 0.25"
}
}
@@ -77,7 +77,7 @@ class RevivalHerbItem(block: RevivalHerbBlock) : ItemNameBlockItem(block, Proper
pokemon.entity?.playSound(CobblemonSounds.MEDICINE_HERB_USE, 1F, 1F)
pokemon.currentHealth = amount
pokemon.decrementFriendship(CobblemonMechanics.remedies.getFriendshipDrop(runtime))
pokemon.decrementFriendship(CobblemonMechanics.remedies.getFriendshipDrop("revival_herb", runtime))
if (!player.isCreative) {
stack.shrink(1)
}
@@ -107,7 +107,8 @@ object CobblemonItemGroups {
entries.accept(CobblemonItems.VIVICHOKE)
entries.accept(CobblemonItems.VIVICHOKE_SEEDS)
entries.accept(CobblemonItems.GALARICA_NUTS)
entries.accept(CobblemonItems.Hearty_Grains)
entries.accept(CobblemonItems.HEARTY_GRAINS)
entries.accept(CobblemonItems.TASTY_TAIL)
entries.accept(CobblemonItems.BUGWORT)
entries.accept(CobblemonItems.RED_APRICORN)
@@ -291,6 +292,10 @@ object CobblemonItemGroups {
entries.accept(CobblemonItems.SACCHARINE_LEAVES)
//entries.accept(CobblemonItems.SACCHARINE_SAPLING)
entries.accept(CobblemonItems.HEARTY_GRAIN_BALE)
entries.accept(CobblemonItems.TATAMI_BLOCK)
entries.accept(CobblemonItems.TATAMI_MAT)
entries.accept(CobblemonItems.TUMBLESTONE_BLOCK)
entries.accept(CobblemonItems.BLACK_TUMBLESTONE_BLOCK)
@@ -391,6 +396,23 @@ object CobblemonItemGroups {
entries.accept(CobblemonItems.STAR_SWEET)
entries.accept(CobblemonItems.RIBBON_SWEET)
entries.accept(CobblemonItems.CANDIED_APPLE)
entries.accept(CobblemonItems.CANDIED_BERRY)
entries.accept(CobblemonItems.FRIED_RICE)
entries.accept(CobblemonItems.POTATO_MOCHI)
entries.accept(CobblemonItems.PEWTER_CRUNCHIES)
entries.accept(CobblemonItems.RAGE_CANDY_BAR)
entries.accept(CobblemonItems.LAVA_COOKIE)
entries.accept(CobblemonItems.JUBILIFE_MUFFIN)
entries.accept(CobblemonItems.OLD_GATEAU)
entries.accept(CobblemonItems.CASTELIACONE)
entries.accept(CobblemonItems.LUMIOSE_GALETTE)
entries.accept(CobblemonItems.SHALOUR_SABLE)
entries.accept(CobblemonItems.BIG_MALASADA)
entries.accept(CobblemonItems.SMOKED_TAIL_CURRY)
entries.accept(CobblemonItems.OPEN_FACED_SANDWICH)
entries.accept(CobblemonItems.BERRY_JUICE)
entries.accept(CobblemonItems.REMEDY)
entries.accept(CobblemonItems.FINE_REMEDY)
@@ -461,6 +483,19 @@ object CobblemonItemGroups {
entries.accept(CobblemonItems.EXPERIENCE_CANDY_XL)
entries.accept(CobblemonItems.RARE_CANDY)
entries.accept(CobblemonItems.HEALTH_CANDY)
entries.accept(CobblemonItems.MIGHTY_CANDY)
entries.accept(CobblemonItems.TOUGH_CANDY)
entries.accept(CobblemonItems.SMART_CANDY)
entries.accept(CobblemonItems.COURAGE_CANDY)
entries.accept(CobblemonItems.QUICK_CANDY)
entries.accept(CobblemonItems.SICKLY_CANDY)
entries.accept(CobblemonItems.WEAK_CANDY)
entries.accept(CobblemonItems.BRITTLE_CANDY)
entries.accept(CobblemonItems.NUMB_CANDY)
entries.accept(CobblemonItems.COWARD_CANDY)
entries.accept(CobblemonItems.SLOW_CANDY)
entries.accept(CobblemonItems.LONELY_MINT)
entries.accept(CobblemonItems.ADAMANT_MINT)
entries.accept(CobblemonItems.NAUGHTY_MINT)
@@ -538,6 +573,9 @@ object CobblemonItemGroups {
entries.accept(CobblemonItems.AUSPICIOUS_ARMOR)
entries.accept(CobblemonItems.MALICIOUS_ARMOR)
entries.accept(CobblemonItems.SHELL_HELMET)
entries.accept(CobblemonItems.METAL_ALLOY)
entries.accept(CobblemonItems.SCROLL_OF_DARKNESS)
entries.accept(CobblemonItems.SCROLL_OF_WATERS)
}
private fun heldItemEntries(displayContext: ItemDisplayParameters, entries: Output) {
@@ -558,6 +596,7 @@ object CobblemonItemGroups {
entries.accept(CobblemonItems.CHOICE_SCARF)
entries.accept(CobblemonItems.CHOICE_SPECS)
entries.accept(CobblemonItems.CLEANSE_TAG)
entries.accept(CobblemonItems.CLEAR_AMULET)
entries.accept(CobblemonItems.COVERT_CLOAK)
entries.accept(CobblemonItems.DAMP_ROCK)
entries.accept(CobblemonItems.DEEP_SEA_SCALE)
@@ -575,18 +614,21 @@ object CobblemonItemGroups {
entries.accept(CobblemonItems.FLOAT_STONE)
entries.accept(CobblemonItems.FOCUS_BAND)
entries.accept(CobblemonItems.FOCUS_SASH)
entries.accept(CobblemonItems.GRIP_CLAW)
entries.accept(CobblemonItems.HARD_STONE)
entries.accept(CobblemonItems.HEAT_ROCK)
entries.accept(CobblemonItems.HEAVY_DUTY_BOOTS)
entries.accept(CobblemonItems.ICY_ROCK)
entries.accept(CobblemonItems.IRON_BALL)
entries.accept(CobblemonItems.KINGS_ROCK)
entries.accept(CobblemonItems.LAGGING_TAIL)
entries.accept(CobblemonItems.LEFTOVERS)
entries.accept(CobblemonItems.LIFE_ORB)
entries.accept(CobblemonItems.LIGHT_BALL)
entries.accept(CobblemonItems.LIGHT_CLAY)
entries.accept(CobblemonItems.LOADED_DICE)
entries.accept(CobblemonItems.LUCKY_EGG)
entries.accept(CobblemonItems.LUMINOUS_MOSS)
entries.accept(CobblemonItems.MAGNET)
entries.accept(CobblemonItems.MENTAL_HERB)
entries.accept(CobblemonItems.METAL_COAT)
@@ -710,11 +752,26 @@ object CobblemonItemGroups {
injector.putAfter(CobblemonItems.STAR_SWEET, CobblemonItems.FLOWER_SWEET)
injector.putAfter(CobblemonItems.RIBBON_SWEET, CobblemonItems.STAR_SWEET)
injector.putAfter(CobblemonItems.CANDIED_APPLE, CobblemonItems.RIBBON_SWEET)
injector.putAfter(CobblemonItems.CANDIED_BERRY, CobblemonItems.CANDIED_APPLE)
injector.putAfter(CobblemonItems.FRIED_RICE, CobblemonItems.CANDIED_BERRY)
injector.putAfter(CobblemonItems.POTATO_MOCHI, CobblemonItems.FRIED_RICE)
injector.putAfter(CobblemonItems.PEWTER_CRUNCHIES, CobblemonItems.POTATO_MOCHI)
injector.putAfter(CobblemonItems.RAGE_CANDY_BAR, CobblemonItems.PEWTER_CRUNCHIES)
injector.putAfter(CobblemonItems.LAVA_COOKIE, CobblemonItems.RAGE_CANDY_BAR)
injector.putAfter(CobblemonItems.JUBILIFE_MUFFIN, CobblemonItems.LAVA_COOKIE)
injector.putAfter(CobblemonItems.OLD_GATEAU, CobblemonItems.JUBILIFE_MUFFIN)
injector.putAfter(CobblemonItems.CASTELIACONE, CobblemonItems.OLD_GATEAU)
injector.putAfter(CobblemonItems.LUMIOSE_GALETTE, CobblemonItems.CASTELIACONE)
injector.putAfter(CobblemonItems.SHALOUR_SABLE, CobblemonItems.LUMIOSE_GALETTE)
injector.putAfter(CobblemonItems.BIG_MALASADA, CobblemonItems.SHALOUR_SABLE)
injector.putAfter(CobblemonItems.SMOKED_TAIL_CURRY, CobblemonItems.BIG_MALASADA)
injector.putAfter(CobblemonItems.OPEN_FACED_SANDWICH, CobblemonItems.SMOKED_TAIL_CURRY)
injector.putAfter(CobblemonItems.LEEK_AND_POTATO_STEW, Items.RABBIT_STEW)
injector.putAfter(CobblemonItems.VIVICHOKE_DIP, CobblemonItems.LEEK_AND_POTATO_STEW)
injector.putLast(CobblemonItems.POTATO_MOCHI)
injector.putLast(CobblemonItems.FRIED_RICE)
injector.putLast(CobblemonItems.CANDIED_APPLE)
}
private fun toolsAndUtilitiesInjections(injector: Injector) {
@@ -22,8 +22,6 @@ import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
import com.cobblemon.mod.common.block.EnergyRootBlock
import com.cobblemon.mod.common.item.battle.BagItem
import com.cobblemon.mod.common.pokemon.Pokemon
import com.cobblemon.mod.common.util.genericRuntime
import com.cobblemon.mod.common.util.resolveInt
import net.minecraft.server.level.ServerPlayer
import net.minecraft.world.InteractionHand
import net.minecraft.world.InteractionResultHolder
@@ -42,7 +40,7 @@ class EnergyRootItem(block: EnergyRootBlock, settings: Properties) : ItemNameBlo
override val returnItem = Items.AIR
override fun canUse(stack: ItemStack, battle: PokemonBattle, target: BattlePokemon) = target.health > 0 && target.health < target.maxHealth
override fun getShowdownInput(actor: BattleActor, battlePokemon: BattlePokemon, data: String?): String {
battlePokemon.effectedPokemon.decrementFriendship(CobblemonMechanics.remedies.getFriendshipDrop(runtime))
battlePokemon.effectedPokemon.decrementFriendship(CobblemonMechanics.remedies.getFriendshipDrop("root", runtime))
return "potion ${getHealAmount()}"
}
}
@@ -58,7 +56,7 @@ class EnergyRootItem(block: EnergyRootBlock, settings: Properties) : ItemNameBlo
amount = event.amount
}
pokemon.currentHealth += amount
pokemon.decrementFriendship(CobblemonMechanics.remedies.getFriendshipDrop(runtime))
pokemon.decrementFriendship(CobblemonMechanics.remedies.getFriendshipDrop("root", runtime))
pokemon.entity?.playSound(CobblemonSounds.MEDICINE_HERB_USE, 1F, 1F)
if (!player.isCreative) {
stack.shrink(1)
@@ -8,11 +8,14 @@
package com.cobblemon.mod.common.item.interactive
import com.bedrockk.molang.runtime.MoLangRuntime
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.CobblemonMechanics
import com.cobblemon.mod.common.CobblemonSounds
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor
import com.cobblemon.mod.common.api.item.PokemonSelectingItem
import com.cobblemon.mod.common.api.molang.MoLangFunctions.setup
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
import com.cobblemon.mod.common.item.CobblemonItem
import com.cobblemon.mod.common.item.battle.BagItem
@@ -30,9 +33,14 @@ class HealPowderItem : CobblemonItem(Properties()), PokemonSelectingItem {
override val itemName = "item.cobblemon.heal_powder"
override val returnItem = Items.AIR
override fun canUse(stack: ItemStack, battle: PokemonBattle, target: BattlePokemon) = canUseOnPokemon(stack, target.effectedPokemon)
override fun getShowdownInput(actor: BattleActor, battlePokemon: BattlePokemon, data: String?) = "cure_status"
override fun getShowdownInput(actor: BattleActor, battlePokemon: BattlePokemon, data: String?): String {
battlePokemon.effectedPokemon.decrementFriendship(CobblemonMechanics.remedies.getFriendshipDrop("heal_powder", runtime))
return "cure_status"
}
}
private val runtime = MoLangRuntime().setup()
init {
Cobblemon.implementation.registerCompostable(this, .75F)
}
@@ -47,6 +55,7 @@ class HealPowderItem : CobblemonItem(Properties()), PokemonSelectingItem {
return if (currentStatus != null) {
pokemon.status = null
pokemon.entity?.playSound(CobblemonSounds.MEDICINE_HERB_USE, 1F, 1F)
pokemon.decrementFriendship(CobblemonMechanics.remedies.getFriendshipDrop("heal_powder", runtime))
if (!player.isCreative) {
stack.shrink(1)
}
@@ -0,0 +1,73 @@
/*
* 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.item.interactive
import com.cobblemon.mod.common.CobblemonSounds
import com.cobblemon.mod.common.api.item.PokemonSelectingItem
import com.cobblemon.mod.common.api.pokemon.stats.Stat
import com.cobblemon.mod.common.api.pokemon.stats.Stats
import com.cobblemon.mod.common.item.CobblemonItem
import com.cobblemon.mod.common.pokemon.IVs
import com.cobblemon.mod.common.pokemon.Pokemon
import com.cobblemon.mod.common.util.lang
import net.minecraft.world.entity.player.Player
import net.minecraft.world.item.ItemStack
import net.minecraft.server.level.ServerPlayer
import net.minecraft.util.Mth.clamp
import net.minecraft.world.InteractionHand
import net.minecraft.world.InteractionResultHolder
import net.minecraft.world.level.Level
import kotlin.math.roundToInt
// An item that modifies a Pokémon's IVs according to a given modifier and valid range.
class HyperTrainingItem(val ivIncreaseAmount: Int, val targetStats: Set<Stat>, val validRange: IntRange) : CobblemonItem(Properties()), PokemonSelectingItem {
override val bagItem = null
// Helper to ensure prospective IVs are within the valid range
private fun canChangeIV(stat: Stat, pokemon: Pokemon): Boolean {
val effectiveIV = pokemon.ivs.getEffectiveBattleIV(stat)
return effectiveIV in validRange && effectiveIV + ivIncreaseAmount in 0..IVs.MAX_VALUE
}
override fun canUseOnPokemon(stack: ItemStack, pokemon: Pokemon): Boolean {
// Check if at least one stat's effective IV can be modified
return targetStats.any { stat -> canChangeIV(stat, pokemon) }
}
override fun applyToPokemon(
player: ServerPlayer,
stack: ItemStack,
pokemon: Pokemon
): InteractionResultHolder<ItemStack> {
if(!canUseOnPokemon(stack, pokemon)) {
return InteractionResultHolder.fail(stack)
}
// Modify the effective IVs for the target stats
targetStats.forEach { stat ->
if (canChangeIV(stat, pokemon)) {
val effectiveIV = pokemon.ivs.getEffectiveBattleIV(stat)
pokemon.hyperTrainIV(stat, effectiveIV + ivIncreaseAmount)
}
}
if (!player.isCreative) {
stack.shrink(1)
}
pokemon.entity?.playSound(CobblemonSounds.MEDICINE_PILLS_USE, 1F, 1F)
return InteractionResultHolder.success(stack)
}
override fun use(world: Level, user: Player, hand: InteractionHand): InteractionResultHolder<ItemStack> {
if (user is ServerPlayer) {
return use(user, user.getItemInHand(hand))
}
return InteractionResultHolder.success(user.getItemInHand(hand))
}
}
@@ -42,7 +42,7 @@ class RemedyItem(val remedyStrength: String) : CobblemonItem(Properties()), Poke
override val returnItem = Items.AIR
override fun canUse(stack: ItemStack, battle: PokemonBattle, target: BattlePokemon) = target.health > 0 && target.health < target.maxHealth
override fun getShowdownInput(actor: BattleActor, battlePokemon: BattlePokemon, data: String?): String {
battlePokemon.effectedPokemon.decrementFriendship(CobblemonMechanics.remedies.getFriendshipDrop(runtime))
battlePokemon.effectedPokemon.decrementFriendship(CobblemonMechanics.remedies.getFriendshipDrop(remedyStrength, runtime))
return "potion ${CobblemonMechanics.remedies.getHealingAmount(remedyStrength, runtime, 20)}"
}
}
@@ -60,7 +60,7 @@ class RemedyItem(val remedyStrength: String) : CobblemonItem(Properties()), Poke
}
pokemon.currentHealth += amount
pokemon.entity?.playSound(CobblemonSounds.MEDICINE_HERB_USE, 1F, 1F)
pokemon.decrementFriendship(CobblemonMechanics.remedies.getFriendshipDrop(runtime))
pokemon.decrementFriendship(CobblemonMechanics.remedies.getFriendshipDrop(remedyStrength, runtime))
if (!player.isCreative) {
stack.shrink(1)
}
@@ -10,13 +10,13 @@ package com.cobblemon.mod.common.mechanics
import com.bedrockk.molang.runtime.MoLangRuntime
import com.cobblemon.mod.common.api.molang.ExpressionLike
import com.cobblemon.mod.common.util.asExpressionLike
import com.cobblemon.mod.common.util.resolveInt
class RemediesMechanic {
val healingAmounts = mutableMapOf<String, ExpressionLike>()
val friendshipDrop: ExpressionLike = "10".asExpressionLike()
val remedies = mutableMapOf<String, RemedyEntry>()
fun getHealingAmount(type: String, runtime: MoLangRuntime, default: Int = 20) = healingAmounts[type]?.let { runtime.resolveInt(it) } ?: default
fun getFriendshipDrop(runtime: MoLangRuntime) = runtime.resolveInt(friendshipDrop)
}
fun getHealingAmount(type: String, runtime: MoLangRuntime, default: Int = 20) = remedies[type]?.let { runtime.resolveInt(it.healingAmount) } ?: default
fun getFriendshipDrop(type: String, runtime: MoLangRuntime, default: Int = 0) = remedies[type]?.let { runtime.resolveInt(it.friendshipDrop) } ?: default
}
data class RemedyEntry(val healingAmount: ExpressionLike, val friendshipDrop: ExpressionLike)
@@ -23,7 +23,7 @@ import net.minecraft.network.RegistryFriendlyByteBuf
class EVsUpdatePacket(pokemon: () -> Pokemon?, eVs: EVs) : SingleUpdatePacket<EVs, EVsUpdatePacket>(pokemon, eVs) {
override val id = ID
override fun encodeValue(buffer: RegistryFriendlyByteBuf) {
this.value.saveToBuffer(buffer)
EVs.STREAM_CODEC.encode(buffer, this.value)
}
override fun set(pokemon: Pokemon, value: EVs) {
value.forEach { (stat, value) ->
@@ -32,7 +32,7 @@ class EVsUpdatePacket(pokemon: () -> Pokemon?, eVs: EVs) : SingleUpdatePacket<EV
}
companion object {
val ID = cobblemonResource("ev_update")
fun decode(buffer: RegistryFriendlyByteBuf) = EVsUpdatePacket(decodePokemon(buffer), EVs().apply { loadFromBuffer(buffer) })
fun decode(buffer: RegistryFriendlyByteBuf) = EVsUpdatePacket(decodePokemon(buffer), EVs.STREAM_CODEC.decode(buffer))
}
}
@@ -45,15 +45,19 @@ class EVsUpdatePacket(pokemon: () -> Pokemon?, eVs: EVs) : SingleUpdatePacket<EV
class IVsUpdatePacket(pokemon: () -> Pokemon?, iVs: IVs) : SingleUpdatePacket<IVs, IVsUpdatePacket>(pokemon, iVs) {
override val id = ID
override fun encodeValue(buffer: RegistryFriendlyByteBuf) {
this.value.saveToBuffer(buffer)
IVs.STREAM_CODEC.encode(buffer, this.value)
}
override fun set(pokemon: Pokemon, value: IVs) {
value.forEach { (stat, value) ->
pokemon.ivs[stat] = value
}
pokemon.ivs.hyperTrainedIVs.clear()
value.hyperTrainedIVs.forEach { (stat, value) ->
pokemon.ivs.setHyperTrainedIV(stat, value)
}
}
companion object {
val ID = cobblemonResource("iv_update")
fun decode(buffer: RegistryFriendlyByteBuf) = IVsUpdatePacket(decodePokemon(buffer), IVs().apply { loadFromBuffer(buffer) })
fun decode(buffer: RegistryFriendlyByteBuf) = IVsUpdatePacket(decodePokemon(buffer), IVs.STREAM_CODEC.decode(buffer))
}
}
@@ -15,6 +15,9 @@ import com.cobblemon.mod.common.api.pokemon.stats.EvSource
import com.cobblemon.mod.common.api.pokemon.stats.Stat
import com.mojang.serialization.Codec
import com.mojang.serialization.DataResult
import io.netty.buffer.ByteBuf
import net.minecraft.network.codec.ByteBufCodecs
import net.minecraft.network.codec.StreamCodec
import kotlin.math.min
class EVs : PokemonStats() {
@@ -111,5 +114,8 @@ class EVs : PokemonStats() {
return@comapFlatMap map
}
)
@JvmStatic
val STREAM_CODEC: StreamCodec<ByteBuf, EVs> = ByteBufCodecs.fromCodec(CODEC)
}
}
@@ -10,32 +10,67 @@ package com.cobblemon.mod.common.pokemon
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.pokemon.stats.Stat
import com.cobblemon.mod.common.util.DataKeys
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import io.netty.buffer.ByteBuf
import net.minecraft.network.codec.ByteBufCodecs
import net.minecraft.network.codec.StreamCodec
class IVs : PokemonStats() {
override val acceptableRange = 0..MAX_VALUE
override val defaultValue = 0
// TODO: Hyper training
val hyperTrainedIVs = mutableMapOf<Stat, Int>()
fun isHyperTrained(stat: Stat): Boolean {
return hyperTrainedIVs.containsKey(stat)
}
fun setHyperTrainedIV(stat: Stat, value: Int) {
if (value in acceptableRange) {
if(value == this[stat]) {
//not hypertrained any more if it ends up being the same as natural IV
if (hyperTrainedIVs.remove(stat) == null)
return //this means nothing has changed; no hypertraining did actually happen, e.g. you hypertrain to 31 HP when your normal IVs are already 31, its moot so no update needed
}
else {
hyperTrainedIVs[stat] = value
}
update()
} else {
throw IllegalArgumentException("Value $value is out of acceptable range $acceptableRange")
}
}
// Used to get the value that should be used for stat calculation.
fun getEffectiveBattleIV(stat: Stat): Int {
return (this.hyperTrainedIVs[stat] ?: this[stat]) as Int
}
companion object {
const val MAX_VALUE = 31
@JvmStatic
fun createRandomIVs(minPerfectIVs : Int = 0) : IVs = Cobblemon.statProvider.createEmptyIVs(minPerfectIVs)
fun createRandomIVs(minPerfectIVs: Int = 0): IVs = Cobblemon.statProvider.createEmptyIVs(minPerfectIVs)
@JvmStatic
val CODEC: Codec<IVs> = Codec.unboundedMap(Stat.PERMANENT_ONLY_CODEC, Codec.intRange(0, MAX_VALUE))
.xmap(
{ map ->
val ivs = Cobblemon.statProvider.createEmptyIVs(0)
map.forEach { (stat, value) -> ivs[stat] = value }
return@xmap ivs
},
{ ivs ->
val map = hashMapOf<Stat, Int>()
ivs.forEach { (stat, value) -> map[stat] = value }
return@xmap map
val CODEC: Codec<IVs> = RecordCodecBuilder.create { instance ->
instance.group(
Codec.unboundedMap(Stat.PERMANENT_ONLY_CODEC, Codec.intRange(0, MAX_VALUE)).fieldOf(DataKeys.POKEMON_IVS_BASE).forGetter(IVs::stats),
Codec.unboundedMap(Stat.PERMANENT_ONLY_CODEC, Codec.intRange(0, MAX_VALUE)).fieldOf(DataKeys.POKEMON_IVS_HYPERTRAINED).forGetter(IVs::hyperTrainedIVs)
).apply(instance) { stats, hyperTrained ->
val ivs = IVs()
stats.entries.forEach {
ivs[it.key] = it.value
}
)
hyperTrained.entries.forEach {
ivs.setHyperTrainedIV(it.key, it.value)
}
ivs
}
}
@JvmStatic
val STREAM_CODEC: StreamCodec<ByteBuf, IVs> = ByteBufCodecs.fromCodec(CODEC)
}
}
@@ -216,6 +216,7 @@ open class Pokemon : ShowdownIdentifiable {
field = value
value.changeFunction = oldChangeFunction
}
var evs = EVs.createEmpty().also { it.changeFunction = { onChange(EVsUpdatePacket({ this }, it as EVs)) } }
internal set(value) {
val oldChangeFunction = field.changeFunction
@@ -232,6 +233,14 @@ open class Pokemon : ShowdownIdentifiable {
}
}
fun hyperTrainIV(stat: Stat, value: Int) {
val quotient = clamp(currentHealth / maxHealth.toFloat(), 0F, 1F)
ivs.setHyperTrainedIV(stat, value)
if (stat == Stats.HP) {
updateHP(quotient)
}
}
fun setEV(stat: Stat, value : Int) {
val quotient = clamp(currentHealth / maxHealth.toFloat(), 0F, 1F)
evs[stat] = value
@@ -1263,6 +1272,9 @@ open class Pokemon : ShowdownIdentifiable {
other.ivs.forEach {
this.ivs[it.key] = it.value
}
other.ivs.hyperTrainedIVs.forEach {
(stat, value) -> this.ivs.setHyperTrainedIV(stat, value)
}
}
this.evs.doWithoutEmitting {
other.evs.forEach {
@@ -37,7 +37,7 @@ abstract class PokemonStats : Iterable<Map.Entry<Stat, Int>> {
/** Run whenever anything changes. */
var changeFunction: (PokemonStats) -> Unit = {}
private val stats = mutableMapOf<Stat, Int>()
protected val stats = mutableMapOf<Stat, Int>()
private var emit = true
fun doWithoutEmitting(action: () -> Unit) {
@@ -67,65 +67,5 @@ abstract class PokemonStats : Iterable<Map.Entry<Stat, Int>> {
protected open fun canSet(stat: Stat, value: Int) = value in acceptableRange
fun saveToNBT(nbt: CompoundTag): CompoundTag {
this.stats.forEach { (stat, value) ->
// don't waste space if default
if (value != this.defaultValue) {
nbt.putShort(this.cleanStatIdentifier(stat.identifier), value.toShort())
}
}
return nbt
}
fun loadFromNBT(nbt: CompoundTag): PokemonStats {
stats.clear()
Stats.PERMANENT.forEach { stat ->
val identifier = this.cleanStatIdentifier(stat.identifier)
this[stat] = nbt.getShort(identifier).toInt().coerceIn(this.acceptableRange)
}
return this
}
fun saveToJSON(json: JsonObject): JsonObject {
this.stats.forEach { (stat, value) ->
// don't waste space if default
if (value != this.defaultValue) {
json.addProperty(this.cleanStatIdentifier(stat.identifier), value)
}
}
return json
}
fun loadFromJSON(json: JsonObject): PokemonStats {
stats.clear()
Stats.PERMANENT.forEach { stat ->
val identifier = this.cleanStatIdentifier(stat.identifier)
json.get(identifier)?.asInt?.coerceIn(this.acceptableRange)?.let { this.stats[stat] = it }
}
return this
}
fun saveToBuffer(buffer: RegistryFriendlyByteBuf) {
buffer.writeSizedInt(IntSize.U_BYTE, stats.size)
for ((stat, value) in stats) {
Cobblemon.statProvider.encode(buffer, stat)
buffer.writeSizedInt(IntSize.U_SHORT, value)
}
}
fun loadFromBuffer(buffer: RegistryFriendlyByteBuf) {
stats.clear()
repeat(times = buffer.readUnsignedByte().toInt()) {
val stat = Cobblemon.statProvider.decode(buffer)
val value = buffer.readUnsignedShort()
stats[stat] = value
}
}
fun getOrDefault(stat: Stat) = this[stat] ?: this.defaultValue
// util to prevent unnecessary long identifiers, usually vanilla defaults to Minecraft but in our context defaulting to cobblemon makes more sense
private fun cleanStatIdentifier(identifier: ResourceLocation): String = identifier.toString().substringAfter("${Cobblemon.MODID}:")
}
@@ -86,7 +86,7 @@ object CobblemonStatProvider : StatProvider {
}
override fun getStatForPokemon(pokemon: Pokemon, stat: Stat): Int {
val iv = pokemon.ivs.getOrDefault(stat)
val iv = pokemon.ivs.getEffectiveBattleIV(stat)
val base = pokemon.form.baseStats[stat]!!
val ev = pokemon.evs.getOrDefault(stat)
val level = pokemon.level
@@ -21,6 +21,8 @@ object DataKeys {
const val POKEMON_FULLNESS = "Fullness"
const val POKEMON_IVS = "IVs"
const val POKEMON_IVS_BASE = "Base"
const val POKEMON_IVS_HYPERTRAINED = "HyperTrained"
const val POKEMON_EVS = "EVs"
const val POKEMON_HEALTH = "Health"
const val POKEMON_SCALE_MODIFIER = "ScaleModifier"
@@ -10,13 +10,18 @@ package com.cobblemon.mod.common.util.adapters
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviourSettings
import com.cobblemon.mod.common.api.riding.behaviour.types.*
import com.cobblemon.mod.common.api.riding.behaviour.types.air.*
import com.cobblemon.mod.common.api.riding.behaviour.types.composite.CompositeBehaviour
import com.cobblemon.mod.common.api.riding.behaviour.types.composite.CompositeSettings
import com.cobblemon.mod.common.api.riding.behaviour.types.composite.strategies.FallCompositeSettings
import com.cobblemon.mod.common.api.riding.behaviour.types.composite.strategies.FallStrategy
import com.cobblemon.mod.common.api.riding.behaviour.types.composite.strategies.JumpStrategy
import com.cobblemon.mod.common.api.riding.behaviour.types.composite.strategies.RunStrategy
import com.cobblemon.mod.common.api.riding.behaviour.types.land.HorseBehaviour
import com.cobblemon.mod.common.api.riding.behaviour.types.land.HorseSettings
import com.cobblemon.mod.common.api.riding.behaviour.types.land.VehicleBehaviour
import com.cobblemon.mod.common.api.riding.behaviour.types.land.VehicleSettings
import com.cobblemon.mod.common.api.riding.behaviour.types.liquid.*
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
@@ -30,15 +35,16 @@ import java.lang.reflect.Type
* @author landonjw
*/
object RidingBehaviourSettingsAdapter : JsonDeserializer<RidingBehaviourSettings?> {
val types: MutableMap<ResourceLocation, Class<out RidingBehaviourSettings>> = mutableMapOf(BirdAirBehaviour.KEY to BirdAirSettings::class.java,
val types: MutableMap<ResourceLocation, Class<out RidingBehaviourSettings>> = mutableMapOf(
BirdBehaviour.KEY to BirdSettings::class.java,
DolphinBehaviour.KEY to DolphinSettings::class.java,
GenericLandBehaviour.KEY to GenericLandSettings::class.java,
GenericSwimBehaviour.KEY to GenericSwimSettings::class.java,
GliderAirBehaviour.KEY to GliderAirSettings::class.java,
HorseBehaviour.KEY to HorseSettings::class.java,
BoatBehaviour.KEY to BoatSettings::class.java,
GliderBehaviour.KEY to GliderSettings::class.java,
HelicopterBehaviour.KEY to HelicopterSettings::class.java,
JetAirBehaviour.KEY to JetAirSettings::class.java,
SwimDashBehaviour.KEY to SwimDashSettings::class.java,
VehicleLandBehaviour.KEY to VehicleLandSettings::class.java,
JetBehaviour.KEY to JetSettings::class.java,
BurstBehaviour.KEY to BurstSettings::class.java,
VehicleBehaviour.KEY to VehicleSettings::class.java,
HoverBehaviour.KEY to HoverSettings::class.java,
CompositeBehaviour.KEY to CompositeSettings::class.java,
@@ -61,8 +61,11 @@ internal class ClientPokemonP1(
other.setFriendship(this.friendship)
// Applied before current health for calcs to take place
other.ivs.doWithoutEmitting {
this.ivs.forEach {
other.ivs[it.key] = it.value
this.ivs.forEach { (stat, value) ->
other.ivs[stat] = value
if(this.ivs.isHyperTrained(stat)) {
other.ivs.setHyperTrainedIV(stat, this.ivs.hyperTrainedIVs[stat]!!)
}
}
}
other.evs.doWithoutEmitting {
@@ -54,8 +54,11 @@ internal class PokemonP1(
other.setFriendship(this.friendship)
// Applied before current health for calcs to take place
other.ivs.doWithoutEmitting {
this.ivs.forEach {
other.ivs[it.key] = it.value
this.ivs.forEach { (stat, value) ->
other.ivs[stat] = value
if(this.ivs.isHyperTrained(stat)) {
other.ivs.setHyperTrainedIV(stat, this.ivs.hyperTrainedIVs[stat]!!)
}
}
}
other.evs.doWithoutEmitting {
@@ -52,4 +52,11 @@ object CobblemonStructureIDs {
val TAIGA_BERRY_SMALL = cobblemonResource("village_taiga/taiga_berry_small")
@JvmField
val TAIGA_BERRY_LARGE = cobblemonResource("village_taiga/taiga_berry_large")
@JvmField
val STONJOURNER_HENGE = cobblemonResource("ruins/stonjourner_henge_ruins")
@JvmField
val SOL_HENGE = cobblemonResource("ruins/sol_henge_ruins")
@JvmField
val LUNA_HENGE = cobblemonResource("ruins/luna_henge_ruins")
}
@@ -0,0 +1,16 @@
{
"variants": {
"axis=x": {
"model": "cobblemon:block/hearty_grain_bale",
"x": 90,
"y": 90
},
"axis=y": {
"model": "cobblemon:block/hearty_grain_bale"
},
"axis=z": {
"model": "cobblemon:block/hearty_grain_bale",
"x": 90
}
}
}
@@ -1,10 +1,20 @@
{
"variants": {
"age=0,part=lower": { "model": "cobblemon:block/hearty_grains_stage_1" },
"age=1,part=lower": { "model": "cobblemon:block/hearty_grains_stage_2" },
"age=2,part=lower": { "model": "cobblemon:block/hearty_grains_stage_3" },
"age=3,part=lower": { "model": "cobblemon:block/hearty_grains_stage_4_bottom" },
"age=4,part=lower": { "model": "cobblemon:block/hearty_grains_stage_5_bottom" },
"age=4,part=upper": { "model": "cobblemon:block/hearty_grains_stage_5_top" }
"age=0,half=lower": { "model": "cobblemon:block/hearty_grains_stage_0" },
"age=0,half=upper": { "model": "cobblemon:block/hearty_grains_stage_5_top" },
"age=1,half=lower": { "model": "cobblemon:block/hearty_grains_stage_1" },
"age=1,half=upper": { "model": "cobblemon:block/hearty_grains_stage_5_top" },
"age=2,half=lower": { "model": "cobblemon:block/hearty_grains_stage_2" },
"age=2,half=upper": { "model": "cobblemon:block/hearty_grains_stage_5_top" },
"age=3,half=lower": { "model": "cobblemon:block/hearty_grains_stage_3" },
"age=3,half=upper": { "model": "cobblemon:block/hearty_grains_stage_5_top" },
"age=4,half=lower": { "model": "cobblemon:block/hearty_grains_stage_4_bottom" },
"age=4,half=upper": { "model": "cobblemon:block/hearty_grains_stage_5_top" },
"age=5,half=lower": { "model": "cobblemon:block/hearty_grains_stage_5_bottom" },
"age=5,half=upper": { "model": "cobblemon:block/hearty_grains_stage_5_top" },
"age=6,half=lower": { "model": "cobblemon:block/hearty_grains_stage_6_bottom" },
"age=6,half=upper": { "model": "cobblemon:block/hearty_grains_stage_6_top" },
"age=7,half=lower": { "model": "cobblemon:block/hearty_grains_stage_7_bottom" },
"age=7,half=upper": { "model": "cobblemon:block/hearty_grains_stage_7_top" }
}
}
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "cobblemon:block/potted_black_apricorn_sapling"
}
}
}
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "cobblemon:block/potted_blue_apricorn_sapling"
}
}
}
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "cobblemon:block/potted_green_apricorn_sapling"
}
}
}
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "cobblemon:block/potted_pink_apricorn_sapling"
}
}
}
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "cobblemon:block/potted_red_apricorn_sapling"
}
}
}
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "cobblemon:block/potted_saccharine_sapling"
}
}
}
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "cobblemon:block/potted_white_apricorn_sapling"
}
}
}
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "cobblemon:block/potted_yellow_apricorn_sapling"
}
}
}
@@ -0,0 +1,20 @@
{
"variants": {
"facing=east": {
"model": "cobblemon:block/tatami_block_alt",
"y": 90
},
"facing=north": {
"model": "cobblemon:block/tatami_block_alt",
"y": 0
},
"facing=south": {
"model": "cobblemon:block/tatami_block",
"y": 180
},
"facing=west": {
"model": "cobblemon:block/tatami_block",
"y": 270
}
}
}
@@ -0,0 +1,20 @@
{
"variants": {
"facing=east": {
"model": "cobblemon:block/tatami_mat",
"y": 270
},
"facing=north": {
"model": "cobblemon:block/tatami_mat",
"y": 180
},
"facing=south": {
"model": "cobblemon:block/tatami_mat_alt",
"y": 180
},
"facing=west": {
"model": "cobblemon:block/tatami_mat_alt",
"y": 270
}
}
}
@@ -72,8 +72,9 @@
"item.cobblemon.pink_apricorn": "Pink Apricorn",
"item.cobblemon.red_apricorn": "Red Apricorn",
"item.cobblemon.white_apricorn": "White Apricorn",
"item.cobblemon.saccharine_sapling": "Saccharine Sapling",
"item.cobblemon.yellow_apricorn": "Yellow Apricorn",
"item.cobblemon.saccharine_sapling": "Saccharine Sapling",
"block.cobblemon.potted_saccharine_sapling": "Potted Saccharine Sapling",
"item.cobblemon.vivichoke_seeds": "Vivichoke Seeds",
"item.cobblemon.vivichoke": "Vivichoke",
"item.cobblemon.galarica_nuts": "Galarica Nuts",
@@ -163,6 +164,12 @@
"item.cobblemon.black_augurite.tooltip": "Evolves Scyther into Kleavor",
"item.cobblemon.peat_block": "Peat Block",
"item.cobblemon.peat_block.tooltip": "Evolves Ursaring into Ursaluna when used during a full moon at night",
"item.cobblemon.metal_alloy": "Metal Alloy",
"item.cobblemon.metal_alloy.tooltip": "Evolves Duraludon into Archaludon",
"item.cobblemon.scroll_of_darkness": "Scroll of Darkness",
"item.cobblemon.scroll_of_darkness.tooltip": "Evolves Kubfu into Single Strike Style Urshifu",
"item.cobblemon.scroll_of_waters": "Scroll of Waters",
"item.cobblemon.scroll_of_waters.tooltip": "Evolves Kubfu into Rapid Strike Style Urshifu",
"item.cobblemon.dawn_stone": "Dawn Stone",
"item.cobblemon.dawn_stone.tooltip": "Evolves certain Pokémon",
@@ -212,11 +219,11 @@
"item.cobblemon.zinc.tooltip": "Raises the Pokémon's Sp. Defense EVs by 10",
"item.cobblemon.potion": "Potion",
"item.cobblemon.potion.tooltip": "Restores 60 HP of a Pokémon",
"item.cobblemon.potion.tooltip": "Restores 20 HP of a Pokémon",
"item.cobblemon.super_potion": "Super Potion",
"item.cobblemon.super_potion.tooltip": "Restores 100 HP of a Pokémon",
"item.cobblemon.super_potion.tooltip": "Restores 60 HP of a Pokémon",
"item.cobblemon.hyper_potion": "Hyper Potion",
"item.cobblemon.hyper_potion.tooltip": "Restores 150 HP of a Pokémon",
"item.cobblemon.hyper_potion.tooltip": "Restores 120 HP of a Pokémon",
"item.cobblemon.max_potion": "Max Potion",
"item.cobblemon.max_potion.tooltip": "Fully restores the HP of a Pokémon",
"item.cobblemon.full_restore": "Full Restore",
@@ -580,7 +587,7 @@
"item.cobblemon.medicinal_leek.tooltip_1": "Used to make medicinal brews",
"item.cobblemon.medicinal_leek.tooltip_2": "Also boosts the critical hit ratio of a Farfetch'd or Sirfetch'd that holds it by two stages",
"item.cobblemon.energy_root": "Energy Root",
"item.cobblemon.energy_root.tooltip": "Restores 120 HP of a Pokémon whilst reducing friendship",
"item.cobblemon.energy_root.tooltip": "Restores 80 HP of a Pokémon whilst reducing friendship",
"item.cobblemon.revival_herb": "Revival Herb",
"item.cobblemon.revival_herb.tooltip": "Fully revives a fainted Pokémon whilst reducing Friendship",
"item.cobblemon.roasted_leek": "Roasted Leek",
@@ -590,13 +597,13 @@
"item.cobblemon.berry_juice": "Berry Juice",
"item.cobblemon.berry_juice.tooltip": "Restores 20 HP when a Pokémon holding the item falls below 50% HP",
"item.cobblemon.remedy": "Remedy",
"item.cobblemon.remedy.tooltip": "Restores 60 HP of a Pokémon",
"item.cobblemon.remedy.tooltip": "Restores 20 HP of a Pokémon whilst slightly reducing Friendship",
"item.cobblemon.fine_remedy": "Fine Remedy",
"item.cobblemon.fine_remedy.tooltip": "Restores 100 HP of a Pokémon",
"item.cobblemon.fine_remedy.tooltip": "Restores 60 HP of a Pokémon whilst slightly reducing Friendship",
"item.cobblemon.superb_remedy": "Superb Remedy",
"item.cobblemon.superb_remedy.tooltip": "Restores 150 HP of a Pokémon",
"item.cobblemon.superb_remedy.tooltip": "Restores 120 HP of a Pokémon whilst slightly reducing Friendship",
"item.cobblemon.heal_powder": "Heal Powder",
"item.cobblemon.heal_powder.tooltip": "Cures a Pokémon of all status conditions whilst reducing friendship",
"item.cobblemon.heal_powder.tooltip": "Cures a Pokémon of all status conditions whilst slightly reducing friendship",
"item.cobblemon.medicinal_brew": "Medicinal Brew",
"item.cobblemon.revive": "Revive",
"item.cobblemon.revive.tooltip": "Revives a fainted Pokémon to 50% of their max HP",
@@ -782,10 +789,28 @@
"trim_pattern.cobblemon.automaton": "Automaton Armor Trim",
"cobblemon.tooltip.see_more_info": "Hold shift to see info",
"cobblemon.item_class.fishing_bait": "Bait Effects",
"cobblemon.item_class.seasoning": "Seasoning",
"cobblemon.item_class.mob_effect": "Mob Effects",
"cobblemon.item_class.food": "Food",
"cobblemon.item_class.fishing_bait": "Fishing Bait",
"cobblemon.item_class.cooking_pot_recipe_absorbs": "Absorbs",
"cobblemon.item_class.seasonings": "Seasonings",
"cobblemon.item_class.flavor_seasoning": "Flavor Seasoning",
"cobblemon.item_class.bait_effect_seasoning": "Bait Seasoning",
"cobblemon.item_class.mob_effect_seasoning": "Effect Seasoning",
"cobblemon.item_class.food_seasoning": "Food Seasoning",
"cobblemon.seasoning_bait_effect_header": "Bait",
"cobblemon.seasoning_mob_effect_header": "Effect",
"cobblemon.seasoning_food_header": "Food",
"cobblemon.seasoning_flavor_header": "Flavor",
"cobblemon.seasoning_bait_effect_info_header": "Bait Info:",
"cobblemon.seasoning_mob_effect_info_header": "Effect Info:",
"cobblemon.seasoning_food_info_header": "Food Info:",
"cobblemon.seasoning_flavor_info_header": "Flavor Info:",
"cobblemon.seasoning_flavor.spicy": "Spicy",
"cobblemon.seasoning_flavor.dry": "Dry",
"cobblemon.seasoning_flavor.sweet": "Sweet",
"cobblemon.seasoning_flavor.bitter": "Bitter",
"cobblemon.seasoning_flavor.sour": "Sour",
"cobblemon.cooking.cooking_quality": "Quality: %1$s",
"cobblemon.cooking.cooking_quality.low": "Low",
@@ -855,6 +880,13 @@
"block.cobblemon.red_apricorn_sapling": "Red Apricorn Sapling",
"block.cobblemon.white_apricorn_sapling": "White Apricorn Sapling",
"block.cobblemon.yellow_apricorn_sapling": "Yellow Apricorn Sapling",
"block.cobblemon.potted_black_apricorn_sapling": "Potted Black Apricorn Sapling",
"block.cobblemon.potted_blue_apricorn_sapling": "Potted Blue Apricorn Sapling",
"block.cobblemon.potted_green_apricorn_sapling": "Potted Green Apricorn Sapling",
"block.cobblemon.potted_pink_apricorn_sapling": "Potted Pink Apricorn Sapling",
"block.cobblemon.potted_red_apricorn_sapling": "Potted Red Apricorn Sapling",
"block.cobblemon.potted_white_apricorn_sapling": "Potted White Apricorn Sapling",
"block.cobblemon.potted_yellow_apricorn_sapling": "Potted Yellow Apricorn Sapling",
"block.cobblemon.apricorn_door": "Apricorn Door",
"block.cobblemon.apricorn_trapdoor": "Apricorn Trapdoor",
"block.cobblemon.saccharine_log": "Saccharine Log",
@@ -907,6 +939,9 @@
"block.cobblemon.campfire_pot_red": "Red Campfire Pot",
"block.cobblemon.campfire_pot_white": "White Campfire Pot",
"block.cobblemon.campfire_pot_yellow": "Yellow Campfire Pot",
"block.cobblemon.hearty_grain_bale": "Hearty Grain Bale",
"block.cobblemon.tatami_block": "Tatami",
"block.cobblemon.tatami_mat": "Tatami Mat",
"block.cobblemon.small_budding_tumblestone": "Small Tumblestone Bud",
"block.cobblemon.medium_budding_tumblestone": "Medium Tumblestone Bud",
@@ -978,7 +1013,7 @@
"cobblemon.fishing.no_bite": "Not even a nibble.",
"cobblemon.fishing_bait_effect_header": "Bait Effects:",
"cobblemon.fishing_bait_effect_header": "Bait Info:",
"cobblemon.fishing_bait_effects.nature.tooltip": "%1$s%% - Attract %2$s Nature",
"cobblemon.fishing_bait_effects.iv.tooltip": "%1$s%% - %2$s IV +%3$s",
"cobblemon.fishing_bait_effects.ev.tooltip": "%1$s%% - Attract %2$s EV Yields",
@@ -1010,13 +1045,6 @@
"cobblemon.egg_group.dragon": "Dragon",
"cobblemon.egg_group.undiscovered": "Undiscovered",
"cobblemon.seasoning_flavor_header": "Seasoning Flavor:",
"cobblemon.seasoning_flavor.spicy": "Spicy",
"cobblemon.seasoning_flavor.dry": "Dry",
"cobblemon.seasoning_flavor.sweet": "Sweet",
"cobblemon.seasoning_flavor.bitter": "Bitter",
"cobblemon.seasoning_flavor.sour": "Sour",
"item.cobblemon.ponigiri": "Ponigiri",
"item.cobblemon.jelly_doughnut": "Jelly Donut",
"item.cobblemon.sinister_tea": "Sinister Tea",
@@ -1038,6 +1066,30 @@
"tooltip.cobblemon.poke_puff.friendship_increase": "+%1$s Friendship for %2$s natures",
"tooltip.cobblemon.poke_puff.friendship_decrease": "-%1$s Friendship for other natures",
"cobblemon.tooltip.poke_puff.friendship_effects": "Friendship Effects",
"item.cobblemon.health_candy": "Health Candy",
"item.cobblemon.health_candy.tooltip_1": "Raises the Pokémon's effective HP IV stat by 1",
"item.cobblemon.mighty_candy": "Mighty Candy",
"item.cobblemon.mighty_candy.tooltip_1": "Raises the Pokémon's effective Attack IV stat by 1",
"item.cobblemon.tough_candy": "Tough Candy",
"item.cobblemon.tough_candy.tooltip_1": "Raises the Pokémon's effective Defense IV stat by 1",
"item.cobblemon.smart_candy": "Smart Candy",
"item.cobblemon.smart_candy.tooltip_1": "Raises the Pokémon's effective Special Attack IV stat by 1",
"item.cobblemon.courage_candy": "Courage Candy",
"item.cobblemon.courage_candy.tooltip_1": "Raises the Pokémon's effective Special Defense IV stat by 1",
"item.cobblemon.quick_candy": "Quick Candy",
"item.cobblemon.quick_candy.tooltip_1": "Raises the Pokémon's effective Speed IV stat by 1",
"item.cobblemon.sickly_candy": "Sickly Candy",
"item.cobblemon.sickly_candy.tooltip_1": "Lowers the Pokémon's effective HP IV stat by 1",
"item.cobblemon.weak_candy": "Weak Candy",
"item.cobblemon.weak_candy.tooltip_1": "Lowers the Pokémon's effective Attack IV stat by 1",
"item.cobblemon.brittle_candy": "Brittle Candy",
"item.cobblemon.brittle_candy.tooltip_1": "Lowers the Pokémon's effective Defense IV stat by 1",
"item.cobblemon.numb_candy": "Numb Candy",
"item.cobblemon.numb_candy.tooltip_1": "Lowers the Pokémon's effective Special Attack IV stat by 1",
"item.cobblemon.coward_candy": "Coward Candy",
"item.cobblemon.coward_candy.tooltip_1": "Lowers the Pokémon's effective Special Defense IV stat by 1",
"item.cobblemon.slow_candy": "Slow Candy",
"item.cobblemon.slow_candy.tooltip_1": "Lowers the Pokémon's effective Speed IV stat by 1",
"entity.minecraft.villager.nurse": "Nurse",
"entity.minecraft.villager.cobblemon.nurse": "Nurse",
@@ -1099,6 +1151,7 @@
"cobblemon.ui.stash.netherite": "Scrap Stash",
"cobblemon.ui.info": "Info",
"cobblemon.ui.info.gender": "Gender",
"cobblemon.ui.info.pokedex_number": "Dex No.",
"cobblemon.ui.info.species": "Species",
"cobblemon.ui.info.type": "Type",
@@ -2307,6 +2360,16 @@
"cobblemon.command.cobblemon_config.reload": "Reloading Cobblemon settings.",
"cobblemon.command.unlockboxwallpaper.success": "%1$s can now use the %2$s wallpaper.",
"cobblemon.command.unlockboxwallpaper.already": "%1$s already has the %2$s wallpaper.",
"cobblemon.command.pcsearch.tooltip.shiny": "This Pokémon is shiny!",
"cobblemon.command.pcsearch.entry": "- %1$s %2$s",
"cobblemon.command.pcsearch.location": " [Box %1$s Slot %2$s]",
"cobblemon.command.pcsearch.takepokemon": "Click to take this Pokémon",
"cobblemon.command.pcsearch.nomatch": "No Pokémon matching '%1$s' found in %2$s's PC.",
"cobblemon.command.pcsearch.found": "Found Pokémon in %1$s's PC:",
"cobblemon.command.pctake.too_many_boxes": "PC only has %1$s boxes.",
"cobblemon.command.pctake.invalid_slot": "Invalid slot number.",
"cobblemon.command.pctake.no_pokemon": "There is no Pokémon in box %1$s slot %2$s.",
"cobblemon.command.pctake.taken_other": "You took %1$s from %2$s's PC",
"cobblemon.wallpaper_unlocked": "Wallpaper Unlocked",
"cobblemon.unknown_wallpaper": "???",
@@ -2601,6 +2664,8 @@
"advancements.cobblemon.evolve_gholdengo_netherite.description": "Evolve a Gimmighoul into a fully netherite-coated Gholdengo",
"advancements.cobblemon.resurrect_pokemon": "Life Finds a Way",
"advancements.cobblemon.resurrect_pokemon.description": "Obtain a Fossil Pokémon from a Resurrection Machine",
"advancements.cobblemon.resurrect_galar_fossil": "Didn't Stop to Think",
"advancements.cobblemon.resurrect_galar_fossil.description": "Resurrect a Fossil Pokémon made from a Fossilized Bird or Fossilized Fish and a Fossilized Drake or Fossilized Dino",
"advancements.cobblemon.obtain_tumblestone": "The Rolling Stone",
"advancements.cobblemon.obtain_tumblestone.description": "Safely extract a Tumblestone from suspicious sand or gravel",
"advancements.cobblemon.grow_tumblestone": "Tumbling Down",
@@ -2615,6 +2680,8 @@
"advancements.cobblemon.craft_master_rod.description": "Craft a Poké Rod using a Master Ball",
"advancements.cobblemon.craft_pokedex": "Researcher Recruit",
"advancements.cobblemon.craft_pokedex.description": "Craft a Pokédex out of Apricorns, Iron, Copper, and any glowing powder",
"advancements.cobblemon.ride_pokemon": "Pokémon Jockey!",
"advancements.cobblemon.ride_pokemon.description": "Ride a Pokémon for the first time",
"cobblemon.battle.crash": "A battle error has occurred. If playing single-player, report this to the mod team. Otherwise, report this to the servers administrator.",
"cobblemon.battle.damage_dealt": "%1$s took %2$s damage!",
@@ -2852,29 +2919,52 @@
"cobblemon.battle.fieldend.watersport": "The effects of Water Sport have faded.",
"cobblemon.battle.fieldend.wonderroom": "Wonder Room wore off, and Defense and Sp. Def stats returned to normal!",
"cobblemon.battle.sidestart.auroraveil": "Aurora Veil made %1$s team stronger against physical and special moves!",
"cobblemon.battle.sidestart.lightscreen": "Light Screen made %1$s team stronger against special moves!",
"cobblemon.battle.sidestart.luckychant": "Lucky Chant shielded %1$s team from critical hits!",
"cobblemon.battle.sidestart.mist": "%1$s team became shrouded in mist!",
"cobblemon.battle.sidestart.reflect": "Reflect made %1$s team stronger against physical moves!",
"cobblemon.battle.sidestart.safeguard": "%1$s team cloaked itself in a mystical veil!",
"cobblemon.battle.sidestart.spikes": "Spikes were scattered on the ground all around %1$s team!",
"cobblemon.battle.sidestart.stealthrock": "Polished stones float in the air around %1$s team!",
"cobblemon.battle.sidestart.stickyweb": "A sticky web has been laid on the ground around %1$s team!",
"cobblemon.battle.sidestart.tailwind": "The Tailwind blew from behind %1$s team!",
"cobblemon.battle.sidestart.toxicspikes": "Poison spikes were scattered on the ground all around %1$s team!",
"cobblemon.battle.sidestart.ally.auroraveil": "Aurora Veil made your team stronger against physical and special moves!",
"cobblemon.battle.sidestart.ally.lightscreen": "Light Screen made your team stronger against special moves!",
"cobblemon.battle.sidestart.ally.luckychant": "Lucky Chant shielded your team from critical hits!",
"cobblemon.battle.sidestart.ally.mist": "Your team became shrouded in mist!",
"cobblemon.battle.sidestart.ally.reflect": "Reflect made your team stronger against physical moves!",
"cobblemon.battle.sidestart.ally.safeguard": "Your team cloaked itself in a mystical veil!",
"cobblemon.battle.sidestart.ally.spikes": "Spikes were scattered on the ground all around your team!",
"cobblemon.battle.sidestart.ally.stealthrock": "Polished stones float in the air around your team!",
"cobblemon.battle.sidestart.ally.stickyweb": "A sticky web has been laid on the ground around your team!",
"cobblemon.battle.sidestart.ally.tailwind": "The Tailwind blew from behind your team!",
"cobblemon.battle.sidestart.ally.toxicspikes": "Poison spikes were scattered on the ground all around your team!",
"cobblemon.battle.sidestart.opponent.auroraveil": "Aurora Veil made the opposing team stronger against physical and special moves!",
"cobblemon.battle.sidestart.opponent.lightscreen": "Light Screen made the opposing team stronger against special moves!",
"cobblemon.battle.sidestart.opponent.luckychant": "Lucky Chant shielded the opposing team from critical hits!",
"cobblemon.battle.sidestart.opponent.mist": "The opposing team became shrouded in mist!",
"cobblemon.battle.sidestart.opponent.reflect": "Reflect made the opposing team stronger against physical moves!",
"cobblemon.battle.sidestart.opponent.safeguard": "The opposing team cloaked itself in a mystical veil!",
"cobblemon.battle.sidestart.opponent.spikes": "Spikes were scattered on the ground all around the opposing team!",
"cobblemon.battle.sidestart.opponent.stealthrock": "Polished stones float in the air around the opposing team!",
"cobblemon.battle.sidestart.opponent.stickyweb": "A sticky web has been laid on the ground around the opposing team!",
"cobblemon.battle.sidestart.opponent.tailwind": "The Tailwind blew from behind the opposing team!",
"cobblemon.battle.sidestart.opponent.toxicspikes": "Poison spikes were scattered on the ground all around the opposing team!",
"cobblemon.battle.sideend.auroraveil": "%1$s team's Aurora Veil wore off!",
"cobblemon.battle.sideend.lightscreen": "%1$s team's Light Screen wore off!",
"cobblemon.battle.sideend.luckychant": "%1$s team's Lucky Chant wore off!",
"cobblemon.battle.sideend.mist": "%1$s team is no longer protected by mist!",
"cobblemon.battle.sideend.reflect": "%1$s team's Reflect wore off!",
"cobblemon.battle.sideend.safeguard": "%1$s team is no longer protected by Safeguard!",
"cobblemon.battle.sideend.spikes": "The spikes disappeared from the ground around %1$s team!",
"cobblemon.battle.sideend.stealthrock": "The pointed stones disappeared from around %1$s team!",
"cobblemon.battle.sideend.stickyweb": "The sticky web has disappeared from the ground around %1$s team",
"cobblemon.battle.sideend.tailwind": "%1$s team's Tailwind petered out!",
"cobblemon.battle.sideend.toxicspikes": "The poison spikes disappeared from the ground around %1$s team!",
"cobblemon.battle.sideend.ally.auroraveil": "Your team's Aurora Veil wore off!",
"cobblemon.battle.sideend.ally.lightscreen": "Your team's Light Screen wore off!",
"cobblemon.battle.sideend.ally.luckychant": "Your team's Lucky Chant wore off!",
"cobblemon.battle.sideend.ally.mist": "Your team is no longer protected by mist!",
"cobblemon.battle.sideend.ally.reflect": "Your team's Reflect wore off!",
"cobblemon.battle.sideend.ally.safeguard": "Your team is no longer protected by Safeguard!",
"cobblemon.battle.sideend.ally.spikes": "The spikes disappeared from the ground around your team!",
"cobblemon.battle.sideend.ally.stealthrock": "The pointed stones disappeared from around your team!",
"cobblemon.battle.sideend.ally.stickyweb": "The sticky web has disappeared from the ground around your team",
"cobblemon.battle.sideend.ally.tailwind": "Your team's Tailwind petered out!",
"cobblemon.battle.sideend.ally.toxicspikes": "The poison spikes disappeared from the ground around your team!",
"cobblemon.battle.sideend.opponent.auroraveil": "The opposing team's Aurora Veil wore off!",
"cobblemon.battle.sideend.opponent.lightscreen": "The opposing team's Light Screen wore off!",
"cobblemon.battle.sideend.opponent.luckychant": "The opposing team's Lucky Chant wore off!",
"cobblemon.battle.sideend.opponent.mist": "The opposing team is no longer protected by mist!",
"cobblemon.battle.sideend.opponent.reflect": "The opposing team's Reflect wore off!",
"cobblemon.battle.sideend.opponent.safeguard": "The opposing team is no longer protected by Safeguard!",
"cobblemon.battle.sideend.opponent.spikes": "The spikes disappeared from the ground around the opposing team!",
"cobblemon.battle.sideend.opponent.stealthrock": "The pointed stones disappeared from around the opposing team!",
"cobblemon.battle.sideend.opponent.stickyweb": "The sticky web has disappeared from the ground around the opposing team",
"cobblemon.battle.sideend.opponent.tailwind": "The opposing team's Tailwind petered out!",
"cobblemon.battle.sideend.opponent.toxicspikes": "The poison spikes disappeared from the ground around the opposing team!",
"cobblemon.battle.cant.generic": "%1$s can't use %2$s!",
"cobblemon.battle.cant.truant": "%1$s is loafing around!",
@@ -3398,6 +3488,10 @@
"tag.item.cobblemon.remedy_berries": "Remedy Berries",
"tag.item.cobblemon.sandwich_veggies": "Sandwich Vegetables",
"tag.item.cobblemon.super_potion_ingredients": "Super Potion Ingredients",
"tag.item.cobblemon.regional_delicacies": "Regional Delicacies",
"tag.item.cobblemon.aprijuices": "Aprijuices",
"tag.item.cobblemon.mochis": "Mochis",
"tag.item.cobblemon.poke_food": "Poké Foods",
"npc.sacchi.name": "Professor Sacchi",
@@ -64,7 +64,7 @@
"south": {"uv": [8, 2.5, 12, 4], "texture": "#1"},
"west": {"uv": [4, 2.5, 8, 4], "texture": "#1"},
"up": {"uv": [4, 8, 0, 4], "texture": "#1"},
"down": {"uv": [16, 0, 12, 4], "texture": "#1"}
"down": {"uv": [16, 4, 12, 8], "texture": "#1"}
}
},
{
@@ -80,39 +80,37 @@
}
}
],
"gui_light": "side",
"display": {
"gui": {
"rotation": [ 30, 225, 0 ],
"translation": [ 0, 0, 0 ],
"scale":[ 0.625, 0.625, 0.625 ]
},
"ground": {
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 3, 0 ],
"scale":[ 0.25, 0.25, 0.25 ]
},
"fixed": {
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 0, 0 ],
"scale":[ 0.5, 0.5, 0.5 ]
},
"thirdperson_righthand": {
"rotation": [ 75, 135, 0 ],
"translation": [ 0, 2.5, 0 ],
"scale": [ 0.375, 0.375, 0.375 ]
},
"firstperson_righthand": {
"rotation": [ 0, 135, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 0.40, 0.40, 0.40 ]
},
"firstperson_lefthand": {
"rotation": [ 0, 135, 0 ],
"translation": [ 0, 0, 0 ],
"scale": [ 0.40, 0.40, 0.40 ]
}
},
"display": {
"thirdperson_righthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"thirdperson_lefthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"firstperson_righthand": {
"rotation": [0, 45, 0],
"scale": [0.4, 0.4, 0.4]
},
"firstperson_lefthand": {
"rotation": [0, 225, 0],
"scale": [0.4, 0.4, 0.4]
},
"ground": {
"translation": [0, 3, 0],
"scale": [0.25, 0.25, 0.25]
},
"gui": {
"rotation": [30, 225, 0],
"scale": [0.625, 0.625, 0.625]
},
"fixed": {
"scale": [0.5, 0.5, 0.5]
}
},
"groups": [
{
"name": "fossil_analyzer",
@@ -64,7 +64,7 @@
"south": {"uv": [8, 2.5, 12, 4], "texture": "#1"},
"west": {"uv": [4, 2.5, 8, 4], "texture": "#1"},
"up": {"uv": [4, 8, 0, 4], "texture": "#1"},
"down": {"uv": [16, 0, 12, 4], "texture": "#1"}
"down": {"uv": [16, 4, 12, 8], "texture": "#1"}
}
},
{

Some files were not shown because too many files have changed in this diff Show More