Compare commits

...
Author SHA1 Message Date
Slippy 2895c0a2ef I hate the crumbling arch 2024-07-18 08:57:11 -05:00
Slippy acc87f9eae Solhenge, Lunahenge, and Stonjournerhenge structures completed. 2024-07-17 12:31:55 -05:00
Slippy 928dfcdadf i hate the crumbling arch 2024-06-01 08:47:58 -05:00
Slippy 21363405fc console log spam fix for real this time 2024-05-18 12:00:11 -05:00
Slippy 08c4f4a0ff added loot to the trapped chest in unstable caves so you can't tell which one is trapped if you're using lootr muwahahahaha 2024-05-16 01:57:41 -05:00
Slippy c4a1704a8b unstable cave loot table fixes 2024-05-15 20:35:24 -05:00
Slippy 837aa5acf5 missing loot table in deserted tower 2024-05-14 16:58:55 -05:00
Slippy 969d6ac7fc console spam fix 2024-05-12 09:23:39 -05:00
Slippy 46bb9e1aec console fix 2024-05-11 21:58:50 -05:00
Slippy 9792ff3392 console spam fix 2024-05-11 21:36:29 -05:00
Slippy e863c6d094 Deleted Duplicate Loot Table 2024-05-10 16:19:15 -05:00
Slippy a070dc56bd Cleaning up unused files 2024-04-29 01:05:00 -05:00
Slippy 79f9e0f0f2 Gimmi Towers now have more junk it can generate at the top 2024-04-29 00:59:41 -05:00
Slippy 8500eb58ef Removed spam log issues and blended some structures into the world better 2024-04-29 00:49:48 -05:00
Slippy e835b833b3 One more try 2024-04-26 16:48:04 -05:00
Slippy 3b653b745e suspicious mound shoved further into the ground 2024-04-22 17:20:46 -05:00
Slippy d03541ff6f iron bar fix 2024-04-15 00:56:31 -05:00
Slippy 0d7aff0349 Please work 2024-04-15 00:24:54 -05:00
Slippy c904888c6a found a spelling error smh 2024-04-13 09:12:21 -05:00
Slippy c07d7d304e It wasnt the last D: 2024-04-09 19:19:02 -05:00
Slippy 5f94999b4f Is this the last push? 2024-04-09 19:15:02 -05:00
Slippy 6515bfa108 Decaying Crypt no longer has a random floating granite block 2024-04-05 12:14:57 -05:00
Slippy c502fec709 more bug fixes and balancing 2024-04-01 02:48:33 -05:00
Slippy 756ef48ba2 coins are more common in sus blocks 2024-03-31 04:52:02 -05:00
Slippy 2c4df6622a fixed spelling error in gilded chest loot table 2024-03-31 04:30:48 -05:00
Slippy f1213abdf4 candy adjustment 2024-03-31 01:04:02 -05:00
Slippy 9b1d847f59 added absorb bulb to some fossil loot tables 2024-03-31 00:09:28 -05:00
Slippy bf900a0167 Just an enormous amount of changes to loot tables and structures 2024-03-30 23:57:54 -05:00
Slippy 703282eca1 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into 1.5-Structures 2024-03-30 19:39:12 -05:00
Hiroku 4e3e6405d0 Merge branch 'FossilMachineBalancing01' into 'main'
Fossil machine balancing01

See merge request cable-mc/cobblemon!944
2024-03-30 23:01:44 +00:00
JazzMcNade 1e161a52ee Fixed an index out of bounds issue related to having a extreme excess of material in the tank 2024-03-30 02:27:04 -05:00
JazzMcNade 65b2204783 Decreased required material to 128 (from 256). Decreased restoration time to 12min (from 15min). 2024-03-30 02:14:06 -05:00
Slippy a9115bfb15 XL RCs are less common 2024-03-29 01:27:30 -05:00
Hiroku f2c5113f0b Merge branch 'json-addict' into 'main'
Advancement and Tag Updates

See merge request cable-mc/cobblemon!942
2024-03-29 05:31:33 +00:00
Hiroku e29a2402e9 Merge branch 'spawning-gamerule-change' into 'main'
Move doPokemonSpawning gamerule logic

See merge request cable-mc/cobblemon!941
2024-03-29 05:30:53 +00:00
Hiroku aa4857abbb Merge branch 'Quick-Move-Stacked-PokePotion-Bases' into 'main'
Add the ability to quick move stacked PokePotion bases into Brewing Stands.

See merge request cable-mc/cobblemon!935
2024-03-29 05:29:13 +00:00
Hiroku d29653233d Merge branch 'main' into 'Quick-Move-Stacked-PokePotion-Bases'
# Conflicts:
#   CHANGELOG.md
2024-03-29 05:28:22 +00:00
Hiroku 1b51a128d7 Merge branch 'OldAmberSpriteUpdate' into 'main'
Corrected Old Amber Sprite

See merge request cable-mc/cobblemon!939
2024-03-29 05:27:10 +00:00
Hiroku 245011cf5e Merge branch '1.5-Structures' into 'main'
Oh boy that's a lot of changes and fixes to structures

See merge request cable-mc/cobblemon!940
2024-03-29 05:26:30 +00:00
dhi_holo 20a97984a2 Misc Structures
Just a couple tags containing all structures not represented in a sub-tag, if someone wants to go in and make more tags to reduce the ones in here feel free, just make sure it adds up.
2024-03-29 10:54:10 +10:00
dhi_holo d1517548bd Update en_us.json
Gamerule Translation so it's not just a shitty string anymore
2024-03-29 10:09:22 +10:00
dhi_holo 3e1f9dc9b0 2 Shiny
Updated shiny icon for summary and advancement
2024-03-29 09:54:52 +10:00
miasmus fd19e65f79 move doPokemonSpawing gamerule logic 2024-03-28 16:42:42 -04:00
dhi_holo 6b10d81bc8 Update en_us.json
Capital fixes because it wasn't right
2024-03-28 23:53:56 +10:00
dhi_holo f3b9c03fc2 Advancement Updates
Reorgainised the advancements Healing Power, Consult the Fossil, and Free Roam: Enabled, renamed Tumbling Down to be correct, and changed the Shiny advancement to use Shiny icon.
2024-03-28 21:39:56 +10:00
Slippy 2b95138c46 Oh boy that's a lot of changes and fixes to structures 2024-03-27 20:02:02 -05:00
JazzMcNade 864e6be461 Corrected Old Amber Sprite 2024-03-27 19:53:10 -05:00
Apion c02fa1f85e Merge branch '1.5-Drops-and-Fixes' into 'main'
New drops and some tag/script fixes.

See merge request cable-mc/cobblemon!938
2024-03-27 20:29:11 +00:00
Apion 503b1069fd Merge branch 'MultiBlockEntityClientCrashFix' into 'main'
MultiBlockEntity Safer Casting

See merge request cable-mc/cobblemon!937
2024-03-27 20:27:01 +00:00
JazzMcNadeandApion f1d593d53c MultiBlockEntity Safer Casting 2024-03-27 20:27:01 +00:00
Veraxiel 55dd486044 Updated Changelog. 2024-03-27 01:10:26 -04:00
Hiroku 3263837137 Merge branch '1.5-Structures' into 'main'
Structure fixes and generation rate adjustments

See merge request cable-mc/cobblemon!936
2024-03-25 21:14:19 +00:00
Slippy a471fcd948 Increased rates for underground ruin structures, forest ruin structures and gimmi towers 2024-03-25 12:29:03 -05:00
Slippy a14bfd55d1 Jungle Fossil rates were increased 2024-03-25 12:22:25 -05:00
Slippy 725e819e89 Snow Forest structures rates were increased 2024-03-25 12:21:23 -05:00
Slippy b52b843206 Ocean fossils structures rates were increased 2024-03-25 12:20:13 -05:00
Slippy 74c65e22cb Decaying Crypt generation rates increased 2024-03-25 12:19:20 -05:00
Slippy c348520a9b Increased the generation rate for Mossy Oubliette 2024-03-25 12:15:42 -05:00
Slippy 78dd5f334a Decrease how common desert ruins are and adjusted the weights at which each will generate 2024-03-25 12:12:54 -05:00
Slippy 67318c9307 Sandy Den's were way too common. Adjusted their rates of generation 2024-03-25 12:05:17 -05:00
Slippy 31c48407df Slightly lowered the amount of sus sand in the sandy den structure 2024-03-25 11:43:45 -05:00
Charzard4261 0957de86c7 Add the ability to quick move stacked PokePotion bases into Brewing Stands. 2024-03-25 00:05:19 +00:00
Slippy daae444fa9 Prehistoric Rooted Pits are more common 2024-03-23 22:51:39 -05:00
Slippy 79423ef5ee Prehistoric_Birch_Tree Fix 2024-03-23 22:13:07 -05:00
Veraxiel 6255f7dc31 Removed spawn that shouldn't be in. 2024-03-23 22:29:43 -04:00
Hiroku ff10306372 Merge branch 'GiveGimmighoulRightClick' into 'main'
Easier Gimmighoul Giving

See merge request cable-mc/cobblemon!930
2024-03-23 22:07:16 +00:00
Hiroku aaf7daa45b Merge branch 'sound' into 'main'
A lot of audio asset updates

See merge request cable-mc/cobblemon!933
2024-03-23 22:06:29 +00:00
Waldleufer ae550f78c4 Now the order of selection of input and output does not matter anymore. [skip-ci] 2024-03-23 16:19:40 +01:00
Waldleufer 66e4194a3e Made public spawn writer read Dex No. as int for consistency [skip-ci] 2024-03-23 16:04:53 +01:00
Waldleufer 12e6b76504 chore: added spawn specific drops to a bunch of cobblemon - mainly nether spawns. 2024-03-23 15:54:52 +01:00
Waldleufer 93861af71f dropping drops helps. [skip-ci] 2024-03-23 15:51:34 +01:00
Waldleufer 0c80748012 perf: script speed is over 9000! [skip-ci] 2024-03-23 15:18:30 +01:00
Waldleufer fcf832c22c more sensible script default values [skip-ci] 2024-03-23 13:17:48 +01:00
Sterrezo a065aff744 Added audio assets for fossil Pokemon cries 2024-03-23 13:04:19 +01:00
Sterrezo d77f424a83 Updated battle SFX 2024-03-23 12:49:47 +01:00
Waldleufer d5d2a2cec3 fix: improved hint for rare spreadsheet parsing bug. [skip-ci] 2024-03-23 11:55:02 +01:00
Sterrezo 036e150191 Merge branch 'main' into sound 2024-03-23 11:52:52 +01:00
Waldleufer 0bf1d84675 fix: added hint for rare spreadsheet parsing bug. [skip-ci] 2024-03-23 11:52:52 +01:00
Waldleufer b1b8e658b2 chore: updated drops data and fixed some missing form specific drops. 2024-03-23 11:42:20 +01:00
Waldleufer f984b21929 fix: Drops script now robustly handles form drops and hints at missing data in both spreadsheet and .json files [skip-ci] 2024-03-23 11:34:42 +01:00
Waldleufer 0a5193b209 perf: Increase preformance of drops script to be linear function, added dex_range option [skip-ci] 2024-03-23 10:46:59 +01:00
Veraxiel 43f1f1c30d Update to spawns to use SkyLight. 2024-03-23 04:05:56 -04:00
Waldleufer c16597ae41 chore: CHANGELOG [skip-ci] 2024-03-22 23:31:39 +01:00
Waldleufer f76e7582d2 Reworked our spawn writer script to be compatible with new UI [skip-ci] 2024-03-22 23:28:41 +01:00
Waldleufer 40761d87db Adding DexRange as input [skip-ci] 2024-03-22 20:45:19 +01:00
Waldleufer 89a9ad0bfb Refactoring the hell out of it [skip-ci] 2024-03-22 19:41:36 +01:00
Waldleufer 20291c54a5 First Version of public spawn writer script [skip-ci] 2024-03-22 19:12:13 +01:00
Hiroku d6fdfe6ebc Merge branch 'FetusResizing' into 'main'
Fossil Fetus Rescaling

See merge request cable-mc/cobblemon!927
2024-03-22 01:06:17 +00:00
Nick 9f63b62651 Merge branch '1.5-Structures' into 'main'
Hi Hiro

See merge request cable-mc/cobblemon!928
2024-03-21 16:42:25 +00:00
JazzMcNade 392632b7d4 Added the ability for a player to add to Gimighoul's treasure horde by right clicking directly on a gimmighoul that they own. 2024-03-21 00:48:59 -05:00
Slippy 0d377dcbe0 Changes, fixes, and balancing of 1.5 structures 2024-03-20 22:17:13 -05:00
JazzMcNade 88c31bcb7b Scaled Archen to0.55 (from 0.8). Scaled Kabuto to 0.85 (from 0.75) 2024-03-20 19:36:27 -05:00
Waldleufer 8efea17ae6 added structure: prefix for anticonditions and conditions and refactored script [skip-ci] 2024-03-20 21:03:37 +01:00
Waldleufer cdbf569bbc feat: made spawnwriter handle new preset: tag for spawn specific drops [skip-ci] 2024-03-20 16:26:28 +01:00
Hiroku 8b81b13d01 Merge branch 'archaeology_fixup' into 'main'
Archaeology Fixup

See merge request cable-mc/cobblemon!925
2024-03-20 12:34:33 +00:00
Hiroku f19d9410c0 Merge branch 'GildedChestComparatorOutput' into 'main'
Add comparator output for the Gilded Chest

See merge request cable-mc/cobblemon!926
2024-03-20 11:36:52 +00:00
JazzMcNade 9ac3a9249d Added comparator output for the Gilded Chest 2024-03-20 00:49:56 -05:00
Lily 4f340b2eee - Fixed a bug involving hoppers and Gimmighoul chests
- Fixed certain structures not generating
- Fixed certain loot tables failing to load
2024-03-19 17:15:32 -04:00
Veraxiel 0415cf8a69 Added Carnivine spawn files. 2024-03-19 04:09:58 -04:00
Sterrezo 79af092888 Merge branch 'main' into sound 2024-03-18 11:52:30 +01:00
Hiroku 5cff52df5f Merge branch 'archaeology' into 'main'
Merging Structure Tweaks for Playtesting

See merge request cable-mc/cobblemon!924
2024-03-18 06:38:20 +00:00
Hiroku ca311fa97c Merge branch 'Waldleufer/automatingTagListCreation' into 'main'
tooling: automating tag list creation

See merge request cable-mc/cobblemon!908
2024-03-18 06:34:42 +00:00
Slippy 27020d3068 Loot table changes for structures 2024-03-18 01:14:55 -05:00
Paul 3ac4b8622f Merge remote-tracking branch 'origin/main' into 1.5-Spawns 2024-03-18 15:41:22 +10:00
Paul acd7a0583c Fixed Ekans line spawns, fixed season tag references for new locations 2024-03-18 15:35:28 +10:00
Nick e341948bd4 Merge branch 'tooling-fixes' into 'main'
tooling: mark gradlew as executable & fix logs being created during unit tests

See merge request cable-mc/cobblemon!921
2024-03-18 04:24:22 +00:00
broccolaiandNick 1a465abf9d tooling: mark gradlew as executable & fix logs being created during unit tests 2024-03-18 04:24:22 +00:00
Paul e56a6e5b1a Updated qwilfish and overqwil spawns 2024-03-18 14:03:53 +10:00
Paul 33d707a73b Spawn fixes 2024-03-18 14:02:17 +10:00
Paul e3c3cd380c Merge remote-tracking branch 'origin/main' into 1.5-Spawns
# Conflicts:
#	utilityscripts/cobblemon_drops_csv_to_json.py
2024-03-18 13:42:02 +10:00
Hiroku 578ce789b1 Merge branch 'implement_pokemon' into 'main'
Many Pokémon implemented and some animation transition fixes.

See merge request cable-mc/cobblemon!923
2024-03-18 03:19:20 +00:00
Paul 460e8f7501 Fixed various Pokemon not being marked as implemented when they are, fixed Golem and Lairon legs moving in a hurry 2024-03-18 11:37:24 +10:00
Tyzillion 2fee86e7bc Updated branch and forgot to add diglett line updates to changelog. 2024-03-17 19:35:04 -04:00
Tyzillion f73e631f81 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2024-03-17 19:28:46 -04:00
Tyzillion 0ca0c1a552 hitboxes adjusted. 2024-03-17 19:26:34 -04:00
Hiroku b3bf2c5ded Merge branch 'test-improvements' into 'main'
tooling: improve tests by properly bootstrapping minecraft

See merge request cable-mc/cobblemon!922
2024-03-17 22:31:17 +00:00
broccoli 7875006c8e tooling: improve tests by properly bootstrapping minecraft
- uses the fabric-loader-junit build
- rewrites the SpawnValidator to use #getResource instead of code file paths
- create a junit extension to bootstrap easier
2024-03-17 21:13:45 +00:00
Slippy 67bb63b638 Well that didn't work at all... 2024-03-17 14:34:42 -05:00
Slippy 511f97b963 Fixed structures unintentionally generating in the oceans. Fixed structures unintentionally generating on the surface. 2024-03-17 13:15:31 -05:00
Waldleufer 54c426f5ff feat: spawn writer now handles skyLight [skip-ci] 2024-03-17 16:01:07 +01:00
Waldleufer f89902ece8 feat: spawn_csv_to_json script improvements [skip-ci]
* only verify biome tags if tag directories are available.
* Missing cobblemon items in the natural names to tags spreadsheet are now printed out as an error.
2024-03-17 15:45:32 +01:00
Waldleufer 52c6bbd842 chore: update Changelog [skip-ci] 2024-03-17 14:24:26 +01:00
Waldleufer 8246a822cf feat: added "ready for implementation" list to cry_checker script. [skip-ci] 2024-03-17 14:17:01 +01:00
Hiroku 54202bed98 Merge branch 'BalancedFossils' into 'main'
Play test values for fossil machine

See merge request cable-mc/cobblemon!920
2024-03-17 08:55:46 +00:00
Paul e6313cf4c5 Reverted partial run change 2024-03-17 16:44:56 +10:00
JazzMcNade 7debc6e047 Increased timings, increased required natural material, updated material values, increased quirk cooldown. Fixed bugs revealed upon changing these values 2024-03-16 22:37:16 -05:00
Tyzillion bf9b69a143 Updated Dragonite, Omanyte, Omastar, and Pinsir animations. 2024-03-16 21:44:02 -04:00
Hiroku d7f34972c1 Merge branch 'MoreHoldItems' into 'main'
more held items woah

See merge request cable-mc/cobblemon!918
2024-03-17 00:58:35 +00:00
Veraxiel fa7356d2ed Update to Ocean tag. 2024-03-16 18:10:07 -04:00
Sterrezo 812d42a42f Merge branch 'main' into sound 2024-03-16 22:22:26 +01:00
Sterrezo 3f114706fa Implemented sounds for Revival Herb and Vivichoke. Volume adjustments.
Implemented sounds for Revival Herb and Vivichoke. Tweaked assets for Fossil Machine insert dna sounds. Adjusted volumes to Fossil Machine, Tumblestone and Coin Pouch sounds.
2024-03-16 22:21:05 +01:00
Lily 8d1f41919d nvm eject button can go back in 👍😄 2024-03-16 16:11:48 -04:00
Lily b40c21d99e pull eject pack and eject button since they brick battles 2024-03-16 16:07:35 -04:00
Lily 461d8bd282 more held items woah 2024-03-16 14:37:32 -04:00
Tyzillion 84d34709a3 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2024-03-16 13:44:49 -04:00
Tyzillion b6c04e8746 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon
# Conflicts:
#	common/src/main/resources/data/cobblemon/species/generation2/heracross.json
#	common/src/main/resources/data/cobblemon/species/generation5/darmanitan.json
#	common/src/main/resources/data/cobblemon/species/generation5/lilligant.json
#	common/src/main/resources/data/cobblemon/species/generation5/zoroark.json
#	common/src/main/resources/data/cobblemon/species/generation6/floette.json
#	common/src/main/resources/data/cobblemon/species/generation6/goodra.json
#	common/src/main/resources/data/cobblemon/species/generation7/kommoo.json
#	common/src/main/resources/data/cobblemon/species/generation7/lurantis.json
#	common/src/main/resources/data/cobblemon/species/generation7/salazzle.json
#	common/src/main/resources/data/cobblemon/species/generation8/copperajah.json
2024-03-16 13:43:31 -04:00
Hiroku 81a96afaa6 Merge branch 'tag-god' into 'main'
Added structure tags (for /locate command)

See merge request cable-mc/cobblemon!917
2024-03-16 11:19:40 +00:00
dhi_holo 724332dd34 Added structure tags (for /locate command)
The reason for these is primarily the /locate command, combining biome variants together so if you're just looking for a structure of a specific kind, but the biome doesn't matter, you don't have to deal with deciding which to search for.
2024-03-16 18:23:02 +10:00
Veraxiel f5bfd64495 Added some more spawns. 2024-03-16 01:32:55 -04:00
Hiroku bf8f7f628f Merge branch 'quick-ficks' into 'main'
Puffing Bells

See merge request cable-mc/cobblemon!916
2024-03-16 05:24:14 +00:00
dhi_holo 898fdf983f Puffing Bells
Hisui Puff hopefully fixed, and soothe bell recipe cleaned up (so many errors)

Also added the newer tags to the lang
2024-03-16 14:32:20 +10:00
Hiroku a547e0f535 Merge branch 'fix/adjust-node-type' into 'main'
fix: don't access entity in adjustNodeType

See merge request cable-mc/cobblemon!915
2024-03-16 02:34:46 +00:00
broccoli 564ced926c fix: don't access entity in adjustNodeType
Mojang has disposed of the entity by this point, leading to a crash that's
especially noticed in the Wander goal.
2024-03-16 02:16:28 +00:00
Paul a93dd14fd8 Fixed soothe bell recipe 2024-03-16 12:08:44 +10:00
Paul f0535901cb Fixed prepared transition animations not playing (lol) 2024-03-16 11:47:16 +10:00
Paul 7a42df591f Merge remote-tracking branch 'origin/main' into implement_pokemon
# Conflicts:
#	common/src/main/resources/assets/cobblemon/particles/snowstorm.json
#	common/src/main/resources/data/cobblemon/species/generation2/heracross.json
#	common/src/main/resources/data/cobblemon/species/generation5/darmanitan.json
#	common/src/main/resources/data/cobblemon/species/generation5/lilligant.json
#	common/src/main/resources/data/cobblemon/species/generation5/zoroark.json
#	common/src/main/resources/data/cobblemon/species/generation6/floette.json
#	common/src/main/resources/data/cobblemon/species/generation6/goodra.json
#	common/src/main/resources/data/cobblemon/species/generation7/kommoo.json
#	common/src/main/resources/data/cobblemon/species/generation7/lurantis.json
#	common/src/main/resources/data/cobblemon/species/generation7/salazzle.json
#	common/src/main/resources/data/cobblemon/species/generation8/copperajah.json
2024-03-16 11:21:54 +10:00
Veraxiel 616419880f Updated spawn files. 2024-03-15 16:45:09 -04:00
Slippy 9fa38430c0 Deleted old structure file 2024-03-15 13:42:25 -05:00
Slippy 26012278e7 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into archaeology 2024-03-15 13:35:42 -05:00
Slippy 2c0967d293 1.5 structures for real??? 2024-03-15 13:04:00 -05:00
Nick 885fc72d93 Revert "1.5 Structures final changes before Playtesting"
This reverts commit 8130cd0998
2024-03-15 17:56:22 +00:00
Slippy 8130cd0998 1.5 Structures final changes before Playtesting 2024-03-15 12:52:32 -05:00
Veraxiel 447d35f28b Updated tags. Added presets. 2024-03-15 05:47:07 -04:00
Hiroku bf82def925 Merge branch 'MoreHoldItems' into 'main'
Implement more held items

See merge request cable-mc/cobblemon!905
2024-03-15 02:57:05 +00:00
Hiroku dace364701 Merge branch 'FossilMachineHandWaggling' into 'main'
When using a pokeball, fossil, or natural material on the fossil machine the...

See merge request cable-mc/cobblemon!911
2024-03-15 02:49:31 +00:00
Lily d737444ac9 Merge branch 'main' into MoreHoldItems
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/Cobblemon.kt
2024-03-14 21:43:54 -04:00
Hiroku 95f58ba557 Merge branch 'panning_for_gilded_chests' into 'main'
make gilded chests waterloggable

See merge request cable-mc/cobblemon!910
2024-03-15 01:28:56 +00:00
Hiroku 8993b007a5 Merge branch 'FossilMachineChunkLoadFix' into 'main'
Fossil machine chunk load fix

See merge request cable-mc/cobblemon!912
2024-03-15 01:28:04 +00:00
Hiroku c84f9dd112 Merge branch 'anychangeobservable-public' into 'main'
Make anyChangeObservable public

See merge request cable-mc/cobblemon!909
2024-03-15 01:25:46 +00:00
apionandJazzMcNade eea7477f7f More changes to how things work in unloaded chunks 2024-03-14 01:19:10 -05:00
JazzMcNade 241abd79d7 FossilMultiblock multiblock getter performance improvement for chunkloading issues 2024-03-14 01:19:10 -05:00
Veraxiel 35618cea46 Merge branch '1.5-Spawns' of https://gitlab.com/cable-mc/pokemon-cobbled into 1.5-Spawns 2024-03-14 02:10:34 -04:00
Veraxiel 31b97d391d Updated tags. Reorganized tags. Added tags for blocks in biomes. 2024-03-14 02:10:00 -04:00
Lily 7769a73246 make gilded chests waterloggable 2024-03-13 23:28:00 -04:00
Nick 65bf9507d3 Fix invalid JSON 2024-03-13 04:48:50 +00:00
miasmus 6d336fc27b make anyChangeObservable public 2024-03-12 17:25:54 -04:00
Sterrezo 9514a1d470 Fossil Machine sound updates
Updated audio assets. Moved and renamed the files for consistency. Adjusted volumes.
2024-03-12 13:31:02 +01:00
Waldleufer 16df7695c4 feat: made speciesJsonReader more robust. 2024-03-10 21:32:11 +01:00
Waldleufer 8fd63912a3 feat: always sort tables alphabetically 2024-03-09 09:07:53 +01:00
Waldleufer 04941a9a38 feat: adding header and TOC 2024-03-09 09:06:24 +01:00
Waldleufer 1853a1677a feat: adding header and TOC 2024-03-09 09:06:18 +01:00
Waldleufer 94f8de8ddc feat: three column representation 2024-03-09 08:52:51 +01:00
Waldleufer 7ea866d82a feat: 2 column version 2024-03-09 08:46:34 +01:00
Waldleufer ea529a52c2 feat: initial version of SpawnPresetListWriter script 2024-03-09 08:34:47 +01:00
Waldleufer 1f6dd03064 refactor: separating code into functions. 2024-03-09 07:42:49 +01:00
Waldleufer d62ea394ee feat: added place for descriptive text for the detailed tag files. 2024-03-09 07:36:33 +01:00
Waldleufer d0b8a3368c feat: moved full tag lists to their own folder 2024-03-09 07:25:32 +01:00
Tyzillion 6d23e762d6 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2024-03-08 19:41:19 -05:00
Tyzillion 6edb0c19c4 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	common/src/main/resources/assets/cobblemon/particles/snowstorm.json
#	common/src/main/resources/data/cobblemon/species/generation2/heracross.json
#	common/src/main/resources/data/cobblemon/species/generation5/darmanitan.json
#	common/src/main/resources/data/cobblemon/species/generation5/lilligant.json
#	common/src/main/resources/data/cobblemon/species/generation5/zoroark.json
#	common/src/main/resources/data/cobblemon/species/generation6/floette.json
#	common/src/main/resources/data/cobblemon/species/generation6/goodra.json
#	common/src/main/resources/data/cobblemon/species/generation7/kommoo.json
#	common/src/main/resources/data/cobblemon/species/generation7/lurantis.json
#	common/src/main/resources/data/cobblemon/species/generation7/salazzle.json
#	common/src/main/resources/data/cobblemon/species/generation8/copperajah.json
2024-03-08 19:27:53 -05:00
Veraxiel 71e9adae1f Merge branch '1.5-Spawns' of https://gitlab.com/cable-mc/pokemon-cobbled into 1.5-Spawns 2024-03-08 19:16:02 -05:00
Veraxiel 35b53daa09 Added tags. 2024-03-08 19:12:59 -05:00
Waldleufer 937c30fca5 feat: initial version of output mds. 2024-03-08 23:54:34 +01:00
Waldleufer 141249e6c7 feat: remove redundant "Tags ↓" 2024-03-08 23:50:52 +01:00
Waldleufer 94f9bf9f50 feat: splitting output in multiple md files. 2024-03-08 23:43:20 +01:00
Waldleufer 4638b01279 feat: first version of markdown writer. 2024-03-08 23:35:10 +01:00
Nick e39d59c37a Merge branch 'gen10-will-wash-this-away' into 'main'
Support Stellar tera type & fix tera type selection.

See merge request cable-mc/cobblemon!907
2024-03-08 20:31:44 +00:00
LiciousandNick 072071d679 Support Stellar tera type & fix tera type selection. 2024-03-08 20:31:44 +00:00
Licious aa4400395b Support for soothe bell mechanic. 2024-03-08 10:50:07 +00:00
Licious 09ad3d0a4d Merge branch 'consolidated-versioning' into 'main'
Quick Fix for Crash Report Details to Actually be Written

See merge request cable-mc/cobblemon!906
2024-03-08 10:30:22 +00:00
NickandLicious de7df10f36 Quick Fix for Crash Report Details to Actually be Written 2024-03-08 10:30:22 +00:00
Lily 897bcf6fc0 Merge branch 'main' into MoreHoldItems
# Conflicts:
#	CHANGELOG.md
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonItems.kt
2024-03-07 17:21:43 -05:00
Lily 1e14042455 removed recipes for cut held items 2024-03-07 17:14:47 -05:00
Nick 8583c9af4d Merge branch 'ores_galore' into 'main'
terracotta sun stone ore

See merge request cable-mc/cobblemon!904
2024-03-07 19:50:08 +00:00
LilyandNick ce756997d6 terracotta sun stone ore 2024-03-07 19:50:08 +00:00
Licious 4efc5b6748 Merge branch 'consolidated-versioning' into 'main'
Change Version Publication for Better Maven Support

See merge request cable-mc/cobblemon!901
2024-03-07 18:23:07 +00:00
NickandLicious 7ed6075410 Change Version Publication for Better Maven Support 2024-03-07 18:23:06 +00:00
Lily 320d995672 add new held item sprites 2024-03-07 12:19:23 -05:00
Nick 8ae91587aa Merge branch 'feat/rework-starter-toast' into 'main'
Removing Starter Toast when it is nice and crispy.

Closes #579, #656, #771, and #655

See merge request cable-mc/cobblemon!898
2024-03-06 23:12:49 +00:00
WaldleuferandNick 61362fa1b1 Removing Starter Toast when it is nice and crispy. 2024-03-06 23:12:49 +00:00
Nick d010129864 Merge branch 'food_reorganization' into 'main'
moved the items in the food category around to make more sense (previously...

See merge request cable-mc/cobblemon!903
2024-03-06 21:24:18 +00:00
Nick 282f002895 Merge branch 'amo/sendout-upgrade' into 'main'
Ancient Send Outs

See merge request cable-mc/cobblemon!902
2024-03-06 21:22:48 +00:00
Lily 863f6de059 moved the items in the food category around to make more sense (previously were all at the very bottom) 2024-03-06 14:43:03 -05:00
JazzMcNade 8ddf628f19 When using a pokeball, fossil, or natural material on the fossil machine the client will always play ActionResult.CONSUME. 2024-03-05 01:25:43 -06:00
dhi_holo 8762d518c1 Merge branch 'main' into amo/sendout-upgrade 2024-03-05 13:56:10 +10:00
Paul 46798d694e Fixed generic entities not rendering, fixed Torkoal particles going upside down, fixed idle animation particles not playing, fixed loop particles not looping 2024-03-04 11:26:20 +10:00
Hiroku 056dd0fd4b Merge branch 'JsonScriptFixes' into 'main'
tiny Json script fixes

See merge request cable-mc/cobblemon!853
2024-03-03 07:54:12 +00:00
WaldleuferandHiroku 3ac00d976b tiny Json script fixes 2024-03-03 07:54:11 +00:00
Paul b30a76855b Fixed cancelling spawn events not actually cancelling the action, closes #612 2024-03-03 17:18:08 +10:00
Paul e976556ae3 (Probably) fixed edge case with pose transitions 2024-03-03 16:10:02 +10:00
Paul 9f16eca621 Merge branch 'main' into implement_pokemon 2024-03-03 15:49:20 +10:00
dhi_holo f4a94bd732 Merge branch 'main' into amo/sendout-upgrade
does this really fix forge?
2024-03-03 15:14:10 +10:00
Paul b6c964e03b Fixed Forge runs, again 2024-03-03 14:40:18 +10:00
dhi_holo aed2204483 Merge branch 'main' into amo/sendout-upgrade 2024-03-03 13:39:35 +10:00
Paul 3ed46cb7af Removed unused option in config (maxHorizontalSpace) 2024-03-03 13:38:59 +10:00
Paul cf9efe9b8c Fixed Snowstorm particles sometimes not appearing 2024-03-03 13:28:40 +10:00
Paul 02b9431731 Attach the entity from the entity particle packet to the storm (oops) 2024-03-03 13:14:13 +10:00
Paul a30ae0ccef Added query functions for entity_width, height, size, and radius to entity tracked particle storms 2024-03-03 12:46:28 +10:00
Hiroku a2905f4d37 Merge branch 'particle-events' into 'main'
Added "event" support to bedrock particles, locator support in the command,...

Closes #767

See merge request cable-mc/cobblemon!900
2024-03-03 02:00:36 +00:00
Paul b3aba1532c Added "event" support to bedrock particles, locator support in the command, and fixed inwards motion direction 2024-03-03 11:28:54 +10:00
Hiroku 6369bdb612 Merge branch '1.5_Structures' into 'main'
Added most of the 1.5 Structures

See merge request cable-mc/cobblemon!877
2024-03-03 00:20:02 +00:00
Hiroku b5db5605ef Merge branch 'FossilAnalyzerDirRenderFix' into 'main'
Fossils are now positioned correctly in all possible block facing directions

See merge request cable-mc/cobblemon!899
2024-03-02 23:48:29 +00:00
JazzMcNade 0207459a0f Fossils are now positioned correctly in all possible block facing directions 2024-03-02 16:37:44 -06:00
Hiroku 0e2fdfbce8 Merge branch 'ability-fix' into 'main'
Abilities fix

See merge request cable-mc/cobblemon!891
2024-03-02 05:20:10 +00:00
Hiroku 8c9da885c7 Merge branch 'main' into 'ability-fix'
# Conflicts:
#   CHANGELOG.md
2024-03-02 04:16:11 +00:00
Hiroku a5b6529f3c Merge branch 'display_case' into 'main'
Display case

See merge request cable-mc/cobblemon!879
2024-03-02 04:10:44 +00:00
Tyzillion 6e9bdb6019 Many hitboxes adjusted. Updated Squirtle and Wartortle animations. 2024-03-01 21:27:34 -05:00
Paul b430b7db76 Corrected Gimmighoul chest battle behaviour on server environments 2024-03-02 12:02:35 +10:00
Hiroku 8015ff0e20 Merge branch 'fix-grow-tumblestone-advancement' into 'main'
Grow Tumblestone Advancement triggers when placed near Lava or Magma

See merge request cable-mc/cobblemon!893
2024-03-02 01:21:55 +00:00
Dhyan PatelandHiroku ee78657e3d Grow Tumblestone Advancement triggers when placed near Lava or Magma 2024-03-02 01:21:55 +00:00
Hiroku 6cc84cd38c Merge branch 'tooltip-fix-fix' into 'main'
fix a small issue with appending tooltips

See merge request cable-mc/cobblemon!897
2024-03-02 00:28:30 +00:00
miasmus 31d6ff541e fix a small issue with appending tooltips 2024-03-01 16:36:31 -05:00
Veraxiel 841a40c973 Added and updated spawns. 2024-03-01 01:42:54 -05:00
jeffw773 e1a4086f24 - push new changes for Slippy 2024-02-29 20:11:09 -08:00
Tyzillion df049a315c Finished adjusting portraits and profiles on all newly implemented Pokemon. Started adjusting hitboxes. 2024-02-29 22:19:38 -05:00
Tyzillion 9ce5486189 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2024-02-29 22:18:54 -05:00
Paul b1992a94d3 Fixed piglin entity mixin on Forge 2024-03-01 11:10:47 +10:00
Veraxiel 167a1ea8eb Added some new tags. Updated spawn writer. 2024-02-29 10:19:57 -05:00
dhi_holo f95beaa7a1 Delete LICENSE
Gonna hope this wasn't important, it's giving a log error though and feels randomly placed in this folder, if we're meant to have it in here, probably shouldn't randomly be in the fossil items folder?
2024-02-29 20:08:36 +10:00
dhi_holo 1c0f7bbf8f Update restoration_tank.json
was erroring, so I fixed it so it'd be two less errors in the log (and potentially not break ingame, didn't test if these things could happen in natural gameplay)
2024-02-29 20:07:07 +10:00
dhi_holo 34cc2cda46 Maybe Masterball Fixes?
Need to break so just pushing this
2024-02-29 13:58:11 +10:00
dhi_holo 696e58bd1a Update snowstorm.json
removed unneeded/erroring lines
2024-02-29 13:50:40 +10:00
Tyzillion 10412b80ca Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2024-02-28 21:59:22 -05:00
dhi_holo 458c2ce0ed Merge branch 'main' into amo/sendout-upgrade 2024-02-29 12:34:00 +10:00
Tyzillion 6182715644 Implemented Salandit, Salazzle, Skarmory, Flabebe, Floette, Florges, Ferroseed Carbink, Goomy, Sliggoo, Goodra, Hisuian Goomy, Sliggoo, and Goodra, Flabebe, Floette, Florges, Jangmo-o, Hakamo-o, and Kommo-o.
Caught up a little on Profile and Portrait frames.
2024-02-28 21:26:20 -05:00
Hiroku b41c4c21a8 Merge branch 'publish-versioning-fix' into 'main'
fix versioning

See merge request cable-mc/cobblemon!894
2024-02-28 22:07:33 +00:00
miasmus e1893f50ae fix versioning 2024-02-28 16:52:13 -05:00
Tyzillion a1bdf3ded6 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2024-02-28 15:21:29 -05:00
Lily a458b31c9f Merge branch 'main' into display_case
# Conflicts:
#	.gitignore
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonBlocks.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonItems.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonSounds.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/gui/battle/subscreen/BattleGeneralActionSelection.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/item/group/CobblemonItemGroups.kt
#	common/src/main/resources/assets/cobblemon/lang/en_us.json
#	common/src/main/resources/assets/cobblemon/models/item/relic_coin_pouch.json
#	common/src/main/resources/assets/cobblemon/sounds.json
2024-02-28 14:07:19 -05:00
Lily 03b5336eb8 refactor getPositioningType to avoid using tags 2024-02-28 14:02:29 -05:00
apion 9e2d00df63 Finished Anorith, Armaldo, Tyrantrum, Zorua, Zoroark, ZoruaH 2024-02-28 11:11:37 -05:00
apion e8003bb29a Added a few comments 2024-02-28 04:15:02 -05:00
apion a248d661fa Finished omastar 2024-02-28 01:07:05 -05:00
apion 59390f4d84 Finished archen line 2024-02-28 01:00:51 -05:00
apion 99b7e4a89e Finished tyrunt 2024-02-28 00:49:36 -05:00
apion fb37e543cf Fixed issues with json posers 2024-02-28 00:43:25 -05:00
apion c0c75a9735 Finished Rowlet line 2024-02-28 00:25:58 -05:00
apion 3febee21b6 Changed increment of debug keybindings 2024-02-28 00:03:44 -05:00
apion c3a017687c Finished Gen VIII fossil mons 2024-02-28 00:01:05 -05:00
apion afd082c966 Added scaling/translation key binds to portrait view, enableable/disableable via config 2024-02-27 23:34:52 -05:00
apion a6a1f7b75b Added scaling/translation keybinds to summary menu 2024-02-27 22:00:10 -05:00
apion 72738a45e6 Made portraitScale, portraitTranslation, profileScale, and profileTranslation vars instead of vals in every model file 2024-02-27 21:46:44 -05:00
apion 8a0076acb4 Start working on dragovish 2024-02-27 20:54:53 -05:00
apion f7e1def555 Fixed arctovish scaling and translations 2024-02-27 20:45:44 -05:00
apion c13f6ae627 Implemented Ferrothorn, fixed missing anim on Dragonair 2024-02-27 19:12:39 -05:00
Licious c24ab2049d Merge branch 'main' into ability-fix
# Conflicts:
#	CHANGELOG.md
2024-02-26 11:45:32 +00:00
Licious b7b1850a4e Clarify changelog. 2024-02-26 11:41:49 +00:00
Licious 8995c107f7 Fix abilities, add ability capsule & patch. 2024-02-26 11:38:22 +00:00
dhi_holo d6a412b91a tags
tags
2024-02-26 17:38:30 +10:00
dhi_holo 5984d7a126 Cups and Functions
Adds Masterpiece and Unremarkable Teacups (Sinistea evolution items), and makes Medicinal Leek, Bone, and Snowball work as the Leek, Thick Club, and Snowball held items.
Snowballs do have a small issue with being thrown when trying to give it to a Pokemon though, for someone cool to investigate.
2024-02-26 16:44:26 +10:00
dhi_holo 6d8e645092 Merge branch 'main' into MoreHoldItems 2024-02-26 15:03:45 +10:00
Tyzillion 55f0db2263 Implemented Lunatone, Solrock, Woobat, Swoobat, Sandile, Krokorok, Krookodile, Frillish, Jellicent, Cubchoo, Beartic, Deino, Zweilous, Hydreigon, Larvesta, Volcarona, Fomantis, Lurantis, Dreepy, Drakloak, Dragapult, Makuhita, Hariyama, Alolan Diglett, Alolan Dugtrio, and Alomomola.
Updated Diglett and Dugtrio models.
2024-02-25 19:38:27 -05:00
Tyzillion 411788a07e Implemented Turtonator, Stonjourner, Cufant, Copperajah, Budew, Roselia, and Roserade.
Updated Growlithe's model.
2024-02-24 21:52:09 -05:00
Tyzillion f6151041c5 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2024-02-24 21:51:27 -05:00
Lily ac65910380 updated the relic coin pouch rendering inside display case 2024-02-22 17:18:20 -05:00
Lily ba6847be9a Merge branch 'gimmighoul_gholdengo' into display_case
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonBlocks.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonSounds.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/item/group/CobblemonItemGroups.kt
#	common/src/main/resources/assets/cobblemon/lang/en_us.json
#	common/src/main/resources/assets/cobblemon/sounds.json
2024-02-22 16:27:39 -05:00
Lily 5ddbcd1830 various changes to display case 2024-02-22 15:03:17 -05:00
Lily 47605646d0 Merge branch 'main' into display_case 2024-02-22 14:26:33 -05:00
Lily d9fdf089c2 fix display case z-fighting 2024-02-22 14:00:15 -05:00
Lily e9a405694c display case sounds 2024-02-21 18:47:20 -05:00
dhi_holo 8555168a6a Undoing commit "Tags on top of Tags"
Moving it to a new branch, so just removing it from here so my new changes don't conflict later
2024-02-21 15:41:48 +10:00
Tyzillion 1b5c0be975 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2024-02-20 23:25:41 -05:00
dhi_holo 5924398eff Update CobblemonItemGroups.kt
soothe bell to creative tab
2024-02-21 10:47:10 +10:00
dhi_holoandPlastered_Crab a08855ab37 Heal and Harm
Added translations for the battle text of Dry Skin, Cheek Pouch, Earth Eater, Icy Body, Volt Absorb, Water Absorb, and Sand Tomb.
2024-02-20 16:09:52 -08:00
Plastered_Crab 91abe39cdd Merge remote-tracking branch 'origin/MoreHoldItems' into MoreHoldItems
# Conflicts:
#	CHANGELOG.md
2024-02-20 16:07:49 -08:00
Plastered_Crab ad8aab7c19 - Added Soothe Bell 2024-02-20 16:06:45 -08:00
Plastered_Crab aa6b196c29 Merge branch 'main' into MoreHoldItems
# Conflicts:
#	common/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json
#	common/src/main/resources/data/minecraft/tags/items/decorated_pot_sherds.json
2024-02-20 15:58:50 -08:00
dhi_holo 5268447fa3 could've sworn I pushed these yesterday
placeholder particles for balls which aren't getting particles yet
2024-02-21 09:11:07 +10:00
dhi_holo 818b39e945 Dusky
Apparently missed this one

But why do Ancient Feather, Wing, Jet, Leaden, Gigaton no worky??
(remaining unimplemented: cherish, dream, beast, origin)
2024-02-20 12:08:29 +10:00
dhi_holo 30666349a1 [WIP] Ancient Send Outs
base 7, great, and ultra work right, but the heavy/wing sets have broken send out flashes (besides ancient heavy specifically)
Just pushing because it's 11pm and it's honkshnoomemememememe time
2024-02-19 23:09:17 +10:00
Lily fb34d4bd23 suppressed gimmighoul's desire to be a necromancer 2024-02-16 20:50:03 -05:00
Paul 6ca1337ff9 Merge branch 'gimmighoul_gholdengo' into 1.5_Structures 2024-02-17 10:29:18 +10:00
Tyzillion 98106cad12 Implemented Darumaka line, and Petilil line with Hisuian counterparts. 2024-02-16 16:14:43 -05:00
Lily 0d344337dd Merge branch 'main' into display_case
# Conflicts:
#	.gitignore
#	CHANGELOG.md
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
2024-02-16 11:55:15 -05:00
Paul 3d27681aaa Randomize Pokémon spawn positions and position gimmighoul reveals better 2024-02-16 16:31:00 +10:00
Paul 352202203a Merge branch 'gimmighoul_gholdengo' into 1.5_Structures 2024-02-16 15:04:51 +10:00
Paul 62cfbd7087 Licenses 2024-02-16 15:03:53 +10:00
Paul 5a64e8ea1b Animated the trap chest opening 2024-02-16 15:03:15 +10:00
Paul 8dc9863a5d Conflict resolution and cleanup 2024-02-16 14:39:22 +10:00
Myslippy 9280258413 Implemented most of the Fossil & Ruin Structures 2024-02-16 03:13:32 +00:00
Paul 51a11163dd Merge remote-tracking branch 'origin/main' into gimmighoul_gholdengo
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonBlocks.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonSounds.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/events/CobblemonEvents.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/block/FossilTubeRenderer.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/bedrock/animation/BedrockStatefulAnimation.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/item/group/CobblemonItemGroups.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/pokemon/Species.kt
#	common/src/main/resources/assets/cobblemon/lang/en_us.json
#	common/src/main/resources/assets/cobblemon/sounds.json
2024-02-16 12:43:35 +10:00
Lily d5ad84a495 refactored PositioningType 2024-02-13 19:02:53 -05:00
Tyzillion 1560b142d2 Updated quirks for implemented Pokemon. 2024-02-13 08:22:50 -05:00
Lily b01086270a fix positioning on certain items that use block entity renderers 2024-02-12 19:18:18 -05:00
Lily 8d5eb5883d gilded chests now get blocked with blocks above them like regular chests do 2024-02-12 14:57:24 -05:00
Tyzillion d5fa693f43 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/BlastoiseModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/ChanseyModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/DragonairModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/DratiniModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/ElectabuzzModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/ElekidModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/IllumiseModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/NumelModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/VolbeatModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/CarnivineModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/DrifblimModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/DrifloonModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/ChandelureModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/LampentModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen5/LitwickModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen9/LechonkModel.kt
#	common/src/main/resources/assets/cobblemon/bedrock/pokemon/animations/0009_blastoise/blastoise.animation.json
#	common/src/main/resources/assets/cobblemon/bedrock/pokemon/models/0009_blastoise/blastoise.geo.json
#	common/src/main/resources/assets/cobblemon/particles/snowstorm.json
2024-02-11 12:52:08 -05:00
JazzMcNade 0d12bf1190 Relic Coins Sacks can be bartered with Piglins for loot.
Can always remove this if undesired or make it a tag, change the item, etc.
2024-02-10 21:23:05 -06:00
Lily 4f773f63cb fix hopper dupe bug 2024-02-09 22:04:01 -05:00
Lily 3f3ae74535 update .gitignore 2024-02-09 19:58:44 -05:00
Lily 7429fea802 fixed crash on dedicated servers (again) + made cases compatible with hoppers 2024-02-09 19:46:23 -05:00
Lily ac5cd47715 multiple display case bugfixes 2024-02-09 17:59:57 -05:00
Tyzillion 9901d39f9b Implemented Hisuian Sneasel, Sneasler, and Tropius. 2024-02-09 14:46:18 -05:00
JazzMcNade c635a1d331 Removed duped block tag entry 2024-02-09 01:08:35 -06:00
JazzMcNade cf2173a281 Opening a gilded chest now aggros piglins 2024-02-09 00:15:55 -06:00
JazzMcNade 710d37f453 Added piglin related tags for glided chests and relic coin related items 2024-02-08 23:52:36 -06:00
Lily 1fb3416211 implemented the display case 2024-02-08 22:46:16 -05:00
Tyzillion f49f2a7305 Implemented Amaura, Aurorus, Hisuian Voltorb, Hisuian Electrode, Sentret, Furret, Qwilfish, Hisuian Qwilfish, and Overqwil.
Updated Dracovish model.
2024-02-06 14:30:54 -05:00
Tyzillion b0e9c1ab28 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2024-02-06 14:22:32 -05:00
JazzMcNade ac1c7d8b78 Mobs can now pathfind around Gilded Chests 2024-02-04 20:00:20 -06:00
Tyzillion dec5151eb8 /gradlew updateLicenses go brrrrrrrrr. 2024-02-04 00:11:14 -05:00
Tyzillion 196edc2711 Updated animations for Happiny, Carnivine, Litwick, Lampent, Chandelure, Lechonk, and Falinks.
Updated model for Lechonk, Drifloon, and Drifblim.
Fixed Drifloon eyes.
2024-02-03 23:35:35 -05:00
Tyzillion 18015a26fd Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2024-02-03 21:10:07 -05:00
Tyzillion aa296a79a9 Added placeholder walk animations to Zoroark. Updated animations for Galarian Meowth, Galarian Rapidash, Venonat, Venomoth, Phanphy, Donphan, Dratini, Dragonair, Chansey, Blissey, Volbeat, Illumise, Numel, Drifloon, and Drifblim.
Updated model and texture for Danphan.
Updated model for Illumise, Dratini, Dragonair, Drifloon, and Drifblim.
Added cries for all Meowth variants.
Added missing blink to Psyduck.
2024-02-03 21:09:04 -05:00
Lily 92dd85643e Merge branch 'amo/sendout-upgrade' into gimmighoul_gholdengo
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/api/events/CobblemonEvents.kt
2024-02-03 19:45:47 -05:00
Lily 8849de1bfd Merge remote-tracking branch 'origin/amo/sendout-upgrade' into amo/sendout-upgrade
# Conflicts:
#	common/src/main/resources/assets/cobblemon/bedrock/particles/balls/capture/capturestar.particle.json
#	common/src/main/resources/assets/cobblemon/bedrock/particles/balls/capture/hisui/hisuicapturestar.particle.json
2024-02-03 19:44:41 -05:00
Lily 2a349697b4 colored gilded chest variants :3 2024-02-01 20:28:12 -05:00
Tyzillion a4055e6206 Been a minute since I've last added stuff...
Updated models and textures for Omanyte, Squirtle, Rowlet line, Psyduck, Dusknoir, Swinub, and Piloswine.

Implemented Aron, Gossifleur, Zorua, Hisui Zorua, Hippopotas, Tyrunt, Anorith, and Archen line.
2024-01-31 20:58:23 -05:00
Lily 03bda4e27d fixes to be compatible with the updated held item event 2024-01-30 17:33:51 -05:00
Lily 5d8abbd4c7 Merge branch 'main' into gimmighoul_gholdengo
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/pokemon/Pokemon.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/pokemon/evolution/adapters/CobbledRequirementAdapter.kt
2024-01-30 16:51:56 -05:00
Lily 6b167a7a17 gilded chest variants are implemented, waiting for textures 2024-01-30 16:46:22 -05:00
Tyzillion 5c64bc94ff Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2024-01-30 13:32:04 -05:00
apion d36c24075c Fixed rotations? 2024-01-29 16:48:21 -05:00
Lily d1a8122296 fixed rotation for gilded chest as well 2024-01-29 12:44:41 -05:00
Lily a8e6e684ab updated relic_coin_pouch.png 2024-01-29 12:22:55 -05:00
Lily 188fc2b5d9 fixed inconsistencies between the actual value of the facing property and the direction the coin pouch was facing 2024-01-29 12:19:50 -05:00
Tyzillion 2bc2e3f020 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	common/src/main/resources/data/cobblemon/species/generation8/basculegion.json
2024-01-28 12:36:36 -05:00
Lily 7a15e6b004 Merge remote-tracking branch 'origin/amo/sendout-upgrade' into amo/sendout-upgrade
# Conflicts:
#	CHANGELOG.md
#	common/src/main/resources/assets/cobblemon/bedrock/particles/balls/capture/hisui/hisuicapturestar.particle.json
2024-01-26 17:46:34 -05:00
Lily 6ee6beddeb capture particles... again 2024-01-26 17:45:31 -05:00
Lily b92960da77 Merge branch 'main' into amo/sendout-upgrade 2024-01-26 17:29:13 -05:00
dhi_holo 99618184e7 Heal and Harm
Added translations for the battle text of Dry Skin, Cheek Pouch, Earth Eater, Icy Body, Volt Absorb, Water Absorb, and Sand Tomb.
2024-01-22 16:18:55 +10:00
dhi_holo fcdff126fd Merge branch 'main' into MoreHoldItems 2024-01-22 15:22:31 +10:00
jeffw773 3b285cc8bd - Changes to Relic Coin sack default placement direction for Structures 2024-01-19 10:51:21 -08:00
jeffw773 4dead98e6b - Pesky little chest Gimmieghouls spawn facing the direction of the chest block now 2024-01-18 18:16:09 -08:00
jeffw773 db36f8da2a - Gimmieghoul Chest and Gilded Chest now face the player when placed down 2024-01-18 16:07:45 -08:00
dhi_holo 3a448071d7 Merge branch 'main' into MoreHoldItems 2024-01-16 11:38:51 +10:00
Paul 7215860d74 Merge remote-tracking branch 'origin/gimmighoul_gholdengo' into gimmighoul_gholdengo 2024-01-14 08:08:04 +10:00
Paul dc899ffc1b Fixed gimmighoul stuff for realsies this time 2024-01-14 08:07:49 +10:00
Lily 88fe55bbb9 pouch blocks and bugfixes 2024-01-13 16:23:39 -05:00
Paul 3d3c421b5c Fixed syncing issues with species feature providers 2024-01-12 18:15:10 +10:00
Tyzillion 3c2cfa4ffc Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2024-01-10 18:46:04 -05:00
Lily 89a4edb327 drops and creative inv 2024-01-09 15:59:33 -05:00
Lily ab37580258 gimmighoul chests crash ur game a little bit less now :o 2024-01-09 14:56:50 -05:00
Lily c116c01fd6 licenses 2024-01-09 14:16:09 -05:00
Lily e3ad8f8079 gimmi now challenges the player on reveal 2024-01-09 13:54:35 -05:00
Lily a491d508b6 gilded chest visuals, loot tables/recipes, sounds, etc. 2024-01-09 12:38:58 -05:00
dhi_holo 3e11d0550f More item sprites!
24 left, I think, since there's 4 updates and 4 news today
2024-01-09 18:49:20 +10:00
dhi_holo e8b50f8115 Merge branch 'main' into MoreHoldItems 2024-01-09 11:40:46 +10:00
apion 02fb825328 Update Gimmighoul model, add disguised chest block entity, gilded chests now save contents 2024-01-08 14:05:09 -05:00
Paul 8df6eea107 Fixed various issues with the gilded chest and its animations 2024-01-08 11:00:20 +10:00
apion 1376bb68f4 Tried again, failed again 2024-01-07 11:53:38 -05:00
apion beb8f2ccf1 Merge branch 'main' into gimmighoul_gholdengo
# Conflicts:
#	CHANGELOG.md
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonNetwork.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonSounds.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/storage/party/PlayerPartyStore.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/PoseableEntityModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/repository/PokemonModelRepository.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/net/messages/PokemonDTO.kt
#	common/src/main/resources/assets/cobblemon/lang/en_us.json
#	common/src/main/resources/assets/cobblemon/sounds.json
#	common/src/main/resources/data/cobblemon/species/generation9/gimmighoul.json
2024-01-07 10:41:34 -05:00
dhi_holo 510dfec0e5 Merge branch 'main' into MoreHoldItems 2024-01-06 13:12:24 +10:00
dhi_holo e54932c876 8 Textures
Replaced Black Belt and Focus Band textures, added Covert Cloak, Expert Belt, Focus Sash, Iron Ball, Red Card, and Shell Bell
2024-01-06 13:12:00 +10:00
Tyzillion dd14c3bbdd Implemented Basculegion, Cranidos, and Rampardos. Tyrogue can mount shoulder.
Updated models and textures for Basculin and Squirtle line.
2024-01-05 13:30:57 -05:00
Tyzillion 5ea237f8a0 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2024-01-05 13:29:56 -05:00
dhi_holo fb154ba457 Merge branch 'main' into MoreHoldItems 2024-01-05 08:39:23 +10:00
dhi_holo f7812896a8 Weather Rock Textures
4 down, 36 to go (+6 unimplemented)
2024-01-05 08:38:55 +10:00
Lily b0d57dd875 coin bags and blocks and stuff 2024-01-04 15:56:58 -05:00
Lily 6c09e2b553 Merge remote-tracking branch 'origin/gimmighoul_gholdengo' into gimmighoul_gholdengo 2024-01-04 13:47:21 -05:00
Lily 593104fb0a BIG COIN BAG!! 2024-01-04 13:45:43 -05:00
apion e314664731 Throw some stuff in and hope Hiro can fix it (I need a hero! I'm holding out for a hero...) 2024-01-04 07:31:29 -05:00
apion d0a38a9704 Add chest assets, do some work on getting chest animation working 2024-01-04 06:48:59 -05:00
Lily 6e155d7651 Merge remote-tracking branch 'origin/gimmighoul_gholdengo' into gimmighoul_gholdengo 2024-01-04 00:04:41 -05:00
Lily ae8f8a2fb8 working run button!!! wow!!! 2024-01-04 00:04:26 -05:00
apion 5a6a83aac1 Cleanup, add new model 2024-01-03 23:50:55 -05:00
dhi_holo e8236b55a4 Recipe Fixes plus Information in Description
There are 6 items left unimplemented from the recipe document.
Soothe Bell, due to being an out of battle effect, I don't want to attempt, and Amulet Coin needs design work before implementation.
The four terrain seeds, due to future plans, I'm not sure if need to be set up differently. Beyond those six held items, this branch has all currently requested held items to my knowledge, all should now work as intended, although I have not confirmed all battle dialogue works, in part due to not wanting to find all the documentations of what the lines should be. I might come back to that another day, though.

Commits marked with "No Obtain Method" refer to items which have obtain methods of loot or whatever, which can be handled later by people familiar with those systems. If not, I'm down to learn, just not a thing for today.
2024-01-04 13:52:21 +10:00
dhi_holo 2ea07899ea -Added Sticky Barb
No Obtain Method
2024-01-04 13:01:30 +10:00
dhi_holo d0ce03cd5e -Added Shed Shell
No Obtain Method
2024-01-04 13:00:02 +10:00
dhi_holo 8ae0c409a3 -Added Light Ball
No Obtain Method
2024-01-04 12:58:15 +10:00
dhi_holo 2782cb5f34 -Added Lagging Tail
No Obtain Method
2024-01-04 12:56:09 +10:00
dhi_holo 2f10707211 -Added Grip Claw
No Obtain Method
2024-01-04 12:54:48 +10:00
dhi_holo f40a9d762a -Added Float Stone
No Obtain Method
2024-01-04 12:53:17 +10:00
dhi_holo 17587f97e5 -Added Absorb Bulb
No Obtain Method
2024-01-04 12:51:46 +10:00
dhi_holo 5230820657 -Added Punching Glove 2024-01-04 12:49:01 +10:00
dhi_holo 61c55e136f -Added Throat Spray
need to figure out how to add the potion brewing later, not a huge priority at this stage
2024-01-04 12:45:59 +10:00
dhi_holo 22cced74f5 -Added Luminous Moss 2024-01-04 12:43:40 +10:00
dhi_holo 3cd2dec8e0 -Added Loaded Dice 2024-01-04 12:40:34 +10:00
dhi_holo cea930893a -Added Iron Ball 2024-01-04 10:26:54 +10:00
dhi_holo 8662364ca8 -Added Wide Lens and Zoom Lens 2024-01-04 10:24:00 +10:00
dhi_holo 1fd079b1b4 -Added Weather Rocks
Damp Rock, Heat Rock, Smooth Rock, Icy Rock, terrible items
2024-01-04 10:19:53 +10:00
dhi_holo 244876a26c -Added Weakness Policy 2024-01-04 10:11:52 +10:00
dhi_holo e7790f530f -Added Utility Umbrella 2024-01-04 10:08:56 +10:00
dhi_holo 04a9ab0e67 -Adds Terrain Extender
If someone wants to work out how to make it so we can have a recipe that costs a water bucket, rather than water from a bucket, that'd be good, for now the recipe just costs an empty bucket
2024-01-04 10:06:39 +10:00
dhi_holo 3f338d27c3 -Added Scope Lens 2024-01-04 09:55:46 +10:00
dhi_holo 5da3dfb451 -Added Room Service 2024-01-04 09:54:00 +10:00
dhi_holo fd329e00cd -Added Ring Target 2024-01-04 09:52:00 +10:00
dhi_holo 6da47a8b2c -Added Red Card
Not gonna test this one for now, don't feel like setting up a second instance test. But, given Eject Button works, I'd say decent shot this one also works
2024-01-04 09:49:02 +10:00
dhi_holo 860c73fac9 -Added Protective Pads 2024-01-04 09:45:50 +10:00
dhi_holo e26fdd4bdd -Added Metronome
Deciding I'll ignore all held items with a * next to the name for now, not sure what they mean but hey, makes it easier to work through, and I can come back to them afterwards
2024-01-04 09:42:31 +10:00
dhi_holo 8e642f71b8 Merge branch 'main' into MoreHoldItems 2024-01-04 09:32:19 +10:00
dhi_holo f17884b4e1 Eject Button Lang, Read Description
All of the items added just now by me were tested besides Eviolite (don't feel like crunching those numbers today), Eject Pack is broken in my testing (see https://canary.discord.com/channels/725110639554592879/993671151870017656/1192009424282320957 for details), and ofc no item sprites yet, but that's dev life
2024-01-03 17:53:57 +10:00
dhi_holo c40b456948 -Added Eviolite and Expert Belt
test and finalise this little bit time (also corrected some jsons)
2024-01-03 17:19:31 +10:00
dhi_holo 7e74e85315 -Added Eject Button and Pack
I'm not testing these in game rn, I'll do that at the end of the session, which will probably be in a couple more items. But, these all hit the internet at the same time, so haha
2024-01-03 17:09:13 +10:00
dhi_holo 21fd4d7cbf -Added Covert Cloak 2024-01-03 17:00:58 +10:00
dhi_holo 908bff9892 -Added Cell Battery and Clear Amulet 2024-01-03 16:57:32 +10:00
dhi_holo fa14f70bbb -Added Shell Bell
Bell Go Heal
2024-01-03 15:59:01 +10:00
Lily 188ae2ac85 changes to the gimmighoul evolution system. added relic coins, updated bars, removed NetheriteMaterials and GoldMaterials 2024-01-02 14:09:52 -05:00
dhi_holo 346559f292 Tags on top of Tags
Added a very large amount of tags.
The different tiers of Poké balls, also the Apricorn balls so it's easier for people to see what balls count for that advancement, different healing and battle item types, some evolution item sets which made sense to make tags (may add more later, these ones were just the obvious ones to make thing easier for future), the three colours for tumblestones, machine blocks, as well as adding the fence gate item tag, and adding the new tumblestone stuff to the pickaxe tag (although they can still be mined with an axe, probably something that needs fixing)

Mod loader tags were not tested on Forge, due to a crash involving CobblemonEntities, but Fabric works all nicely
2024-01-02 14:44:01 +10:00
dhi_holo 331b282fcf Decorated sherds tag, and fixed Focus Sash not being named
`focus_Sash` isn't valid, sadly
2024-01-02 12:41:28 +10:00
dhi_holo 7f97eeafed Update is_held_item.json
Reorganized alphabetically, for the most part, roughly matches the registry now.
2024-01-02 11:45:38 +10:00
dhi_holo 51f5a1f5a8 Merge branch 'main' into MoreHoldItems 2024-01-02 11:35:53 +10:00
dhi_holo 7c0535b8bd Merge branch 'main' into MoreHoldItems 2024-01-01 21:08:33 +10:00
dhi_holo 4f15ac0cbc Update CobblemonItems.kt
No More "why are the held items not in alphabetical order" for the time being (besides the three Powders and four Herbs, I left them together at the bottom because nobody cares about them)
2024-01-01 18:37:53 +10:00
JazzMcNade 35a0d8a80d -Added Blunder Policy 2024-01-01 01:31:08 -06:00
JazzMcNade c0270d3ef0 -Added Binding Band 2023-12-31 23:58:24 -06:00
JazzMcNade 82a1eb2a55 -Finished Air Balloon implementation. Fixed white space on recipes for for focus sash and Ability Shield 2023-12-31 21:44:26 -06:00
JazzMcNade a528ea952a -Added Ability Shield and Focus Sash. Begin work on Air Balloon. 2023-12-31 21:20:10 -06:00
Tyzillion af2df51a2a Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2023-12-30 18:25:27 -05:00
Lily 95a0f9603c gilded chest model stuffs 2023-12-27 14:54:28 -05:00
Tyzillion d38aa6b1a2 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-12-24 22:45:50 -05:00
Tyzillion 4566e1b33f Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2023-12-24 07:07:56 -05:00
Tyzillion f2d16ca9b7 Implemented Lileep, Cradily, Tirtouga, Carracosta, Arctovish, Dracovish, Arctozolt, Dracozolt, Shieldon, Bastiodon.
Updated models for Kabuto, Kabutops, Piplup, Prinplup, Elekid, Electabuzz, Cubone, Marowak, Paras, Venonat, Venomoth, Yanma, and Yanmega, and Raboot. Resized Snorlax.
2023-12-23 17:47:44 -05:00
Lily d6fbb70db0 add level ranges to DisguisedPokemonBlock 2023-12-11 16:10:13 -05:00
Lily 150a5c668a redid disguised gimmighouls 2023-12-11 14:55:43 -05:00
Lily 1bf01a2826 more bar stuff 2023-11-30 15:16:32 -05:00
Lily 4d1bf677a1 bar color update 2023-11-29 21:49:06 -05:00
Lily 069f56acfd gholdengo/gimmighoul are basically done, gilded chests still unfinished 2023-11-29 20:32:20 -05:00
Lily 19cdc8fbef Merge remote-tracking branch 'origin/gimmighoul_gholdengo' into gimmighoul_gholdengo 2023-11-27 17:31:27 -05:00
Lily 1408b94f06 started on gilded chests 2023-11-27 17:31:17 -05:00
Paul de081dc514 Added aspects support for int range features 2023-11-27 11:53:06 +10:00
Lily 1538f12934 more gimmighoul changes 2023-11-14 20:59:10 -05:00
Paul 857f67604c Fixed some logic in held item event + gimmighoul item 2023-11-14 19:30:27 +10:00
Paul ae49e3f977 Fixed gold materials data registry not being loaded 2023-11-14 19:18:45 +10:00
Lily ec01a03820 pushed some stuff idk what to put here 2023-11-14 00:47:15 -05:00
Lily 96cc3671da Merge branch 'held_item_event' into gimmighoul_gholdengo 2023-11-13 18:36:09 -05:00
Lily ad7c9c560c add an event for updating a pokemon's held item 2023-11-13 18:33:45 -05:00
Tyzillion ee15ff6b35 Corrected Gimmighoul chest and roaming size. 2023-11-13 16:49:00 -05:00
Tyzillion ca83103703 Bling, bling, every time I come around your city. 2023-11-13 16:33:07 -05:00
Tyzillion 1aeb894b09 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into gimmighoul_gholdengo 2023-11-13 13:42:38 -05:00
Lily 8e9ab26963 json files for gold and netherite materials (doesnt work in-game yet) 2023-11-13 18:09:34 +00:00
Paul 44b4fbcfe3 Minor license thing 2023-11-13 20:04:29 +10:00
Paul 42cc1dd8a9 Upgraded species features so they can be synced and rendered in summary screen 2023-11-13 19:39:17 +10:00
Lily d69310e52c re-do the way the other stats screen draws stuff 2023-11-10 20:15:40 -05:00
Lily a0f89274d1 started work on SummaryValue properties (CW: messy, incomplete systems) 2023-11-10 18:57:11 -05:00
3969 changed files with 228560 additions and 15419 deletions
+132 -3
View File
@@ -1,5 +1,6 @@
# Changelog
## [1.5.0](#1-5-0)
### Additions
- Added over (number here) ruin structures, where you can find Pokémon-themed Armor Trims and Pottery Sherds, Tumblestones, and more.
- Added (number here) fossil structures, where you can brush Suspicious Sand/Gravel for Fossils.
@@ -14,23 +15,133 @@
- Added the hidden "True Vivillionaire" advancement.
- The "Poké Ball" Vivillon variant is now obtainable by evolving a Spewpa after obtaining the "Aspiring Vivillionaire" advancement.
- Added dynamic lighting support for any Species or Forms when using [LambDynamicLights](https://modrinth.com/mod/lambdynamiclights) or [Dynamic Lights Reforged](https://www.curseforge.com/minecraft/mc-mods/dynamiclights-reforged), at this time we don't ship with any defaults for this feature but addon creators can make use of this feature.
- Added a Display Case block! Use it to display your archaeological findings, or other items.
- Added 6 Pokémon-themed Pottery Sherds, obtained from ruin structures.
- Added a Pokémon-themed armor trim, obtained from ruin structures.
- You can now find Nether Fire Stone Ore in, surprisingly, the Nether.
- You'll also find Terracotta Sun Stone Ore in Badlands biomes.
- Added effects for many Poké Balls when sending out Pokémon or capturing.
- Added a new send-out ball toss animation that showcases the ball used for the Pokémon.
- Added simple move animations for Pokémon in battle with a proof of concept for more complicated animations.
- Added the EV Boosting Feathers.
- Added Type Gems.
- Added various new tags for searchability and better compatibility.
- Added the [Ability Capsule](https://bulbapedia.bulbagarden.net/wiki/Ability_Capsule) and [Patch](https://bulbapedia.bulbagarden.net/wiki/Ability_Patch), these have no acquisition method for now and only work as intended with the traditional ability format of 1 to 2 common abilities and 1 hidden ability.
- Added Gilded Chests, available in all Apricorn colors.
- Added Relic Coins, Relic Coin Pouches, and Relic Coin Sacks.
- Added Gimmighoul.
- Added various new tags for searchability and better compatibility.
- Added Type Gems. These items hold no functionality for now. Start collecting though...
- Added 6 custom Pottery Sherds, obtained from ruin structures.
- Added cries to Meowth, Alolan Meowth, Galaraian Meowth,
- Completed the advancement for placing a Tumblestone near Lava or Magma to make it grow.
- Added new held items: Ability Shield, Absorb Bulb, Air Balloon, Binding Band, Blunder Policy, Cell Battery, Covert Cloak, Damp Rock, Eject Button, Eviolite, Expert Belt, Float Stone, Focus Sash, Heat Rock, Icy Rock, Iron Ball, Light Ball, Loaded Dice, Red Card, Shell Bell, Sticky Barb, Smooth Rock, Soothe Bell and Weakness Policy.
### Pokémon Added
#### Gen 2
- Sentret
- Furret
- Qwilfish
- Heracross
- Skarmory
- Ferroseed
- Ferrothorn
#### Gen 3
- Lileep
- Cradily
- Anorith
- Armaldo
- Tropius
- Roselia
#### Gen 4
- Shieldon
- Bastiodon
- Cranidos
- Rampardos
- Budew
- Roserade
#### Gen 5
- Tirtouga
- Carracosta
- Archen
- Archeops
- Zorua
- Zoroark
- Petilil
- Lilligant
- Darumaka
- Darmanitan
- Woobat
- Swoobat
- Sandile
- Krokorok
- Krookodile
- Frillish
- Jellicent
- Cubchoo
- Beartic
- Deino
- Zweilous
- Hydreigon
- Larvesta
- Volcarona
#### Gen 6
- Tyrunt
- Tyrantrum
- Amaura
- Aurorus
- Goomy
- Sliggoo
- Goodra
#### Gen 7
- Turtonator
- Fomantis
- Lurantis
- Salandit
- Salazzle
- Jangmo-o
- Hakamo-o
- Kommo-o
#### Gen 8
- Gossifleur
- Eldegoss
- Arctozolt
- Arctovish
- Dracozolt
- Dracovish
- Basculegion
- Hisuian Zorua
- Hisuian Zoroark
- Hisuian Voltorb
- Hisuian Electrode
- Hisuian Qwilfish
- Overqwil
- Hisuian Sneasel
- Sneasler
- Stonjourner
- Cufant
- Copperajah
- Dreepy
- Drakloak
- Dragapult
- Hisuian Sliggoo
- Hisuian Goodra
#### Gen 9
- Gimmighoul.
- Using Relic Coins, you can increase Gimmighoul's Coin Stash. Upon reaching 999, it can be evolved into Gholdengo.
- Additionally, if you give Gimmighoul a Netherite Scrap, you can increase its Netherite Stash. Who knows what might happen if it fills up?
### Changes
- Pokémon now transition more smoothly between different poses.
- Updated models for Mimikyu, Alcremie, Squirtle, Wartortle, Blastoise, Omanyte, Omastar, Growlithe, Swinub, Piloswine, Basculine, Rowlet, Dartrix, Decidueye, Kabuto, Kabutops, Piplup, Prinplup, Elekid, Electabuzz, Cubone, Marowak, Paras, Drifloon, Drifblim, Venonat, Venomoth, Yanma, Yanmega, and Raboot.
- Updated animations for Diglett, Dugtrio, Dragonite, Omanyte, Omastar, Pinsir, Falinks, Lechonk, Litwick, Lampent, Chandelure, Carnivine, Galarian Meowth, Galarian Rapidash, Venonat, Venomoth, Phanphy, Donphan, Dratini, Dragonair, Happiny, Chansey, Blissey, Volbeat, Illumise, Numel, Drifloon, and Drifblim.
- Added more held items to the held item tag, and Metal Coat to the held item tab.
- Added all ores to the modloader ore tags, and added tags for each ore type to the mod (both blocks and items).
- Changed the Destiny Knot to be crafted with a Ghast Tear, rather than a diamond.
@@ -41,8 +152,16 @@
- Apricorn Sprouts can now be planted directly on Apricorn leaves to create a new Apricorn of the same color.
- Added tooltips to interaction GUIs to make it clearer what they do.
- Poké Ball recipes now use tags for their center ingredient, rather than specificied Copper Ingot, Iron Ingot, Gold Ingot, and Diamond, allowing for further datapack customisation.
- Starter Toast now closes once corresponding button is pressed once.
- Moved some items in the vanilla Food & Drinks category.
- Stacked Cobblemon Potion Bases can now be quick moved into Brewing Stands.
- Changed Healer recipe to swap the Max Revive for a Revive.
- Upped the rate that Gastly drop Ghast Tears from 2.5% to 5%.
- Pokémon with a low Blaze Powder drop chance now drop it more frequently in the Nether.
- Reorganised a few advancements.
### Fixes
- Resized Snorlax.
- Re-added the recipe for the Iron Vitamin.
- Cleaned up empty evolutions declaration in species files (no, I'm not listing all 169 by name).
- Fixed Exeggcute not being able to evolve.
@@ -61,6 +180,8 @@
- Fixed incompatibility with [Just Enough Resources](https://modrinth.com/mod/just-enough-resources-jer).
- Fixed incompatibility with [Visual Overhaul](https://modrinth.com/mod/visual-overhaul).
- Fixed an issue that allowed Pokemon to spawn on rails.
- Fixed the data set on Pokémon when abilities are given via properties such as in ``/spawnpokemon``.
- Fixed sometimes Pokémon losing hidden abilities when evolving, this fix will only take effect to newly created Pokémon.
### Developer
- Significantly changed the way properties in PokemonEntity work. This could break some plugins (not in a big way, but changes will be needed).
@@ -72,7 +193,13 @@
- Made PokemonProperties.parse more interoperable with Java.
- Added the ``HeldItemEvent``, this comes with 2 implementation ``HeldItemEvent.Pre`` and ``HeldItemEvent.Post``.
- API to support dynamic lighting in any mod that implements this feature has been added to all Species & Forms, see LightingData class for details.
- Added a Mixin for the BrewingStandScreenHandler to fix the incorrect handling of quickMove in Fabric.
- Corrections to the ability implementation have been made that make ``Ability.forced`` function as intended and never reroll an ability for a Pokémon, please check your implementations to ensure the corrected behavior is intended for your use case.
- ``Pokemon.ability`` no longer has a public setter, please migrate to using ``Pokemon#updateAbility``, this handles the ability coordinate storage for you when necessary.
- ``Ability.forced``, ``Ability.index`` and ``Ability.priority`` have all had their setters internalized, there is no longer any need to manually adjust these migrate to the method mentioned above to handle that process for you.
- ``AbilityChanger`` has been added to API alongside some implementations, this is subject to change as the ability capsule and patch currently only expect the traditional behaviour in the Pokémon games of 1 to 2 regular abilities and 1 hidden.
- ``Pokemon#rollAbility`` has been added, this rerolls a legal ability for the Pokémon.
- `docs/cobblemon-tags` tags and spawn-presets can now be auto-generated from the current tags in the cobblemon mod with the `generateSpawnPresetList.py` and `generateTagList.py` scripts.
- `public_spawns_to_json.py` script has been added to give the powerful spawn.json generator a simplistic UI.
### Datapack & Resourcepack Creators
- The maximum amount of fossils that can fit in the Fossil Analyzer can be adjusted in the config.
@@ -107,6 +234,8 @@
}
```
- Following up on this change ``light_source`` was removed as a possible shoulder effect due to becoming unnecessary and never having had a default implementation.
- Added the item tag ``cobblemon:ability_changers``, contains the ``cobblemon:ability_capsule`` & ``cobblemon:ability_patch`` by default.
- Added the item tag ``cobblemon:held/is_friendship_booster``, allows items to give the Soothe Bell effect of a boost of 1.5x Friendship gained, contains ``cobblemon:soothe_bell`` by default.
## [1.4.1 (December 23rd, 2023)](#1-4-1)
@@ -1042,4 +1171,4 @@ Thank you so much to all of our community translators that bring the mod to the
- Added species, ability, and move translations for `ko_ko`, `jp_jp`, `fr_fr`, `es_es`, `it_it`, and `zh_cn`.
## [1.0.0 (November 12th, 2022)](#1-0-0)
- Initial release.
- Initial release.
+3
View File
@@ -15,4 +15,7 @@ dependencies {
implementation(libs.shadow)
implementation(libs.loom)
implementation(libs.architecturyPlugin)
implementation(libs.blossom)
implementation(libs.ideaExt)
}
@@ -1,3 +1,6 @@
import extensions.VersionType
import extensions.writeVersion
plugins {
java
`java-library`
@@ -31,7 +34,7 @@ publishing {
groupId = "com.cobblemon"
artifactId = project.findProperty("maven.artifactId")?.toString() ?: project.name
version = rootProject.version.toString()
version = project.writeVersion(VersionType.PUBLISHING)
}
}
}
@@ -0,0 +1,24 @@
package extensions
import org.gradle.api.Project
fun Project.version(): String {
return rootProject.property("mod_version").toString()
}
fun Project.isSnapshot(): Boolean {
return rootProject.property("snapshot") == "true"
}
fun Project.writeVersion(type: VersionType = VersionType.FULL): String {
val version = "${rootProject.property("mod_version")}+${rootProject.property("mc_version")}"
return when (type) {
VersionType.PUBLISHING -> if(this.isSnapshot()) "$version-SNAPSHOT" else version
VersionType.FULL -> if(this.isSnapshot()) rootProject.version.toString() else version
}
}
enum class VersionType {
PUBLISHING,
FULL
}
+2 -2
View File
@@ -9,5 +9,5 @@ version = "${project.property("mod_version")}+${project.property("mc_version")}"
val isSnapshot = project.property("snapshot")?.equals("true") ?: false
if (isSnapshot) {
version = "$version-SNAPSHOT-${versioning.info.branch}-${versioning.info.build}"
}
version = "$version-${versioning.info.branch}-${versioning.info.build}"
}
+42 -2
View File
@@ -1,3 +1,9 @@
import extensions.isSnapshot
import extensions.version
import java.time.OffsetDateTime
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter
/*
*
* * Copyright (C) 2023 Cobblemon Contributors
@@ -11,6 +17,10 @@
plugins {
id("cobblemon.base-conventions")
id("cobblemon.publish-conventions")
id("net.kyori.blossom")
id("org.jetbrains.gradle.plugin.idea-ext")
id ("net.nemerosa.versioning") version "2.8.2"
}
architectury {
@@ -44,8 +54,7 @@ dependencies {
modCompileOnly(libs.mongoDriverCore)
modCompileOnly(libs.mongoDriverSync)
testRuntimeOnly(libs.junitEngine)
testImplementation(libs.junitApi)
testImplementation(libs.fabricJunit)
testImplementation(libs.junitParams)
testImplementation(libs.mockito)
testImplementation(libs.mockk)
@@ -59,3 +68,34 @@ tasks.withType<Test> {
setExceptionFormat("full")
}
}
sourceSets {
main {
blossom {
kotlinSources {
fun generateLicenseHeader() : String {
val builder = StringBuilder()
builder.append("/*\n")
rootProject.file("HEADER").forEachLine {
if(it.isEmpty()) {
builder.append(" *").append("\n")
} else {
builder.append(" * ").append(it).append("\n")
}
}
return builder.append(" */").append("\n").toString()
}
property("license", generateLicenseHeader())
property("modid", "cobblemon")
property("version", project.version())
property("isSnapshot", if(rootProject.isSnapshot()) "true" else "false")
property("gitCommit", versioning.info.commit)
property("branch", versioning.info.branch)
System.getProperty("buildNumber")?.let { property("buildNumber", it) }
property("timestamp", OffsetDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern("MM/dd/yyyy hh:mm:ss")) + " UTC")
}
}
}
}
@@ -0,0 +1,35 @@
/*
* 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.CobblemonBuildDetails;
import net.minecraft.util.crash.CrashReport;
import net.minecraft.util.crash.CrashReportSection;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(CrashReport.class)
public final class CrashReportMixin {
@Inject(method = "addStackTrace", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/SystemDetails;writeTo(Ljava/lang/StringBuilder;)V"))
public void cobblemon$printCobblemonDetails(StringBuilder builder, CallbackInfo callback) {
CrashReportSection cobblemon = new CrashReportSection("Cobblemon");
cobblemon.add("Version", CobblemonBuildDetails.VERSION);
cobblemon.add("Is Snapshot", CobblemonBuildDetails.SNAPSHOT);
cobblemon.add("Git Commit", CobblemonBuildDetails.INSTANCE.smallCommitHash() + " (" + "https://gitlab.com/cable-mc/cobblemon/-/commit/" + CobblemonBuildDetails.GIT_COMMIT + ")");
cobblemon.add("Branch", CobblemonBuildDetails.BRANCH);
cobblemon.add("Timestamp", CobblemonBuildDetails.TIMESTAMP);
cobblemon.addStackTrace(builder);
builder.append("\n\n");
}
}
@@ -9,18 +9,23 @@
package com.cobblemon.mod.common.mixin;
import com.cobblemon.mod.common.CobblemonItems;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.mob.PiglinEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(PiglinEntity.class)
public class PiglinEntityMixin {
@Redirect(method = "equipToOffHand", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;isOf(Lnet/minecraft/item/Item;)Z"))
public boolean cobblemon$isValidBarteringItem(ItemStack stack, Item item) {
//TODO: Make a tag?
return stack.isOf(item) || stack.isOf(CobblemonItems.RELIC_COIN_POUCH);
public abstract class PiglinEntityMixin {
@Inject(method = "equipToOffHand", at = @At(value = "HEAD"), cancellable = true)
public void cobblemon$isValidBarteringItem(ItemStack stack, CallbackInfo ci) {
PiglinEntity entity = (PiglinEntity)(Object) this;
if (stack.isOf(CobblemonItems.RELIC_COIN_POUCH)) {
entity.equipStack(EquipmentSlot.OFFHAND, stack);
entity.updateDropChances(EquipmentSlot.OFFHAND);
ci.cancel();
}
}
}
@@ -0,0 +1,18 @@
{{ license }}
package com.cobblemon.mod.common
object CobblemonBuildDetails {
const val MOD_ID = "{{ modid }}"
const val VERSION = "{{ version }}"
const val SNAPSHOT = {{ isSnapshot }}
const val GIT_COMMIT = "{{ gitCommit | default("Not Specified") }}"
const val BRANCH = "{{ branch | default("Not Specified") }}"
const val TIMESTAMP = "{{ timestamp }}"
fun smallCommitHash(): String {
return this.GIT_COMMIT.substring(0, 7)
}
}
@@ -8,6 +8,7 @@
package com.cobblemon.mod.common
import com.cobblemon.mod.common.CobblemonBuildDetails.smallCommitHash
import com.cobblemon.mod.common.advancement.CobblemonCriteria
import com.cobblemon.mod.common.advancement.criterion.EvolvePokemonContext
import com.cobblemon.mod.common.api.Priority
@@ -16,10 +17,10 @@ import com.cobblemon.mod.common.api.data.DataProvider
import com.cobblemon.mod.common.api.drop.CommandDropEntry
import com.cobblemon.mod.common.api.drop.DropEntry
import com.cobblemon.mod.common.api.drop.ItemDropEntry
import com.cobblemon.mod.common.api.events.CobblemonEvents
import com.cobblemon.mod.common.api.events.CobblemonEvents.BATTLE_VICTORY
import com.cobblemon.mod.common.api.events.CobblemonEvents.DATA_SYNCHRONIZED
import com.cobblemon.mod.common.api.events.CobblemonEvents.EVOLUTION_COMPLETE
import com.cobblemon.mod.common.api.events.CobblemonEvents.HELD_ITEM_UPDATED
import com.cobblemon.mod.common.api.events.CobblemonEvents.LEVEL_UP_EVENT
import com.cobblemon.mod.common.api.events.CobblemonEvents.POKEMON_CAPTURED
import com.cobblemon.mod.common.api.events.CobblemonEvents.TRADE_COMPLETED
@@ -35,7 +36,10 @@ import com.cobblemon.mod.common.api.pokemon.effect.ShoulderEffectRegistry
import com.cobblemon.mod.common.api.pokemon.experience.ExperienceCalculator
import com.cobblemon.mod.common.api.pokemon.experience.ExperienceGroups
import com.cobblemon.mod.common.api.pokemon.experience.StandardExperienceCalculator
import com.cobblemon.mod.common.api.pokemon.feature.*
import com.cobblemon.mod.common.api.pokemon.feature.ChoiceSpeciesFeatureProvider
import com.cobblemon.mod.common.api.pokemon.feature.FlagSpeciesFeatureProvider
import com.cobblemon.mod.common.api.pokemon.feature.IntSpeciesFeatureProvider
import com.cobblemon.mod.common.api.pokemon.feature.SpeciesFeatures
import com.cobblemon.mod.common.api.pokemon.helditem.HeldItemProvider
import com.cobblemon.mod.common.api.pokemon.stats.EvCalculator
import com.cobblemon.mod.common.api.pokemon.stats.Generation8EvCalculator
@@ -62,6 +66,7 @@ import com.cobblemon.mod.common.api.storage.player.PlayerDataStoreManager
import com.cobblemon.mod.common.api.storage.player.factory.JsonPlayerDataStoreFactory
import com.cobblemon.mod.common.api.storage.player.factory.MongoPlayerDataStoreFactory
import com.cobblemon.mod.common.api.tags.CobblemonEntityTypeTags
import com.cobblemon.mod.common.api.tags.CobblemonItemTags
import com.cobblemon.mod.common.battles.BagItems
import com.cobblemon.mod.common.battles.BattleFormat
import com.cobblemon.mod.common.battles.BattleRegistry
@@ -93,7 +98,6 @@ import com.cobblemon.mod.common.pokemon.aspects.SHINY_ASPECT
import com.cobblemon.mod.common.pokemon.evolution.variants.BlockClickEvolution
import com.cobblemon.mod.common.pokemon.feature.TagSeasonResolver
import com.cobblemon.mod.common.pokemon.helditem.CobblemonHeldItemManager
import com.cobblemon.mod.common.pokemon.misc.GimmighoulStashHandler
import com.cobblemon.mod.common.pokemon.properties.HiddenAbilityPropertyType
import com.cobblemon.mod.common.pokemon.properties.UncatchableProperty
import com.cobblemon.mod.common.pokemon.properties.tags.PokemonFlagProperty
@@ -115,31 +119,32 @@ import com.mongodb.ConnectionString
import com.mongodb.MongoClientSettings
import com.mongodb.client.MongoClient
import com.mongodb.client.MongoClients
import java.io.File
import java.io.FileReader
import java.io.FileWriter
import java.io.PrintWriter
import java.util.UUID
import kotlin.properties.Delegates
import kotlin.reflect.full.memberProperties
import kotlin.reflect.jvm.isAccessible
import kotlin.reflect.jvm.javaField
import net.minecraft.client.MinecraftClient
import net.minecraft.command.argument.serialize.ConstantArgumentSerializer
import net.minecraft.entity.data.TrackedDataHandlerRegistry
import net.minecraft.item.Items
import net.minecraft.item.NameTagItem
import net.minecraft.registry.RegistryKey
import net.minecraft.sound.SoundCategory
import net.minecraft.util.WorldSavePath
import net.minecraft.world.World
import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.Logger
import java.io.File
import java.io.FileReader
import java.io.FileWriter
import java.io.PrintWriter
import java.util.*
import kotlin.properties.Delegates
import kotlin.reflect.full.memberProperties
import kotlin.reflect.jvm.isAccessible
import kotlin.reflect.jvm.javaField
import kotlin.math.roundToInt
object Cobblemon {
const val MODID = "cobblemon"
const val VERSION = "1.4.0"
const val CONFIG_PATH = "config/$MODID/main.json"
val LOGGER = LogManager.getLogger()
val LOGGER: Logger = LogManager.getLogger()
lateinit var implementation: CobblemonImplementation
@Deprecated("This field is now a config value", ReplaceWith("Cobblemon.config.captureCalculator"))
@@ -169,6 +174,14 @@ object Cobblemon {
fun preInitialize(implementation: CobblemonImplementation) {
this.implementation = implementation
this.LOGGER.info("Launching Cobblemon ${CobblemonBuildDetails.VERSION}${if(CobblemonBuildDetails.SNAPSHOT) "-SNAPSHOT" else ""} ")
if(CobblemonBuildDetails.SNAPSHOT) {
this.LOGGER.info(" - Git Commit: ${smallCommitHash()} (https://gitlab.com/cable-mc/cobblemon/-/commit/${CobblemonBuildDetails.GIT_COMMIT})")
this.LOGGER.info(" - Branch: ${CobblemonBuildDetails.BRANCH}")
this.LOGGER.info(" - Timestamp: ${CobblemonBuildDetails.TIMESTAMP}")
}
implementation.registerPermissionValidator()
implementation.registerSoundEvents()
implementation.registerBlocks()
@@ -231,6 +244,9 @@ object Cobblemon {
}
}
// Register the grow_tumblestone advancement
PlatformEvents.RIGHT_CLICK_BLOCK.subscribe { AdvancementHandler.onTumbleStonePlaced(it) }
PlatformEvents.CHANGE_DIMENSION.subscribe {
it.player.party().forEach { pokemon -> pokemon.entity?.recallWithAnimation() }
}
@@ -240,6 +256,16 @@ object Cobblemon {
TrackedDataHandlerRegistry.register(PoseTypeDataSerializer)
TrackedDataHandlerRegistry.register(IdentifierDataSerializer)
// Lowest priority because this applies after luxury ball bonus as of gen 4
CobblemonEvents.FRIENDSHIP_UPDATED.subscribe(Priority.LOWEST) { event ->
var increment = (event.newFriendship - event.pokemon.friendship).toFloat()
// Our Luxury ball spec is diff from official, but we will still assume these stack
if (event.pokemon.heldItemNoCopy().isIn(CobblemonItemTags.IS_FRIENDSHIP_BOOSTER)) {
increment += increment * 0.5F
}
event.newFriendship = event.pokemon.friendship + increment.roundToInt()
}
HeldItemProvider.register(CobblemonHeldItemManager, Priority.LOWEST)
}
@@ -17,6 +17,7 @@ import com.cobblemon.mod.common.block.entity.FossilMultiblockEntity
import com.cobblemon.mod.common.block.entity.RestorationTankBlockEntity
import com.cobblemon.mod.common.block.multiblock.FossilMultiblockBuilder
import com.cobblemon.mod.common.block.entity.*
import com.cobblemon.mod.common.block.entity.DisplayCaseBlockEntity
import com.cobblemon.mod.common.platform.PlatformRegistry
import net.minecraft.block.entity.BlockEntityType
import net.minecraft.registry.Registries
@@ -77,4 +78,9 @@ object CobblemonBlockEntities : PlatformRegistry<Registry<BlockEntityType<*>>, R
CobblemonBlocks.FOSSIL_ANALYZER
).build(null)
)
@JvmField
val DISPLAY_CASE: BlockEntityType<DisplayCaseBlockEntity> = this.create("display_case",
BlockEntityType.Builder.create(::DisplayCaseBlockEntity, CobblemonBlocks.DISPLAY_CASE).build(null)
)
}
@@ -72,6 +72,8 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
@JvmField
val SUN_STONE_ORE = evolutionStoneOre("sun_stone_ore")
@JvmField
val TERRACOTTA_SUN_STONE_ORE = evolutionStoneOre("terracotta_sun_stone_ore")
@JvmField
val THUNDER_STONE_ORE = evolutionStoneOre("thunder_stone_ore")
@JvmField
val WATER_STONE_ORE = evolutionStoneOre("water_stone_ore")
@@ -158,7 +160,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
@JvmField
val BIG_ROOT = this.create("big_root", BigRootBlock(AbstractBlock.Settings.create().pistonBehavior(PistonBehavior.DESTROY).burnable().mapColor(MapColor.DARK_GREEN).noCollision().ticksRandomly().breakInstantly().sounds(CobblemonSounds.BIG_ROOT_SOUNDS)))
@JvmField
val REVIVAL_HERB = this.create("revival_herb", RevivalHerbBlock(AbstractBlock.Settings.create().pistonBehavior(PistonBehavior.DESTROY).mapColor(MapColor.DARK_GREEN).burnable().noCollision().breakInstantly().sounds(BlockSoundGroup.CROP)))
val REVIVAL_HERB = this.create("revival_herb", RevivalHerbBlock(AbstractBlock.Settings.create().pistonBehavior(PistonBehavior.DESTROY).mapColor(MapColor.DARK_GREEN).burnable().noCollision().breakInstantly().sounds(CobblemonSounds.REVIVAL_HERB_SOUNDS)))
@JvmField
val TUMBLESTONE_CLUSTER = tumblestoneBlock("tumblestone_cluster", GrowableStoneBlock.STAGE_3, 7, 3, null)
@@ -387,6 +389,18 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
)
@JvmField
val DISPLAY_CASE = create(
"display_case",
DisplayCaseBlock(
AbstractBlock.Settings.create()
.sounds(CobblemonSounds.DISPLAY_CASE_SOUNDS)
.nonOpaque()
.pistonBehavior(PistonBehavior.BLOCK)
.mapColor(MapColor.STONE_GRAY)
.strength(0.3f)
)
)
val RED_MINT = create("red_mint", MintBlock(MintType.RED, AbstractBlock.Settings.create().mapColor(MapColor.RED).noCollision().ticksRandomly().breakInstantly().sounds(CobblemonSounds.MINT_SOUNDS)))
@JvmField
val BLUE_MINT = create("blue_mint", MintBlock(MintType.BLUE, AbstractBlock.Settings.create().mapColor(MapColor.BLUE).noCollision().ticksRandomly().breakInstantly().sounds(CobblemonSounds.MINT_SOUNDS)))
@@ -414,7 +428,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
)
@JvmField
val VIVICHOKE_SEEDS = this.create("vivichoke_seeds", VivichokeBlock(AbstractBlock.Settings.create().pistonBehavior(PistonBehavior.DESTROY).burnable().mapColor(MapColor.DARK_GREEN).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP)))
val VIVICHOKE_SEEDS = this.create("vivichoke_seeds", VivichokeBlock(AbstractBlock.Settings.create().pistonBehavior(PistonBehavior.DESTROY).burnable().mapColor(MapColor.DARK_GREEN).noCollision().ticksRandomly().breakInstantly().sounds(CobblemonSounds.VIVICHOKE_SOUNDS)))
@JvmField
val PEP_UP_FLOWER = this.create("pep_up_flower", FlowerBlock(StatusEffects.LEVITATION, 10, AbstractBlock.Settings.create().mapColor(MapColor.DARK_GREEN).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XZ).pistonBehavior(PistonBehavior.DESTROY)))
@JvmField
@@ -48,5 +48,9 @@ object CobblemonCommands {
PokemonRestartCommand.register(dispatcher)
BedrockParticleCommand.register(dispatcher)
OpenDialogueCommand.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
CobblemonInfoCommand.register(dispatcher)
}
}
@@ -8,6 +8,7 @@
package com.cobblemon.mod.common
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
@@ -29,6 +30,8 @@ import com.cobblemon.mod.common.item.berry.PortionHealingBerryItem
import com.cobblemon.mod.common.item.berry.StatusCuringBerryItem
import com.cobblemon.mod.common.item.berry.VolatileCuringBerryItem
import com.cobblemon.mod.common.item.interactive.*
import com.cobblemon.mod.common.item.interactive.PotionItem
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.helditem.CobblemonHeldItemManager
@@ -37,14 +40,7 @@ import net.minecraft.block.Block
import net.minecraft.entity.LivingEntity
import net.minecraft.entity.effect.StatusEffectInstance
import net.minecraft.entity.effect.StatusEffects
import net.minecraft.item.BlockItem
import net.minecraft.item.FoodComponent
import net.minecraft.item.HangingSignItem
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
import net.minecraft.item.SignItem
import net.minecraft.item.SmithingTemplateItem
import net.minecraft.item.StewItem
import net.minecraft.item.*
import net.minecraft.registry.Registries
import net.minecraft.registry.Registry
import net.minecraft.registry.RegistryKey
@@ -258,6 +254,8 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
val PC = blockItem("pc", CobblemonBlocks.PC)
@JvmField
val PASTURE = blockItem("pasture", CobblemonBlocks.PASTURE)
@JvmField
val DISPLAY_CASE = blockItem("display_case", CobblemonBlocks.DISPLAY_CASE)
// Evolution items
@JvmField val LINK_CABLE = create("link_cable", LinkCableItem())
@@ -285,6 +283,8 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
@JvmField val RIBBON_SWEET = noSettingsItem("ribbon_sweet")
@JvmField val CHIPPED_POT = noSettingsItem("chipped_pot")
@JvmField val CRACKED_POT = noSettingsItem("cracked_pot")
@JvmField val MASTERPIECE_TEACUP = noSettingsItem("masterpiece_teacup")
@JvmField val UNREMARKABLE_TEACUP = noSettingsItem("unremarkable_teacup")
@JvmField val SWEET_APPLE = noSettingsItem("sweet_apple")
@JvmField val TART_APPLE = noSettingsItem("tart_apple")
@JvmField val GALARICA_CUFF = noSettingsItem("galarica_cuff")
@@ -408,7 +408,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
@JvmField
val CLEVER_FEATHER = create("clever_feather", FeatherItem(Stats.SPECIAL_DEFENCE))
@JvmField
val MEDICINAL_LEEK = create("medicinal_leek", MedicinalLeekItem(CobblemonBlocks.MEDICINAL_LEEK, Item.Settings().food(FoodComponent.Builder().snack().hunger(1).saturationModifier(0.2f).build())))
val MEDICINAL_LEEK = heldItem("medicinal_leek", MedicinalLeekItem(CobblemonBlocks.MEDICINAL_LEEK, Item.Settings().food(FoodComponent.Builder().snack().hunger(1).saturationModifier(0.2f).build())), "leek")
@JvmField
val ROASTED_LEEK = create("roasted_leek", Item(Item.Settings().food(FoodComponent.Builder().snack().hunger(3).saturationModifier(0.3f).build())))
@JvmField
@@ -558,6 +558,11 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
@JvmField val ELIXIR = create("elixir", ElixirItem(max = false))
@JvmField val MAX_ELIXIR = create("max_elixir", ElixirItem(max = true))
@JvmField
val ABILITY_CAPSULE = this.create("ability_capsule", AbilityChangeItem(AbilityChanger.COMMON_ABILITY))
@JvmField
val ABILITY_PATCH = this.create("ability_patch", AbilityChangeItem(AbilityChanger.HIDDEN_ABILITY))
/**
* Evolution Ores and Stones
*/
@@ -578,6 +583,8 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
@JvmField
val SUN_STONE_ORE = blockItem("sun_stone_ore", CobblemonBlocks.SUN_STONE_ORE)
@JvmField
val TERRACOTTA_SUN_STONE_ORE = blockItem("terracotta_sun_stone_ore", CobblemonBlocks.TERRACOTTA_SUN_STONE_ORE)
@JvmField
val THUNDER_STONE_ORE = blockItem("thunder_stone_ore", CobblemonBlocks.THUNDER_STONE_ORE)
@JvmField
val WATER_STONE_ORE = blockItem("water_stone_ore", CobblemonBlocks.WATER_STONE_ORE)
@@ -629,16 +636,28 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
// Held Items
@JvmField
val ABILITY_SHIELD = heldItem("ability_shield")
@JvmField
val ABSORB_BULB = heldItem("absorb_bulb")
@JvmField
val AIR_BALLOON = heldItem("air_balloon")
@JvmField
val ASSAULT_VEST = heldItem("assault_vest")
@JvmField
val BIG_ROOT = blockItem("big_root", CobblemonBlocks.BIG_ROOT)
@JvmField
val BINDING_BAND = heldItem("binding_band")
@JvmField
val BLACK_BELT = heldItem("black_belt")
@JvmField
val BLACK_GLASSES = heldItem("black_glasses")
@JvmField
val BLACK_SLUDGE = heldItem("black_sludge")
@JvmField
val BLUNDER_POLICY = heldItem("blunder_policy")
@JvmField
val CELL_BATTERY = heldItem("cell_battery")
@JvmField
val CHARCOAL = heldItem("charcoal_stick", remappedName = "charcoal")
@JvmField
val CHOICE_BAND = heldItem("choice_band")
@@ -649,26 +668,64 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
@JvmField
val CLEANSE_TAG = heldItem("cleanse_tag")
@JvmField
val CLEAR_AMULET = heldItem("clear_amulet")
@JvmField
val COVERT_CLOAK = heldItem("covert_cloak")
@JvmField
val DESTINY_KNOT = heldItem("destiny_knot")
@JvmField
val DRAGON_FANG = heldItem("dragon_fang")
@JvmField
val EJECT_BUTTON = heldItem("eject_button")
@JvmField
val EJECT_PACK = heldItem("eject_pack")
@JvmField
val EVERSTONE = heldItem("everstone")
@JvmField
val EVIOLITE = heldItem("eviolite")
@JvmField
val EXP_SHARE = heldItem("exp_share")
@JvmField
val EXPERT_BELT = heldItem("expert_belt")
@JvmField
val FAIRY_FEATHER = heldItem("fairy_feather")
@JvmField
val FLAME_ORB = heldItem("flame_orb")
@JvmField
val FLOAT_STONE = heldItem("float_stone")
@JvmField
val FOCUS_BAND = heldItem("focus_band")
@JvmField
val FOCUS_SASH = heldItem("focus_sash")
@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 LEFTOVERS = heldItem("leftovers")
@JvmField
val LIFE_ORB = heldItem("life_orb")
@JvmField
val LIGHT_BALL = heldItem("light_ball")
@JvmField
val LIGHT_CLAY = heldItem("light_clay")
@JvmField
val LOADED_DICE = heldItem("loaded_dice")
@JvmField
val LUCKY_EGG = heldItem("lucky_egg")
@JvmField
val LUMINOUS_MOSS = heldItem("luminous_moss")
@JvmField
val MAGNET = heldItem("magnet")
@JvmField
val METRONOME = heldItem("metronome")
@JvmField
val MIRACLE_SEED = heldItem("miracle_seed")
@JvmField
val MUSCLE_BAND = heldItem("muscle_band")
@@ -679,14 +736,42 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
@JvmField
val POISON_BARB = heldItem("poison_barb")
@JvmField
val POWER_ANKLET = heldItem("power_anklet")
@JvmField
val POWER_BAND = heldItem("power_band")
@JvmField
val POWER_BELT = heldItem("power_belt")
@JvmField
val POWER_BRACER = heldItem("power_bracer")
@JvmField
val POWER_LENS = heldItem("power_lens")
@JvmField
val POWER_WEIGHT = heldItem("power_weight")
@JvmField
val PROTECTIVE_PADS = heldItem("protective_pads")
@JvmField
val PUNCHING_GLOVE = heldItem("punching_glove")
@JvmField
val QUICK_CLAW = heldItem("quick_claw")
@JvmField
val RED_CARD = heldItem("red_card")
@JvmField
val RING_TARGET = heldItem("ring_target")
@JvmField
val ROCKY_HELMET = heldItem("rocky_helmet")
@JvmField
val ROOM_SERVICE = heldItem("room_service")
@JvmField
val SAFETY_GOGGLES = heldItem("safety_goggles")
@JvmField
val SCOPE_LENS = heldItem("scope_lens")
@JvmField
val SHARP_BEAK = heldItem("sharp_beak")
@JvmField
val SHED_SHELL = heldItem("shed_shell")
@JvmField
val SHELL_BELL = heldItem("shell_bell")
@JvmField
val SILK_SCARF = heldItem("silk_scarf")
@JvmField
val SILVER_POWDER = heldItem("silver_powder")
@@ -695,10 +780,30 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
@JvmField
val SPELL_TAG = heldItem("spell_tag")
@JvmField
val SMOKE_BALL = heldItem("smoke_ball")
@JvmField
val SOOTHE_BELL = heldItem("soothe_bell")
@JvmField
val STICKY_BARB = heldItem("sticky_barb")
@JvmField
val TERRAIN_EXTENDER = heldItem("terrain_extender")
@JvmField
val THROAT_SPRAY = heldItem("throat_spray")
@JvmField
val TOXIC_ORB = heldItem("toxic_orb")
@JvmField
val TWISTED_SPOON = heldItem("twisted_spoon")
@JvmField
val UTILITY_UMBRELLA = heldItem("utility_umbrella")
@JvmField
val WEAKNESS_POLICY = heldItem("weakness_policy")
@JvmField
val WIDE_LENS = heldItem("wide_lens")
@JvmField
val WISE_GLASSES = heldItem("wise_glasses")
@JvmField
val ZOOM_LENS = heldItem("zoom_lens")
@JvmField
val MENTAL_HERB = compostableHeldItem("mental_herb", null, 1F)
@JvmField
val MIRROR_HERB = compostableHeldItem("mirror_herb", null, 1F)
@@ -713,29 +818,13 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
@JvmField
val QUICK_POWDER = heldItem("quick_powder")
@JvmField
val DESTINY_KNOT = heldItem("destiny_knot")
val DAMP_ROCK = heldItem("damp_rock")
@JvmField
val EVERSTONE = heldItem("everstone")
val HEAT_ROCK = heldItem("heat_rock")
@JvmField
val POWER_ANKLET = heldItem("power_anklet")
val SMOOTH_ROCK = heldItem("smooth_rock")
@JvmField
val POWER_BAND = heldItem("power_band")
@JvmField
val POWER_BELT = heldItem("power_belt")
@JvmField
val POWER_BRACER = heldItem("power_bracer")
@JvmField
val POWER_LENS = heldItem("power_lens")
@JvmField
val POWER_WEIGHT = heldItem("power_weight")
@JvmField
val FLAME_ORB = heldItem("flame_orb")
@JvmField
val LIFE_ORB = heldItem("life_orb")
@JvmField
val TOXIC_ORB = heldItem("toxic_orb")
@JvmField
val SMOKE_BALL = heldItem("smoke_ball")
val ICY_ROCK = heldItem("icy_rock")
// Mulch
@JvmField
@@ -922,6 +1011,16 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
}
}
)
private fun heldItem(name: String, item: Item, remappedName: String? = null) = create(
name = name,
entry = item.also {
if (remappedName != null) {
CobblemonHeldItemManager.registerRemap(it, remappedName)
CobblemonHeldItemManager.registerRemap(Items.BONE, "thickclub")
CobblemonHeldItemManager.registerRemap(Items.SNOWBALL, "snowball")
}
}
)
private fun compostable(item: Item, increaseLevelChance: Float) = Cobblemon.implementation.registerCompostable(item, increaseLevelChance)
@@ -99,27 +99,27 @@ object CobblemonSounds : PlatformRegistry<Registry<SoundEvent>, RegistryKey<Regi
val MULCH_REMOVE = this.create("mulch.remove")
@JvmField
val FOSSIL_MACHINE_ACTIVATE = this.create("fossilmachine.activate")
val FOSSIL_MACHINE_ACTIVATE = this.create("fossil_machine.activate")
@JvmField
val FOSSIL_MACHINE_ACTIVE_LOOP = this.create("fossilmachine.active_loop")
val FOSSIL_MACHINE_ACTIVE_LOOP = this.create("fossil_machine.active_loop")
@JvmField
val FOSSIL_MACHINE_ASSEMBLE = this.create("fossilmachine.assemble")
val FOSSIL_MACHINE_ASSEMBLE = this.create("fossil_machine.assemble")
@JvmField
val FOSSIL_MACHINE_DNA_FULL = this.create("fossilmachine.dna_full")
val FOSSIL_MACHINE_DNA_FULL = this.create("fossil_machine.dna_full")
@JvmField
val FOSSIL_MACHINE_FINISHED = this.create("fossilmachine.finished")
val FOSSIL_MACHINE_FINISHED = this.create("fossil_machine.finished")
@JvmField
val FOSSIL_MACHINE_INSERT_DNA = this.create("fossilmachine.insert_dna")
val FOSSIL_MACHINE_INSERT_DNA = this.create("fossil_machine.insert_dna")
@JvmField
val FOSSIL_MACHINE_INSERT_DNA_SMALL = this.create("fossilmachine.insert_dna_small")
val FOSSIL_MACHINE_INSERT_DNA_SMALL = this.create("fossil_machine.insert_dna_small")
@JvmField
val FOSSIL_MACHINE_INSERT_FOSSIL = this.create("fossilmachine.insert_fossil")
val FOSSIL_MACHINE_INSERT_FOSSIL = this.create("fossil_machine.insert_fossil")
@JvmField
val FOSSIL_MACHINE_RETRIEVE_FOSSIL = this.create("fossilmachine.retrieve_fossil")
val FOSSIL_MACHINE_RETRIEVE_FOSSIL = this.create("fossil_machine.retrieve_fossil")
@JvmField
val FOSSIL_MACHINE_RETRIEVE_POKEMON = this.create("fossilmachine.retrieve_pokemon")
val FOSSIL_MACHINE_RETRIEVE_POKEMON = this.create("fossil_machine.retrieve_pokemon")
@JvmField
val FOSSIL_MACHINE_UNPROTECTED = this.create("fossilmachine.unprotected")
val FOSSIL_MACHINE_UNPROTECTED = this.create("fossil_machine.unprotected")
@JvmField
val COIN_POUCH_BREAK = this.create("coin_pouch.break")
@@ -155,11 +155,21 @@ object CobblemonSounds : PlatformRegistry<Registry<SoundEvent>, RegistryKey<Regi
@JvmField
val ENERGY_ROOT_PLACE = this.create("energy_root.place")
@JvmField
val VIVICHOKE_BREAK = this.create("vivichoke.break")
@JvmField
val VIVICHOKE_PLACE = this.create("vivichoke.place")
@JvmField
val MINT_BREAK = this.create("mint.break")
@JvmField
val MINT_PLACE = this.create("mint.place")
@JvmField
val REVIVAL_HERB_BREAK = this.create("revival_herb.break")
@JvmField
val REVIVAL_HERB_PLACE = this.create("revival_herb.place")
@JvmField
val MEDICINAL_LEEK_BREAK = this.create("medicinal_leek.break")
@JvmField
@@ -277,6 +287,15 @@ object CobblemonSounds : PlatformRegistry<Registry<SoundEvent>, RegistryKey<Regi
SoundEvents.BLOCK_GRASS_FALL
)
@JvmField
val VIVICHOKE_SOUNDS = BlockSoundGroup(1f, 1f,
VIVICHOKE_BREAK,
SoundEvents.BLOCK_GRASS_STEP,
VIVICHOKE_PLACE,
SoundEvents.BLOCK_GRASS_HIT,
SoundEvents.BLOCK_GRASS_FALL
)
@JvmField
val MINT_SOUNDS = BlockSoundGroup(1f, 1f,
MINT_BREAK,
@@ -286,6 +305,15 @@ object CobblemonSounds : PlatformRegistry<Registry<SoundEvent>, RegistryKey<Regi
SoundEvents.BLOCK_GRASS_FALL
)
@JvmField
val REVIVAL_HERB_SOUNDS = BlockSoundGroup(1f, 1f,
REVIVAL_HERB_BREAK,
SoundEvents.BLOCK_GRASS_STEP,
REVIVAL_HERB_PLACE,
SoundEvents.BLOCK_GRASS_HIT,
SoundEvents.BLOCK_GRASS_FALL
)
@JvmField
val GILDED_CHEST_SOUNDS = BlockSoundGroup(1f, 1f,
GILDED_CHEST_BREAK,
@@ -295,5 +323,27 @@ object CobblemonSounds : PlatformRegistry<Registry<SoundEvent>, RegistryKey<Regi
GILDED_CHEST_STEP
)
@JvmField
val DISPLAY_CASE_ADD_ITEM = this.create("display_case.add_item")
@JvmField
val DISPLAY_CASE_REMOVE_ITEM = this.create("display_case.remove_item")
@JvmField
val DISPLAY_CASE_BREAK = this.create("display_case.break")
@JvmField
val DISPLAY_CASE_HIT = this.create("display_case.hit")
@JvmField
val DISPLAY_CASE_PLACE = this.create("display_case.place")
@JvmField
val DISPLAY_CASE_STEP = this.create("display_case.step")
@JvmField
val DISPLAY_CASE_SOUNDS = BlockSoundGroup(1f, 1f,
DISPLAY_CASE_BREAK,
DISPLAY_CASE_STEP,
DISPLAY_CASE_PLACE,
DISPLAY_CASE_HIT,
DISPLAY_CASE_STEP
)
private fun create(name: String): SoundEvent = this.create(name, SoundEvent.of(cobblemonResource(name)))
}
@@ -113,6 +113,14 @@ object CobblemonCriteria {
)
)
// Advancement criteria for [grow_tumblestone.json]
val PLANT_TUMBLESTONE = this.create(
SimpleCriterionTrigger(
cobblemonResource("plant_tumblestone"),
PlantTumblestoneCriterionCondition::class.java
)
)
private fun <T : Criterion<*>> create(criteria: T): T = Cobblemon.implementation.registerCriteria(criteria)
}
@@ -0,0 +1,52 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.advancement.criterion
import com.cobblemon.mod.common.block.TumblestoneBlock
import com.google.gson.JsonObject
import net.minecraft.predicate.entity.LootContextPredicate
import net.minecraft.server.network.ServerPlayerEntity
import net.minecraft.util.Identifier
import net.minecraft.util.math.BlockPos
/**
* A criterion condition for when a tumblestone block is planted
* @param id The identifier of the criterion
* @param predicate The predicate for the criterion
*
* @author Aethen
* @since 02/28/2024
*/
class PlantTumblestoneCriterionCondition(id: Identifier, predicate: LootContextPredicate) :
SimpleCriterionCondition<PlantTumblestoneContext>(id, predicate) {
override fun toJson(json: JsonObject) {
// Add properties to json if needed. None needed for this criterion
}
override fun fromJson(json: JsonObject) {
// Parse properties from json if needed. None needed for this criterion
}
/**
* Checks if the tumblestone block can grow at the given position
* @param player The player that planted the tumblestone block
* @param context The context of the criterion
* @return True if the tumblestone block can grow at the given position, false otherwise
*/
override fun matches(player: ServerPlayerEntity, context: PlantTumblestoneContext): Boolean {
return context.tumbleStoneBlock.canGrow(context.pos, player.world)
}
}
/**
* The context of the [PlantTumblestoneCriterionCondition]
* @param pos The position of the tumblestone block
* @param tumbleStoneBlock The tumblestone block
*/
open class PlantTumblestoneContext(var pos: BlockPos, var tumbleStoneBlock: TumblestoneBlock)
@@ -9,6 +9,7 @@
package com.cobblemon.mod.common.api.abilities
import com.cobblemon.mod.common.api.Priority
import com.cobblemon.mod.common.pokemon.Pokemon
import com.cobblemon.mod.common.util.DataKeys
import com.google.gson.JsonObject
import net.minecraft.nbt.NbtCompound
@@ -21,7 +22,7 @@ import net.minecraft.nbt.NbtCompound
* @author Qu
* @since January 9th, 2022
*/
open class Ability internal constructor(var template: AbilityTemplate, var forced: Boolean) {
open class Ability internal constructor(var template: AbilityTemplate, forced: Boolean) {
val name: String
get() = template.name
@@ -34,16 +35,26 @@ open class Ability internal constructor(var template: AbilityTemplate, var force
/**
* This represents the last known index of this backing ability in the species data.
* If -1 the ability will attempt to find the correct index or reroll itself, this is done in order to be compatible with existing data
* The value can be mutated however this is not recommended by API users.
* @see [Pokemon.updateAbility].
*/
var forced: Boolean = forced
internal set
/**
* This represents the last known index of this backing ability in the species data.
*
* @see [Pokemon.updateAbility].
*/
var index: Int = -1
internal set
/**
* The last known priority of this ability in the species data.
* The value can be mutated however this is not recommended by API users.
*
* @see [Pokemon.updateAbility].
*/
var priority = Priority.LOWEST
internal set
open fun saveToNBT(nbt: NbtCompound): NbtCompound {
nbt.putString(DataKeys.POKEMON_ABILITY_NAME, name)
@@ -62,19 +73,23 @@ open class Ability internal constructor(var template: AbilityTemplate, var force
}
open fun loadFromNBT(nbt: NbtCompound): Ability {
forced = nbt.getBoolean(DataKeys.POKEMON_ABILITY_FORCED)
this.template = Abilities.getOrException(nbt.getString(DataKeys.POKEMON_ABILITY_NAME))
this.forced = nbt.getBoolean(DataKeys.POKEMON_ABILITY_FORCED)
if (nbt.contains(DataKeys.POKEMON_ABILITY_INDEX) && nbt.contains(DataKeys.POKEMON_ABILITY_PRIORITY)) {
this.index = nbt.getInt(DataKeys.POKEMON_ABILITY_INDEX)
this.priority = Priority.valueOf(nbt.getString(DataKeys.POKEMON_ABILITY_PRIORITY))
}
return this
}
open fun loadFromJSON(json: JsonObject): Ability {
forced = json.get(DataKeys.POKEMON_ABILITY_FORCED)?.asBoolean ?: false
this.template = Abilities.getOrException(json.get(DataKeys.POKEMON_ABILITY_NAME).asString)
this.forced = json.get(DataKeys.POKEMON_ABILITY_FORCED)?.asBoolean ?: false
if (json.has(DataKeys.POKEMON_ABILITY_INDEX) && json.has(DataKeys.POKEMON_ABILITY_PRIORITY)) {
this.index = json.get(DataKeys.POKEMON_ABILITY_INDEX).asInt
this.priority = Priority.valueOf(json.get(DataKeys.POKEMON_ABILITY_PRIORITY).asString)
}
return this
}
}
@@ -28,7 +28,6 @@ class AbilityTemplate(
*/
fun create(forced: Boolean = false) = builder(this, forced)
/**
* Returns the Ability and loads the given NBT Tag into it.
*
@@ -42,4 +41,5 @@ class AbilityTemplate(
* Ability extensions need to write and read their needed data from here.
*/
fun create(json: JsonObject) = create().loadFromJSON(json)
}
@@ -0,0 +1,74 @@
/*
* 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.item.ability
import com.cobblemon.mod.common.api.abilities.*
import com.cobblemon.mod.common.item.interactive.ability.AbilityTypeChanger
import com.cobblemon.mod.common.pokemon.Pokemon
import com.cobblemon.mod.common.pokemon.abilities.HiddenAbility
import com.cobblemon.mod.common.pokemon.abilities.HiddenAbilityType
/**
* Represents a change operation for a [Pokemon.ability].
* This is backed by the associated [PotentialAbility].
*
* @param T The type of [PotentialAbility].
*/
interface AbilityChanger<T : PotentialAbility> {
/**
* The [PotentialAbilityType] of type [T].
*/
val type: PotentialAbilityType<T>
/**
* Collects all the possible targets for the [type] and the given [pokemon].
*
* @param pokemon The [Pokemon] being queried.
* @return A set containing all their legal abilities associated with [type], can be empty.
*/
fun queryPossible(pokemon: Pokemon): Set<AbilityTemplate>
/**
* Attempts to update the ability of the given [pokemon].
*
* @param pokemon The [Pokemon] attempting to change an ability.
* @return If the operation was successful.
*/
fun performChange(pokemon: Pokemon): Boolean
/**
* Checks if the current [PotentialAbilityType] of a [Pokemon.ability] is possible to swap from with this.
*
* @param type The [PotentialAbilityType] or null if the ability is forced and/or illegal.
* @return If the operation can be performed.
*/
fun canChangeFrom(type: PotentialAbilityType<*>?): Boolean
companion object {
/**
* An implementation of [AbilityChanger] for [CommonAbility].
*
* While this can be used in custom data scenarios this functions most "game-like" if the Pokémon only has 2 common abilities.
*/
@JvmStatic
val COMMON_ABILITY: AbilityChanger<CommonAbility> = AbilityTypeChanger(CommonAbilityType) { other -> other == CommonAbilityType }
/**
* An implementation of [AbilityChanger] for [HiddenAbility].
*
* While this can be used in custom data scenarios this functions most "game-like" if the Pokémon only has 1 hidden ability.
*/
@JvmStatic
val HIDDEN_ABILITY: AbilityChanger<HiddenAbility> = AbilityTypeChanger(HiddenAbilityType) { other -> other == CommonAbilityType || other == HiddenAbilityType }
}
}
@@ -35,8 +35,8 @@ abstract class MultiblockBlock(properties: Settings) : BlockWithEntity(propertie
itemStack: ItemStack?
) {
if (world is ServerWorld) {
val multiblockEntity = world.getBlockEntity(pos) as MultiblockEntity
multiblockEntity.multiblockBuilder?.validate(world)
val multiblockEntity = world.getBlockEntity(pos) as? MultiblockEntity
multiblockEntity?.multiblockBuilder?.validate(world)
}
super.onPlaced(world, pos, state, placer, itemStack)
}
@@ -52,8 +52,8 @@ abstract class MultiblockBlock(properties: Settings) : BlockWithEntity(propertie
if(hand == Hand.OFF_HAND) {
return ActionResult.SUCCESS
}
val entity = world.getBlockEntity(pos) as MultiblockEntity
if (entity.multiblockStructure != null) {
val entity = world.getBlockEntity(pos) as MultiblockEntity?
if (entity?.multiblockStructure != null) {
return entity.multiblockStructure!!.onUse(state, world, pos, player, hand, hit)
}
return super.onUse(state, world, pos, player, hand, hit)
@@ -205,8 +205,8 @@ object PokeBalls : JsonDataRegistry<PokeBall> {
createDefault("ancient_wing_ball", throwPower = 2.5f, ancient = true)
createDefault("ancient_jet_ball", throwPower = 2.5f, ancient = true)
createDefault("ancient_origin_ball", GuaranteedModifier(), ancient = true)
// Luxury ball effect
CobblemonEvents.FRIENDSHIP_UPDATED.subscribe(priority = Priority.LOWEST) { event ->
// Luxury ball effect, low priority as it must be triggered before soothe bell as of gen 4
CobblemonEvents.FRIENDSHIP_UPDATED.subscribe(priority = Priority.LOW) { event ->
var increment = (event.newFriendship - event.pokemon.friendship).toFloat()
if (increment <= 1F) {
event.pokemon.caughtBall.effects.filterIsInstance<FriendshipEarningBoostEffect>()
@@ -13,12 +13,14 @@ import com.bedrockk.molang.runtime.value.DoubleValue
import com.bedrockk.molang.runtime.value.StringValue
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.abilities.Abilities
import com.cobblemon.mod.common.api.abilities.Ability
import com.cobblemon.mod.common.api.pokeball.PokeBalls
import com.cobblemon.mod.common.api.pokemon.aspect.AspectProvider
import com.cobblemon.mod.common.api.pokemon.stats.Stats
import com.cobblemon.mod.common.api.pokemon.status.Statuses
import com.cobblemon.mod.common.api.properties.CustomPokemonProperty
import com.cobblemon.mod.common.api.types.ElementalTypes
import com.cobblemon.mod.common.api.types.tera.TeraTypes
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.pokemon.*
import com.cobblemon.mod.common.pokemon.status.PersistentStatus
@@ -294,6 +296,18 @@ open class PokemonProperties {
)
fun apply(pokemon: Pokemon) {
// Custom properties check could be duplicated but can't assume 3rd party hasn't done anything type specific
this.customProperties.forEach { it.apply(pokemon) }
this.commonApply(pokemon)
}
fun apply(pokemonEntity: PokemonEntity) {
// Custom properties check could be duplicated but can't assume 3rd party hasn't done anything type specific
this.customProperties.forEach { it.apply(pokemonEntity) }
this.commonApply(pokemonEntity.pokemon)
}
private fun commonApply(pokemon: Pokemon) {
species?.let {
return@let try {
if (it == "random") {
@@ -313,8 +327,8 @@ open class PokemonProperties {
friendship?.let { pokemon.setFriendship(it) }
pokeball?.let { PokeBalls.getPokeBall(it.asIdentifierDefaultingNamespace())?.let { pokeball -> pokemon.caughtBall = pokeball } }
nature?.let { Natures.getNature(it.asIdentifierDefaultingNamespace())?.let { nature -> pokemon.nature = nature } }
ability?.let { Abilities.getOrException(it).create(true).let { ability -> pokemon.ability = ability } }
status?.let { Statuses.getStatus(it)?.let { pokemon.applyStatus(it as PersistentStatus) } }
ability?.let { this.createAbility(it, pokemon.form)?.let(pokemon::updateAbility) }
status?.let { Statuses.getStatus(it)?.let { status -> if (status is PersistentStatus) pokemon.applyStatus(status) } }
customProperties.forEach { it.apply(pokemon) }
ivs?.let { ivs ->
ivs.forEach { stat ->
@@ -326,7 +340,7 @@ open class PokemonProperties {
pokemon.setEV(stat.key, stat.value)
}
}
teraType?.let { ElementalTypes.get(it)?.let { type -> pokemon.teraType = type } }
teraType?.let { TeraTypes.get(it.asIdentifierDefaultingNamespace())?.let { type -> pokemon.teraType = type } }
dmaxLevel?.let { pokemon.dmaxLevel = it }
gmaxFactor?.let { pokemon.gmaxFactor = it }
tradeable?.let { pokemon.tradeable = it }
@@ -355,69 +369,17 @@ open class PokemonProperties {
pokemon.updateAspects()
}
fun apply(pokemonEntity: PokemonEntity) {
species?.let {
return@let try {
if (it == "random") {
PokemonSpecies.species.random()
} else {
PokemonSpecies.getByIdentifier(it.asIdentifierDefaultingNamespace())
}
} catch (e: InvalidIdentifierException) {
null
}
}?.let { pokemonEntity.pokemon.species = it }
nickname?.let { pokemonEntity.pokemon.nickname = it }
form?.let { formID -> pokemonEntity.pokemon.species.forms.firstOrNull { it.formOnlyShowdownId().equals(formID, true) } }?.let { form -> pokemonEntity.pokemon.form = form }
level?.let { pokemonEntity.pokemon.level = it }
shiny?.let { pokemonEntity.pokemon.shiny = it }
gender?.let { pokemonEntity.pokemon.gender = it }
friendship?.let { pokemonEntity.pokemon.setFriendship(it) }
pokeball?.let { PokeBalls.getPokeBall(it.asIdentifierDefaultingNamespace())?.let { pokeball -> pokemonEntity.pokemon.caughtBall = pokeball } }
nature?.let { Natures.getNature(it.asIdentifierDefaultingNamespace())?.let { nature -> pokemonEntity.pokemon.nature = nature } }
ability?.let { Abilities.getOrException(it).create(true).let { ability -> pokemonEntity.pokemon.ability = ability } }
status?.let { Statuses.getStatus(it)?.let { pokemonEntity.pokemon.applyStatus(it as PersistentStatus) } }
customProperties.forEach { it.apply(pokemonEntity) }
ivs?.let { ivs ->
ivs.forEach { stat ->
pokemonEntity.pokemon.setIV(stat.key, stat.value)
}
}
evs?.let { evs ->
evs.forEach { stat ->
pokemonEntity.pokemon.setEV(stat.key, stat.value)
}
}
teraType?.let { ElementalTypes.get(it)?.let { type -> pokemonEntity.pokemon.teraType = type } }
dmaxLevel?.let { pokemonEntity.pokemon.dmaxLevel = it }
gmaxFactor?.let { pokemonEntity.pokemon.gmaxFactor = it }
tradeable?.let { pokemonEntity.pokemon.tradeable = it }
// If it has been explicitly set to NONE, clear the stored information, including the originalTrainer property
originalTrainerType?.let {
if (it == OriginalTrainerType.NONE) {
pokemonEntity.pokemon.removeOriginalTrainer()
originalTrainer = null
}
}
originalTrainer?.let { ot ->
val type = originalTrainerType ?: pokemonEntity.pokemon.originalTrainerType
when (type) {
OriginalTrainerType.PLAYER -> {
when (ot.length) {
in 3..16 -> server()?.userCache?.findByName(ot)?.get()?.id // OT is a Username
36 -> UUID.fromString(ot) // OT is a UUID
else -> null // OT is invalid
}?.let { uuid -> pokemonEntity.pokemon.setOriginalTrainer(uuid) }
}
OriginalTrainerType.NPC -> pokemonEntity.pokemon.setOriginalTrainer(ot)
else -> {}
}
pokemonEntity.pokemon.refreshOriginalTrainer()
}
pokemonEntity.pokemon.updateAspects()
fun matches(pokemon: Pokemon): Boolean {
// Custom properties check could be duplicated but can't assume 3rd party hasn't done anything type specific
return this.commonMatches(pokemon) && this.customProperties.none { !it.matches(pokemon) }
}
fun matches(pokemon: Pokemon): Boolean {
fun matches(pokemonEntity: PokemonEntity): Boolean {
// Custom properties check could be duplicated but can't assume 3rd party hasn't done anything type specific
return this.commonMatches(pokemonEntity.pokemon) && this.customProperties.none { !it.matches(pokemonEntity) }
}
private fun commonMatches(pokemon: Pokemon): Boolean {
level?.takeIf { it != pokemon.level }?.let { return false }
shiny?.takeIf { it != pokemon.shiny }?.let { return false }
gender?.takeIf { it != pokemon.gender }?.let { return false }
@@ -448,59 +410,23 @@ open class PokemonProperties {
evs?.forEach{ stat ->
if (stat.value != pokemon.evs[stat.key]) { return false }
}
teraType?.takeIf { it != pokemon.teraType.name }?.let { return false }
teraType?.takeIf { it.asIdentifierDefaultingNamespace() != pokemon.teraType.id }?.let { return false }
dmaxLevel?.takeIf { it != pokemon.dmaxLevel }?.let { return false }
gmaxFactor?.takeIf { it != pokemon.gmaxFactor }?.let { return false }
tradeable?.takeIf { it != pokemon.tradeable }?.let { return false }
originalTrainer?.takeIf { it != pokemon.originalTrainer }?.let{ return false }
originalTrainerType?.takeIf { it != pokemon.originalTrainerType }?.let{ return false }
return customProperties.none { !it.matches(pokemon) }
}
fun matches(pokemonEntity: PokemonEntity): Boolean {
level?.takeIf { it != pokemonEntity.pokemon.level }?.let { return false }
shiny?.takeIf { it != ("shiny" in pokemonEntity.pokemon.aspects) }?.let { return false }
gender?.takeIf { it != pokemonEntity.pokemon.gender }?.let { return false }
species?.run {
try {
val species = if (this == "random") {
PokemonSpecies.species.random()
} else {
PokemonSpecies.getByIdentifier(this.asIdentifierDefaultingNamespace()) ?: return@run
}
if (pokemonEntity.pokemon.species != species) {
return false
}
} catch (e: InvalidIdentifierException) {}
}
nickname?.takeIf { it != pokemonEntity.pokemon.nickname }?.let { return false }
form?.takeIf { !it.equals(pokemonEntity.pokemon.form.name, true) }?.let { return false }
friendship?.takeIf { it != pokemonEntity.pokemon.friendship }?.let { return false }
pokeball?.takeIf { it != pokemonEntity.pokemon.caughtBall.name.toString() }?.let { return false }
nature?.takeIf { it != pokemonEntity.pokemon.nature.name.toString() }?.let { return false }
ability?.takeIf { it != pokemonEntity.pokemon.ability.name }?.let { return false }
status?.takeIf { it != pokemonEntity.pokemon.status?.status?.showdownName }?.let { return false }
ivs?.forEach{ stat ->
if (stat.value != pokemonEntity.pokemon.ivs[stat.key]) { return false }
}
evs?.forEach{ stat ->
if (stat.value != pokemonEntity.pokemon.evs[stat.key]) { return false }
}
teraType?.takeIf { it != pokemonEntity.pokemon.teraType.name }?.let { return false }
dmaxLevel?.takeIf { it != pokemonEntity.pokemon.dmaxLevel }?.let { return false }
gmaxFactor?.takeIf { it != pokemonEntity.pokemon.gmaxFactor }?.let { return false }
tradeable?.takeIf { it != pokemonEntity.pokemon.tradeable }?.let { return false }
originalTrainer?.takeIf { it != pokemonEntity.pokemon.originalTrainer }?.let{ return false }
originalTrainerType?.takeIf { it != pokemonEntity.pokemon.originalTrainerType }?.let{ return false }
return customProperties.none { !it.matches(pokemonEntity) }
return true
}
// TODO Review the need for this, usage for us is in commands that deviate from the behavior established by multiple Pokémon query equivalent
fun isSubSetOf(properties: PokemonProperties): Boolean {
level?.takeIf { it != properties.level }?.let { return false }
shiny?.takeIf { it != ("shiny" in properties.aspects) }?.let { return false }
gender?.takeIf { it != properties.gender }?.let { return false }
species?.run {
try {
// TODO get context on this bit, it's highly unlikely two randoms would result in the same Pokémon, doesn't mean the prop is not equal?
val species = if (this == "random") {
PokemonSpecies.species.random()
} else {
@@ -509,7 +435,7 @@ open class PokemonProperties {
if (properties.species != species.toString()) {
return false
}
} catch (e: InvalidIdentifierException) {}
} catch (_: InvalidIdentifierException) {}
}
nickname?.takeIf { it != properties.nickname }?.let { return false }
form?.takeIf { !it.equals(properties.form, true) }?.let { return false }
@@ -551,20 +477,18 @@ open class PokemonProperties {
// TEST YOUR LUCK!
fun roll(pokemon: Pokemon) {
val baseTypes = pokemon.species.types.toList()
val baseTypes = pokemon.form.types.toList()
if (this.shiny == null) pokemon.shiny = Cobblemon.config.shinyRate.checkRate()
if (this.teraType == null) pokemon.teraType =
if (Cobblemon.config.teraTypeRate.checkRate()) ElementalTypes.all().filter { !baseTypes.contains(it) }.random()
else baseTypes.random()
if (Cobblemon.config.teraTypeRate.checkRate()) TeraTypes.random(true)
else TeraTypes.forElementalType(baseTypes.random())
}
// If the config value is at least 1, then do 1/x and use that as the property chance
private fun Float.checkRate(): Boolean = this >= 1 && (Random.Default.nextFloat() < 1 / this)
fun createEntity(world: World): PokemonEntity {
return PokemonEntity(world, create())
}
// TODO Codecs at some point
fun saveToNBT(): NbtCompound {
val nbt = NbtCompound()
originalString.let { nbt.putString(DataKeys.POKEMON_PROPERTIES_ORIGINAL_TEXT, it) }
@@ -593,6 +517,7 @@ open class PokemonProperties {
return nbt
}
// TODO Codecs at some point
fun loadFromNBT(tag: NbtCompound): PokemonProperties {
originalString = tag.getString(DataKeys.POKEMON_PROPERTIES_ORIGINAL_TEXT)
level = if (tag.contains(DataKeys.POKEMON_LEVEL)) tag.getInt(DataKeys.POKEMON_LEVEL) else null
@@ -621,6 +546,7 @@ open class PokemonProperties {
return this
}
// TODO Codecs at some point
fun saveToJSON(): JsonObject {
val json = JsonObject()
originalString.let { json.addProperty(DataKeys.POKEMON_PROPERTIES_ORIGINAL_TEXT, it) }
@@ -650,6 +576,7 @@ open class PokemonProperties {
return json
}
// TODO Codecs at some point
fun loadFromJSON(json: JsonObject): PokemonProperties {
originalString = json.get(DataKeys.POKEMON_PROPERTIES_ORIGINAL_TEXT)?.asString ?: ""
level = json.get(DataKeys.POKEMON_LEVEL)?.asInt
@@ -727,4 +654,21 @@ open class PokemonProperties {
fun copy(): PokemonProperties {
return PokemonProperties().loadFromJSON(saveToJSON())
}
// If the config value is at least 1, then do 1/x and use that as the property chance
private fun Float.checkRate(): Boolean = this >= 1 && (Random.Default.nextFloat() < 1 / this)
/**
* Attempts to find an ability by ID and resolve if it should be forced or if it's legal for the given form.
*
* @param id The literal ID of the [Ability] being mapped.
* @param form The [FormData] whose [FormData.abilities] is queried for legality.
* @return The [Ability] with the [Ability.forced] state necessary for the given [form].
*/
private fun createAbility(id: String, form: FormData): Ability? {
val ability = Abilities.get(id) ?: return null
val potentialAbility = form.abilities.firstOrNull { potential -> potential.template == ability } ?: return ability.create(true)
return potentialAbility.template.create(false)
}
}
@@ -20,7 +20,6 @@ import com.mojang.serialization.codecs.PrimitiveCodec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.network.PacketByteBuf
import net.minecraft.util.Identifier
import net.minecraft.util.math.Vec3d
/**
* Effect details for the actual particles of a particle effect.
@@ -44,48 +43,106 @@ class BedrockParticle(
var cameraMode: ParticleCameraMode = RotateXYZCameraMode(),
var tinting: ParticleTinting = ExpressionParticleTinting(),
var collision: ParticleCollision = ParticleCollision(),
var environmentLighting: Boolean = false
var environmentLighting: Boolean = false,
var creationEvents: MutableList<SimpleEventTrigger> = mutableListOf(),
var expirationEvents: MutableList<SimpleEventTrigger> = mutableListOf(),
var timeline: EventTriggerTimeline = EventTriggerTimeline(mutableMapOf())
) {
class ExpressionSet(
val sizeX: Expression,
val sizeY: Expression,
val maxAge: Expression,
val killExpression: Expression,
val updateExpressions: MutableList<Expression>,
val renderExpressions: MutableList<Expression>
)
/*
"creation_event": "event_sendspark",
"expiration_event": ["event_spark", "event_afterspark", "event_capturestar"],
"timeline": {
"21.00": "event_spark"
}
*/
class EventSet(
val creationEvents: MutableList<SimpleEventTrigger>,
val expirationEvents: MutableList<SimpleEventTrigger>,
val timeline: EventTriggerTimeline
)
// kill plane maybe
companion object {
val CODEC: Codec<BedrockParticle> = RecordCodecBuilder.create { instance ->
val EXPRESSION_SET_CODEC = RecordCodecBuilder.create<ExpressionSet> { instance ->
instance.group(
Identifier.CODEC.fieldOf("texture").forGetter { it.texture },
PrimitiveCodec.STRING.fieldOf("material").forGetter { it.material.name },
ParticleUVMode.codec.fieldOf("uvMode").forGetter { it.uvMode },
EXPRESSION_CODEC.fieldOf("sizeX").forGetter { it.sizeX },
EXPRESSION_CODEC.fieldOf("sizeY").forGetter { it.sizeY },
EXPRESSION_CODEC.fieldOf("maxAge").forGetter { it.maxAge },
EXPRESSION_CODEC.fieldOf("killExpression").forGetter { it.killExpression },
ListCodec(EXPRESSION_CODEC).fieldOf("updateExpressions").forGetter { it.updateExpressions },
ListCodec(EXPRESSION_CODEC).fieldOf("renderExpressions").forGetter { it.renderExpressions },
ListCodec(EXPRESSION_CODEC).fieldOf("renderExpressions").forGetter { it.renderExpressions }
).apply(instance, ::ExpressionSet)
}
val EVENT_SET_CODEC = RecordCodecBuilder.create<EventSet> { instance ->
instance.group(
ListCodec(SimpleEventTrigger.CODEC).fieldOf("creationEvents").forGetter { it.creationEvents },
ListCodec(SimpleEventTrigger.CODEC).fieldOf("expirationEvents").forGetter { it.expirationEvents },
EventTriggerTimeline.CODEC.fieldOf("timeline").forGetter { it.timeline }
).apply(instance, ::EventSet)
}
val CODEC: Codec<BedrockParticle> = RecordCodecBuilder.create { instance ->
instance.group(
Identifier.CODEC.fieldOf("texture").forGetter { it.texture },
PrimitiveCodec.STRING.fieldOf("material").forGetter { it.material.name },
ParticleUVMode.codec.fieldOf("uvMode").forGetter { it.uvMode },
EXPRESSION_SET_CODEC.fieldOf("expressionSet").forGetter {
ExpressionSet(
it.sizeX,
it.sizeY,
it.maxAge,
it.killExpression,
it.updateExpressions,
it.renderExpressions
)
},
ParticleMotion.codec.fieldOf("motion").forGetter { it.motion },
ParticleRotation.codec.fieldOf("rotation").forGetter { it.rotation },
ParticleViewDirection.codec.fieldOf("viewDirection").forGetter { it.viewDirection },
ParticleCameraMode.codec.fieldOf("cameraMode").forGetter { it.cameraMode },
ParticleTinting.codec.fieldOf("tinting").forGetter { it.tinting },
ParticleCollision.CODEC.fieldOf("collision").forGetter { it.collision },
PrimitiveCodec.BOOL.fieldOf("environmentLighting").forGetter { it.environmentLighting }
PrimitiveCodec.BOOL.fieldOf("environmentLighting").forGetter { it.environmentLighting },
EVENT_SET_CODEC.fieldOf("eventSet").forGetter {
EventSet(
it.creationEvents,
it.expirationEvents,
it.timeline
)
}
).apply(instance) {
texture, materialStr, uvMode, sizeX, sizeY, maxAge, killExpression, updateExpressions,
renderExpressions, motion, rotation, viewDirection, cameraMode, tinting, collision, environmentLighting ->
texture, materialStr, uvMode, expressionSet, motion, rotation, viewDirection, cameraMode, tinting, collision, environmentLighting, eventSet ->
BedrockParticle(
texture = texture,
material = ParticleMaterial.valueOf(materialStr),
uvMode = uvMode,
sizeX = sizeX,
sizeY = sizeY,
maxAge = maxAge,
killExpression = killExpression,
updateExpressions = updateExpressions,
renderExpressions = renderExpressions,
sizeX = expressionSet.sizeX,
sizeY = expressionSet.sizeY,
maxAge = expressionSet.maxAge,
killExpression = expressionSet.killExpression,
updateExpressions = expressionSet.updateExpressions,
renderExpressions = expressionSet.renderExpressions,
motion = motion,
rotation = rotation,
viewDirection = viewDirection,
cameraMode = cameraMode,
tinting = tinting,
collision = collision,
environmentLighting = environmentLighting
environmentLighting = environmentLighting,
creationEvents = eventSet.creationEvents,
expirationEvents = eventSet.expirationEvents,
timeline = eventSet.timeline
)
}
}
@@ -108,6 +165,9 @@ class BedrockParticle(
ParticleTinting.writeToBuffer(buffer, tinting)
collision.writeToBuffer(buffer)
buffer.writeBoolean(environmentLighting)
buffer.writeCollection(creationEvents) { pb, event -> event.encode(pb) }
buffer.writeCollection(expirationEvents) { pb, event -> event.encode(pb) }
timeline.encode(buffer)
}
fun readFromBuffer(buffer: PacketByteBuf) {
@@ -127,5 +187,8 @@ class BedrockParticle(
tinting = ParticleTinting.readFromBuffer(buffer)
collision.readFromBuffer(buffer)
environmentLighting = buffer.readBoolean()
creationEvents = buffer.readList { SimpleEventTrigger("").also { it.decode(buffer) } }
expirationEvents = buffer.readList { SimpleEventTrigger("").also { it.decode(buffer) } }
timeline.decode(buffer)
}
}
@@ -10,7 +10,9 @@ package com.cobblemon.mod.common.api.snowstorm
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.ListCodec
import com.mojang.serialization.codecs.PrimitiveCodec
import com.mojang.serialization.codecs.RecordCodecBuilder
import com.mojang.serialization.codecs.UnboundedMapCodec
import net.minecraft.network.PacketByteBuf
import net.minecraft.util.Identifier
@@ -27,7 +29,8 @@ class BedrockParticleEffect(
var emitter: BedrockParticleEmitter = BedrockParticleEmitter(),
var particle: BedrockParticle = BedrockParticle(),
var curves: MutableList<MoLangCurve> = mutableListOf(),
var space: ParticleSpace = ParticleSpace()
var space: ParticleSpace = ParticleSpace(),
var events: MutableMap<String, ParticleEvent> = mutableMapOf()
) {
companion object {
val CODEC: Codec<BedrockParticleEffect> = RecordCodecBuilder.create { instance ->
@@ -36,14 +39,16 @@ class BedrockParticleEffect(
BedrockParticleEmitter.CODEC.fieldOf("emitter").forGetter { it.emitter },
BedrockParticle.CODEC.fieldOf("particle").forGetter { it.particle },
ListCodec(MoLangCurve.codec).fieldOf("curves").forGetter { it.curves },
ParticleSpace.CODEC.fieldOf("space").forGetter { it.space }
).apply(instance) { id, emitter, particle, curves, space ->
ParticleSpace.CODEC.fieldOf("space").forGetter { it.space },
UnboundedMapCodec(PrimitiveCodec.STRING, ParticleEvent.CODEC).fieldOf("events").forGetter { it.events }
).apply(instance) { id, emitter, particle, curves, space, events ->
BedrockParticleEffect(
id = id,
emitter = emitter,
particle = particle,
curves = curves.toMutableList(),
space = space
space = space,
events = events
)
}
}
@@ -55,6 +60,7 @@ class BedrockParticleEffect(
particle.writeToBuffer(buffer)
buffer.writeCollection(curves) { pb, curve -> MoLangCurve.writeToBuffer(buffer, curve) }
space.writeToBuffer(buffer)
buffer.writeMap(events, { _, v -> buffer.writeString(v) }) { _, event -> event.encode(buffer) }
}
fun readFromBuffer(buffer: PacketByteBuf) {
@@ -63,5 +69,6 @@ class BedrockParticleEffect(
particle.readFromBuffer(buffer)
curves = buffer.readList { MoLangCurve.readFromBuffer(buffer) }
space.readFromBuffer(buffer)
events = buffer.readMap({ buffer.readString() }) { ParticleEvent().also { it.decode(buffer) } }
}
}
@@ -29,7 +29,12 @@ class BedrockParticleEmitter(
var updateExpressions: MutableList<Expression> = mutableListOf(),
var rate: ParticleEmitterRate = InstantParticleEmitterRate(),
var shape: ParticleEmitterShape = SphereParticleEmitterShape(),
var lifetime: ParticleEmitterLifetime = OnceEmitterLifetime(NumberExpression(1.0))
var lifetime: ParticleEmitterLifetime = OnceEmitterLifetime(NumberExpression(1.0)),
var eventTimeline: EventTriggerTimeline = EventTriggerTimeline(mutableMapOf()),
var creationEvents: MutableList<SimpleEventTrigger> = mutableListOf(),
var expirationEvents: MutableList<SimpleEventTrigger> = mutableListOf(),
var travelDistanceEvents: EventTriggerTimeline = EventTriggerTimeline(mutableMapOf()),
var loopingTravelDistanceEvents: MutableList<LoopingTravelDistanceEventTrigger> = mutableListOf()
) {
companion object {
val CODEC: Codec<BedrockParticleEmitter> = RecordCodecBuilder.create { instance ->
@@ -38,14 +43,24 @@ class BedrockParticleEmitter(
ListCodec(EXPRESSION_CODEC).fieldOf("updateExpressions").forGetter { it.updateExpressions },
ParticleEmitterRate.codec.fieldOf("rate").forGetter { it.rate },
ParticleEmitterShape.codec.fieldOf("shape").forGetter { it.shape },
ParticleEmitterLifetime.codec.fieldOf("lifetime").forGetter { it.lifetime }
).apply(instance) { startExpressions, updateExpressions, rate, shape, lifetime ->
ParticleEmitterLifetime.codec.fieldOf("lifetime").forGetter { it.lifetime },
EventTriggerTimeline.CODEC.fieldOf("eventTimeline").forGetter { it.eventTimeline },
ListCodec(SimpleEventTrigger.CODEC).fieldOf("creationEvents").forGetter { it.creationEvents },
ListCodec(SimpleEventTrigger.CODEC).fieldOf("expirationEvents").forGetter { it.expirationEvents },
EventTriggerTimeline.CODEC.fieldOf("travelDistanceEvents").forGetter { it.travelDistanceEvents },
ListCodec(LoopingTravelDistanceEventTrigger.CODEC).fieldOf("loopingTravelDistanceEvents").forGetter { it.loopingTravelDistanceEvents }
).apply(instance) { startExpressions, updateExpressions, rate, shape, lifetime, eventTimeline, creationEvents, expirationEvents, travelDistanceEvents, loopingTravelDistanceEvents ->
BedrockParticleEmitter(
startExpressions = startExpressions,
updateExpressions = updateExpressions,
shape = shape,
rate = rate,
lifetime = lifetime
lifetime = lifetime,
eventTimeline = eventTimeline,
creationEvents = creationEvents,
expirationEvents = expirationEvents,
travelDistanceEvents = travelDistanceEvents,
loopingTravelDistanceEvents = loopingTravelDistanceEvents
)
}
}
@@ -57,6 +72,11 @@ class BedrockParticleEmitter(
ParticleEmitterRate.writeToBuffer(buffer, rate)
ParticleEmitterShape.writeToBuffer(buffer, shape)
ParticleEmitterLifetime.writeToBuffer(buffer, lifetime)
eventTimeline.encode(buffer)
buffer.writeCollection(creationEvents) { pb, event -> event.encode(pb) }
buffer.writeCollection(expirationEvents) { pb, event -> event.encode(pb) }
travelDistanceEvents.encode(buffer)
buffer.writeCollection(loopingTravelDistanceEvents) { pb, event -> event.encode(pb) }
}
fun readFromBuffer(buffer: PacketByteBuf) {
@@ -65,5 +85,10 @@ class BedrockParticleEmitter(
rate = ParticleEmitterRate.readFromBuffer(buffer)
shape = ParticleEmitterShape.readFromBuffer(buffer)
lifetime = ParticleEmitterLifetime.readFromBuffer(buffer)
eventTimeline.decode(buffer)
creationEvents = buffer.readList { SimpleEventTrigger("").also { it.decode(buffer) } }
expirationEvents = buffer.readList { SimpleEventTrigger("").also { it.decode(buffer) } }
travelDistanceEvents.decode(buffer)
loopingTravelDistanceEvents = buffer.readList { LoopingTravelDistanceEventTrigger(0.0, mutableListOf()).also { it.decode(buffer) } }
}
}
@@ -136,6 +136,11 @@ class LoopingEmitterLifetime(var activeTime: Expression = 1.0.asExpression(), va
val interval = activeTimeValue + sleepTime
val displacement = emitterAge % interval
runtime.environment.setSimpleVariable("emitter_lifetime", activeTime)
if (emitterAge > activeTimeValue && sleepTime == 0.0) {
return ParticleEmitterAction.STOP
}
return if (displacement < activeTimeValue) {
ParticleEmitterAction.GO
} else {
@@ -145,7 +145,7 @@ class PointParticleEmitterShape(
override val type = ParticleEmitterShapeType.POINT
override fun getNewParticlePosition(runtime: MoLangRuntime, entity: Entity?) = runtime.resolveVec3d(offset)
override fun getCenter(runtime: MoLangRuntime, entity: Entity?): Vec3d {
return getNewParticlePosition(runtime, entity) // Questionable
return Vec3d.ZERO
}
override fun <T> encode(ops: DynamicOps<T>) = CODEC.encodeStart(ops, this)
@@ -0,0 +1,174 @@
/*
* 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.snowstorm
import com.bedrockk.molang.runtime.MoLangRuntime
import com.cobblemon.mod.common.api.molang.ExpressionLike
import com.cobblemon.mod.common.api.molang.MoLangFunctions.getQueryStruct
import com.cobblemon.mod.common.api.molang.MoLangFunctions.setup
import com.cobblemon.mod.common.api.net.Decodable
import com.cobblemon.mod.common.api.net.Encodable
import com.cobblemon.mod.common.client.particle.BedrockParticleEffectRepository
import com.cobblemon.mod.common.client.particle.ParticleStorm
import com.cobblemon.mod.common.client.render.MatrixWrapper
import com.cobblemon.mod.common.client.render.SnowstormParticle
import com.cobblemon.mod.common.util.asExpressionLike
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.PrimitiveCodec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.network.PacketByteBuf
import net.minecraft.sound.SoundCategory
import net.minecraft.sound.SoundEvent
import net.minecraft.util.Identifier
import net.minecraft.util.math.Vec3d
/**
* An event that can be referenced from various particle event triggers. The events are not necessarily particles,
* but can be combinations of particles, sounds, and MoLang expressions.
*
* @author Hiroku
* @since March 2nd, 2024
*/
class ParticleEvent(
var particleEffect: EventParticleEffect? = null,
var soundEffect: EventSoundEffect? = null,
var expression: ExpressionLike? = null
): Encodable, Decodable {
companion object {
val CODEC: Codec<ParticleEvent> = RecordCodecBuilder.create { instance ->
instance.group(
EventParticleEffect.CODEC.optionalFieldOf("particle_effect", null).forGetter { it.particleEffect },
EventSoundEffect.CODEC.optionalFieldOf("sound_effect", null).forGetter { it.soundEffect },
PrimitiveCodec.STRING.optionalFieldOf("expression", null).forGetter { it.expression?.toString() }
).apply(instance) { particleEffect, soundEffect, expression ->
ParticleEvent(
particleEffect,
soundEffect,
expression?.asExpressionLike()
)
}
}
}
override fun encode(buffer: PacketByteBuf) {
buffer.writeNullable(particleEffect) { pb, effect ->
pb.writeIdentifier(effect.effect)
pb.writeEnumConstant(effect.type)
pb.writeNullable(effect.expression) { pb, expr -> pb.writeString(expr.toString()) }
}
buffer.writeNullable(soundEffect) { pb, effect -> pb.writeIdentifier(effect.sound) }
buffer.writeNullable(expression) { pb, expr -> pb.writeString(expr.toString()) }
}
override fun decode(buffer: PacketByteBuf) {
particleEffect = buffer.readNullable { pb -> EventParticleEffect(
pb.readIdentifier(),
pb.readEnumConstant(EventParticleEffect.EventParticleType::class.java),
pb.readNullable { pb.readString().asExpressionLike() }
) }
soundEffect = buffer.readNullable { pb -> EventSoundEffect(pb.readIdentifier()) }
expression = buffer.readNullable { pb -> pb.readString().asExpressionLike() }
}
fun run(storm: ParticleStorm, particle: SnowstormParticle?) {
particleEffect?.let { effect ->
val bedrockParticleEffect = BedrockParticleEffectRepository.getEffect(effect.effect) ?: return@let
val rootMatrix = when (effect.type) {
EventParticleEffect.EventParticleType.EMITTER -> MatrixWrapper().updatePosition(storm.matrixWrapper.getOrigin())
EventParticleEffect.EventParticleType.EMITTER_BOUND -> storm.matrixWrapper
EventParticleEffect.EventParticleType.PARTICLE,
EventParticleEffect.EventParticleType.PARTICLE_WITH_VELOCITY -> (particle?.let { Vec3d(it.getX(), it.getY(), it.getZ()) } ?: Vec3d(storm.getX(), storm.getY(), storm.getZ())).let { MatrixWrapper().updatePosition(it) }
}
val sourceVelocity = when (effect.type) {
EventParticleEffect.EventParticleType.EMITTER -> storm.sourceVelocity().let { { it } }
EventParticleEffect.EventParticleType.EMITTER_BOUND -> storm.sourceVelocity
EventParticleEffect.EventParticleType.PARTICLE -> { { Vec3d.ZERO } }
EventParticleEffect.EventParticleType.PARTICLE_WITH_VELOCITY -> (particle?.let { Vec3d(it.getVelocityX(), it.getVelocityY(), it.getVelocityZ()) } ?: Vec3d.ZERO).let { { it } }
}
val newStorm = ParticleStorm(
effect = bedrockParticleEffect,
matrixWrapper = rootMatrix,
world = storm.world,
sourceVelocity = sourceVelocity,
sourceAlive = storm.sourceAlive,
sourceVisible = storm.sourceVisible,
onDespawn = {},
runtime = MoLangRuntime().setup().also { it.environment.structs["query"] = storm.runtime.environment.getQueryStruct() },
entity = storm.entity
)
effect.expression?.resolve(newStorm.runtime)
newStorm.spawn()
}
soundEffect?.let { effect ->
val position = particle?.let { Vec3d(it.getX(), it.getY(), it.getZ()) } ?: Vec3d(storm.getX(), storm.getY(), storm.getZ())
val world = storm.world
val soundEvent = SoundEvent.of(effect.sound)
world.playSound(position.x, position.y, position.z, soundEvent, SoundCategory.NEUTRAL, 1F, 1F, true)
}
expression?.resolve(storm.runtime)
}
}
/**
* A particle component of a [ParticleEvent]. It contains the effect to play, the spawning type, and a pre-run
* expression to run in the new storm's runtime.
*
* @author Hiroku
* @since March 2nd, 2024
*/
class EventParticleEffect(
val effect: Identifier,
val type: EventParticleType,
val expression: ExpressionLike? = null
) {
companion object {
val CODEC = RecordCodecBuilder.create<EventParticleEffect> { instance ->
instance.group(
Identifier.CODEC.fieldOf("effect").forGetter { it.effect },
PrimitiveCodec.STRING.fieldOf("type").forGetter { it.type.name },
PrimitiveCodec.STRING.optionalFieldOf("expression", null).forGetter { it.expression?.toString() }
).apply(instance) { effect, type, expression ->
EventParticleEffect(
effect,
EventParticleType.valueOf(type),
expression?.asExpressionLike()
)
}
}
}
enum class EventParticleType {
EMITTER,
EMITTER_BOUND,
PARTICLE,
PARTICLE_WITH_VELOCITY
}
}
/**
* A simple sound effect component of a [ParticleEvent]. Plays a sound at the particle location, or if run from an
* emitter event, at the emitter's location.
*
* @author Hiroku
* @since March 2nd, 2024
*/
class EventSoundEffect(
val sound: Identifier,
) {
companion object {
val CODEC = RecordCodecBuilder.create<EventSoundEffect> { instance ->
instance.group(
Identifier.CODEC.fieldOf("sound").forGetter { it.sound }
).apply(instance, ::EventSoundEffect)
}
}
}
@@ -0,0 +1,118 @@
/*
* 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.snowstorm
import com.cobblemon.mod.common.api.net.Decodable
import com.cobblemon.mod.common.api.net.Encodable
import com.cobblemon.mod.common.client.particle.ParticleStorm
import com.cobblemon.mod.common.client.render.SnowstormParticle
import com.mojang.serialization.codecs.PrimitiveCodec
import com.mojang.serialization.codecs.RecordCodecBuilder
import com.mojang.serialization.codecs.UnboundedMapCodec
import net.minecraft.network.PacketByteBuf
/*
* The different references to events that can be triggered by an effect.
*/
/**
* It really is simple.
*
* @author Hiroku
* @since March 2nd, 2024
*/
class SimpleEventTrigger(var event: String): Encodable, Decodable {
companion object {
val CODEC = RecordCodecBuilder.create<SimpleEventTrigger> { instance ->
instance.group(
PrimitiveCodec.STRING.fieldOf("event").forGetter { it.event }
).apply(instance, ::SimpleEventTrigger)
}
}
override fun encode(buffer: PacketByteBuf) {
buffer.writeString(event)
}
override fun decode(buffer: PacketByteBuf) {
event = buffer.readString()
}
fun trigger(storm: ParticleStorm, particle: SnowstormParticle?) {
val event = storm.effect.events[event] ?: return
event.run(storm, particle)
}
}
/**
* An event trigger that outlines specific times at which point groups of effects will play. This can be used
* on the basis of time but is also used in the case of travel distance.
*
* @author Hiroku
* @since March 2nd, 2024
*/
class EventTriggerTimeline(var map: MutableMap<Double, MutableList<String>>): Encodable, Decodable {
companion object {
val CODEC = RecordCodecBuilder.create<EventTriggerTimeline> { instance ->
instance.group(
UnboundedMapCodec(PrimitiveCodec.DOUBLE, PrimitiveCodec.STRING.listOf()).fieldOf("map").forGetter { it.map }
).apply(instance, ::EventTriggerTimeline)
}
}
override fun encode(buffer: PacketByteBuf) {
buffer.writeMap(map, { pb, k -> pb.writeDouble(k) }, { pb, v -> pb.writeCollection(v) { _, s -> pb.writeString(s) } })
}
override fun decode(buffer: PacketByteBuf) {
map = buffer.readMap({ pb -> pb.readDouble() }, { pb -> pb.readList { pb.readString() } })
}
fun check(storm: ParticleStorm, particle: SnowstormParticle?, previousTime: Double, newTime: Double) {
val events = map.entries.filter { it.key in previousTime..newTime }.flatMap { it.value }
events.forEach { event ->
val event = storm.effect.events[event] ?: return
event.run(storm, particle)
}
}
}
/**
* An event trigger that takes the total distance travelled by the emitter and modulos it across [distance] to know
* if we need to play it again.
*
* @author Hiroku
* @since March 2nd, 2024
*/
class LoopingTravelDistanceEventTrigger(var distance: Double, var events: MutableList<String>): Encodable, Decodable {
companion object {
val CODEC = RecordCodecBuilder.create<LoopingTravelDistanceEventTrigger> { instance ->
instance.group(
PrimitiveCodec.DOUBLE.fieldOf("distance").forGetter { it.distance },
PrimitiveCodec.STRING.listOf().fieldOf("events").forGetter { it.events }
).apply(instance, ::LoopingTravelDistanceEventTrigger)
}
}
override fun encode(buffer: PacketByteBuf) {
buffer.writeDouble(distance)
buffer.writeCollection(events) { _, s -> buffer.writeString(s) }
}
override fun decode(buffer: PacketByteBuf) {
distance = buffer.readDouble()
events = buffer.readList { buffer.readString() }
}
fun check(storm: ParticleStorm, particle: SnowstormParticle?, previousDistance: Double, currentDistance: Double) {
if (previousDistance < distance && currentDistance >= distance) {
events.mapNotNull { storm.effect.events[it] }.forEach { it.run(storm, particle) }
}
}
}
@@ -140,7 +140,7 @@ class InwardsMotionDirection : ParticleMotionDirection {
return if (particlePos == emitterPos) {
Vec3d(storm.world.random.nextDouble() - 0.5, storm.world.random.nextDouble() - 0.5, storm.world.random.nextDouble() - 0.5)
} else {
particlePos.subtract(emitterPos)
emitterPos.subtract(particlePos)
}.normalize()
}
override fun <T> encode(ops: DynamicOps<T>) = CODEC.encodeStart(ops, this)
@@ -12,6 +12,8 @@ import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.spawning.spawner.PlayerSpawner
import com.cobblemon.mod.common.api.spawning.spawner.PlayerSpawnerFactory
import com.cobblemon.mod.common.platform.events.PlatformEvents
import com.cobblemon.mod.common.util.server
import com.cobblemon.mod.common.world.gamerules.CobblemonGameRules
import java.util.UUID
import net.minecraft.server.network.ServerPlayerEntity
@@ -34,7 +36,7 @@ object CobblemonWorldSpawnerManager : SpawnerManager() {
fun onPlayerLogin(player: ServerPlayerEntity) {
// Disables spawning
if (!Cobblemon.config.enableSpawning) {
if (!Cobblemon.config.enableSpawning || server()?.gameRules?.getBoolean(CobblemonGameRules.DO_POKEMON_SPAWNING) == false) {
return;
}
@@ -12,6 +12,8 @@ import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.spawning.influence.SpawningInfluence
import com.cobblemon.mod.common.api.spawning.spawner.Spawner
import com.cobblemon.mod.common.api.spawning.spawner.TickingSpawner
import com.cobblemon.mod.common.util.server
import com.cobblemon.mod.common.world.gamerules.CobblemonGameRules.DO_POKEMON_SPAWNING
/**
* A manager of various spawners. This is a class in which you should register
@@ -49,7 +51,7 @@ open class SpawnerManager {
open fun onServerTick() {
// Disables spawning
if (!Cobblemon.config.enableSpawning) {
if (!Cobblemon.config.enableSpawning || server()?.gameRules?.getBoolean(DO_POKEMON_SPAWNING) == false) {
return
}
influences.removeIf { it.isExpired() }
@@ -30,9 +30,16 @@ abstract class SingleEntitySpawnAction<T : Entity>(
override fun run(): EntitySpawnResult? {
val e = createEntity() ?: return null
e.setPosition(ctx.position.toVec3d().add(0.5, 1.0, 0.5))
entity.emit(e)
CobblemonEvents.ENTITY_SPAWN.postThen(SpawnEvent(e, ctx), ifSucceeded = { ctx.world.spawnEntity(e) })
return EntitySpawnResult(listOf(e))
var shouldSpawn = false
CobblemonEvents.ENTITY_SPAWN.postThen(SpawnEvent(e, ctx), ifSucceeded = {
ctx.world.spawnEntity(e)
shouldSpawn = true
})
return if (shouldSpawn) {
this.entity.emit(e)
EntitySpawnResult(listOf(e))
} else null
}
@@ -63,9 +63,6 @@ abstract class AreaSpawner(
override fun run(cause: SpawnCause): Pair<SpawningContext, SpawnDetail>? {
val area = getArea(cause)
if (area?.world?.gameRules?.getBoolean(DO_POKEMON_SPAWNING) == false) {
return null
}
val constrainedArea = if (area != null) constrainArea(area) else null
if (constrainedArea != null) {
@@ -8,6 +8,7 @@
package com.cobblemon.mod.common.api.storage.adapter.conversions
import com.cobblemon.mod.common.api.abilities.Abilities
import com.cobblemon.mod.common.api.moves.Moves
import com.cobblemon.mod.common.api.pokeball.PokeBalls
import com.cobblemon.mod.common.api.pokemon.Natures
@@ -98,8 +99,9 @@ class ReforgedConversion(val base: Path) : CobblemonConverter<NbtCompound> {
result.level = nbt.getInt("Level")
result.addExperience(SidemodExperienceSource("Reforged"), nbt.getInt("EXP"))
result.setFriendship(nbt.getInt("Friendship"))
result.ability = (result.form.abilities.find { it.template.name == nbt.getString("Ability") } ?: result.form.abilities.first())
.template.create()
Abilities.get(nbt.getString("Ability"))?.let { template ->
result.updateAbility(template.create(forced = result.form.abilities.none { it.template == template }))
}
result.nature = Natures.getNature(Identifier(ReforgedNatures.values()[nbt.getInt("Nature")].name.lowercase())) ?: Natures.getRandomNature()
result.mintedNature = Natures.getNature(Identifier(ReforgedNatures.values()[nbt.getInt("MintNature")].name.lowercase()))
result.currentHealth = nbt.getInt("Health")
@@ -22,107 +22,15 @@ import net.minecraft.registry.tag.TagKey
object CobblemonBiomeTags {
@JvmField
val IS_DEEP_DARK = create("is_deep_dark")
val IS_AUTUMN = create("has_season/autumn")
@JvmField
val IS_ARID = create("is_arid")
val IS_SPRING = create("has_season/spring")
@JvmField
val IS_AUTUMN = create("is_autumn")
@JvmField
val IS_BADLANDS = create("is_badlands")
@JvmField
val IS_BAMBOO = create("is_bamboo")
@JvmField
val IS_CAVE = create("is_cave")
@JvmField
val IS_COAST = create("is_coast")
@JvmField
val IS_COLD = create("is_cold")
@JvmField
val IS_DEEP_OCEAN = create("is_deep_ocean")
@JvmField
val IS_DESERT = create("is_desert")
@JvmField
val IS_DRIPSTONE = create("is_dripstone")
@JvmField
val IS_FLORAL = create("is_floral")
@JvmField
val IS_FOREST = create("is_forest")
@JvmField
val IS_FREEZING = create("is_freezing")
@JvmField
val IS_FRESHWATER = create("is_freshwater")
@JvmField
val IS_COLD_OCEAN = create("is_cold_ocean")
@JvmField
val IS_FROZEN_OCEAN = create("is_frozen_ocean")
@JvmField
val IS_GLACIAL = create("is_glacial")
@JvmField
val IS_GRASSLAND = create("is_grassland")
@JvmField
val IS_HIGHLANDS = create("is_highlands")
@JvmField
val IS_HILLS = create("is_hills")
@JvmField
val IS_ISLAND = create("is_island")
@JvmField
val IS_JUNGLE = create("is_jungle")
@JvmField
val IS_LUKEWARM_OCEAN = create("is_lukewarm_ocean")
@JvmField
val IS_LUSH = create("is_lush")
@JvmField
val IS_MAGICAL = create("is_magical")
@JvmField
val IS_MOUNTAIN = create("is_mountain")
@JvmField
val IS_MUSHROOM = create("is_mushroom")
@JvmField
val IS_OVERWORLD = create("is_overworld")
@JvmField
val IS_PEAK = create("is_peak")
@JvmField
val IS_PLAINS = create("is_plains")
@JvmField
val IS_PLATEAU = create("is_plateau")
@JvmField
val IS_WARM_OCEAN = create("is_warm_ocean")
@JvmField
val IS_RIVER = create("is_river")
@JvmField
val IS_SANDY = create("is_sandy")
@JvmField
val IS_SAVANNA = create("is_savanna")
@JvmField
val IS_SKY = create("is_sky")
@JvmField
val IS_SNOWY_FOREST = create("is_snowy_forest")
@JvmField
val IS_SPOOKY = create("is_spooky")
@JvmField
val IS_SPRING = create("is_spring")
@JvmField
val IS_SUMMER = create("is_summer")
@JvmField
val IS_SWAMP = create("is_swamp")
@JvmField
val IS_TAIGA = create("is_taiga")
val IS_SUMMER = create("has_season/summer")
@JvmField
val IS_TEMPERATE = create("is_temperate")
@JvmField
val IS_THERMAL = create("is_thermal")
@JvmField
val IS_TUNDRA = create("is_tundra")
@JvmField
val IS_VOID = create("is_void")
@JvmField
val IS_VOlCANIC = create("is_volcanic")
@JvmField
val IS_WINTER = create("is_winter")
@JvmField
val IS_SPARSE = create("is_sparse")
@JvmField
val IS_DENSE = create("is_dense")
val IS_WINTER = create("has_season/winter")
// Has Feature tags
@JvmField
@@ -180,16 +88,5 @@ object CobblemonBiomeTags {
@JvmField
val HAS_WATER_STONE_ORE_RARE = create("has_ore/ore_water_stone_rare")
// ToDo remove in 1.3
@Deprecated(message = "This tag no longer exists", level = DeprecationLevel.ERROR)
@JvmField
val IS_CRAG = create("is_crag")
@Deprecated(message = "This tag no longer exists", level = DeprecationLevel.ERROR)
@JvmField
val IS_ICY = create("is_icy")
@Deprecated(message = "This tag no longer exists", replaceWith = ReplaceWith("com.cobblemon.mod.common.api.tags.CobblemonBiomeTags.IS_CAVE"), level = DeprecationLevel.ERROR)
@JvmField
val IS_UNDERGROUND = create("is_underground")
private fun create(path: String) = TagKey.of(RegistryKeys.BIOME, cobblemonResource(path))
}
@@ -144,6 +144,12 @@ object CobblemonItemTags {
@JvmField
val POTTERY_SHERDS = create("decorated_pot_sherds")
@JvmField
val ABILITY_CHANGERS = create("ability_changers")
@JvmField
val IS_FRIENDSHIP_BOOSTER = create("is_friendship_booster")
private fun create(path: String) = TagKey.of(RegistryKeys.ITEM, cobblemonResource(path))
}
@@ -0,0 +1,38 @@
/*
* 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.types.tera
import com.cobblemon.mod.common.api.data.ShowdownIdentifiable
import net.minecraft.text.Text
import net.minecraft.util.Identifier
/**
* The representation of the Pokémons Tera type.
*
* @see [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Terastal_phenomenon)
*
*/
interface TeraType : ShowdownIdentifiable {
/**
* The [Identifier] associated to this type.
*/
val id: Identifier
/**
* If this tera type can be selected naturally.
*/
val legalAsStatic: Boolean
/**
* The display name of this type.
*/
val displayName: Text
}
@@ -0,0 +1,128 @@
/*
* 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.types.tera
import com.cobblemon.mod.common.api.types.ElementalType
import com.cobblemon.mod.common.api.types.ElementalTypes
import com.cobblemon.mod.common.api.types.tera.elemental.ElementalTypeTeraType
import com.cobblemon.mod.common.api.types.tera.gimmick.StellarTeraType
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.util.Identifier
/**
* The registry of all [TeraType]s.
*/
@Suppress("unused")
object TeraTypes {
private val types = hashMapOf<Identifier, TeraType>()
@JvmStatic
val NORMAL = this.create(cobblemonResource("normal"), ElementalTypeTeraType(ElementalTypes.NORMAL))
@JvmStatic
val FIRE = this.create(cobblemonResource("fire"), ElementalTypeTeraType(ElementalTypes.FIRE))
@JvmStatic
val WATER = this.create(cobblemonResource("water"), ElementalTypeTeraType(ElementalTypes.WATER))
@JvmStatic
val GRASS = this.create(cobblemonResource("grass"), ElementalTypeTeraType(ElementalTypes.GRASS))
@JvmStatic
val ELECTRIC = this.create(cobblemonResource("electric"), ElementalTypeTeraType(ElementalTypes.ELECTRIC))
@JvmStatic
val ICE = this.create(cobblemonResource("ice"), ElementalTypeTeraType(ElementalTypes.ICE))
@JvmStatic
val FIGHTING = this.create(cobblemonResource("fighting"), ElementalTypeTeraType(ElementalTypes.FIGHTING))
@JvmStatic
val POISON = this.create(cobblemonResource("poison"), ElementalTypeTeraType(ElementalTypes.POISON))
@JvmStatic
val GROUND = this.create(cobblemonResource("ground"), ElementalTypeTeraType(ElementalTypes.GROUND))
@JvmStatic
val FLYING = this.create(cobblemonResource("flying"), ElementalTypeTeraType(ElementalTypes.FLYING))
@JvmStatic
val PSYCHIC = this.create(cobblemonResource("psychic"), ElementalTypeTeraType(ElementalTypes.PSYCHIC))
@JvmStatic
val BUG = this.create(cobblemonResource("bug"), ElementalTypeTeraType(ElementalTypes.BUG))
@JvmStatic
val ROCK = this.create(cobblemonResource("rock"), ElementalTypeTeraType(ElementalTypes.ROCK))
@JvmStatic
val GHOST = this.create(cobblemonResource("ghost"), ElementalTypeTeraType(ElementalTypes.GHOST))
@JvmStatic
val DRAGON = this.create(cobblemonResource("dragon"), ElementalTypeTeraType(ElementalTypes.DRAGON))
@JvmStatic
val DARK = this.create(cobblemonResource("dark"), ElementalTypeTeraType(ElementalTypes.DARK))
@JvmStatic
val STEEL = this.create(cobblemonResource("steel"), ElementalTypeTeraType(ElementalTypes.STEEL))
@JvmStatic
val FAIRY = this.create(cobblemonResource("fairy"), ElementalTypeTeraType(ElementalTypes.FAIRY))
@JvmStatic
val STELLAR = this.create(StellarTeraType.ID, StellarTeraType())
/**
* Pick a random [TeraType].
*
* @param legalOnly If [TeraType.legalAsStatic] should be respected.
* @return The selected [TeraType].
*/
@JvmStatic
fun random(legalOnly: Boolean): TeraType {
val possible = this.types.values
if (legalOnly) {
return possible.filter(TeraType::legalAsStatic).random()
}
return possible.random()
}
/**
* Gets a [TeraType] by its [id].
*
* @param id The [Identifier] expected to match against a [TeraType.id].
* @return The found [TeraType] or null.
*/
@JvmStatic
fun get(id: Identifier): TeraType? = this.types[id]
/**
* Gets a [TeraType] by its [id].
*
* @param id The string representation of a [Identifier] if no namespace is present assumes Cobblemon' instead of Minecraft'.
* @return The found [TeraType] or null.
*/
@JvmStatic
fun get(id: String): TeraType? = this.get(cobblemonResource(id))
/**
* Gets the corresponding tera type for a [ElementalType].
*
* @param type The [ElementalType] being checked.
* @return The associated [TeraType].
*/
@JvmStatic
fun forElementalType(type: ElementalType): TeraType = this.get(cobblemonResource(type.name))!! // it's safe to do
private fun create(id: Identifier, type: TeraType): TeraType {
this.types[id] = type
return type
}
}
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.types.tera.elemental
import com.cobblemon.mod.common.api.types.ElementalType
import com.cobblemon.mod.common.api.types.tera.TeraType
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.text.Text
import net.minecraft.util.Identifier
class ElementalTypeTeraType(val type: ElementalType) : TeraType {
override val legalAsStatic: Boolean = true
override val id: Identifier = cobblemonResource(this.type.name)
override val displayName: Text = this.type.displayName
override fun showdownId(): String = this.type.name
}
@@ -0,0 +1,30 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.types.tera.gimmick
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.types.tera.TeraType
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.text.Text
import net.minecraft.util.Identifier
class StellarTeraType : TeraType {
override val id: Identifier = ID
override val legalAsStatic: Boolean = false
override val displayName: Text = LANG
override fun showdownId(): String = ID.path
companion object {
val ID = cobblemonResource("stellar")
private val LANG = Text.translatable("${Cobblemon.MODID}.terra_type.stellar")
}
}
@@ -22,7 +22,6 @@ import com.cobblemon.mod.common.net.messages.client.battle.BattleChallengeExpire
import com.cobblemon.mod.common.util.getPlayer
import com.google.gson.GsonBuilder
import java.time.Instant
import java.util.Optional
import java.util.UUID
import java.util.concurrent.ConcurrentHashMap
import net.minecraft.server.network.ServerPlayerEntity
@@ -139,7 +138,7 @@ object BattleRegistry {
// 0 - 9, empty == 10
packedTeamBuilder.append("${if (pk.dmaxLevel < 10) pk.dmaxLevel else ""},")
// Teratype
packedTeamBuilder.append("${pokemon.effectedPokemon.teraType.name},")
packedTeamBuilder.append("${pokemon.effectedPokemon.teraType.showdownId()},")
team.add(packedTeamBuilder.toString())
}
@@ -0,0 +1,111 @@
/*
* 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.cobblemon.mod.common.block.entity.DisplayCaseBlockEntity
import com.cobblemon.mod.common.item.PokeBallItem
import net.minecraft.block.*
import net.minecraft.block.HorizontalFacingBlock.*
import net.minecraft.entity.ai.pathing.NavigationType
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.item.BlockItem
import net.minecraft.item.ItemPlacementContext
import net.minecraft.state.StateManager
import net.minecraft.util.ActionResult
import net.minecraft.util.Hand
import net.minecraft.util.ItemScatterer
import net.minecraft.util.hit.BlockHitResult
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Direction
import net.minecraft.world.BlockView
import net.minecraft.world.World
import net.minecraft.world.WorldAccess
@Suppress("OVERRIDE_DEPRECATION")
class DisplayCaseBlock(settings: Settings) : BlockWithEntity(settings) {
init {
this.defaultState = this.stateManager.defaultState
.with(FACING, Direction.NORTH)
}
override fun getPlacementState(ctx: ItemPlacementContext): BlockState? {
var blockState = defaultState
val worldView = ctx.world
val blockPos = ctx.blockPos
ctx.placementDirections.forEach { direction ->
if (direction.axis.isHorizontal) {
blockState = blockState.with(FACING, direction) as BlockState
if (blockState.canPlaceAt(worldView, blockPos)) {
return blockState
}
}
}
return null
}
override fun appendProperties(builder: StateManager.Builder<Block, BlockState>) {
builder.add(FACING)
}
override fun createBlockEntity(pos: BlockPos, state: BlockState): DisplayCaseBlockEntity {
return DisplayCaseBlockEntity(pos, state)
}
override fun getStateForNeighborUpdate(
state: BlockState,
direction: Direction,
neighborState: BlockState,
world: WorldAccess,
pos: BlockPos,
neighborPos: BlockPos
): BlockState {
return if (direction == state.get(FACING) && !state.canPlaceAt(world, pos)) Blocks.AIR.defaultState
else super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos)
}
override fun onUse(
state: BlockState,
world: World,
pos: BlockPos,
player: PlayerEntity,
hand: Hand,
hit: BlockHitResult
): ActionResult {
val entity = world.getBlockEntity(pos) as DisplayCaseBlockEntity
val result = entity.updateItem(player, hand)
if ((hit.side != Direction.UP && hit.side != Direction.DOWN) && result == ActionResult.SUCCESS) {
world.setBlockState(pos, state.with(FACING, hit.side.opposite))
}
return result
}
override fun onBreak(world: World, pos: BlockPos, state: BlockState, player: PlayerEntity) {
val entity = world.getBlockEntity(pos) as DisplayCaseBlockEntity
if (!entity.getStack().isEmpty && !player.isCreative) {
ItemScatterer.spawn(world, pos, entity.inv)
}
super.onBreak(world, pos, state, player)
}
override fun getRenderType(state: BlockState?) = BlockRenderType.MODEL
override fun getComparatorOutput(state: BlockState, world: World, pos: BlockPos): Int {
val stack = (world.getBlockEntity(pos) as DisplayCaseBlockEntity).getStack()
if (stack.isEmpty) return 0
if (stack.item is PokeBallItem) return 3
if (stack.item is BlockItem) return 2
return 1
}
override fun hasComparatorOutput(state: BlockState?) = true
override fun canPathfindThrough(state: BlockState, world: BlockView, pos: BlockPos, type: NavigationType) = false
}
@@ -62,8 +62,8 @@ class MonitorBlock(properties: Settings) : MultiblockBlock(properties) {
if(world == null || pos == null) {
return 0
}
val monitorEntity = world.getBlockEntity(pos) as MultiblockEntity
val multiBlockEntity = monitorEntity.multiblockStructure
val monitorEntity = world.getBlockEntity(pos) as? MultiblockEntity
val multiBlockEntity = monitorEntity?.multiblockStructure
if(multiBlockEntity != null) {
return multiBlockEntity.getComparatorOutput(state, world, pos)
}
@@ -149,8 +149,8 @@ class RestorationTankBlock(properties: Settings) : MultiblockBlock(properties),
if(world == null || pos == null) {
return 0
}
val tankEntity = world.getBlockEntity(pos) as MultiblockEntity
val multiBlockEntity = tankEntity.multiblockStructure
val tankEntity = world.getBlockEntity(pos) as? MultiblockEntity
val multiBlockEntity = tankEntity?.multiblockStructure
if(multiBlockEntity != null) {
return multiBlockEntity.getComparatorOutput(state, world, pos)
}
@@ -180,7 +180,7 @@ class RestorationTankBlock(properties: Settings) : MultiblockBlock(properties),
return
}
val tankEntity = world.getBlockEntity(pos) as? MultiblockEntity
tankEntity?.multiblockStructure!!.onTriggerEvent(state, world, pos, random)
tankEntity?.multiblockStructure?.onTriggerEvent(state, world, pos, random)
}
override fun getOutlineShape(
@@ -23,13 +23,18 @@ import net.minecraft.block.BlockWithEntity
import net.minecraft.block.Blocks
import net.minecraft.block.HorizontalFacingBlock
import net.minecraft.block.ShapeContext
import net.minecraft.block.Waterloggable
import net.minecraft.entity.ai.pathing.NavigationType
import net.minecraft.entity.mob.PiglinBrain
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.fluid.FluidState
import net.minecraft.fluid.Fluids
import net.minecraft.item.ItemPlacementContext
import net.minecraft.screen.ScreenHandler
import net.minecraft.server.network.ServerPlayerEntity
import net.minecraft.sound.SoundCategory
import net.minecraft.state.StateManager
import net.minecraft.state.property.BooleanProperty
import net.minecraft.state.property.Properties
import net.minecraft.text.MutableText
import net.minecraft.text.Text
@@ -46,17 +51,21 @@ import net.minecraft.util.shape.VoxelShape
import net.minecraft.util.shape.VoxelShapes
import net.minecraft.world.BlockView
import net.minecraft.world.World
import net.minecraft.world.WorldAccess
@Suppress("OVERRIDE_DEPRECATION")
class GildedChestBlock(settings: Settings, val type: Type = Type.RED) : BlockWithEntity(settings) {
class GildedChestBlock(settings: Settings, val type: Type = Type.RED) : BlockWithEntity(settings), Waterloggable {
init {
defaultState = defaultState.with(Properties.HORIZONTAL_FACING, Direction.SOUTH)
defaultState = defaultState
.with(Properties.HORIZONTAL_FACING, Direction.SOUTH)
.with(WATERLOGGED, false)
}
companion object {
val POKEMON_ARGS = "gimmighoul"
val LEVEL_RANGE = 5..30
val WATERLOGGED = BooleanProperty.of("waterlogged")
val SOUTH_OUTLINE = VoxelShapes.union(
VoxelShapes.cuboid(0.0, 0.0, 0.25, 1.0, 1.0, 0.9375)
@@ -88,9 +97,28 @@ class GildedChestBlock(settings: Settings, val type: Type = Type.RED) : BlockWit
}
}
override fun getStateForNeighborUpdate(
state: BlockState,
direction: Direction,
neighborState: BlockState,
world: WorldAccess,
pos: BlockPos,
neighborPos: BlockPos
): BlockState {
if (state.get(WATERLOGGED)) world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world))
return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos)
}
override fun getFluidState(state: BlockState): FluidState {
return if (state.get(WATERLOGGED)) {
Fluids.WATER.getStill(false)
} else super.getFluidState(state)
}
override fun appendProperties(builder: StateManager.Builder<Block, BlockState>) {
super.appendProperties(builder)
builder.add(Properties.HORIZONTAL_FACING)
builder.add(WATERLOGGED)
}
private val facingToYaw: HashMap<Direction, Float> = hashMapOf(
@@ -111,7 +139,7 @@ class GildedChestBlock(settings: Settings, val type: Type = Type.RED) : BlockWit
if (player is ServerPlayerEntity) {
spawnPokemon(world, pos, state, player)
}
world.setBlockState(pos, Blocks.AIR.defaultState)
world.setBlockState(pos, if (state.fluidState.isOf(Fluids.WATER)) Blocks.WATER.defaultState else Blocks.AIR.defaultState)
} else super.onBreak(world, pos, state, player)
}
@@ -188,12 +216,9 @@ class GildedChestBlock(settings: Settings, val type: Type = Type.RED) : BlockWit
override fun getRenderType(state: BlockState?) = BlockRenderType.ENTITYBLOCK_ANIMATED
override fun getPlacementState(blockPlaceContext: ItemPlacementContext): BlockState? {
// val abovePosition = blockPlaceContext.blockPos.up()
// val world = blockPlaceContext.world
// if (world.getBlockState(abovePosition).canReplace(blockPlaceContext) && !world.isOutOfHeightLimit(abovePosition)) {
return defaultState.with(HorizontalFacingBlock.FACING, blockPlaceContext.horizontalPlayerFacing.opposite)
// }
// return null
return defaultState
.with(HorizontalFacingBlock.FACING, blockPlaceContext.horizontalPlayerFacing.opposite)
.with(WATERLOGGED, blockPlaceContext.world.getFluidState(blockPlaceContext.blockPos).fluid == Fluids.WATER)
}
@Deprecated("Deprecated in Java")
@@ -205,6 +230,14 @@ class GildedChestBlock(settings: Settings, val type: Type = Type.RED) : BlockWit
) as BlockState
}
override fun hasComparatorOutput(state: BlockState?): Boolean {
return true
}
override fun getComparatorOutput(state: BlockState?, world: World, pos: BlockPos?): Int {
return ScreenHandler.calculateComparatorOutput(world.getBlockEntity(pos))
}
override fun mirror(state: BlockState, mirror: BlockMirror): BlockState {
return state.rotate(mirror.getRotation(state.get(Properties.HORIZONTAL_FACING) as Direction))
}
@@ -0,0 +1,180 @@
/*
* 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.entity
import com.cobblemon.mod.common.CobblemonBlockEntities
import com.cobblemon.mod.common.CobblemonSounds
import net.minecraft.block.Block
import net.minecraft.block.BlockState
import net.minecraft.block.entity.BlockEntity
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.inventory.Inventories
import net.minecraft.inventory.SidedInventory
import net.minecraft.item.ItemStack
import net.minecraft.item.Items
import net.minecraft.nbt.NbtCompound
import net.minecraft.network.listener.ClientPlayPacketListener
import net.minecraft.network.packet.Packet
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket
import net.minecraft.sound.SoundCategory
import net.minecraft.util.ActionResult
import net.minecraft.util.Hand
import net.minecraft.util.collection.DefaultedList
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Direction
import net.minecraft.world.World
class DisplayCaseBlockEntity(pos: BlockPos, state: BlockState) : BlockEntity(CobblemonBlockEntities.DISPLAY_CASE, pos, state), SidedInventory {
val inv: DefaultedList<ItemStack> = DefaultedList.ofSize(1, ItemStack.EMPTY)
/**
* Updates the [ItemStack] stored in this entity
*
* @param player The [PlayerEntity] that performed this interaction
* @param hand The [Hand] the player used to perform this interaction
* @author whatsy
*/
fun updateItem(player: PlayerEntity, hand: Hand): ActionResult {
val playerStack = player.getStackInHand(hand)
// Player and case item are the same - do nothing
if (playerStack.item == getStack().item) {
return if (playerStack.item != Items.AIR) ActionResult.SUCCESS else ActionResult.FAIL
}
// Player's hand is empty, case is not empty - give player the item in the case
if (playerStack.isEmpty && !getStack().isEmpty) {
if (!player.isCreative) player.setStackInHand(hand, getStack())
setCaseStack(ItemStack.EMPTY)
return ActionResult.success(true)
}
// Case is empty, player's hand is not - put playerStack in the case
if (getStack().isEmpty && !playerStack.isEmpty) {
setCaseStack(playerStack.copy())
if (!player.isCreative) playerStack.decrement(1)
return ActionResult.success(true)
}
// Player has item, case has item - swap items
if (!getStack().isEmpty && !playerStack.isEmpty) {
val oldCaseStack = getStack()
setCaseStack(playerStack.copy())
if (!player.isCreative) {
playerStack.decrement(1)
player.giveItemStack(oldCaseStack)
}
return ActionResult.SUCCESS
}
return ActionResult.FAIL
}
fun getStack(): ItemStack {
return inv[0]
}
private fun setCaseStack(newStack: ItemStack) {
if (world == null) return
val oldState = world!!.getBlockState(pos)
newStack.count = 1
inv[0] = newStack
if (newStack.isEmpty) {
world!!.playSound(null, pos, CobblemonSounds.DISPLAY_CASE_REMOVE_ITEM, SoundCategory.BLOCKS)
} else {
world!!.playSound(null, pos, CobblemonSounds.DISPLAY_CASE_ADD_ITEM, SoundCategory.BLOCKS)
}
world!!.updateListeners(pos, oldState, world!!.getBlockState(pos), Block.NOTIFY_LISTENERS)
world!!.updateComparators(pos, world!!.getBlockState(pos).block)
}
override fun writeNbt(nbt: NbtCompound) {
super.writeNbt(nbt)
Inventories.writeNbt(nbt, inv, true)
}
override fun readNbt(nbt: NbtCompound) {
super.readNbt(nbt)
inv.clear()
Inventories.readNbt(nbt, inv)
}
override fun toUpdatePacket(): Packet<ClientPlayPacketListener>? {
return BlockEntityUpdateS2CPacket.create(this)
}
override fun toInitialChunkDataNbt(): NbtCompound {
return this.createNbt()
}
private fun onItemUpdated(world: World, oldState: BlockState, newState: BlockState) {
markDirty()
world.updateListeners(pos, oldState, newState, Block.NOTIFY_LISTENERS)
world.updateComparators(pos, world.getBlockState(pos).block)
}
override fun clear() {
inv.clear()
}
override fun size(): Int {
return inv.size
}
override fun isEmpty(): Boolean {
return getStack().isEmpty
}
override fun getStack(slot: Int): ItemStack {
return getStack()
}
override fun removeStack(slot: Int, amount: Int): ItemStack {
val oldState = cachedState
val result = Inventories.splitStack(inv, slot, amount)
if (world != null) onItemUpdated(world!!, oldState, world!!.getBlockState(pos))
return result
}
override fun removeStack(slot: Int): ItemStack {
val oldState = cachedState
val result = Inventories.removeStack(inv, slot)
if (world != null) onItemUpdated(world!!, oldState, world!!.getBlockState(pos))
return result
}
override fun setStack(slot: Int, stack: ItemStack) {
val oldState = cachedState
inv[slot] = stack
if (stack.count > stack.maxCount) {
stack.count = stack.maxCount
}
if (world != null) onItemUpdated(world!!, oldState, world!!.getBlockState(pos))
}
override fun canPlayerUse(player: PlayerEntity?) = false
override fun getAvailableSlots(side: Direction?): IntArray {
val result = IntArray(inv.size)
for (i in result.indices) {
result[i] = i
}
return result
}
override fun getMaxCountPerStack() = 1
override fun canInsert(slot: Int, stack: ItemStack?, dir: Direction?): Boolean {
if(dir == Direction.DOWN) return false
return getStack().isEmpty
}
override fun canExtract(slot: Int, stack: ItemStack?, dir: Direction?): Boolean = (dir == Direction.DOWN)
}
@@ -19,6 +19,7 @@ import net.minecraft.block.entity.BlockEntityType
import net.minecraft.nbt.NbtCompound
import net.minecraft.nbt.NbtHelper
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.ChunkPos
open class FossilMultiblockEntity(
pos: BlockPos,
@@ -39,8 +40,12 @@ open class FossilMultiblockEntity(
get() {
return if (field != null) {
field
} else if (masterBlockPos != null && masterBlockPos != pos && world?.getBlockEntity(masterBlockPos) != null) {
field = (world?.getBlockEntity(masterBlockPos) as FossilMultiblockEntity).multiblockStructure
} else if (masterBlockPos != null && masterBlockPos != pos) {
val chunkPos = ChunkPos(masterBlockPos)
if (world?.chunkManager?.isChunkLoaded(chunkPos.x, chunkPos.z) == true) {
val entity: FossilMultiblockEntity? = world?.getBlockEntity(masterBlockPos) as FossilMultiblockEntity?
field = entity?.multiblockStructure
}
field
} else {
null
@@ -20,6 +20,7 @@ import net.minecraft.entity.player.PlayerEntity
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.inventory.DoubleInventory
import net.minecraft.inventory.Inventories
import net.minecraft.inventory.SidedInventory
import net.minecraft.item.ItemStack
import net.minecraft.nbt.NbtCompound
import net.minecraft.screen.GenericContainerScreenHandler
@@ -28,9 +29,10 @@ import net.minecraft.state.property.Properties
import net.minecraft.text.Text
import net.minecraft.util.collection.DefaultedList
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Direction
import net.minecraft.world.World
class GildedChestBlockEntity(pos: BlockPos, state: BlockState, val type: Type = Type.RED) : LootableContainerBlockEntity(CobblemonBlockEntities.GILDED_CHEST, pos, state) {
class GildedChestBlockEntity(pos: BlockPos, state: BlockState, val type: Type = Type.RED) : LootableContainerBlockEntity(CobblemonBlockEntities.GILDED_CHEST, pos, state), SidedInventory {
var inventoryContents: DefaultedList<ItemStack> = DefaultedList.ofSize(NUM_SLOTS, ItemStack.EMPTY)
val poseableState: GildedState = GildedState()
@@ -69,7 +71,7 @@ class GildedChestBlockEntity(pos: BlockPos, state: BlockState, val type: Type =
override fun getContainerName() = Text.translatable("block.cobblemon.gilded_chest")
override fun createScreenHandler(syncId: Int, playerInventory: PlayerInventory?) =
GenericContainerScreenHandler.createGeneric9x3(syncId, playerInventory, this);
GenericContainerScreenHandler.createGeneric9x3(syncId, playerInventory, this)
override fun onOpen(player: PlayerEntity) {
if (!this.removed && !player.isSpectator && type != Type.FAKE) {
@@ -83,6 +85,22 @@ class GildedChestBlockEntity(pos: BlockPos, state: BlockState, val type: Type =
}
}
override fun getAvailableSlots(side: Direction): IntArray {
return if (type == Type.FAKE) IntArray(0) else IntArray(NUM_SLOTS)
}
override fun canInsert(slot: Int, stack: ItemStack?, dir: Direction?): Boolean {
if (type == Type.FAKE) return false
return dir != Direction.DOWN
}
override fun canExtract(slot: Int, stack: ItemStack?, dir: Direction?): Boolean {
if (type == Type.FAKE) return false
return dir == Direction.DOWN
}
override fun canPlayerUse(player: PlayerEntity) = !player.isSpectator
override fun getInvStackList(): DefaultedList<ItemStack> = inventoryContents
override fun setInvStackList(list: DefaultedList<ItemStack>) {
@@ -117,10 +117,10 @@ class FossilMultiblockBuilder(val centerPos: BlockPos) : MultiblockStructureBuil
val monitorPos = monitorPositions[fossilTankIndex]
val fossilAnalyzerPos = fossilAnalyzerPositions[fossilTankIndex]!!
val restorationTankPos = restorationTankPositions[fossilTankIndex]!!
val monitorEntity = world.getBlockEntity(monitorPos) as MultiblockEntity
val analyzerEntity = world.getBlockEntity(fossilAnalyzerPos) as MultiblockEntity
val tankBaseEntity = world.getBlockEntity(restorationTankPos) as MultiblockEntity
val tankTopEntity = world.getBlockEntity(restorationTankPos.up()) as MultiblockEntity
val monitorEntity = world.getBlockEntity(monitorPos) as? MultiblockEntity
val analyzerEntity = world.getBlockEntity(fossilAnalyzerPos) as? MultiblockEntity
val tankBaseEntity = world.getBlockEntity(restorationTankPos) as? MultiblockEntity
val tankTopEntity = world.getBlockEntity(restorationTankPos.up()) as? MultiblockEntity
val structure = FossilMultiblockStructure(monitorPos, fossilAnalyzerPos, restorationTankPos)
structure.tankConnectorDirection = dirsToCheck.filter {
@@ -128,20 +128,20 @@ class FossilMultiblockBuilder(val centerPos: BlockPos) : MultiblockStructureBuil
return@filter adjPos == fossilAnalyzerPos
}.first()
analyzerEntity.multiblockStructure = structure
tankBaseEntity.multiblockStructure = structure
tankTopEntity.multiblockStructure = structure
monitorEntity.multiblockStructure = structure
analyzerEntity?.multiblockStructure = structure
tankBaseEntity?.multiblockStructure = structure
tankTopEntity?.multiblockStructure = structure
monitorEntity?.multiblockStructure = structure
structure.syncToClient(world)
structure.markDirty(world)
world.playSound(null, centerPos, CobblemonSounds.FOSSIL_MACHINE_ASSEMBLE, SoundCategory.BLOCKS)
//Set these to null so the builders can be freed
analyzerEntity.multiblockBuilder = null
tankBaseEntity.multiblockBuilder = null
tankTopEntity.multiblockBuilder = null
monitorEntity.multiblockBuilder = null
analyzerEntity?.multiblockBuilder = null
tankBaseEntity?.multiblockBuilder = null
tankTopEntity?.multiblockBuilder = null
monitorEntity?.multiblockBuilder = null
}
companion object {
@@ -98,101 +98,97 @@ class FossilMultiblockStructure (
): ActionResult {
val stack = player.getStackInHand(interactionHand)
if (this.createdPokemon != null) {
if (!stack.isIn(CobblemonItemTags.POKE_BALLS) || stack.item !is PokeBallItem) {
return ActionResult.PASS
}
if(stack.isIn(CobblemonItemTags.POKE_BALLS) || stack.item is PokeBallItem) {
if (player !is ServerPlayerEntity) {
return ActionResult.CONSUME
return ActionResult.SUCCESS
}
if (this.createdPokemon != null) {
if (this.fossilOwnerUUID != null && player.uuid != this.fossilOwnerUUID) {
var ownerName : String = "UNKNOWN_USER" // TODO: lang agnostic fallback
server()?.userCache?.getByUuid(this.fossilOwnerUUID)?.orElse(null)?.name?.let {
ownerName = it
if (this.fossilOwnerUUID != null && player.uuid != this.fossilOwnerUUID) {
var ownerName : String = "UNKNOWN_USER" // TODO: lang agnostic fallback
server()?.userCache?.getByUuid(this.fossilOwnerUUID)?.orElse(null)?.name?.let {
ownerName = it
}
player.sendMessage(lang("fossilmachine.protected", ownerName), true)
return ActionResult.FAIL
}
player.sendMessage(lang("fossilmachine.protected", ownerName), true)
return ActionResult.FAIL
val ballType = (stack.item as PokeBallItem).pokeBall
if (!player.isCreative) {
stack?.decrement(1)
}
this.createdPokemon!!.caughtBall = ballType
player.party().add(this.createdPokemon!!)
this.fossilState.growthState = "Taken"
player.playSound(CobblemonSounds.FOSSIL_MACHINE_RETRIEVE_POKEMON, SoundCategory.BLOCKS, 1.0F, 1.0F)
CobblemonCriteria.RESURRECT_POKEMON.trigger(player, createdPokemon!!)
// Turn the monitor off
val monitorState = world.getBlockState(monitorPos)
if(!monitorState.equals(MonitorBlock.MonitorScreen.OFF)) {
world.setBlockState(monitorPos, monitorState.with(MonitorBlock.SCREEN, MonitorBlock.MonitorScreen.OFF))
}
this.createdPokemon = null
this.fossilOwnerUUID = null
this.protectionTime = -1
this.updateFossilType(world)
this.syncToClient(world)
this.markDirty(world)
return ActionResult.SUCCESS
}
val ballType = (stack.item as PokeBallItem).pokeBall
if (!player.isCreative) {
stack?.decrement(1)
}
this.createdPokemon!!.caughtBall = ballType
player.party().add(this.createdPokemon!!)
this.fossilState.growthState = "Taken"
player.playSound(CobblemonSounds.FOSSIL_MACHINE_RETRIEVE_POKEMON, SoundCategory.BLOCKS, 1.0F, 1.0F)
CobblemonCriteria.RESURRECT_POKEMON.trigger(player, createdPokemon!!)
// Turn the monitor off
val monitorState = world.getBlockState(monitorPos)
if(!monitorState.equals(MonitorBlock.MonitorScreen.OFF)) {
world.setBlockState(monitorPos, monitorState.with(MonitorBlock.SCREEN, MonitorBlock.MonitorScreen.OFF))
}
this.createdPokemon = null
this.fossilOwnerUUID = null
this.protectionTime = -1
this.updateFossilType(world)
this.syncToClient(world)
this.markDirty(world)
return ActionResult.SUCCESS
}
if (this.isRunning()) {
return ActionResult.PASS
}
// Reclaim the last fossil from the machine if their hand is empty
if (player.getStackInHand(interactionHand).isEmpty) {
if (fossilInventory.isEmpty()) {
return ActionResult.CONSUME
}
if(!this.isRunning() && this.createdPokemon == null) {
if (fossilInventory.isEmpty()) {
return ActionResult.CONSUME
}
player.setStackInHand(interactionHand, fossilInventory.last())
player.setStackInHand(interactionHand, fossilInventory.last())
// remove last fossil in the fossil machine stack when grabbed out of the machine
this.fossilInventory.removeAt(fossilInventory.size - 1)
if(!world.isClient) {
world.playSound(null, analyzerPos, CobblemonSounds.FOSSIL_MACHINE_RETRIEVE_FOSSIL, SoundCategory.BLOCKS)
this.updateFossilType(world)
this.syncToClient(world)
this.markDirty(world)
// remove last fossil in the fossil machine stack when grabbed out of the machine
this.fossilInventory.removeAt(fossilInventory.size - 1)
if(!world.isClient) {
world.playSound(null, analyzerPos, CobblemonSounds.FOSSIL_MACHINE_RETRIEVE_FOSSIL, SoundCategory.BLOCKS)
this.updateFossilType(world)
this.syncToClient(world)
this.markDirty(world)
}
}
return ActionResult.CONSUME
}
// Check if the player is holding a fossil and if so insert it into the machine.
if (Fossils.isFossilIngredient(stack)) {
if (fossilInventory.size > Cobblemon.config.maxInsertedFossilItems) {
return ActionResult.FAIL
}
if(!this.isRunning() && this.createdPokemon == null) {
if (fossilInventory.size > Cobblemon.config.maxInsertedFossilItems) {
return ActionResult.FAIL
}
val copyFossilStack = stack.copyWithCount(1)
if (!player.isCreative) {
stack?.decrement(1)
}
val copyFossilStack = stack.copyWithCount(1)
if (!player.isCreative) {
stack?.decrement(1)
}
fossilOwnerUUID = player.uuid
fossilInventory.add(copyFossilStack)
if(!world.isClient) {
this.updateFossilType(world)
world.playSound(null, analyzerPos, CobblemonSounds.FOSSIL_MACHINE_INSERT_FOSSIL, SoundCategory.BLOCKS)
this.syncToClient(world)
this.markDirty(world)
fossilOwnerUUID = player.uuid
fossilInventory.add(copyFossilStack)
if(!world.isClient) {
this.updateFossilType(world)
world.playSound(null, analyzerPos, CobblemonSounds.FOSSIL_MACHINE_INSERT_FOSSIL, SoundCategory.BLOCKS)
this.syncToClient(world)
this.markDirty(world)
}
}
return ActionResult.SUCCESS
}
// Check if the player is holding a natural material and if so, feed it to the machine.
if (NaturalMaterials.isNaturalMaterial(stack) && this.organicMaterialInside < MATERIAL_TO_START) {
if (insertOrganicMaterial(stack, world)) {
if (NaturalMaterials.isNaturalMaterial(stack)) {
if (!this.isRunning() && this.createdPokemon == null && this.organicMaterialInside < MATERIAL_TO_START && insertOrganicMaterial(stack, world)) {
this.lastInteraction = world.time
if (!player.isCreative) {
val returnItem = NaturalMaterials.getReturnItem(stack)
@@ -200,7 +196,6 @@ class FossilMultiblockStructure (
player.giveOrDropItemStack(ItemStack(Registries.ITEM.get(returnItem)), false)
}
}
return ActionResult.success(world.isClient)
}
@@ -311,22 +306,22 @@ class FossilMultiblockStructure (
}
override fun onBreak(world: World, pos: BlockPos, state: BlockState, player: PlayerEntity?) {
val monitorEntity = world.getBlockEntity(monitorPos) as MultiblockEntity
val analyzerEntity = world.getBlockEntity(analyzerPos) as MultiblockEntity
val tankBaseEntity = world.getBlockEntity(tankBasePos) as MultiblockEntity
val tankTopEntity = world.getBlockEntity(tankBasePos.up()) as MultiblockEntity
val state = world.getBlockState(tankBaseEntity.pos)
val monitorEntity = world.getBlockEntity(monitorPos) as? MultiblockEntity
val analyzerEntity = world.getBlockEntity(analyzerPos) as? MultiblockEntity
val tankBaseEntity = world.getBlockEntity(tankBasePos) as? MultiblockEntity
val tankTopEntity = world.getBlockEntity(tankBasePos.up()) as? MultiblockEntity
val state = world.getBlockState(tankBaseEntity?.pos)
val direction = state.get(HorizontalFacingBlock.FACING).getOpposite()
val wildPokemon: Pokemon? = this.createdPokemon
monitorEntity.multiblockStructure = null
analyzerEntity.multiblockStructure = null
tankBaseEntity.multiblockStructure = null
tankTopEntity.multiblockStructure = null
monitorEntity.masterBlockPos = null
analyzerEntity.masterBlockPos = null
tankBaseEntity.masterBlockPos = null
tankTopEntity.masterBlockPos = null
monitorEntity?.multiblockStructure = null
analyzerEntity?.multiblockStructure = null
tankBaseEntity?.multiblockStructure = null
tankTopEntity?.multiblockStructure = null
monitorEntity?.masterBlockPos = null
analyzerEntity?.masterBlockPos = null
tankBaseEntity?.masterBlockPos = null
tankTopEntity?.masterBlockPos = null
// Drop fossils from machine as long as the machine is not started or near completion
if (this.timeRemaining == -1 || this.timeRemaining >= 20) {
@@ -544,7 +539,7 @@ class FossilMultiblockStructure (
}
if (natureValue < 0 && organicMaterialInside == 0) return false
val oldFillStage = organicMaterialInside / 8
val oldFillStage = organicMaterialInside * 8 / MATERIAL_TO_START
// to prevent over/under filling the tank causing a crash
if ((organicMaterialInside + natureValue) > MATERIAL_TO_START) {
@@ -562,7 +557,7 @@ class FossilMultiblockStructure (
world.playSound(null, this.tankBasePos, CobblemonSounds.FOSSIL_MACHINE_INSERT_DNA, SoundCategory.BLOCKS, 1.0F, 1.0F)
}
this.markDirty(world)
if (oldFillStage != (organicMaterialInside / 8)) {
if (oldFillStage != (organicMaterialInside * 8 / MATERIAL_TO_START)) {
this.syncToClient(world)
}
return true
@@ -624,10 +619,10 @@ class FossilMultiblockStructure (
}
const val TICKS_PER_MINUTE = 1200
const val MATERIAL_TO_START = 64
const val TIME_TO_TAKE = TICKS_PER_MINUTE * 1
const val MATERIAL_TO_START = 128
const val TIME_TO_TAKE = TICKS_PER_MINUTE * 12
const val TIME_PER_STAGE = TIME_TO_TAKE / 8
const val PROTECTION_TIME = 6000
const val PROTECTION_TIME = TICKS_PER_MINUTE * 5
fun fromNbt(nbt: NbtCompound, animAge: Int = -1, partialTicks: Float = 0f): FossilMultiblockStructure {
val monitorPos = NbtHelper.toBlockPos(nbt.getCompound(DataKeys.MONITOR_POS))
@@ -662,7 +657,7 @@ class FossilMultiblockStructure (
if (nbt.contains(DataKeys.CREATED_POKEMON)) {
result.createdPokemon = Pokemon.loadFromNBT(nbt.getCompound(DataKeys.CREATED_POKEMON))
}
result.fillLevel = result.organicMaterialInside / 8
result.fillLevel = result.organicMaterialInside * 8 / MATERIAL_TO_START
return result
}
@@ -27,7 +27,9 @@ import com.cobblemon.mod.common.client.render.block.FossilAnalyzerRenderer
import com.cobblemon.mod.common.client.render.block.RestorationTankRenderer
import com.cobblemon.mod.common.client.render.block.GildedChestBlockRenderer
import com.cobblemon.mod.common.client.render.block.HealingMachineRenderer
import com.cobblemon.mod.common.client.render.block.*
import com.cobblemon.mod.common.client.render.boat.CobblemonBoatRenderer
import com.cobblemon.mod.common.client.render.generic.GenericBedrockRenderer
import com.cobblemon.mod.common.client.render.item.CobblemonBuiltinItemRendererRegistry
import com.cobblemon.mod.common.client.render.item.PokemonItemRenderer
import com.cobblemon.mod.common.client.render.layer.PokemonOnShoulderRenderer
@@ -46,6 +48,7 @@ import com.cobblemon.mod.common.data.CobblemonDataProvider
import com.cobblemon.mod.common.entity.boat.CobblemonBoatType
import com.cobblemon.mod.common.item.PokeBallItem
import com.cobblemon.mod.common.client.render.models.blockbench.repository.FossilModelRepository
import com.cobblemon.mod.common.client.render.models.blockbench.repository.GenericBedrockEntityModelRepository
import com.cobblemon.mod.common.client.render.models.blockbench.repository.MiscModelRepository
import com.cobblemon.mod.common.platform.events.PlatformEvents
import com.cobblemon.mod.common.util.DataKeys
@@ -117,7 +120,6 @@ object CobblemonClient {
PlatformEvents.CLIENT_ITEM_TOOLTIP.subscribe { event ->
val stack = event.stack
val lines = event.lines
val size = lines.size
@Suppress("DEPRECATION")
if (stack.item.registryEntry.key.isPresent && stack.item.registryEntry.key.get().value.namespace == Cobblemon.MODID) {
if (stack.nbt?.getBoolean(DataKeys.HIDE_TOOLTIP) == true) {
@@ -125,14 +127,14 @@ object CobblemonClient {
}
val language = Language.getInstance()
val key = this.baseLangKeyForItem(stack)
val offset = if (size > 1) 1 else 0
val offset = if (lines.size > 1) 1 else 0
if (language.hasTranslation(key)) {
lines.add(size - offset, key.asTranslated().gray())
lines.add(lines.size - offset, key.asTranslated().gray())
}
var i = 1
var listKey = "${key}_$i"
while(language.hasTranslation(listKey)) {
lines.add(size - offset, listKey.asTranslated().gray())
lines.add(lines.size - offset, listKey.asTranslated().gray())
listKey = "${key}_${++i}"
}
}
@@ -218,7 +220,8 @@ object CobblemonClient {
CobblemonBlocks.MEDIUM_BUDDING_SKY_TUMBLESTONE,
CobblemonBlocks.LARGE_BUDDING_SKY_TUMBLESTONE,
CobblemonBlocks.SKY_TUMBLESTONE_CLUSTER,
CobblemonBlocks.GIMMIGHOUL_CHEST
CobblemonBlocks.GIMMIGHOUL_CHEST,
CobblemonBlocks.DISPLAY_CASE
)
this.createBoatModelLayers()
@@ -249,6 +252,7 @@ object CobblemonClient {
this.implementation.registerBlockEntityRenderer(CobblemonBlockEntities.FOSSIL_ANALYZER, ::FossilAnalyzerRenderer)
this.implementation.registerBlockEntityRenderer(CobblemonBlockEntities.RESTORATION_TANK, ::RestorationTankRenderer)
this.implementation.registerBlockEntityRenderer(CobblemonBlockEntities.GILDED_CHEST, ::GildedChestBlockRenderer)
this.implementation.registerBlockEntityRenderer(CobblemonBlockEntities.DISPLAY_CASE, ::DisplayCaseRenderer)
}
private fun registerEntityRenderers() {
@@ -260,6 +264,8 @@ object CobblemonClient {
this.implementation.registerEntityRenderer(CobblemonEntities.BOAT) { ctx -> CobblemonBoatRenderer(ctx, false) }
LOGGER.info("Registering Boat with Chest renderer")
this.implementation.registerEntityRenderer(CobblemonEntities.CHEST_BOAT) { ctx -> CobblemonBoatRenderer(ctx, true) }
LOGGER.info("Registering Generic Bedrock Entity renderer")
this.implementation.registerEntityRenderer(CobblemonEntities.GENERIC_BEDROCK_ENTITY, ::GenericBedrockRenderer)
}
fun reloadCodedAssets(resourceManager: ResourceManager) {
@@ -267,13 +273,14 @@ object CobblemonClient {
BedrockParticleEffectRepository.loadEffects(resourceManager)
BedrockAnimationRepository.loadAnimations(
resourceManager = resourceManager,
directories = PokemonModelRepository.animationDirectories + PokeBallModelRepository.animationDirectories + FossilModelRepository.animationDirectories + BlockEntityModelRepository.animationDirectories
directories = PokemonModelRepository.animationDirectories + PokeBallModelRepository.animationDirectories + FossilModelRepository.animationDirectories + BlockEntityModelRepository.animationDirectories + GenericBedrockEntityModelRepository.animationDirectories
)
PokemonModelRepository.reload(resourceManager)
PokeBallModelRepository.reload(resourceManager)
BerryModelRepository.reload(resourceManager)
FossilModelRepository.reload(resourceManager)
BlockEntityModelRepository.reload(resourceManager)
GenericBedrockEntityModelRepository.reload(resourceManager)
MiscModelRepository.reload(resourceManager)
LOGGER.info("Loaded assets")
}
@@ -59,7 +59,7 @@ class PartyOverlay : InGameHud(MinecraftClient.getInstance(), MinecraftClient.ge
BattleGUI::class.java
)
private val starterToast = CobblemonToast(
val starterToast = CobblemonToast(
MathHelper.randomUuid(),
CobblemonItems.POKE_BALL.defaultStack,
lang("ui.starter.choose_starter_title", SummaryBinding.boundKey().localizedText).red(),
@@ -104,24 +104,12 @@ class PartyOverlay : InGameHud(MinecraftClient.getInstance(), MinecraftClient.ge
!CobblemonClient.checkedStarterScreen
) {
if (!this.attachedToast) {
// Adding starter toast on start and connect of client to server.
minecraft.toastManager.add(this.starterToast)
this.attachedToast = true
}
/*
drawScaledText(
context = context,
text = lang("ui.starter.chooseyourstarter", SummaryBinding.boundKey().localizedText),
x = minecraft.window.scaledWidth / 2,
y = 70,
centered = true,
shadow = true
)
*/
}
return
}
if (this.starterToast.nextVisibility != Toast.Visibility.HIDE) {
this.starterToast.nextVisibility = Toast.Visibility.HIDE
return // Don't render the stuff below if no Pokémon in party
}
val totalHeight = party.slots.size * SLOT_HEIGHT
@@ -10,6 +10,8 @@ package com.cobblemon.mod.common.client.gui.battle.subscreen
import com.cobblemon.mod.common.CobblemonSounds
import com.cobblemon.mod.common.api.battles.model.actor.ActorType
import com.cobblemon.mod.common.api.text.yellow
import com.cobblemon.mod.common.battles.BattleRegistry
import com.cobblemon.mod.common.client.CobblemonClient
import com.cobblemon.mod.common.client.battle.SingleActionRequest
import com.cobblemon.mod.common.client.gui.battle.BattleGUI
@@ -21,7 +23,6 @@ import net.minecraft.client.gui.Selectable
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder
import net.minecraft.client.sound.PositionedSoundInstance
import net.minecraft.client.sound.SoundManager
import net.minecraft.client.util.math.MatrixStack
import net.minecraft.text.MutableText
import net.minecraft.util.Identifier
class BattleGeneralActionSelection(
@@ -61,8 +62,9 @@ class BattleGeneralActionSelection(
}
addOption(rank++, battleLang("ui.run"), BattleGUI.runResource) {
MinecraftClient.getInstance().player?.sendMessage(battleLang("flee"))
CobblemonClient.battle?.minimised = true
MinecraftClient.getInstance().player?.sendMessage(battleLang("run_prompt"), false)
playDownSound(MinecraftClient.getInstance().soundManager)
}
}
}
@@ -15,6 +15,7 @@ import com.cobblemon.mod.common.api.gui.ColourLibrary
import com.cobblemon.mod.common.api.gui.MultiLineLabelK
import com.cobblemon.mod.common.api.gui.blitk
import com.cobblemon.mod.common.api.text.bold
import com.cobblemon.mod.common.client.CobblemonClient
import com.cobblemon.mod.common.client.CobblemonResources
import com.cobblemon.mod.common.client.gui.startselection.widgets.CategoryList
import com.cobblemon.mod.common.client.gui.startselection.widgets.ExitButton
@@ -37,7 +38,7 @@ import net.minecraft.client.MinecraftClient
import net.minecraft.client.gui.DrawContext
import net.minecraft.client.gui.screen.Screen
import net.minecraft.client.sound.PositionedSoundInstance
import net.minecraft.client.util.math.MatrixStack
import net.minecraft.client.toast.Toast
import net.minecraft.text.Text
/**
@@ -74,6 +75,12 @@ class StarterSelectionScreen(private val categories: List<RenderableStarterCateg
override fun init() {
super.init()
// Hide toast once checkedStarterScreen was set, which happens during the opening of the starter screen.
if (CobblemonClient.checkedStarterScreen) {
if (CobblemonClient.overlay.starterToast.nextVisibility != Toast.Visibility.HIDE) {
CobblemonClient.overlay.starterToast.nextVisibility = Toast.Visibility.HIDE
}
}
val x = (width - BASE_WIDTH) / 2
val y = (height - BASE_HEIGHT) / 2
@@ -13,6 +13,7 @@ import com.cobblemon.mod.common.CobblemonSounds
import com.cobblemon.mod.common.api.gui.blitk
import com.cobblemon.mod.common.api.moves.Move
import com.cobblemon.mod.common.api.moves.MoveSet
import com.cobblemon.mod.common.api.pokemon.PokemonSpecies.species
import com.cobblemon.mod.common.api.reactive.Observable.Companion.emitWhile
import com.cobblemon.mod.common.api.reactive.ObservableSubscription
import com.cobblemon.mod.common.api.scheduling.Schedulable
@@ -34,6 +35,7 @@ import com.cobblemon.mod.common.client.gui.summary.widgets.screens.moves.MoveSwa
import com.cobblemon.mod.common.client.gui.summary.widgets.screens.moves.MovesWidget
import com.cobblemon.mod.common.client.gui.summary.widgets.screens.stats.StatWidget
import com.cobblemon.mod.common.client.render.drawScaledText
import com.cobblemon.mod.common.client.render.models.blockbench.repository.PokemonModelRepository
import com.cobblemon.mod.common.net.messages.server.storage.party.MovePartyPokemonPacket
import com.cobblemon.mod.common.net.messages.server.storage.party.SwapPartyPokemonPacket
import com.cobblemon.mod.common.pokemon.Gender
@@ -613,6 +615,27 @@ class Summary private constructor(party: Collection<Pokemon?>, private val edita
) {
this.focused = null
}
if (Cobblemon.config.enableDebugKeys) {
val model = PokemonModelRepository.getPoser(selectedPokemon.species.resourceIdentifier, selectedPokemon.aspects)
if (keyCode == InputUtil.GLFW_KEY_UP) {
model.profileTranslation = model.profileTranslation.add(0.0, -0.01, 0.0)
}
if (keyCode == InputUtil.GLFW_KEY_DOWN) {
model.profileTranslation = model.profileTranslation.add(0.0, 0.01, 0.0)
}
if (keyCode == InputUtil.GLFW_KEY_LEFT) {
model.profileTranslation = model.profileTranslation.add(-0.01, 0.0, 0.0)
}
if (keyCode == InputUtil.GLFW_KEY_RIGHT) {
model.profileTranslation = model.profileTranslation.add(0.01, 0.0, 0.0)
}
if (keyCode == InputUtil.GLFW_KEY_EQUAL) {
model.profileScale += 0.01F
}
if (keyCode == InputUtil.GLFW_KEY_MINUS) {
model.profileScale -= 0.01F
}
}
return super.keyPressed(keyCode, scanCode, modifiers)
}
@@ -620,4 +643,14 @@ class Summary private constructor(party: Collection<Pokemon?>, private val edita
MinecraftClient.getInstance().soundManager.play(PositionedSoundInstance.master(soundEvent, 1.0F))
}
override fun close() {
if (Cobblemon.config.enableDebugKeys) {
val model = PokemonModelRepository.getPoser(selectedPokemon.species.resourceIdentifier, selectedPokemon.aspects)
MinecraftClient.getInstance().player?.sendMessage(Text.of("Profile Translation: ${model.profileTranslation}"))
MinecraftClient.getInstance().player?.sendMessage(Text.of("Profile Scale: ${model.profileScale}"))
Cobblemon.LOGGER.info("override var profileTranslation = Vec3d(${model.profileTranslation.x}, ${model.profileTranslation.y}, ${model.profileTranslation.z})")
Cobblemon.LOGGER.info("override var profileScale = ${model.profileScale}F")
}
super.close()
}
}
@@ -8,11 +8,14 @@
package com.cobblemon.mod.common.client.keybind
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.client.keybind.keybinds.DebugKeybindings
import com.cobblemon.mod.common.client.keybind.keybinds.DownShiftPartyBinding
import com.cobblemon.mod.common.client.keybind.keybinds.HidePartyBinding
import com.cobblemon.mod.common.client.keybind.keybinds.PartySendBinding
import com.cobblemon.mod.common.client.keybind.keybinds.SummaryBinding
import com.cobblemon.mod.common.client.keybind.keybinds.UpShiftPartyBinding
import com.cobblemon.mod.common.config.CobblemonConfig
import com.cobblemon.mod.common.platform.events.PlatformEvents
import net.minecraft.client.option.KeyBinding
@@ -23,13 +26,17 @@ import net.minecraft.client.option.KeyBinding
* @since 2022-02-17
*/
object CobblemonKeyBinds {
private val keyBinds = arrayListOf<CobblemonKeyBinding>()
init {
PlatformEvents.CLIENT_TICK_POST.subscribe { this.onTick() }
if (Cobblemon.config.enableDebugKeys) {
DebugKeybindings.keybindings.forEach {
this.queue(it)
}
}
}
private val keyBinds = arrayListOf<CobblemonKeyBinding>()
val HIDE_PARTY = this.queue(HidePartyBinding)
// ToDo enable again down the line
//val POKENAV = this.queue(PokeNavigatorBinding)
@@ -9,7 +9,9 @@
package com.cobblemon.mod.common.client.keybind
import com.cobblemon.mod.common.api.text.red
import com.cobblemon.mod.common.api.text.yellow
import com.cobblemon.mod.common.client.CobblemonClient
import com.cobblemon.mod.common.client.keybind.keybinds.SummaryBinding
import com.cobblemon.mod.common.net.messages.server.starter.RequestStarterScreenPacket
import com.cobblemon.mod.common.util.lang
import net.minecraft.client.MinecraftClient
@@ -25,12 +27,20 @@ abstract class CobblemonPartyLockedKeyBinding(
category: String
) : CobblemonKeyBinding(name, type, key, category) {
private var skippedStarterSelectionMessageShown = false
override fun onTick() {
if (this.wasPressed() && this.hasPartyMembers()) {
this.onPress()
}
}
/**
* Checks if the player has any party members, and
*
* - Handles the starter selection if the player doesn't have any party members.
* - Shows a message if the player initially skipped the starter selection.
*/
private fun hasPartyMembers(): Boolean {
val havePokemon = CobblemonClient.storage.myParty.slots.any { it != null }
val starterSelected = CobblemonClient.clientPlayerData.starterSelected
@@ -42,6 +52,18 @@ abstract class CobblemonPartyLockedKeyBinding(
RequestStarterScreenPacket().sendToServer()
}
return false
} else if (!startersLocked && !starterSelected && havePokemon) {
if (!skippedStarterSelectionMessageShown) {
MinecraftClient.getInstance().player?.sendMessage(
lang(
"ui.starter.skippedchoosing",
SummaryBinding.boundKey().localizedText
).yellow(), false
)
/** Only show the info message about skipping the selection once per MC instance */
skippedStarterSelectionMessageShown = true
}
return true
}
return true
}
@@ -10,4 +10,5 @@ package com.cobblemon.mod.common.client.keybind
object KeybindCategories {
const val COBBLEMON_CATEGORY = "key.cobblemon.categories.cobblemon"
const val COBBLEMON_DEBUG_CATEGORY = "key.cobblemon.categories.cobblemon.debug"
}
@@ -0,0 +1,140 @@
/*
* 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.keybind.keybinds
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.client.CobblemonClient
import com.cobblemon.mod.common.client.keybind.CobblemonKeyBinding
import com.cobblemon.mod.common.client.keybind.KeybindCategories
import com.cobblemon.mod.common.client.render.models.blockbench.repository.PokemonModelRepository
import net.minecraft.client.MinecraftClient
import net.minecraft.client.util.InputUtil
import net.minecraft.text.Text
object DebugKeybindings {
val keybindings = listOf(
ScaleUpKeybinding(),
ScaleDownKeybinding(),
TranslateLeftKeybinding(),
TranslateRightKeybinding(),
TranslateUpKeybinding(),
TranslateDownKeybinding(),
PrintModelSettingsKeybinding()
)
class ScaleUpKeybinding(): CobblemonKeyBinding(
"key.cobblemon.scaleportraitup",
InputUtil.Type.KEYSYM,
InputUtil.GLFW_KEY_EQUAL,
KeybindCategories.COBBLEMON_DEBUG_CATEGORY
) {
override fun onPress() {
val currentlySelectedPokemon = CobblemonClient.storage.myParty.get(CobblemonClient.storage.selectedSlot)
if (currentlySelectedPokemon != null) {
val model = PokemonModelRepository.getPoser(currentlySelectedPokemon.species.resourceIdentifier, currentlySelectedPokemon.aspects)
model.portraitScale += 0.01F
}
}
}
class ScaleDownKeybinding(): CobblemonKeyBinding(
"key.cobblemon.scaleportraitdown",
InputUtil.Type.KEYSYM,
InputUtil.GLFW_KEY_MINUS,
KeybindCategories.COBBLEMON_DEBUG_CATEGORY
) {
override fun onPress() {
val currentlySelectedPokemon = CobblemonClient.storage.myParty.get(CobblemonClient.storage.selectedSlot)
if (currentlySelectedPokemon != null) {
val model = PokemonModelRepository.getPoser(currentlySelectedPokemon.species.resourceIdentifier, currentlySelectedPokemon.aspects)
model.portraitScale -= 0.01F
}
}
}
class TranslateUpKeybinding: CobblemonKeyBinding(
"key.cobblemon.translateportraitup",
InputUtil.Type.KEYSYM,
InputUtil.GLFW_KEY_I,
KeybindCategories.COBBLEMON_DEBUG_CATEGORY
) {
override fun onPress() {
val currentlySelectedPokemon = CobblemonClient.storage.myParty.get(CobblemonClient.storage.selectedSlot)
if (currentlySelectedPokemon != null) {
val model = PokemonModelRepository.getPoser(currentlySelectedPokemon.species.resourceIdentifier, currentlySelectedPokemon.aspects)
model.portraitTranslation = model.portraitTranslation.add(0.0, -0.01, 0.0)
}
}
}
class TranslateDownKeybinding(): CobblemonKeyBinding(
"key.cobblemon.translateportraitdown",
InputUtil.Type.KEYSYM,
InputUtil.GLFW_KEY_K,
KeybindCategories.COBBLEMON_DEBUG_CATEGORY
) {
override fun onPress() {
val currentlySelectedPokemon = CobblemonClient.storage.myParty.get(CobblemonClient.storage.selectedSlot)
if (currentlySelectedPokemon != null) {
val model = PokemonModelRepository.getPoser(currentlySelectedPokemon.species.resourceIdentifier, currentlySelectedPokemon.aspects)
model.portraitTranslation = model.portraitTranslation.add(0.0, 0.01, 0.0)
}
}
}
class TranslateLeftKeybinding(): CobblemonKeyBinding(
"key.cobblemon.translateportraitleft",
InputUtil.Type.KEYSYM,
InputUtil.GLFW_KEY_J,
KeybindCategories.COBBLEMON_DEBUG_CATEGORY
) {
override fun onPress() {
val currentlySelectedPokemon = CobblemonClient.storage.myParty.get(CobblemonClient.storage.selectedSlot)
if (currentlySelectedPokemon != null) {
val model = PokemonModelRepository.getPoser(currentlySelectedPokemon.species.resourceIdentifier, currentlySelectedPokemon.aspects)
model.portraitTranslation = model.portraitTranslation.add(-0.01, 0.0, 0.0)
}
}
}
class TranslateRightKeybinding(): CobblemonKeyBinding(
"key.cobblemon.translateportraitright",
InputUtil.Type.KEYSYM,
InputUtil.GLFW_KEY_L,
KeybindCategories.COBBLEMON_DEBUG_CATEGORY
) {
override fun onPress() {
val currentlySelectedPokemon = CobblemonClient.storage.myParty.get(CobblemonClient.storage.selectedSlot)
if (currentlySelectedPokemon != null) {
val model = PokemonModelRepository.getPoser(currentlySelectedPokemon.species.resourceIdentifier, currentlySelectedPokemon.aspects)
model.portraitTranslation = model.portraitTranslation.add(0.01, 0.0, 0.0)
}
}
}
class PrintModelSettingsKeybinding() : CobblemonKeyBinding(
"key.cobblemon.printmodelsettings",
InputUtil.Type.KEYSYM,
InputUtil.GLFW_KEY_PERIOD,
KeybindCategories.COBBLEMON_DEBUG_CATEGORY
) {
override fun onPress() {
val currentlySelectedPokemon = CobblemonClient.storage.myParty.get(CobblemonClient.storage.selectedSlot)
if (currentlySelectedPokemon != null) {
val model = PokemonModelRepository.getPoser(currentlySelectedPokemon.species.resourceIdentifier, currentlySelectedPokemon.aspects)
MinecraftClient.getInstance().player?.sendMessage(Text.of("Portrait Translation: ${model.portraitTranslation}"))
MinecraftClient.getInstance().player?.sendMessage(Text.of("Portrait Scale: ${model.portraitScale}"))
Cobblemon.LOGGER.info("override var portraitTranslation = Vec3d(${model.portraitTranslation.x}, ${model.portraitTranslation.y}, ${model.portraitTranslation.z})")
Cobblemon.LOGGER.info("override var portraitScale = ${model.portraitScale}F")
}
}
}
}
@@ -40,7 +40,8 @@ object SpawnSnowstormEntityParticleHandler : ClientNetworkPacketHandler<SpawnSno
runtime = particleRuntime,
sourceVelocity = { entity.velocity },
sourceAlive = { !entity.isRemoved },
sourceVisible = { !entity.isInvisible }
sourceVisible = { !entity.isInvisible },
entity = entity
)
storm.spawn()
@@ -10,6 +10,7 @@ package com.cobblemon.mod.common.client.particle
import com.bedrockk.molang.runtime.MoLangRuntime
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.api.molang.MoLangFunctions.getQueryStruct
import com.cobblemon.mod.common.api.snowstorm.BedrockParticleEffect
import com.cobblemon.mod.common.api.snowstorm.ParticleEmitterAction
import com.cobblemon.mod.common.client.render.MatrixWrapper
@@ -42,6 +43,11 @@ class ParticleStorm(
): NoRenderParticle(world, matrixWrapper.getOrigin().x, matrixWrapper.getOrigin().y, matrixWrapper.getOrigin().z) {
fun spawn() {
if (entity != null) {
runtime.environment.getQueryStruct()
.addFunction("entity_width") { DoubleValue(entity.boundingBox.xLength) }
.addFunction("entity_height") { DoubleValue(entity.boundingBox.yLength) }
.addFunction("entity_size") { DoubleValue(entity.boundingBox.run { if (xLength > yLength) xLength else yLength }) }
.addFunction("entity_radius") { DoubleValue(entity.boundingBox.run { if (xLength > yLength) xLength else yLength } / 2) }
// TODO replace with a generified call to if (entity is MoLangEntity) entity.applyVariables(env) or w/e
runtime.environment.setSimpleVariable("entity_width", DoubleValue(entity.boundingBox.xLength))
runtime.environment.setSimpleVariable("entity_height", DoubleValue(entity.boundingBox.yLength))
@@ -67,6 +73,8 @@ class ParticleStorm(
// The idea is that some instantaneous particle effects could teeeechnically be over before they start.
var hasPlayedOnce = false
var distanceTravelled = 0F
companion object {
var contextStorm: ParticleStorm? = null
}
@@ -75,6 +83,7 @@ class ParticleStorm(
init {
runtime.execute(effect.emitter.startExpressions)
effect.emitter.creationEvents.forEach { it.trigger(this, null) }
}
override fun getMaxAge(): Int {
@@ -84,6 +93,7 @@ class ParticleStorm(
override fun markDead() {
super.markDead()
if (!despawned) {
effect.emitter.expirationEvents.forEach { it.trigger(this, null) }
despawned = true
onDespawn()
}
@@ -116,6 +126,12 @@ class ParticleStorm(
y = pos.y
z = pos.z
val oldDistanceTravelled = distanceTravelled
distanceTravelled += Vec3d(x - prevPosX, y - prevPosY, z - prevPosZ).length().toFloat()
effect.emitter.travelDistanceEvents.check(this, null, oldDistanceTravelled.toDouble(), distanceTravelled.toDouble())
effect.emitter.loopingTravelDistanceEvents.forEach { it.check(this, null, oldDistanceTravelled.toDouble(), distanceTravelled.toDouble()) }
effect.emitter.eventTimeline.check(this, null, (age - 1) / 20.0, age / 20.0)
runtime.environment.setSimpleVariable("emitter_random_1", DoubleValue(Random.Default.nextDouble()))
runtime.environment.setSimpleVariable("emitter_random_2", DoubleValue(Random.Default.nextDouble()))
@@ -137,18 +153,27 @@ class ParticleStorm(
}
}
fun spawnParticle() {
fun getNextParticleSpawnPosition(): Vec3d {
runtime.environment.setSimpleVariable("particle_random_1", DoubleValue(Random.Default.nextDouble()))
runtime.environment.setSimpleVariable("particle_random_2", DoubleValue(Random.Default.nextDouble()))
runtime.environment.setSimpleVariable("particle_random_3", DoubleValue(Random.Default.nextDouble()))
runtime.environment.setSimpleVariable("particle_random_4", DoubleValue(Random.Default.nextDouble()))
val center = transformPosition(effect.emitter.shape.getCenter(runtime, entity))
val newPosition = transformPosition(effect.emitter.shape.getNewParticlePosition(runtime, entity))
val initialVelocity = effect.particle.motion.getInitialVelocity(runtime, storm = this, particlePos = newPosition, emitterPos = center)
val velocity = initialVelocity
return newPosition
}
fun getNextParticleVelocity(nextParticlePosition: Vec3d): Vec3d {
val center = transformPosition(effect.emitter.shape.getCenter(runtime, entity))
val initialVelocity = effect.particle.motion.getInitialVelocity(runtime, storm = this, particlePos = nextParticlePosition, emitterPos = center)
return initialVelocity
.multiply(1 / 20.0)
.add(if (effect.space.localVelocity) sourceVelocity() else Vec3d.ZERO)
}
fun spawnParticle() {
val newPosition = getNextParticleSpawnPosition()
val velocity = getNextParticleVelocity(newPosition)
contextStorm = this
world.addParticle(particleEffect, newPosition.x, newPosition.y, newPosition.z, velocity.x, velocity.y, velocity.z)
@@ -89,6 +89,14 @@ class SnowstormParticle(
var viewDirection = Vec3d.ZERO
var originPos = Vec3d(storm.getX(), storm.getY(), storm.getZ())
fun getX() = x
fun getY() = y
fun getZ() = z
fun getVelocityX() = velocityX
fun getVelocityY() = velocityY
fun getVelocityZ() = velocityZ
fun getSpriteFromAtlas(): Sprite {
val atlas = MinecraftClient.getInstance().particleManager.particleAtlasTexture
@@ -118,6 +126,7 @@ class SnowstormParticle(
storm.particles.add(this)
gravityStrength = 0F
particleTextureSheet = if (invisible) NO_RENDER else PARTICLE_SHEET_TRANSLUCENT
storm.effect.particle.creationEvents.forEach { it.trigger(storm, this) }
// when (storm.effect.particle.material) {
// ParticleMaterial.ALPHA -> ParticleMaterials.ALPHA
// ParticleMaterial.OPAQUE -> ParticleMaterials.OPAQUE
@@ -180,8 +189,8 @@ class SnowstormParticle(
viewDirection = viewDirection
)
val xSize = storm.runtime.resolveDouble(storm.effect.particle.sizeX).toFloat()
val ySize = storm.runtime.resolveDouble(storm.effect.particle.sizeY).toFloat()
val xSize = storm.runtime.resolveDouble(storm.effect.particle.sizeX).toFloat() / 1.5.toFloat()
val ySize = storm.runtime.resolveDouble(storm.effect.particle.sizeY).toFloat() / 1.5.toFloat()
val particleVertices = arrayOf(
Vector3f(-xSize, -ySize, 0.0f),
@@ -245,6 +254,7 @@ class SnowstormParticle(
angularVelocity += storm.effect.particle.rotation.getAngularAcceleration(storm.runtime, angularVelocity) / 20
if (age > maxAge || storm.runtime.resolveBoolean(storm.effect.particle.killExpression)) {
storm.effect.particle.expirationEvents.forEach { it.trigger(storm, this)}
markDead()
return
} else {
@@ -285,6 +295,8 @@ class SnowstormParticle(
age++
this.move(velocityX, velocityY, velocityZ)
storm.effect.particle.timeline.check(storm, this, (age - 1) / 20.0, age / 20.0)
}
override fun move(dx: Double, dy: Double, dz: Double) {
@@ -0,0 +1,165 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.client.render.block
import com.cobblemon.mod.common.CobblemonBlocks
import com.cobblemon.mod.common.CobblemonItems
import com.cobblemon.mod.common.block.entity.DisplayCaseBlockEntity
import com.cobblemon.mod.common.client.render.models.blockbench.repository.PokemonModelRepository
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.item.PokeBallItem
import com.cobblemon.mod.common.item.PokemonItem
import net.minecraft.block.HorizontalFacingBlock
import net.minecraft.client.MinecraftClient
import net.minecraft.client.render.OverlayTexture
import net.minecraft.client.render.VertexConsumer
import net.minecraft.client.render.VertexConsumerProvider
import net.minecraft.client.render.block.entity.BlockEntityRenderer
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory
import net.minecraft.client.render.model.json.ModelTransformationMode
import net.minecraft.client.util.math.MatrixStack
import net.minecraft.item.BannerItem
import net.minecraft.item.BedItem
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
import net.minecraft.item.Items
import net.minecraft.nbt.NbtInt
import net.minecraft.util.math.Direction
import net.minecraft.util.math.RotationAxis
import net.minecraft.world.World
class DisplayCaseRenderer(ctx: BlockEntityRendererFactory.Context) : BlockEntityRenderer<DisplayCaseBlockEntity> {
val coinPouchStack: ItemStack by lazy { ItemStack(CobblemonItems.RELIC_COIN_POUCH).also { it.setSubNbt("CustomModelData", NbtInt.of(1)) } }
override fun render(
entity: DisplayCaseBlockEntity,
tickDelta: Float,
matrices: MatrixStack,
vertexConsumers: VertexConsumerProvider,
light: Int,
overlay: Int
) {
val stack: ItemStack = if (entity.getStack().isOf(CobblemonItems.RELIC_COIN_POUCH)) {
coinPouchStack
} else {
entity.getStack()
}
val world = entity.world ?: return
val posType = getPositioningType(stack, world)
val blockState = if (entity.world != null) entity.cachedState
else (CobblemonBlocks.DISPLAY_CASE.defaultState.with(HorizontalFacingBlock.FACING, Direction.NORTH))
val yRot = if (posType == PositioningType.ITEM_MODEL) blockState.get(HorizontalFacingBlock.FACING).opposite.asRotation()
else blockState.get(HorizontalFacingBlock.FACING).asRotation()
if (stack.item is PokemonItem) {
renderPokemon(
matrices,
vertexConsumers,
light,
stack,
yRot
)
return
}
matrices.push()
matrices.translate(0.5f, 0.4f, 0.5f)
matrices.scale(posType.scaleX, posType.scaleY, posType.scaleZ)
matrices.translate(posType.transX, posType.transY, posType.transZ)
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-yRot))
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(posType.rotY))
MinecraftClient.getInstance().itemRenderer.renderItem(
stack,
ModelTransformationMode.GROUND,
light,
overlay,
matrices,
vertexConsumers,
entity.world,
0
)
matrices.pop()
}
private fun renderPokemon(
matrices: MatrixStack,
vertexConsumers: VertexConsumerProvider,
light: Int,
stack: ItemStack,
yRot: Float
) {
val item = stack.item as? PokemonItem ?: return
val pokemon = item.asPokemon(stack) ?: return
val model = PokemonModelRepository.getPoser(pokemon.species.resourceIdentifier, pokemon.aspects)
val renderLayer = model.getLayer(PokemonModelRepository.getTexture(pokemon.species.resourceIdentifier, pokemon.aspects, 0F))
val tint = item.tint(stack)
val vertexConsumer: VertexConsumer = vertexConsumers.getBuffer(renderLayer)
val scale = 0.25f
matrices.push()
matrices.scale(1f, -1f, -1f)
matrices.translate(0.5f, -0.69f, -0.5f)
matrices.scale(scale, scale, scale)
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(yRot))
model.setupAnimStateless(PoseType.PROFILE)
model.withLayerContext(vertexConsumers, null, PokemonModelRepository.getLayers(pokemon.species.resourceIdentifier, pokemon.aspects)) {
model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, tint.x, tint.y, tint.z, tint.w)
}
matrices.pop()
}
companion object {
private val mobHeads = listOf<Item>(
Items.SKELETON_SKULL,
Items.WITHER_SKELETON_SKULL,
Items.ZOMBIE_HEAD,
Items.PIGLIN_HEAD,
Items.PLAYER_HEAD,
Items.DRAGON_HEAD,
Items.CREEPER_HEAD
)
private fun getPositioningType(stack: ItemStack, world: World) = when {
mobHeads.contains(stack.item) -> PositioningType.MOB_HEAD
stack.item is BedItem -> PositioningType.BED
stack.item is BannerItem -> PositioningType.BANNER
stack.item is PokeBallItem -> PositioningType.POKE_BALL
stack.item == CobblemonItems.RELIC_COIN_POUCH -> PositioningType.COIN_POUCH
stack.item == CobblemonItems.PASTURE -> PositioningType.PASTURE
stack.item == CobblemonItems.POKEMON_MODEL -> PositioningType.ITEM_MODEL
stack.item == Items.SHIELD -> PositioningType.SHIELD
stack.item == Items.DECORATED_POT -> PositioningType.MOB_HEAD
MinecraftClient.getInstance().itemRenderer.getModel(stack, world, null, 0).hasDepth() -> PositioningType.BLOCK_MODEL
else -> PositioningType.ITEM_MODEL
}
}
private enum class PositioningType(
val scaleX: Float, val scaleY: Float, val scaleZ: Float,
val transX: Float, val transY: Float, val transZ: Float,
val rotY: Float = 0f
) {
POKE_BALL(1f, 1f, 1f, 0f, 0.04f, 0f),
BLOCK_MODEL(1f, 1f, 1f, 0f, -0.15f, 0f),
ITEM_MODEL(1f, 1f, 1f, 0f, 0.04f, 0f),
BED(1f, 1f, 1f, 0f, -0.02f, 0f),
BANNER(1f, 1f, 1f, 0f, -0.02f, 0f, 180f),
MOB_HEAD(1f, 1f, 1f, 0f, -0.025f, 0f, 180f),
SHIELD(1f, 1f, 1f, 0f, -0.045f, 0f, 180f),
PASTURE(1f, 1f, 1f, 0f, 0.0375f, 0f),
COIN_POUCH(1f, 1f, 1f, 0f, 0.415f, 0f)
}
}
@@ -19,8 +19,10 @@ import net.minecraft.client.render.block.entity.BlockEntityRenderer
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory
import net.minecraft.client.render.model.json.ModelTransformationMode
import net.minecraft.client.util.math.MatrixStack
import net.minecraft.state.property.DirectionProperty
import net.minecraft.util.math.Direction
import net.minecraft.util.math.RotationAxis
import net.minecraft.util.math.Vec3d
class FossilAnalyzerRenderer(ctx: BlockEntityRendererFactory.Context) : BlockEntityRenderer<FossilAnalyzerBlockEntity> {
@@ -34,21 +36,29 @@ class FossilAnalyzerRenderer(ctx: BlockEntityRendererFactory.Context) : BlockEnt
) {
val blockState = if (entity.world != null) entity.cachedState
else (CobblemonBlocks.FOSSIL_ANALYZER.defaultState.with(HorizontalFacingBlock.FACING, Direction.SOUTH) as BlockState)
val yRot = blockState.get(HorizontalFacingBlock.FACING).asRotation()
//We shouldnt have to do any complex rendering when the block isn't a multiblock
// We shouldn't have to do any complex rendering when the block isn't a multiblock
if (entity.multiblockStructure == null) {
return
}
val direction = blockState.get(HorizontalFacingBlock.FACING)
val yRot = direction.asRotation() + if(direction == Direction.WEST || direction == Direction.EAST) 180F else 0F
val struct = entity.multiblockStructure as FossilMultiblockStructure
struct.fossilInventory.forEachIndexed { index, fossilStack ->
matrices.push()
matrices.translate(0.5, 0.4 + (index * 0.1F), 0.55)
matrices.scale(0.7F, 0.7F, 0.7F)
val dirOffset = when (direction) {
Direction.NORTH -> Vec3d(0.0, 0.0, 0.05)
Direction.SOUTH -> Vec3d(0.0, 0.0, -0.05)
Direction.EAST -> Vec3d(-0.05, 0.0, 0.0)
Direction.WEST -> Vec3d(0.05, 0.0, 0.0)
else -> Vec3d.ZERO
}
matrices.translate(0.5 + dirOffset.x,0.4 + (index * 0.1) + dirOffset.y, 0.5 + dirOffset.z)
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(yRot))
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(180F))
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-yRot))
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(90F))
matrices.scale(0.7F, 0.7F, 0.7F)
MinecraftClient.getInstance().itemRenderer.renderItem(fossilStack, ModelTransformationMode.NONE, light, overlay, matrices, vertexConsumers, entity.world, 0)
@@ -72,7 +72,7 @@ class RestorationTankRenderer(ctx: BlockEntityRendererFactory.Context) : BlockEn
val fluidModel = if (struct.isRunning()) FLUID_MODELS[8]
else if (struct.createdPokemon != null) FLUID_MODELS[7]
else FLUID_MODELS[fillLevel-1]
else FLUID_MODELS[fillLevel.coerceAtMost(FLUID_MODELS.size - 1) - 1]
fluidModel.getQuads(entity.cachedState, null, entity.world?.random).forEach { quad ->
transparentBuffer?.quad(matrices.peek(), quad, 0.75f, 0.75f, 0.75f, light, OverlayTexture.DEFAULT_UV)
}
@@ -18,7 +18,6 @@ import com.cobblemon.mod.common.api.molang.MoLangFunctions.addFunctions
import com.cobblemon.mod.common.api.molang.MoLangFunctions.getQueryStruct
import com.cobblemon.mod.common.api.molang.MoLangFunctions.setup
import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.scheduling.afterOnClient
import com.cobblemon.mod.common.client.ClientMoLangFunctions.setupClient
import com.cobblemon.mod.common.client.entity.PokemonClientDelegate
import com.cobblemon.mod.common.client.render.MatrixWrapper
@@ -46,6 +45,7 @@ import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.util.asExpressionLike
import com.cobblemon.mod.common.util.getDoubleOrNull
import com.cobblemon.mod.common.util.getStringOrNull
import com.cobblemon.mod.common.util.plus
import net.minecraft.client.model.ModelPart
import net.minecraft.client.render.OverlayTexture
import net.minecraft.client.render.RenderLayer
@@ -697,6 +697,7 @@ abstract class PoseableEntityModel<T : Entity>(
val portion = (state.animationSeconds - primaryAnimation.started) / primaryAnimation.duration
state.primaryOverridePortion = 1 - primaryAnimation.curve(portion)
if (!primaryAnimation.run(entity, this, state, limbSwing, limbSwingAmount, ageInTicks, headYaw, headPitch, 1 - state.primaryOverridePortion)) {
primaryAnimation.afterAction.accept(Unit)
state.primaryAnimation = null
state.primaryOverridePortion = 1F
}
@@ -715,6 +716,7 @@ abstract class PoseableEntityModel<T : Entity>(
//This is used to set additional entity type specific context
open fun setupEntityTypeContext(entity: T?) {}
//Called by LivingEntityRenderer's render method before calling model.render (which is this.render in this case)
override fun setAngles(
entity: T,
limbSwing: Float,
@@ -745,19 +747,16 @@ abstract class PoseableEntityModel<T : Entity>(
curve = { 1F }
)
state.addPrimaryAnimation(primaryAnimation)
afterOnClient(seconds = primaryAnimation.duration) {
primaryAnimation.afterAction += {
state.setPose(desirablePose.poseName)
if (state.primaryAnimation == primaryAnimation) {
state.primaryAnimation = null
}
}
} else if (transition != null) {
val animation = transition(previousPose, desirablePose)
val primaryAnimation = if (animation is PrimaryAnimation) animation else PrimaryAnimation(animation, curve = { 1F })
state.addPrimaryAnimation(primaryAnimation)
afterOnClient(seconds = primaryAnimation.duration) {
primaryAnimation.afterAction += {
state.setPose(desirablePose.poseName)
}
state.addPrimaryAnimation(primaryAnimation)
} else {
state.setPose(poses.values.first { desirablePoseType in it.poseTypes && (it.condition == null || (entity != null && it.condition.invoke(entity))) }.poseName)
}
@@ -56,6 +56,8 @@ import net.minecraft.util.math.Vec3d
* handling all the state for an entity's model, and needs to be conscious of the fact that the
* model may change without this state changing.
*
* This also handles setting up the molang runtime that animations have access to
*
* @author Hiroku
* @since December 5th, 2021
*/
@@ -164,6 +166,11 @@ abstract class PoseableEntityState<T : Entity> : Schedulable {
val previousAge = age
updateAge(age + 1)
runEffects(entity, previousAge, age)
val primaryAnimation = primaryAnimation ?: return
if (primaryAnimation.started + primaryAnimation.duration <= animationSeconds) {
this.primaryAnimation = null
primaryAnimation.afterAction.accept(Unit)
}
}
abstract fun updatePartialTicks(partialTicks: Float)
@@ -268,7 +275,7 @@ abstract class PoseableEntityState<T : Entity> : Schedulable {
val pose = currentPose?.let(model::getPose)
allStatefulAnimations.forEach { it.applyEffects(entity, this, previousSeconds, currentSeconds) }
primaryAnimation?.animation?.applyEffects(entity, this, previousSeconds, currentSeconds)
pose?.idleAnimations?.filter { shouldIdleRun(it, 0.5F) }
pose?.idleAnimations?.filter { shouldIdleRun(it, 0.5F) }?.forEach { it.applyEffects(entity, this, previousSeconds, currentSeconds) }
}
}
@@ -12,6 +12,7 @@ import com.cobblemon.mod.common.client.render.models.blockbench.PoseableEntityMo
import com.cobblemon.mod.common.client.render.models.blockbench.PoseableEntityState
import com.cobblemon.mod.common.client.render.models.blockbench.frame.ModelFrame
import com.cobblemon.mod.common.client.render.models.blockbench.wavefunction.WaveFunction
import java.util.function.Consumer
import net.minecraft.entity.Entity
/**
@@ -39,6 +40,7 @@ class PrimaryAnimation<T : Entity>(
): StatefulAnimation<T, ModelFrame> {
var started = -1F
override val duration: Float = animation.duration
var afterAction: Consumer<Unit> = Consumer { }
override fun run(
entity: T?,
@@ -15,7 +15,7 @@ import net.minecraft.entity.Entity
/**
* An animation that can run without an entity associated. These are
* locked to a specific frame, and CAN be given an entity along with
* locked to a specific [ModelFrame], and CAN be given an entity along with
* limb swing and age information, but might not.
*
* @author Hiroku
@@ -32,11 +32,11 @@ class BlockEntityModel(val root: Bone) : PoseableEntityModel<Entity>() {
)
closedPose.transitions[openPose.poseName] = { _, _ ->
bedrockStateful("gilded_chest", "opening").andThen { _, state -> state.setPose(openPose.poseName) }
bedrockStateful("gilded_chest", "opening")
}
openPose.transitions[closedPose.poseName] = { _, _ ->
bedrockStateful("gilded_chest", "closing").andThen { _, state -> state.setPose(closedPose.poseName) }
bedrockStateful("gilded_chest", "closing")
}
}
@@ -51,8 +51,8 @@ class AncientPokeBallModel(root: ModelPart) : PokeBallModel(root), PokeBallFrame
transformTicks = 0
)
shut.transitions[open.poseName] = { _, _ -> bedrockStateful("ancient_poke_ball", "open").andThen { entity, state -> state.setPose(open.poseName) } }
open.transitions[shut.poseName] = { _, _ -> bedrockStateful("ancient_poke_ball", "shut").andThen { entity, state -> state.setPose(shut.poseName) } }
shut.transitions[open.poseName] = { _, _ -> bedrockStateful("ancient_poke_ball", "open") }
open.transitions[shut.poseName] = { _, _ -> bedrockStateful("ancient_poke_ball", "shut") }
midair.transitions[open.poseName] = shut.transitions[open.poseName]!!
}
}
@@ -91,14 +91,18 @@ class JsonPokemonPoseableModel(override val rootPart: Bone) : PokemonPoseableMod
@SerializedName("profileTranslation")
private val _profileTranslation: Vec3d? = null
override val portraitScale
//Some weirdness going on here, vars have to be initialized, gson doesn't like multiple fields with the same name
@Transient
override var portraitScale = 1F
get() = _portraitScale ?: 1F
override val portraitTranslation
@Transient
override var portraitTranslation = Vec3d.ZERO
get() = _portraitTranslation ?: Vec3d(0.0, 0.0, 0.0)
override val profileScale
@Transient
override var profileScale = 1F
get() = _profileScale ?: 1F
override val profileTranslation
@Transient
override var profileTranslation = Vec3d.ZERO
get() = _profileTranslation ?: Vec3d(0.0, 0.0, 0.0)
@@ -56,14 +56,14 @@ abstract class PokemonPoseableModel : PoseableEntityModel<PokemonEntity>() {
}
@Transient
open val portraitScale: Float = 1F
open var portraitScale: Float = 1F
@Transient
open val portraitTranslation: Vec3d = Vec3d.ZERO
open var portraitTranslation: Vec3d = Vec3d.ZERO
@Transient
open val profileScale: Float = 1F
open var profileScale: Float = 1F
@Transient
open val profileTranslation: Vec3d = Vec3d.ZERO
open var profileTranslation: Vec3d = Vec3d.ZERO
open fun getFaintAnimation(
pokemonEntity: PokemonEntity,
@@ -24,11 +24,11 @@ class AbraModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
override val rootPart = root.registerChildWithAllChildren("abra")
override val head = getPart("head")
override val portraitScale = 1.8F
override val portraitTranslation = Vec3d(0.0, 0.2, 0.0)
override var portraitScale = 1.8F
override var portraitTranslation = Vec3d(0.0, 0.2, 0.0)
override val profileScale = 0.85F
override val profileTranslation = Vec3d(0.0, 0.7, 0.0)
override var profileScale = 0.85F
override var profileTranslation = Vec3d(0.0, 0.7, 0.0)
lateinit var standing: PokemonPose
lateinit var walking: PokemonPose
@@ -20,11 +20,11 @@ class AerodactylModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
override val rootPart = root.registerChildWithAllChildren("aerodactyl")
override val head = getPart("head")
override val portraitScale = 1.9F
override val portraitTranslation = Vec3d(-1.0, -0.65, 0.0)
override var portraitScale = 1.9F
override var portraitTranslation = Vec3d(-1.0, -0.65, 0.0)
override val profileScale = 0.55F
override val profileTranslation = Vec3d(0.0, 0.55, 0.0)
override var profileScale = 0.55F
override var profileTranslation = Vec3d(0.0, 0.55, 0.0)
lateinit var standing: PokemonPose
lateinit var walk: PokemonPose
@@ -30,11 +30,11 @@ class AlakazamModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bipe
override val leftLeg = getPart("left_upper_leg")
override val rightLeg = getPart("right_upper_leg")
override val portraitScale = 1.75F
override val portraitTranslation = Vec3d(-0.25, 0.85, 0.0)
override var portraitScale = 1.75F
override var portraitTranslation = Vec3d(-0.25, 0.85, 0.0)
override val profileScale = 0.73F
override val profileTranslation = Vec3d(0.0, 0.65, 0.0)
override var profileScale = 0.73F
override var profileTranslation = Vec3d(0.0, 0.65, 0.0)
lateinit var sleep: PokemonPose
lateinit var standing: PokemonPose
@@ -29,11 +29,11 @@ class ArbokModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
override val rootPart = root.registerChildWithAllChildren("arbok")
override val head = getPart("head_ai")
override val portraitScale = 1.5F
override val portraitTranslation = Vec3d(-0.4, 1.0, 0.0)
override var portraitScale = 1.5F
override var portraitTranslation = Vec3d(-0.4, 1.0, 0.0)
override val profileScale = 0.67F
override val profileTranslation = Vec3d(0.0, 0.7, 0.0)
override var profileScale = 0.67F
override var profileTranslation = Vec3d(0.0, 0.7, 0.0)
lateinit var sleep: PokemonPose
lateinit var standing: PokemonPose
@@ -27,11 +27,11 @@ class ArcanineModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Quad
override val hindLeftLeg = getPart("leg_back_left")
override val hindRightLeg = getPart("leg_back_right")
override val portraitScale = 1.5F
override val portraitTranslation = Vec3d(-0.4, 0.7, 0.0)
override var portraitScale = 1.5F
override var portraitTranslation = Vec3d(-0.4, 0.7, 0.0)
override val profileScale = 0.76F
override val profileTranslation = Vec3d(0.0, 0.57, 0.0)
override var profileScale = 0.76F
override var profileTranslation = Vec3d(0.0, 0.57, 0.0)
lateinit var standing: PokemonPose
lateinit var walk: PokemonPose
@@ -31,11 +31,11 @@ class ArticunoModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bipe
override val leftWing = getPart("leftwing")
override val rightWing = getPart("rightwing")
override val portraitScale = 2.8F
override val portraitTranslation = Vec3d(-0.35, 0.6, 0.0)
override var portraitScale = 2.8F
override var portraitTranslation = Vec3d(-0.35, 0.6, 0.0)
override val profileScale = 0.85F
override val profileTranslation = Vec3d(0.0, 0.5, 0.0)
override var profileScale = 0.85F
override var profileTranslation = Vec3d(0.0, 0.5, 0.0)
lateinit var standing: PokemonPose
lateinit var walk: PokemonPose
@@ -28,11 +28,11 @@ class BeedrillModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, BiWi
override val leftWing = getPart("wing_left")
override val rightWing = getPart("wing_right")
override val portraitScale = 1.9F
override val portraitTranslation = Vec3d(0.05, 0.9, 0.0)
override var portraitScale = 1.9F
override var portraitTranslation = Vec3d(0.05, 0.9, 0.0)
override val profileScale = 0.8F
override val profileTranslation = Vec3d(-0.1, 0.9, 0.0)
override var profileScale = 0.8F
override var profileTranslation = Vec3d(-0.1, 0.9, 0.0)
lateinit var sleep: PokemonPose
lateinit var standing: PokemonPose
@@ -21,11 +21,11 @@ class BellsproutModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
override val rootPart = root.registerChildWithAllChildren("bellsprout")
override val head = getPart("head")
override val portraitScale = 2.0F
override val portraitTranslation = Vec3d(-0.1, 0.41, 0.0)
override var portraitScale = 2.0F
override var portraitTranslation = Vec3d(-0.1, 0.41, 0.0)
override val profileScale = 0.75F
override val profileTranslation = Vec3d(0.0, 0.64, 0.0)
override var profileScale = 0.75F
override var profileTranslation = Vec3d(0.0, 0.64, 0.0)
lateinit var standing: PokemonPose
lateinit var walk: PokemonPose
@@ -27,10 +27,10 @@ class BulbasaurModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Qua
override val hindLeftLeg = getPart("leg_back_left")
override val hindRightLeg = getPart("leg_back_right")
override val portraitScale = 2.0F
override val portraitTranslation = Vec3d(-0.26, -1.20, 0.0)
override val profileScale = 0.9F
override val profileTranslation = Vec3d(0.0, 0.4, 0.0)
override var portraitScale = 2.0F
override var portraitTranslation = Vec3d(-0.26, -1.20, 0.0)
override var profileScale = 0.9F
override var profileTranslation = Vec3d(0.0, 0.4, 0.0)
lateinit var sleep: PokemonPose
lateinit var standing: PokemonPose
@@ -27,11 +27,11 @@ class ButterfreeModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bi
val leftWingBack = getPart("wing_left2")
val rightWingBack = getPart("wing_right2")
override val portraitScale = 2.4F
override val portraitTranslation = Vec3d(-0.1, 0.2, 0.0)
override var portraitScale = 2.4F
override var portraitTranslation = Vec3d(-0.1, 0.2, 0.0)
override val profileScale = 0.7F
override val profileTranslation = Vec3d(0.1, 0.8, 0.0)
override var profileScale = 0.7F
override var profileTranslation = Vec3d(0.1, 0.8, 0.0)
lateinit var sleep: PokemonPose
@@ -25,10 +25,10 @@ class CaterpieModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
override val rootPart = root.registerChildWithAllChildren("caterpie")
override val head = getPart("head")
override val portraitScale = 2.1F
override val portraitTranslation = Vec3d(-0.55, -1.55, 0.0)
override val profileScale = 0.8F
override val profileTranslation = Vec3d(0.0, 0.55, 0.0)
override var portraitScale = 2.1F
override var portraitTranslation = Vec3d(-0.55, -1.55, 0.0)
override var profileScale = 0.8F
override var profileTranslation = Vec3d(0.0, 0.55, 0.0)
lateinit var sleep: PokemonPose
lateinit var standing: PokemonPose
@@ -8,13 +8,16 @@
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
import com.cobblemon.mod.common.client.render.models.blockbench.PoseableEntityState
import com.cobblemon.mod.common.client.render.models.blockbench.animation.BipedWalkAnimation
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BipedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.PoseType.Companion.MOVING_POSES
import com.cobblemon.mod.common.entity.PoseType.Companion.STATIONARY_POSES
import com.cobblemon.mod.common.entity.PoseType.Companion.UI_POSES
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import net.minecraft.client.model.ModelPart
import net.minecraft.util.math.Vec3d
@@ -23,17 +26,27 @@ class ChanseyModel(root: ModelPart) : PokemonPoseableModel(), BipedFrame {
override val leftLeg = getPart("left_foot")
override val rightLeg = getPart("right_foot")
override val portraitScale = 1.5F
override val portraitTranslation = Vec3d(-0.35, 0.3, 0.0)
override var portraitScale = 1.5F
override var portraitTranslation = Vec3d(-0.35, 0.3, 0.0)
override val profileScale = 0.8F
override val profileTranslation = Vec3d(0.0, 0.55, 0.0)
override var profileScale = 0.8F
override var profileTranslation = Vec3d(0.0, 0.55, 0.0)
lateinit var standing: PokemonPose
lateinit var walk: PokemonPose
lateinit var sleep: PokemonPose
override fun registerPoses() {
val blink = quirk { bedrockStateful("chansey", "blink")}
val blink = quirk { bedrockStateful("chansey", "blink") }
sleep = registerPose(
poseName = "sleep",
poseType = PoseType.SLEEP,
idleAnimations = arrayOf(
bedrock("chansey", "ground_sleep")
)
)
standing = registerPose(
poseName = "standing",
poseTypes = STATIONARY_POSES + UI_POSES,
@@ -49,15 +62,13 @@ class ChanseyModel(root: ModelPart) : PokemonPoseableModel(), BipedFrame {
transformTicks = 10,
quirks = arrayOf(blink),
idleAnimations = arrayOf(
bedrock("chansey", "ground_idle"),
BipedWalkAnimation(this),
//bedrock("chansey", "ground_walk")
bedrock("chansey", "ground_walk")
)
)
}
// override fun getFaintAnimation(
// pokemonEntity: PokemonEntity,
// state: PoseableEntityState<PokemonEntity>
// ) = if (state.isPosedIn(standing, walk)) bedrockStateful("chansey", "faint") else null
override fun getFaintAnimation(
pokemonEntity: PokemonEntity,
state: PoseableEntityState<PokemonEntity>
) = bedrockStateful("chansey", "faint")
}
@@ -34,11 +34,11 @@ class CharizardModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bip
override val leftWing = getPart("wing_left")
override val rightWing = getPart("wing_right")
override val portraitScale = 1.9F
override val portraitTranslation = Vec3d(-0.5, 1.4, 0.0)
override var portraitScale = 1.9F
override var portraitTranslation = Vec3d(-0.5, 1.4, 0.0)
override val profileScale = 0.55F
override val profileTranslation = Vec3d(0.05, 0.93, 0.0)
override var profileScale = 0.55F
override var profileTranslation = Vec3d(0.05, 0.93, 0.0)
lateinit var sleep: PokemonPose
lateinit var standing: PokemonPose
@@ -31,11 +31,11 @@ class CharmanderModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bi
override val rightLeg = getPart("leg_right")
override val leftLeg = getPart("leg_left")
override val portraitScale = 2.2F
override val portraitTranslation = Vec3d(-0.1, -0.1, 0.0)
override var portraitScale = 2.2F
override var portraitTranslation = Vec3d(-0.1, -0.1, 0.0)
override val profileScale = 0.71F
override val profileTranslation = Vec3d(0.0, 0.72, 0.0)
override var profileScale = 0.71F
override var profileTranslation = Vec3d(0.0, 0.72, 0.0)
lateinit var sleep: PokemonPose
lateinit var standing: PokemonPose
@@ -29,11 +29,11 @@ class CharmeleonModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bi
override val rightLeg = getPart("leg_right")
override val leftLeg = getPart("leg_left")
override val portraitScale = 1.9F
override val portraitTranslation = Vec3d(-0.16, 0.55, 0.0)
override var portraitScale = 1.9F
override var portraitTranslation = Vec3d(-0.16, 0.55, 0.0)
override val profileScale = 0.65F
override val profileTranslation = Vec3d(0.0, 0.79, 0.0)
override var profileScale = 0.65F
override var profileTranslation = Vec3d(0.0, 0.79, 0.0)
lateinit var sleep: PokemonPose
lateinit var standing: PokemonPose
@@ -23,11 +23,11 @@ import net.minecraft.util.math.Vec3d
class ClefableModel(root: ModelPart) : PokemonPoseableModel() {
override val rootPart = root.registerChildWithAllChildren("clefable")
override val portraitScale = 2.0F
override val portraitTranslation = Vec3d(-0.1, -0.7, 0.0)
override var portraitScale = 2.0F
override var portraitTranslation = Vec3d(-0.1, -0.7, 0.0)
override val profileScale = 1.15F
override val profileTranslation = Vec3d(0.0, 0.02, 0.0)
override var profileScale = 1.15F
override var profileTranslation = Vec3d(0.0, 0.02, 0.0)
lateinit var sleep: PokemonPose
lateinit var standing: PokemonPose
@@ -23,11 +23,11 @@ import net.minecraft.util.math.Vec3d
class ClefairyModel(root: ModelPart) : PokemonPoseableModel() {
override val rootPart = root.registerChildWithAllChildren("clefairy")
override val portraitScale = 2.0F
override val portraitTranslation = Vec3d(0.0, -1.0, 0.0)
override var portraitScale = 2.0F
override var portraitTranslation = Vec3d(0.0, -1.0, 0.0)
override val profileScale = 1.1F
override val profileTranslation = Vec3d(0.0, 0.08, 0.0)
override var profileScale = 1.1F
override var profileTranslation = Vec3d(0.0, 0.08, 0.0)
lateinit var sleep: PokemonPose
lateinit var standing: PokemonPose
@@ -19,11 +19,11 @@ import net.minecraft.util.math.Vec3d
class CloysterModel(root: ModelPart) : PokemonPoseableModel() {
override val rootPart = root.registerChildWithAllChildren("cloyster")
override val portraitScale = 2.0F
override val portraitTranslation = Vec3d(-0.25, -0.85, 0.0)
override var portraitScale = 2.0F
override var portraitTranslation = Vec3d(-0.25, -0.85, 0.0)
override val profileScale = 0.9F
override val profileTranslation = Vec3d(0.0, 0.37, 0.0)
override var profileScale = 0.9F
override var profileTranslation = Vec3d(0.0, 0.37, 0.0)
lateinit var standing: PokemonPose
lateinit var walk: PokemonPose
@@ -23,26 +23,29 @@ class CuboneModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, BipedF
override val rootPart = root.registerChildWithAllChildren("cubone")
override val head = getPart("head")
override val leftLeg = getPart("leftleg")
override val rightLeg = getPart("rightleg")
override val leftLeg = getPart("left_leg")
override val rightLeg = getPart("right_leg")
override val portraitScale = 2.0F
override val portraitTranslation = Vec3d(0.1, -0.7, 0.0)
override var portraitScale = 2.0F
override var portraitTranslation = Vec3d(0.1, -0.7, 0.0)
override val profileScale = 1.0F
override val profileTranslation = Vec3d(0.0, 0.25, 0.0)
override var profileScale = 1.0F
override var profileTranslation = Vec3d(0.0, 0.25, 0.0)
lateinit var standing: PokemonPose
lateinit var walk: PokemonPose
override fun registerPoses() {
val blink = quirk { bedrockStateful("cubone", "blink") }
standing = registerPose(
poseName = "standing",
poseTypes = STATIONARY_POSES + UI_POSES,
transformTicks = 10,
quirks = arrayOf(blink),
idleAnimations = arrayOf(
singleBoneLook(),
bedrock("cubone", "ground_idle")
bedrock("cubone", "idle")
)
)
@@ -50,10 +53,11 @@ class CuboneModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, BipedF
poseName = "walk",
poseTypes = MOVING_POSES,
transformTicks = 10,
quirks = arrayOf(blink),
idleAnimations = arrayOf(
BipedWalkAnimation(this, periodMultiplier = 1.1F, amplitudeMultiplier = 1.15f),
singleBoneLook(),
bedrock("cubone", "ground_idle")
bedrock("cubone", "idle")
//bedrock("cubone", "ground_walk")
)
)
@@ -21,11 +21,11 @@ class DewgongModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
override val rootPart = root.registerChildWithAllChildren("dewgong")
override val head = getPart("head")
override val portraitScale = 2.5F
override val portraitTranslation = Vec3d(-0.6, -2.0, 0.0)
override var portraitScale = 2.5F
override var portraitTranslation = Vec3d(-0.6, -2.0, 0.0)
override val profileScale = 1.1F
override val profileTranslation = Vec3d(0.0, 0.0, 0.0)
override var profileScale = 1.1F
override var profileTranslation = Vec3d(0.0, 0.0, 0.0)
lateinit var standing: PokemonPose
lateinit var float: PokemonPose
@@ -0,0 +1,75 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
import com.cobblemon.mod.common.client.render.models.blockbench.PoseableEntityState
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.PoseType.Companion.MOVING_POSES
import com.cobblemon.mod.common.entity.PoseType.Companion.STATIONARY_POSES
import com.cobblemon.mod.common.entity.PoseType.Companion.UI_POSES
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import net.minecraft.client.model.ModelPart
import net.minecraft.util.math.Vec3d
class DiglettAlolanModel(root: ModelPart) : PokemonPoseableModel() {
override val rootPart = root.registerChildWithAllChildren("diglett_alolan")
override var portraitScale = 1.8F
override var portraitTranslation = Vec3d(-0.06, -0.86, 0.0)
override var profileScale = 0.9F
override var profileTranslation = Vec3d(0.0, 0.32, 0.0)
lateinit var stand: PokemonPose
lateinit var walk: PokemonPose
// lateinit var battleidle: PokemonPose
// lateinit var sleep: PokemonPose
// override val cryAnimation = CryProvider { _, _ -> bedrockStateful("diglett_alolan", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("diglett_alolan", "blink")}
// val quirk = quirk { bedrockStateful("diglett_alolan", "quirk_idle")}
// sleep = registerPose(
// poseName = "sleep",
// poseType = PoseType.SLEEP,
// idleAnimations = arrayOf(bedrock("diglett_alolan", "sleep"))
// )
stand = registerPose(
poseName = "stand",
poseTypes = STATIONARY_POSES + UI_POSES,
quirks = arrayOf(blink),
idleAnimations = arrayOf(bedrock("diglett_alolan", "ground_idle"))
)
walk = registerPose(
poseName = "walk",
poseTypes = MOVING_POSES,
quirks = arrayOf(blink),
idleAnimations = arrayOf(bedrock("diglett_alolan", "ground_idle"))
)
// battleidle = registerPose(
// poseName = "battleidle",
// poseTypes = STATIONARY_POSES,
// quirks = arrayOf(blink),
// idleAnimations = arrayOf(bedrock("diglett_alolan", "battle_idle"))
// )
}
// override fun getFaintAnimation(
// pokemonEntity: PokemonEntity,
// state: PoseableEntityState<PokemonEntity>
// ) = bedrockStateful("diglett_alolan", "faint")
}
@@ -9,6 +9,7 @@
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
import com.cobblemon.mod.common.client.render.models.blockbench.PoseableEntityState
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPose
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
import com.cobblemon.mod.common.entity.PoseType
@@ -22,35 +23,49 @@ import net.minecraft.util.math.Vec3d
class DiglettModel(root: ModelPart) : PokemonPoseableModel() {
override val rootPart = root.registerChildWithAllChildren("diglett")
override val portraitScale = 1.8F
override val portraitTranslation = Vec3d(0.05, -1.0, 0.0)
override var portraitScale = 1.8F
override var portraitTranslation = Vec3d(-0.06, -0.86, 0.0)
override val profileScale = 0.9F
override val profileTranslation = Vec3d(0.0, 0.15, 0.0)
override var profileScale = 0.9F
override var profileTranslation = Vec3d(0.0, 0.32, 0.0)
lateinit var stand: PokemonPose
lateinit var walk: PokemonPose
lateinit var battleidle: PokemonPose
lateinit var sleep: PokemonPose
override val cryAnimation = CryProvider { _, _ -> bedrockStateful("diglett", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("diglett", "blink")}
val quirk = quirk { bedrockStateful("diglett", "quirk_idle")}
sleep = registerPose(
poseName = "sleep",
poseType = PoseType.SLEEP,
idleAnimations = arrayOf(bedrock("diglett", "sleep"))
)
stand = registerPose(
poseName = "stand",
poseTypes = STATIONARY_POSES + UI_POSES,
quirks = arrayOf(blink),
quirks = arrayOf(blink, quirk),
idleAnimations = arrayOf(bedrock("diglett", "ground_idle"))
)
sleep = registerPose(
poseType = PoseType.SLEEP,
idleAnimations = arrayOf(bedrock("diglett", "sleep"))
)
walk = registerPose(
poseName = "walk",
poseTypes = MOVING_POSES,
quirks = arrayOf(blink),
idleAnimations = arrayOf(bedrock("diglett", "ground_walk"))
)
battleidle = registerPose(
poseName = "battleidle",
poseTypes = STATIONARY_POSES,
quirks = arrayOf(blink, quirk),
idleAnimations = arrayOf(bedrock("diglett", "battle_idle"))
)
}
override fun getFaintAnimation(
@@ -23,11 +23,11 @@ import net.minecraft.util.math.Vec3d
class DittoModel(root: ModelPart) : PokemonPoseableModel() {
override val rootPart = root.registerChildWithAllChildren("ditto")
override val portraitScale = 3.2F
override val portraitTranslation = Vec3d(0.0, -2.2, 0.0)
override var portraitScale = 3.2F
override var portraitTranslation = Vec3d(0.0, -2.2, 0.0)
override val profileScale = 1.4F
override val profileTranslation = Vec3d(0.0, -0.34, 0.0)
override var profileScale = 1.4F
override var profileTranslation = Vec3d(0.0, -0.34, 0.0)
lateinit var standing: PokemonPose
lateinit var walk: PokemonPose
@@ -20,11 +20,11 @@ import net.minecraft.util.math.Vec3d
class DodrioModel (root: ModelPart) : PokemonPoseableModel() {
override val rootPart = root.registerChildWithAllChildren("dodrio")
override val portraitScale = 1.5F
override val portraitTranslation = Vec3d(-0.15, 0.9, 0.0)
override var portraitScale = 1.5F
override var portraitTranslation = Vec3d(-0.15, 0.9, 0.0)
override val profileScale = 0.8F
override val profileTranslation = Vec3d(0.0, 0.6, 0.0)
override var profileScale = 0.8F
override var profileTranslation = Vec3d(0.0, 0.6, 0.0)
lateinit var standing: PokemonPose
lateinit var walking: PokemonPose
@@ -20,11 +20,11 @@ import net.minecraft.util.math.Vec3d
class DoduoModel (root: ModelPart) : PokemonPoseableModel() {
override val rootPart = root.registerChildWithAllChildren("doduo")
override val portraitScale = 2.0F
override val portraitTranslation = Vec3d(-0.1, 0.35, 0.0)
override var portraitScale = 2.0F
override var portraitTranslation = Vec3d(-0.1, 0.35, 0.0)
override val profileScale = 0.85F
override val profileTranslation = Vec3d(0.0, 0.5, 0.0)
override var profileScale = 0.85F
override var profileTranslation = Vec3d(0.0, 0.5, 0.0)
lateinit var standing: PokemonPose
lateinit var walking: PokemonPose

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