Compare commits

...
652 Commits
Author SHA1 Message Date
Tyzillion a077e74bf2 When you wish upon a star
Makes no difference who you are
Anything your heart desires
Will come to you
If your heart is in your dream
No request is too extreme
When you wish upon a star
As dreamers do
Fate is kind
She brings to those who love
The sweet fulfillment of
Their secret longing
Like a bolt out of the blue
Fate steps in and sees you through
When you wish upon a star
Your dreams come true
2024-02-18 14:25:47 -05:00
Lily 763f1de793 forgot to push this mb 2024-02-16 22:34:31 -05:00
Lily 62a95b93c5 begin implementing falling stars 2024-02-16 14:48:20 -05:00
Lily 7991f70c09 Merge remote-tracking branch 'origin/dynamax' into dynamax 2024-02-16 14:48:07 -05:00
Lily 70d393a899 begin implementing falling stars 2024-02-16 14:47:58 -05:00
Lily 5bace46aa6 begin implementing falling stars 2024-02-13 21:51:28 -05:00
Lily c5fb411636 Merge branch 'sega_bass_pro_fishing_2' into dynamax
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonEntities.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonItems.kt
#	fabric/src/main/kotlin/com/cobblemon/mod/fabric/client/CobblemonFabricClient.kt
#	forge/src/main/kotlin/com/cobblemon/mod/forge/client/CobblemonForgeClient.kt
2024-02-13 20:59:18 -05:00
Lily 9a8159ee30 start on dynamax 2024-02-13 20:07:29 -05:00
Plastered_Crab acc6f119e1 - Magikarps getting reeled in now land in front of the player instead of behind the player (for battle reasons) 2024-02-13 16:45:22 -08:00
Plastered_Crab 932a2c375c - Begin different reel-in trajectories for fishing up Magikarps 2024-02-13 14:46:42 -08:00
Nick 4217938ada Merge branch 'move-animations' into 'main'
Simplistic move animations

See merge request cable-mc/cobblemon!871
2024-02-10 22:51:29 +00:00
HirokuandNick 4c5f88db06 Simplistic move animations 2024-02-10 22:51:29 +00:00
Nick 142eebe9e6 Apply model predicates, starting with Pokerod 2024-02-09 22:07:43 -08:00
jeffw773 36f19c9180 - Xp is rewarded to player for fishing up Pokemon 2024-02-09 21:15:10 -08:00
Hiroku cfd743c4c0 Merge branch 'armor_trims' into 'main'
oops

See merge request cable-mc/cobblemon!872
2024-02-10 02:11:35 +00:00
Lily 1bbfc6dce5 Merge branch 'main' into armor_trims 2024-02-09 21:06:33 -05:00
Lily 6f2235c751 i swear if this doesn't work 2024-02-09 21:04:59 -05:00
Hiroku 50a0f2d858 Merge branch 'armor_trims' into 'main'
Added Automaton armor trim

See merge request cable-mc/cobblemon!868
2024-02-10 01:37:25 +00:00
Hiroku 27210512f6 Oops 2024-02-10 01:25:08 +00:00
Hiroku 53aa124de6 Merge branch 'main' into 'armor_trims'
# Conflicts:
#   CHANGELOG.md
2024-02-10 01:24:45 +00:00
Apion a18b54849f Merge branch 'FetusAnimsUpdate' into 'main'
Many updates, asset changes, and refactors for the fossil machine

See merge request cable-mc/cobblemon!863
2024-02-10 01:24:04 +00:00
Hiroku c868c63a5f Merge branch 'whatsy/evo_stone_blocks' into 'main'
added nether fire stone ore

See merge request cable-mc/cobblemon!867
2024-02-10 01:23:41 +00:00
Lily 31df7c92f4 remove leftovers from trim materials 2024-02-09 20:00:36 -05:00
Hiroku 3b65d1967e Merge branch 'main' into 'whatsy/evo_stone_blocks'
# Conflicts:
#   CHANGELOG.md
2024-02-10 00:16:06 +00:00
Paul f30b15003f Remove lingering oceanic trim references 2024-02-10 10:05:10 +10:00
Hiroku c4c1b7ac27 Merge branch 'main' into 'armor_trims'
# Conflicts:
#   CHANGELOG.md
2024-02-09 23:56:54 +00:00
Paul ea9287cfb5 Fixed langs on interaction GUIs 2024-02-10 09:55:31 +10:00
Hiroku 02f845af5c Merge branch 'amo/sendout-upgrade' into 'main'
Added generic bedrock entity system, updated molang for fix, added test evo...

See merge request cable-mc/cobblemon!869
2024-02-09 23:11:04 +00:00
Paul 3bb3a00cef Renamed InteractionGUICreationEvent to PokemonInteractionGUICreationEvent 2024-02-10 08:28:31 +10:00
Paul f1ae4163c9 Cleaned up transition portion of PokemonRender#render and removed glow effect we don't want anymore 2024-02-10 08:27:31 +10:00
jeffw773 beb8fed6bd - Pokeball Bobber now renders correctly when cast out with Pokerod
- Luck of the Sea and Lure get read correctly from the rod and factor into the spawn bucket chosen
2024-02-09 14:17:13 -08:00
Paul 05957f2106 Renamed GenericBedrockModelRepository to GenericBedrockEntityModelRepository for clarity 2024-02-10 08:03:50 +10:00
Paul 4b9ea1d4cd Use an entity renderer for GenericBedrockEntities, obviously 2024-02-10 08:03:12 +10:00
Lily 78dff75db9 Update CHANGELOG.md 2024-02-09 16:46:56 -05:00
Lily dbab6404a1 Update CHANGELOG.md 2024-02-09 16:45:48 -05:00
Paul e5c4240ae0 Merge remote-tracking branch 'origin/main' into amo/sendout-upgrade
# Conflicts:
#	CHANGELOG.md
#	forge/src/main/kotlin/com/cobblemon/mod/forge/client/CobblemonForgeClient.kt
2024-02-09 20:22:27 +10:00
Paul 317112f9bb Cleanup 2024-02-09 19:38:32 +10:00
Paul 58fda2e261 Changelog 2024-02-09 16:22:22 +10:00
Paul 3b442d387a licenses good, pipeline errors bad 2024-02-09 16:04:53 +10:00
jeffw773 142284a17c - Pokemon rarity is altered by Luck of the Sea 2024-02-08 21:18:41 -08:00
Paul 2b575c888f Disable evo effect since it's not done yet 2024-02-09 14:15:58 +10:00
Paul 6e5e572412 Fixed some ball effects occurring even when snap-recalling before send out completes 2024-02-09 14:14:55 +10:00
Lily ce87d0dc48 Merge branch 'main' into whatsy/nether_fire_stone
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/item/group/CobblemonItemGroups.kt
2024-02-08 23:10:14 -05:00
Lily d43c91129c implemented nether fire stone ore 2024-02-08 23:02:26 -05:00
Lily d66b9c8d3b removed unused assets, oceanic pattern to be redone/possibly scrapped 2024-02-08 22:51:05 -05:00
JazzMcNade dc37b381a0 Review Changes: Refactored part of setStack into its own function 2024-02-07 21:17:56 -06:00
jeffw773 f1ea86362a - Fixed fishing spawns being able to check if sky is actually visible.
- added isOcean to biomes to Magikarp
2024-02-07 18:28:42 -08:00
Lily 1206aaaf13 some updated textures 2024-02-07 21:13:12 -05:00
JazzMcNade 95bcb9a7b8 Most of the requested review changes 2024-02-06 23:28:15 -06:00
Lily c7d879ec57 removed custom trim materials, added automaton and oceanic trim patterns 2024-02-06 19:03:37 -05:00
Nick d5752982d7 Merge branch 'crystal_block' into 'main'
internal changes to tumblestones

See merge request cable-mc/cobblemon!865
2024-02-06 00:41:19 +00:00
Lily f1439ec724 internal changes to tumblestones 2024-02-05 19:18:53 -05:00
Nick 0cac5714ac Merge branch 'sherd_updates' into 'main'
added a missing sherd + added sherds to the vanilla ingredients tab

See merge request cable-mc/cobblemon!864
2024-02-05 22:45:46 +00:00
Lily 8529bb119f added a missing sherd + added sherds to the vanilla ingredients tab 2024-02-05 17:24:44 -05:00
JazzMcNade b68b3ad55e Fossil Machine now stores return items of natural materials fed via hopper. Return items can be retrieved via hopper or by breaking the machine. Restoration Tank block can now be place on hoppers. 2024-02-04 18:35:23 -06:00
Hiroku 70c6b74f0f Merge branch 'pottery-sherds' into 'main'
Implemented pottery sherds

See merge request cable-mc/cobblemon!861
2024-02-04 05:00:54 +00:00
Hiroku 5cb7a51163 Merge branch 'test-build-rename' into 'main'
Made it so when a snapshot build is built the commit hash and branch is included

See merge request cable-mc/cobblemon!862
2024-02-04 04:27:50 +00:00
apion a68b6928aa Made it so when a snapshot build is built the commit hash and branch is included 2024-02-03 23:26:32 -05:00
Apion 0c26cb026c Remove extra braces 2024-02-04 03:57:40 +00:00
Hiroku 6078e22b14 Merge branch 'ball-entity-names' into 'main'
Empty Poké Ball Entity Name

Closes #755

See merge request cable-mc/cobblemon!852
2024-02-04 03:52:05 +00:00
Apion cb1226013d Removed unneeded access widener 2024-02-04 03:47:39 +00:00
apion 0c8318d317 Licenses :P 2024-02-03 22:46:04 -05:00
apion 8d80bcfd6b Fixed remaining patterns 2024-02-03 22:45:26 -05:00
apion cfd4fa1785 Fix dome, helix, and sus patterns 2024-02-03 22:35:56 -05:00
apion 86bd70177c Sherds work :O 2024-02-03 22:28:57 -05:00
Nick ce668b31ff Merge branch 'dynamic-lighting-compat' into 'main'
Dynamic lighting compat

See merge request cable-mc/cobblemon!860
2024-02-03 21:49:28 +00:00
LiciousandNick 943d6e0c55 Dynamic lighting compat 2024-02-03 21:49:27 +00:00
Paul ec3361ad91 Added basic fishing spawn detail for Magikarp and use the world pool for fishing because ehhh 2024-02-03 12:16:53 +10:00
Paul ca7c36ce15 Added trigger spawning with a fishing implementation 2024-02-03 12:13:38 +10:00
apion 7d82a2f7c8 Start working on injecting sherd textures, bunch of immutable maps need to not be immutable 2024-02-02 20:53:04 -05:00
Lily 782ba524df fossil block break speed + loot table 2024-02-02 20:24:07 -05:00
apion c571d79035 Added sherd tag 2024-02-02 19:48:31 -05:00
jeffw773 f7c73728d7 - Added some newer spawning stuff and added battle initiation after fished up mon 2024-02-02 16:38:15 -08:00
Hiroku 054c22b926 Merge branch 'inkay-grumm' into 'main'
Inkay: Add 2nd easter egg nickname evo

See merge request cable-mc/cobblemon!859
2024-02-02 22:20:48 +00:00
KyozennoandHiroku d2fce5edb5 Inkay: Add 2nd easter egg nickname evo 2024-02-02 22:20:48 +00:00
jeffw773 1992a23edc Merge branch 'main' into sega_bass_pro_fishing_2 2024-02-02 13:39:02 -08:00
jeffw773 cba32b7443 - Adding Tweaked textures for fossil embryo goopies that are a tad darker in case they are liked better 2024-02-02 13:32:56 -08:00
JazzMcNade 4a81c24a3d Hopefully less mobs will get hung up on the Monitor Block 2024-02-02 01:03:41 -06:00
Lily 776e629850 updated CobblemonItemTags and fixed hand animation not playing on pure client instances 2024-02-01 21:38:20 -05:00
Paul 9afb8b04c2 Fixed edge case in FPS particles 2024-02-02 11:54:12 +10:00
Nick 90c74eddc8 Merge branch 'does_this_qualify_as_grafting' into 'main'
Implement #748 Allow players to plant apricorn sprouts on leaves

Closes #748

See merge request cable-mc/cobblemon!854
2024-01-30 17:53:47 +00:00
Nick 3600178d3b Merge branch 'lefties-not-the-store-pls-no-copyright' into 'main'
Adds leaves_leftovers item tag.

See merge request cable-mc/cobblemon!858
2024-01-30 17:52:26 +00:00
Apion 66d8a01917 Merge branch 'hold-my-event' into 'main'
Implement HeldItemEvent. Remove unnecessary setter method for already public var.

See merge request cable-mc/cobblemon!857
2024-01-29 23:55:57 +00:00
Licious 68e32b21b5 Adds leaves_leftovers item tag. 2024-01-29 23:21:47 +00:00
Licious 670882bb4d Implement HeldItemEvent. Remove unnecessary setter method for already public var. 2024-01-29 23:13:27 +00:00
dhi_holo 9c0708651f Cobble Particles
Azure, Slate, Citrine, Verdant, Roseate
2024-01-29 17:09:34 +10:00
JazzMcNade 1b3bb3b5bc Ownership message can now identify players who are currently not connected to the server. 2024-01-29 01:08:57 -06:00
dhi_holo cd03ef68c3 Gen 3 4-7, Gen 4 1-2
Dive, Nest, Repeat, Timer, Heal, Quick
2024-01-29 17:03:20 +10:00
dhi_holo 69716b5050 Gen 2 7-9 and Gen 3 1-3
Friend, Love, Moon, Luxury, Premier, Net
2024-01-29 16:28:40 +10:00
dhi_holo 015deb4eeb Gen 2 1-6
Particles for Park, Sport, Fast, Level, Lure, Heavy Balls
2024-01-29 15:07:53 +10:00
dhi_holo 96023077ad Gen 1 Full
Should fix all of the remaining issues with the Gen 1 particles
2024-01-29 13:09:31 +10:00
JazzMcNade d96c68b5b4 All monitor blockstates now use the off state's particle texture. 2024-01-28 21:05:22 -06:00
JazzMcNade dc27867502 Dry stuff for markedRemoved (related to stopping sounds). Loop sound stops when the monitor block is destroyed. 2024-01-28 20:58:29 -06:00
JazzMcNade bfbea377c1 Monitor now switches to the OFF state if the fossil pokemon is retrieved while machine was in the protected state 2024-01-28 19:55:30 -06:00
dhi_holo f5954fcb33 Gen 1 Poomfs
Ultra, Master, and Safari complete the 5
2024-01-29 11:47:23 +10:00
JazzMcNade eaa909a9f2 Fossilmachine's owner now persists when the machine is loaded/unloaded and is now based on the user's uuid 2024-01-28 19:28:51 -06:00
dhi_holo 5ba4d460b1 great error
should mean the poke ball and great ball particles are all functional, and I can start working on the other balls!
2024-01-29 11:01:51 +10:00
dhi_holo 09143b7ad6 the identifiers need the directory
atleast, that's how they were, so let's redo that
2024-01-29 10:48:49 +10:00
dhi_holo aa1e14b4ac Merge branch 'main' into amo/sendout-upgrade 2024-01-29 10:24:07 +10:00
dhi_holo 0f29cdeaf9 update pokeball and greatball particles
lets see if this works
2024-01-29 10:15:41 +10:00
JazzMcNade b976b9dd68 Fossil machine now stops its loop sound when the machine finishes or is destroyed. 2024-01-28 16:51:40 -06:00
dhi_holo fa94ca8033 The Origin Master
Origin Ball is now Guaranteed, like the Master Ball, because that's the intended behaviour according to Chroma
2024-01-27 19:07:51 +10:00
dhi_holo f206352b6e I am a genius
origin ball go entity
2024-01-27 18:28:34 +10:00
dhi_holo cdee981933 Origin Textures
Tried fixing the Origin Ball not using the right texture. Only worked for the item texture, entity texture doesn't seem to load still
2024-01-27 15:06:16 +10:00
dhi_holo f2fc32b6a9 Updated Catch Particles
Up to date as of time of commit, mostly looking good, some minor issues to be fixed up.
2024-01-27 14:04:26 +10:00
Nick f46b581327 Merge branch 'new-model-repo' into 'main'
Added a bedrock model repo for miscellaneous models

See merge request cable-mc/cobblemon!855
2024-01-26 23:16:16 +00:00
ApionandNick ff1241304b Added a bedrock model repo for miscellaneous models 2024-01-26 23:16:16 +00:00
dhi_holo dd746e6775 Merge branch 'main' into ball-entity-names 2024-01-22 16:39:51 +10:00
Licious 44956ec6da Implement #748 Allow players to plant apricorn sprouts on leaves 2024-01-21 15:03:53 +00:00
Hiroku 83e7a1968a Merge branch 'can-moe-scrape' into 'main'
Blueberry allergy fix

See merge request cable-mc/cobblemon!851
2024-01-19 23:59:49 +00:00
Paul 553ecc8509 Various corrections to pokeballs, including a fix for the delayed bounce animation 2024-01-19 13:48:58 +10:00
Paul 7b0d488b7c Improved fetus transitions 2024-01-19 12:34:50 +10:00
jeffw773 dad28135cc - Brief changes to particle count based on rarity reeled in 2024-01-18 14:32:43 -08:00
JazzMcNade 3f7a5e1318 Fossils in the analyzer block are now have a 1 item spaced gap between them for visibility. 2024-01-17 19:52:39 -06:00
JazzMcNade ce7485f557 Adjusted analyzer block's fossil positioning to avoid clipping and match the base item's orientation. 2024-01-17 01:09:08 -06:00
JazzMcNade b5ca5c29d4 Fixed an issue in which if the machine finished and then was unloaded, breaking the machine would not release the pokemon. 2024-01-17 00:13:24 -06:00
JazzMcNade 43f60da22e Refactored Monitor blockstate into a single enum driven screenid. Protection time of the fossil machine is now saved into nbt. 2024-01-16 23:32:11 -06:00
JazzMcNade 0102c8b392 Updated Restoration tank textures and connector model 2024-01-16 00:58:29 -06:00
jeffw773 e41d13dd53 - Pokerod now uses config values for rarity buckets and access biome spawn pools 2024-01-14 23:02:33 -08:00
JazzMcNade 6bb5c5dadf Fix for Blockupdates interrupting the fetus animation, added phase offset for fetus animations (for real). 2024-01-14 22:18:41 -06:00
JazzMcNade dd21fe2ea3 Implemented locked state visual in the monitor block 2024-01-14 03:56:15 -06:00
jeffw773 64cae53d82 - Pokerod foundation laid out for having chance to spawn Pokemon instead of getting item as well as rarity chance started 2024-01-14 00:11:12 -08:00
JazzMcNade 656c46817a Implemented Resoration_tank's animated texture when the machine is currently running 2024-01-14 02:01:38 -06:00
dhi_holo c9bf0bd8d7 Merge branch 'sega_bass_pro_fishing_2' of https://gitlab.com/cable-mc/cobblemon into sega_bass_pro_fishing_2 2024-01-14 13:36:53 +10:00
dhi_holo 97d2047aee It's a Tool, It's a Rod
makes pokerod be held correctly, and adds second model file for the cast variation, when that is implemented.
2024-01-14 13:36:04 +10:00
jeffw773 811f8abed7 - Added override for model of pokerod when cast 2024-01-13 19:27:22 -08:00
JazzMcNade a373f437fa Refactored fossil machine block files out of fossil directories 2024-01-13 21:22:23 -06:00
jeffw773 ab02a54f28 - Finally the Pokerod is starting to work! (it is backwards tho) 2024-01-13 19:08:36 -08:00
JazzMcNade 0fe3637034 Deep rename of fossil_tube to restoration_tank, fossil_monitor to monitor, fossil_compartment to fossil_analyzer. Updated fossil machine component block assets. 2024-01-13 20:44:58 -06:00
jeffw773 6e0c1aefcc - More testing fishing code for pokerod 2024-01-13 13:55:02 -08:00
jeffw773 e887b6c43c - Some code for fishing testing again 2024-01-13 12:16:38 -08:00
jeffw773 25172c2bc9 - Some code for fishing testing 2024-01-13 11:23:38 -08:00
dhi_holo 4b4be0e2cc Merge branch 'main' into ball-entity-names 2024-01-13 16:14:43 +10:00
dhi_holo 3e673ae8f0 Don't Forget
I'll keep my kneecaps today, thanks
2024-01-13 16:12:02 +10:00
dhi_holo 4b3b7443d3 Empty Poké Ball
Names the Empty Pokeball entity to `Empty Poké Ball`, so it has a name.

Closes #755, possibly. I'm not sure if this entity name is the same kind of entity name as the report, as the order of words is different, but yeah.
2024-01-13 16:10:21 +10:00
Hiroku 70c1b42ede Merge branch 'non-entity-spawning' into 'main'
Abstracted spawning so it could be made to support non-entity spawning

Closes #729

See merge request cable-mc/cobblemon!850
2024-01-13 05:58:32 +00:00
MoeBoy76 b2048bb66f git hates me [skip-ci] 2024-01-13 16:48:45 +11:00
MoeBoy76 9956f1c159 dipplin fix [skip-ci] 2024-01-13 14:14:43 +11:00
MoeBoy76 25857dafc5 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into can-moe-scrape
# Conflicts:
#	common/src/main/resources/data/cobblemon/species/generation9/dipplin.json
2024-01-13 14:10:22 +11:00
MoeBoy76 80345b3810 blueberry allergy fix [skip-ci] 2024-01-13 14:01:59 +11:00
JazzMcNade d4dc24ec49 Updated fossil item sprites. 2024-01-12 20:52:32 -06:00
Paul 2209ee10b6 Licenses 2024-01-13 12:05:07 +10:00
Paul a91aa9835c interop improvement on PokemonProperties.parse 2024-01-13 11:48:29 +10:00
Paul 0e980a846c Abstracted spawning so it could be made to support non-entity spawning 2024-01-13 11:36:31 +10:00
jeffw773 929b90173a - Some code for fishing testing 2024-01-12 11:58:02 -08:00
jeffw773 70a65f6ffe - Testing code 2024-01-12 07:39:21 -08:00
jeffw773 db7d3f01d8 - Starting implementation on fishing 2024-01-12 07:39:20 -08:00
JazzMcNade f54bbe754f Adjust Aerodactyl's y offset inside the fossil tube 2024-01-11 21:31:24 -06:00
Apion 92fff27b4e Merge branch 'can-moe-scrape' into 'main'
Add gen 9 DLC movesets

See merge request cable-mc/cobblemon!846
2024-01-12 03:16:58 +00:00
MoeBoy76andApion 255874cbe4 Add gen 9 DLC movesets 2024-01-12 03:16:58 +00:00
Apion 824bc1b080 Merge branch 'botanypots' into 'main'
Botanypots integration - with additional fixes

See merge request cable-mc/cobblemon!844
2024-01-12 03:12:38 +00:00
GregerandApion 3ee55f24d8 Botanypots integration - with additional fixes 2024-01-12 03:12:38 +00:00
Lily c3379ddf21 fix crash with fossil machine on servers 2024-01-11 17:48:45 -05:00
jeffw773 5983b17e87 - Added in Retro's adjusted capture animation JSON for regular ball and ancient ball 2024-01-11 08:31:24 -08:00
Hiroku 27986d28a7 Merge branch 'musical-blocks' into 'main'
Musical Blocks

See merge request cable-mc/cobblemon!845
2024-01-11 13:06:09 +00:00
Hiroku 8807f2134e Merge branch 'main' into 'musical-blocks'
# Conflicts:
#   CHANGELOG.md
2024-01-11 11:31:10 +00:00
Hiroku d74b1228c1 Merge branch 'new_poison_touch_fix' into 'main'
- Fixed battle lang for Poison Touch in a much simpler way

See merge request cable-mc/cobblemon!849
2024-01-11 11:30:38 +00:00
Hiroku a3dcfe8bfb Merge branch 'main' into 'main'
Update PokemonEntity to be an open class.

See merge request cable-mc/cobblemon!847
2024-01-11 11:24:10 +00:00
jeffw773 8725ef2b54 - Fixed battle lang for Poison Touch in a much simpler way 2024-01-10 19:22:47 -08:00
Pebbles 3074b067dc Update PokemonEntity to be an open class. 2024-01-10 19:08:23 +00:00
Lily 8d0ee6dd6f more particle changes 2024-01-10 11:44:12 -05:00
JazzMcNade a1c1c9bc90 Updated Fossil Tube textures. Fluid opacity increased, Line removed from tank. 2024-01-10 00:41:45 -06:00
MoeBoy76 5e52d350c1 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into can-moe-scrape
# Conflicts:
#	CHANGELOG.md
2024-01-10 12:25:21 +11:00
MoeBoy76 e3ad34e023 changelogs [skip-ci] 2024-01-10 12:23:30 +11:00
MoeBoy76 f308918fd1 update Z species for gen 9 movesets 2024-01-10 12:19:26 +11:00
MoeBoy76 82a8257fa9 update Y species for gen 9 movesets 2024-01-10 12:13:30 +11:00
MoeBoy76 6c06c91cca update W species for gen 9 movesets 2024-01-10 12:07:12 +11:00
MoeBoy76 c5e44031a6 update V species for gen 9 movesets 2024-01-10 11:53:58 +11:00
MoeBoy76 6be2e14af4 update U species for gen 9 movesets 2024-01-10 11:29:04 +11:00
MoeBoy76 5cae25c059 update T species for gen 9 movesets 2024-01-10 11:25:17 +11:00
Lily 87e4f94af5 hisui capture particles, modern capture particles still need to be fixed 2024-01-09 19:18:55 -05:00
MoeBoy76 90ac9ae4df update S species for gen 9 movesets 2024-01-10 10:38:34 +11:00
Apion 527518d0c2 Merge branch 'funny_butterfly' into 'main'
changes to vivillon advancements and patterns

See merge request cable-mc/cobblemon!842
2024-01-09 21:21:10 +00:00
LilyandApion bcb326cd87 changes to vivillon advancements and patterns 2024-01-09 21:21:09 +00:00
Lily 43075f1cb8 updated capture particles, waiting for the animation files 2024-01-09 08:27:31 -05:00
JazzMcNade e1b1e3d5e9 embryo stages now shrink down to nothing before disappearing 2024-01-09 02:44:25 -06:00
MoeBoy76 c226b80430 update R species for gen 9 movesets 2024-01-09 15:38:58 +11:00
dhi_holo 935f7039cf Musical Blocks
Note Block Instruments!
2024-01-09 13:19:32 +10:00
JazzMcNade a7095b30a3 FossilTuberRenderer now gradually shifts between embryo models. Still needs more turning. 2024-01-08 03:09:18 -06:00
Paul ac5a03eebc Made particles use particle sheet translucent 2024-01-08 13:51:56 +10:00
JazzMcNade bd79b58571 Added Embryo model. Very rough draft on swapping embryo stages. 2024-01-07 05:38:14 -06:00
apion 7c164fc4c8 Revert "Added BotanyPots integration"
This reverts commit 846acaef88.
2024-01-07 02:28:40 -05:00
Paul 5e1c233493 Fixed some ancient pokeball animation stuff 2024-01-07 14:02:17 +10:00
Paul 95e95afef3 Conflict resolution stuff 2024-01-07 13:39:46 +10:00
Paul bf9c54e539 Merge remote-tracking branch 'origin/main' into amo/sendout-upgrade
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/entity/PokemonClientDelegate.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/PoseableEntityModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/JsonPokemonPoseableModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/Poseable.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/util/DataKeys.kt
#	fabric/src/main/kotlin/com/cobblemon/mod/fabric/client/CobblemonFabricClient.kt
2024-01-07 13:28:42 +10:00
Apion 2ccda57c66 Merge branch 'botanypots' into 'main'
Added BotanyPots integration

Closes #642

See merge request cable-mc/cobblemon!828
2024-01-06 15:17:50 +00:00
GregerandApion 846acaef88 Added BotanyPots integration 2024-01-06 15:17:50 +00:00
Hiroku 5fa12ff1c5 Merge branch 'punch-apricorn' into 'main'
Punch apricorn

See merge request cable-mc/cobblemon!843
2024-01-06 01:11:53 +00:00
tmetcalfe89 2b3db32243 right, we should make sure it's proper age before harvesting 2024-01-05 15:20:34 -08:00
tmetcalfe89 4b54405017 added ability to punch apricorn to harvest 2024-01-05 13:48:16 -08:00
JazzMcNade b7addd0203 Added rudimentary randomized phase offset for fetus animations 2024-01-05 02:12:47 -06:00
JazzMcNade 7e64938ec9 Updated fetus anims for Aerodactyl, Archen, Galarian Fossils, Omanyte, Shieldon, Cranidos, and Substitute. Slowed Fossil animation rate to expected speed. 2024-01-05 01:35:19 -06:00
Paul 3824531735 Made moveToPose able to function without an entity 2024-01-05 16:14:32 +10:00
amo 618f66c775 fix up sendout particle code and implement greatball particles 2024-01-05 01:36:37 +00:00
MoeBoy76 9eb9c782ce update Q species for gen 9 movesets 2024-01-05 12:24:54 +11:00
MoeBoy76 49149c9c54 update P species for gen 9 movesets 2024-01-05 12:18:58 +11:00
Paul fd1d1075db Corrections to textures on ballsparkles 2024-01-05 10:16:59 +10:00
Paul 1648926aa6 Fixed direction vectors not being normalized 2024-01-05 10:16:42 +10:00
MoeBoy76 7784794689 update O species for gen 9 movesets 2024-01-05 10:16:26 +11:00
MoeBoy76 07b41d7c0a update N species for gen 9 movesets 2024-01-05 10:08:14 +11:00
MoeBoy76 f5287c7e83 update M species for gen 9 movesets 2024-01-05 09:45:46 +11:00
Paul 63a30dcfd0 Merge remote-tracking branch 'origin/main' 2024-01-04 21:47:27 +10:00
Paul 9cc63b59e6 Fixed forge runs 2024-01-04 21:44:37 +10:00
Hiroku cb17c29be5 Merge branch 'squawkabilly_aspect' into 'main'
Fix Squawkabilly forms to use correct aspect

Closes #742

See merge request cable-mc/cobblemon!841
2024-01-04 11:28:02 +00:00
KyozennoandHiroku fd16d59ea2 Fix Squawkabilly forms to use correct aspect 2024-01-04 11:28:01 +00:00
amo 3ce22c0759 particle stuff 2024-01-04 01:32:35 +00:00
MoeBoy76 797eeb09cc update L species for gen 9 movesets 2024-01-04 10:20:15 +11:00
MoeBoy76 e6df322556 update K species for gen 9 movesets 2024-01-04 08:32:17 +11:00
MoeBoy76 744d1e1263 update J species for gen 9 movesets 2024-01-04 07:53:07 +11:00
MoeBoy76 7987713179 update I species for gen 9 movesets 2024-01-04 07:45:43 +11:00
MoeBoy76 f8efe0a7d1 update H species for gen 9 movesets 2024-01-04 07:12:13 +11:00
MoeBoy76 be558ed0ab update G species for gen 9 movesets 2024-01-04 06:32:46 +11:00
amo a786adee9e Merge branch 'evolution-effect' into amo/balls
# Conflicts:
#	common/src/main/java/com/cobblemon/mod/common/mixin/GameRendererMixin.java
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/entity/PokemonClientDelegate.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/gui/interact/wheel/InteractWheelGuiFactory.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/pokemon/PokemonRenderer.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/command/TestCommand.kt
#	common/src/main/resources/assets/cobblemon/particles/snowstorm.json
#	common/src/main/resources/mixins.cobblemon-common.json
#	fabric/src/main/kotlin/com/cobblemon/mod/fabric/client/CobblemonFabricClient.kt
2024-01-03 15:02:26 +00:00
Apion 2d6c7f5148 Merge branch 'dialogue' into 'main'
Dialogue

See merge request cable-mc/cobblemon!834
2024-01-03 12:20:39 +00:00
MoeBoy76 f3f3bfead4 update F species for gen 9 movesets 2024-01-03 22:44:49 +11:00
MoeBoy76 506ff8d1e4 update E species for gen 9 movesets 2024-01-03 22:14:04 +11:00
MoeBoy76 4764264c9a update D species for gen 9 movesets 2024-01-03 21:44:03 +11:00
Paul 7a761003c5 Merge remote-tracking branch 'origin/main' into dialogue
# Conflicts:
#	CHANGELOG.md
2024-01-03 19:07:51 +10:00
Paul f9fa9dcf24 Added ServerRealTimeTaskTracker for server-sided epoch scheduler and use it for dialogue 2024-01-03 19:07:18 +10:00
Hiroku dfc4873ce3 Merge branch 'open-itemdropentry' into 'main'
Opens up the ItemDropEntry class, so it can be extended.

See merge request cable-mc/cobblemon!836
2024-01-03 08:46:07 +00:00
Nick 65bd00033c Merge branch 'berry-rendering' into 'main'
Improve Berry Rendering Perf

See merge request cable-mc/cobblemon!838
2024-01-03 07:35:28 +00:00
ApionandNick f82fa2b4e6 Improve Berry Rendering Perf 2024-01-03 07:35:27 +00:00
Nick 966acecf6d Merge branch 'Fetus_Updates' into 'main'
Fix for Fossil Block Renderers and Fetus Asset Updates

See merge request cable-mc/cobblemon!839
2024-01-03 06:31:05 +00:00
JazzMcNade 2cd09af4d0 Added all remaining fetus models for the fossil machine, updated existing fetus assets. Reregistered fossil block entity renderers. 2024-01-02 23:51:50 -06:00
MoeBoy76 1bc22f1afc update C species for gen 9 movesets 2024-01-03 16:49:27 +11:00
MoeBoy76 3480085a29 update B species for gen 9 movesets 2024-01-03 14:04:43 +11:00
MoeBoy76 f5c0bfb40e update A species for gen 9 movesets (again) 2024-01-03 13:04:28 +11:00
MoeBoy76 9dc9740363 Revert "update A species for gen 9 movesets"
This reverts commit be16d00dd5.
2024-01-03 12:20:30 +11:00
MoeBoy76 be16d00dd5 update A species for gen 9 movesets 2024-01-03 10:15:21 +11:00
MoeBoy76 777ece02cc Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into can-moe-scrape 2024-01-03 08:35:03 +11:00
Deltric 388e03e261 Opens up the ItemDropEntry class, so it can be extended. 2024-01-02 01:12:48 -06:00
Paul 1829f7d48a Renamed FlatfileMoLangDataStoreFactory.kt to NbtMoLangDataStoreFactory.kt 2024-01-01 22:44:30 +10:00
Hiroku bcc3c885d7 Merge branch 'holographic-cleaners-inc' into 'main'
Tags on Tags (plus a couple tiny fixes)

Closes #736 and #706

See merge request cable-mc/cobblemon!835
2024-01-01 12:40:09 +00:00
Paul e2a6dbc709 Undid temp example thingy dw about it 2024-01-01 22:13:15 +10:00
Paul b32ca4af5d Added autocompletion to /opendialogue 2024-01-01 22:11:58 +10:00
Paul a2e728905e Clarified PlayerRenderableFace 2024-01-01 21:47:07 +10:00
dhi_holo ead232be6f Merge branch 'main' into holographic-cleaners-inc 2024-01-01 19:59:44 +10:00
dhi_holo feaba85ba0 Update CHANGELOG.md
improved a description slightly
2024-01-01 19:52:26 +10:00
dhi_holo 6a8822ca76 Undone what was done before
Given it exists in another branch, and this was just me learning anyway, removed the ore from this branch.
2024-01-01 19:50:36 +10:00
Paul 8fc6d93be4 Merge remote-tracking branch 'origin/main' into dialogue
# Conflicts:
#	CHANGELOG.md
2024-01-01 18:22:33 +10:00
Paul 97f8dc562a Oopsy 2024-01-01 18:20:08 +10:00
Hiroku 6616cd1d4c Merge branch 'moe-minor-fixes' into 'main'
empty evolutions tag cleanup and related fixes

See merge request cable-mc/cobblemon!832
2024-01-01 07:08:00 +00:00
Paul f9635cf03f Merge remote-tracking branch 'origin/main' into dialogue
# Conflicts:
#	CHANGELOG.md
2024-01-01 16:52:41 +10:00
Hiroku 49db87737f Merge branch 'original-trainer' into 'main'
Original Trainer Implementation

See merge request cable-mc/cobblemon!831
2024-01-01 06:51:09 +00:00
Hiroku a414213255 Merge branch 'main' into 'original-trainer'
# Conflicts:
#   CHANGELOG.md
#   common/src/main/kotlin/com/cobblemon/mod/common/util/MiscUtils.kt
2024-01-01 06:44:21 +00:00
Paul 59a8c21429 Merge remote-tracking branch 'origin/main' into dialogue
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/data/CobblemonDataProvider.kt
2024-01-01 16:27:58 +10:00
Paul b67fda7a37 changelog for dialogue 2024-01-01 16:27:25 +10:00
Hiroku 4392a61ab5 Merge branch 'archaeology' into 'main'
Archeology

See merge request cable-mc/cobblemon!833
2024-01-01 06:26:13 +00:00
Hiroku a9d96818ec Removed duplicated block entity renderer registration 2024-01-01 06:24:35 +00:00
Paul 6b285e48e9 Added faces to dialogue API 2024-01-01 16:20:46 +10:00
MoeBoy76 532ef09acd updates for recent transformed parts update 2024-01-01 08:14:21 +11:00
MoeBoy76 f0f7bb96ad Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into archaeology
# Conflicts:
#	CHANGELOG.md
2024-01-01 07:10:17 +11:00
Paul ecfb6c60c3 Added dialogue API 2023-12-30 21:55:35 +10:00
dhi_holo 5be436f25c Merge branch 'main' into holographic-cleaners-inc 2023-12-29 18:55:23 +10:00
dhi_holo 2ddc265b0f Destiny Tears
Updated Destiny Knot to use a ghast tear
2023-12-29 18:54:26 +10:00
MoeBoy76 52af8ceb99 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into moe-minor-fixes
# Conflicts:
#	CHANGELOG.md
2023-12-28 23:15:51 +11:00
Hiroku 14a5060100 Merge branch 'dispatch-refactor' into 'main'
Refactored battle interpretor to load into a sequence before starting dispatches

See merge request cable-mc/cobblemon!830
2023-12-28 10:55:22 +00:00
Hiroku 9d33586b44 Merge branch 'improved-transformed-parts' into 'main'
Rebuilt transformed model parts

See merge request cable-mc/cobblemon!829
2023-12-28 10:55:09 +00:00
MoeBoy76 d4f328157e Update file PokemonBattle.kt 2023-12-27 23:35:49 +00:00
MoeBoy76 c4331043f7 changelog file that was missed in selection 2023-12-28 10:05:09 +11:00
MoeBoy76 9945d8a069 cleanup check and fix for empty evolutions in species files 2023-12-28 10:03:39 +11:00
dhi_holo 2595d6ee91 Tags for Ore!
Adds block and item tags for each evolution store ore type, as well as adding the ores to the modloader tags properly, making it match with how ores are handled regularly.
Also boat tags.
2023-12-28 06:04:51 +10:00
dhi_holo f16e024bbe I don't get it
Readded the Iron recipe. No clue why it disappeared, just, isn't a file for it suddenly.
Closes #736
2023-12-28 05:29:05 +10:00
Charzard4261 87a5522acc Update CHANGELOG.md 2023-12-27 16:10:14 +00:00
Charzard4261 2c812cdc3c Change system to explicitly declare if an Original Trainer is NONE, PLAYER or NPC through the use of OriginalTrainerType 2023-12-27 16:06:52 +00:00
dhi_holo f6e910038e Update beast_ball.png
Replaces `assets\cobblemon\textures\item\poke_balls\models\beast_ball.png` with `assets\cobblemon\textures\poke_balls\beast_ball.png`, so they match, as only one was updated.
Resolves #706
2023-12-27 18:55:52 +10:00
dhi_holo 5c7d96897d Generation Sucks, Please Help
Added basically everything for Netherrack Fire Stone Ore, but the generation doesn't work and I'm not sure why. Feel free to investigate it, won't merge until it's solved.
2023-12-27 18:50:53 +10:00
dhi_holo 862d892c84 More EMI Compat
Added the new tags to the lang file, so they look nicer with mods such as EMI
2023-12-27 15:31:50 +10:00
dhi_holo 9246e1e8ee Held Tags
Should add all missed held items to the held item tag, as well as adding Metal Coat to the Held Items tab, and moving Power Herb to after the six Power Items because sure, alphabetical is nice, but it's a set, let's let it sit together xD
2023-12-27 14:23:43 +10:00
Paul 0715cb465f Fixed faints with loop set to true causing super whacky animations 2023-12-26 13:30:22 +10:00
Paul 2e251972aa Merge branch 'main' into improved-transformed-parts 2023-12-26 12:48:22 +10:00
Paul de89c11f24 Fixed issue with localPosition on inward/outward motion particles 2023-12-26 11:40:41 +10:00
Charzard4261 7a1f96e31e Add missing OTPlayer Username -> UUID lookup in PokemonProperties.apply(PokemonEntity) 2023-12-25 21:07:50 +00:00
Charzard4261 d405b099b3 Added the ability to modify the Original Trainer of a Pokémon through Commands 2023-12-25 21:04:42 +00:00
MoeBoy76 a8e4f87c59 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into can-moe-scrape 2023-12-26 07:49:22 +11:00
Hiroku 74322e2f48 Turn snapshot back on 2023-12-25 11:13:48 +00:00
Paul f16d233693 Put the evolution effect behind a switch so we can pull the fixes into main 2023-12-25 20:49:26 +10:00
Paul 54d2711583 Resolved issues from merging main 2023-12-25 20:44:30 +10:00
Paul e54f179ccf Merge remote-tracking branch 'origin/main' into evolution-effect
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/PoseableEntityState.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/command/TestCommand.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/net/messages/client/spawn/SpawnPokemonPacket.kt
#	deps/local/com/bedrockk/molang/maven-metadata-local.xml
2023-12-25 20:33:56 +10:00
Paul 40a37fedd2 Actually maybe don't try tracking causality yet 2023-12-25 20:28:47 +10:00
Paul 3bc6c50d79 Don't use deprecated scheduling 2023-12-25 20:19:13 +10:00
Paul 1ef9f44a1b Merge remote-tracking branch 'origin/main' into dispatch-refactor
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt
2023-12-25 20:18:43 +10:00
MoeBoy76 f1ed339d9d update for 1.4.1 2023-12-25 11:26:26 +11:00
Paul f07930ef16 Just a little AI activity access widener 2023-12-25 09:53:11 +10:00
Paul c6d18cda44 Fixed a fringe flickering issue with pose transitioning 2023-12-24 14:21:27 +10:00
Paul 263b86e833 Merge remote-tracking branch 'origin/main' into improved-transformed-parts
# Conflicts:
#	CHANGELOG.md
#	common/src/main/kotlin/com/cobblemon/mod/common/client/entity/PokemonClientDelegate.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/PoseableEntityState.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
2023-12-24 10:45:12 +10:00
Paul 953560051d Merge conflict corrections 2023-12-24 10:26:12 +10:00
Paul bf3904a214 Merge remote-tracking branch 'origin/main' into tracked-data-cleanup
# Conflicts:
#	CHANGELOG.md
#	common/src/main/kotlin/com/cobblemon/mod/common/battles/BattleBuilder.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/block/entity/PokemonPastureBlockEntity.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/entity/PokemonClientDelegate.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokeball/EmptyPokeBallEntity.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonServerDelegate.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/pokemon/Pokemon.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/pokemon/evolution/requirements/BattleCriticalHitsRequirement.kt
2023-12-24 10:04:03 +10:00
MoeBoy76 c426f4154b Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into can-moe-scrape 2023-12-24 10:18:55 +11:00
MoeBoy76 a326eb3832 Blueberry dex additions 2023-12-24 10:18:06 +11:00
Hiroku 1708eb9b3e Merge branch 'scheduling-rework' into 'main'
Rebuilt scheduling mechanism to be better contained and avoid side issues

See merge request cable-mc/cobblemon!793
2023-12-23 23:15:25 +00:00
Hiroku 0dee18dbfd Merge branch 'spawn-rules' into 'main'
Spawn rules

See merge request cable-mc/cobblemon!825
2023-12-23 23:15:14 +00:00
Paul 7ee7aaab76 Licenses 2023-12-23 21:18:58 +10:00
Paul 3dd4f515dd Squeezed OT into a single value pair 2023-12-23 21:00:16 +10:00
Paul f24310d043 Merge remote-tracking branch 'origin/main' into original-trainer 2023-12-23 20:38:48 +10:00
Paul 61bfe02322 Merge branch 'spawn-rules' into scheduling-rework 2023-12-23 20:17:48 +10:00
Paul 7cbcb30aff Add standard functions from a .setup() on MoLangRuntime 2023-12-23 15:21:59 +10:00
Paul 6fc8fa5b60 Wait no that's not where general functions are meant to go 2023-12-23 15:19:34 +10:00
Paul 7763a6d3e7 Added standard functions to registry entry molang values 2023-12-23 15:18:40 +10:00
Paul 1288469172 Some fixes for spawn rules and include real example 2023-12-23 15:06:42 +10:00
Paul 86cf79bff9 Merge remote-tracking branch 'origin/main' into spawn-rules 2023-12-23 14:10:21 +10:00
Paul 765e9f2cc3 snapshot = false 2023-12-23 11:39:57 +10:00
Paul ffda34742c Edge case protection with nickname migration 2023-12-23 11:01:03 +10:00
Paul c2385edbe7 more more changelog [skip-ci] 2023-12-23 11:00:00 +10:00
Paul 961ad0f4bd more changelog [skip-ci] 2023-12-23 10:45:07 +10:00
Paul 8851594347 Changelog polishing and removing stacks of unused item files 2023-12-23 10:44:32 +10:00
Paul 3c1ad2bea6 Add pokeball vivillon variant back into advancement 2023-12-23 09:10:17 +10:00
Hiroku e1960792d7 Merge branch 'bush_pathing' into 'main'
Berry bush avoidance

See merge request cable-mc/cobblemon!824
2023-12-22 22:50:24 +00:00
gr3ger 23b9f933c7 Updated changelog. 2023-12-22 23:37:27 +01:00
Paul 9662699bcb Fix mongo adapter constructor issue 2023-12-23 08:29:54 +10:00
Hiroku 32b2d2023b Merge branch 'nickname-migrate' into 'main'
Adds json nickname migrate + bug fix for non player entity backed battle actors.

See merge request cable-mc/cobblemon!821
2023-12-22 22:24:03 +00:00
Paul 22441e0b09 More evo effect reworking 2023-12-23 08:20:36 +10:00
Hiroku c64612859c Merge branch '732_spelling' into 'main'
Fix wrong name on animation/model folders

Closes #732

See merge request cable-mc/cobblemon!822
2023-12-22 22:17:12 +00:00
gr3ger 6c97c4c238 Removed extra call to getBlockState() and made function return on match instead of going through all if statements. 2023-12-22 23:11:58 +01:00
Lily 8c6f7335a5 bring changelog up to date. pls keep updating this from now on!! 2023-12-22 19:25:43 +00:00
gr3ger 6535d43964 PoC bush avoidance 2023-12-22 18:16:21 +01:00
gr3ger 234d1dad44 Closes #732
Tested spawning entities after changes, nothing seems out of the ordinary.
2023-12-22 10:12:47 +01:00
Deltric da247e9902 Adds json nickname migrate + bug fix for non player entity backed battle actors. 2023-12-22 01:47:19 -06:00
Paul 8418bc87c8 Merge remote-tracking branch 'origin/main' into evolution-effect
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonEntities.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/storage/adapter/flatfile/NBTStoreAdapter.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/command/TestCommand.kt
#	fabric/src/main/kotlin/com/cobblemon/mod/fabric/client/CobblemonFabricClient.kt
#	forge/src/main/kotlin/com/cobblemon/mod/forge/client/CobblemonForgeClient.kt
2023-12-22 15:41:11 +10:00
Paul c747d089ca More reworking of dispatches and instructions 2023-12-22 13:50:01 +10:00
Paul 8c881ab85a Merge branch 'main' into dispatch-refactor 2023-12-22 13:25:42 +10:00
Paul 0655d63dc5 Removed a couple of recipe advancements that are for items not ingame 2023-12-22 12:06:23 +10:00
Paul 81ba5ef615 Removed errant "light powder" item 2023-12-22 10:53:59 +10:00
Paul 8354c3838a Merge remote-tracking branch 'origin/main' 2023-12-22 10:10:12 +10:00
Paul 80db305aba Updated heaps of langs from crowdin 2023-12-22 10:10:00 +10:00
apion ec43a78ae4 Merge branch 'main' into archaeology 2023-12-20 22:48:50 -05:00
Hiroku 60e0314f29 Merge branch 'Spawn_Level_Scaling' into 'main'
Level scaling tweak

See merge request cable-mc/cobblemon!820
2023-12-19 22:14:21 +00:00
Nick 5f868630e0 Merge branch 'neo-bounties' into 'main'
:)

See merge request cable-mc/cobblemon!818
2023-12-19 20:46:10 +00:00
MoeBoy76 762a53923c license fix 2023-12-19 13:36:16 +11:00
MoeBoy76 1cf03d4a0d Merge branch 'tumblestones' into 'archaeology'
move ancient pokeballs to archaeology branch

See merge request cable-mc/cobblemon!819
2023-12-19 01:56:23 +00:00
LilyandMoeBoy76 48f7be485f move ancient pokeballs to archaeology branch 2023-12-19 01:56:22 +00:00
MoeBoy76 89364a9fd0 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into archaeology 2023-12-19 12:51:12 +11:00
MoeBoy76 b93adae945 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into Spawn_Level_Scaling
# Conflicts:
#	CHANGELOG.md
2023-12-19 12:49:57 +11:00
MoeBoy76 9f1ed344d8 Changelog 2023-12-19 12:46:48 +11:00
MoeBoy76 2c256eefde Correct logic and cleanup unused test code 2023-12-19 12:27:41 +11:00
Neovitalism b075fce83f :)
#725 - Adds a boolean property to PokemonEntity to make it not count towards the spawn cap.
#728 - Makes PokemonEntity respect minecraft's silent flag.
2023-12-18 15:10:19 -06:00
Paul f2ed332c4c Fixed minor error in lang 2023-12-19 05:51:00 +10:00
Paul e8f083d8bf Merge remote-tracking branch 'origin/main' 2023-12-19 05:50:38 +10:00
Paul 43d965f2a1 Further reworks of dispatch refactor 2023-12-19 05:50:11 +10:00
Hiroku 1684a341a1 Merge branch 'Swim_Behavior_Fix' into 'main'
Fixed Swim Behaviors for some Pokemon

See merge request cable-mc/cobblemon!817
2023-12-18 19:40:34 +00:00
Hiroku b4e1bf794d Merge branch 'Pokemon_Weight_Watchers' into 'main'
Changed calculations of Pokemon's weight and height before it is sent to Showdown so that battle damage for weight-based moves are accurate

See merge request cable-mc/cobblemon!816
2023-12-18 19:40:22 +00:00
jeffw773 c85ad7d60c - Changelog 2023-12-18 11:28:53 -08:00
jeffw773 e61e92a5d4 - Changelog 2023-12-18 11:27:08 -08:00
jeffw773 a245e9661c - final tweaks for MR 2023-12-18 11:01:35 -08:00
jeffw773 059152b34c - removed unused test code 2023-12-18 10:58:59 -08:00
Lily e4a698b04b subtitles for fossil machine sounds 2023-12-18 18:48:08 +00:00
jeffw773 0d35157fcf - removed unused test code 2023-12-18 10:42:43 -08:00
jeffw773 302388d0a6 - Added Swim behaviors to Samurott line, Clodsire, Wimpod, Golisopod, Quaxwell, Quaquaval, 2023-12-18 10:30:07 -08:00
jeffw773 ab957f82e1 - Altered some code for how Pokemon's height and weight is calculated for weight-based moves during battles as it had issues and was doing more damage than it should have been 2023-12-17 20:18:41 -08:00
jeffw773 fef82ae6bf - Altered some code for how Pokemon's height and weight is calculated for weight-based moves during battles as it had issues and was doing more damage than it should have been 2023-12-17 20:16:06 -08:00
jeffw773 8b979c1944 - Altered some code for how Pokemon's height and weight is calculated for weight-based moves during battles as it had issues and was doing more damage than it should have been 2023-12-17 19:52:32 -08:00
Paul 4bbbaacacf Merge remote-tracking branch 'origin/main' 2023-12-18 08:34:34 +10:00
jeffw773 eda8e15509 Merge remote-tracking branch 'origin/main' 2023-12-17 10:03:21 -08:00
Nick d53a71c188 Merge branch '1.4.1-fixes' into 'main'
1.4.1 fixes

See merge request cable-mc/cobblemon!814
2023-12-17 01:16:44 +00:00
HirokuandNick d2f02b0d06 1.4.1 fixes 2023-12-17 01:16:44 +00:00
Paul 5c0bb194b6 Fixed Tyrogue fainting into the floor 2023-12-17 10:50:08 +10:00
Paul e41562f5ad Fixed status apply fail messages for when they're already afflicted by that status 2023-12-17 10:49:59 +10:00
Paul 69ea1ac3bf Fixed things like Keen Eye not having translation stuff 2023-12-17 10:29:19 +10:00
Paul 7c15f0f924 Fixed confusing poison heal messages 2023-12-17 09:40:32 +10:00
Paul 6165e5e871 Corrected mistaken changelog entry 2023-12-17 09:19:41 +10:00
Paul dd8f59e0d0 Removed pink bow recipe as not needed anymore 2023-12-17 09:11:56 +10:00
Paul 87611795e9 Fixed battle messages getting out of sync after spectating, unspectating, re-spectating 2023-12-17 09:11:18 +10:00
Paul d2fe9b1132 Fixed Life Orb not having a proper item name 2023-12-17 08:57:26 +10:00
Hiroku e95759a710 Merge branch 'whatsy/bugfixes' into 'main'
Various bugfixes for 1.4.1

Closes #722 and #724

See merge request cable-mc/cobblemon!805
2023-12-16 21:50:39 +00:00
Hiroku 7284f8d35d Merge branch 'can-moe-scrape' into 'main'
Teal Mask species data

See merge request cable-mc/cobblemon!806
2023-12-16 21:24:07 +00:00
Hiroku 334dd1206e Merge branch 'share-the-explove' into 'main'
Balanced EXP Share Recipe

Closes #727

See merge request cable-mc/cobblemon!811
2023-12-16 21:23:32 +00:00
Hiroku e7caab0ae0 Merge branch 'Waldleufer/spawnCSVScriptPolishing' into 'main'
minor spawn CSV Script improvements and pokemon.json fix

See merge request cable-mc/cobblemon!812
2023-12-16 21:22:58 +00:00
Waldleufer 47f02f6e50 Restored Script default settings 2023-12-16 11:42:31 +01:00
Waldleufer 3367b0c39c dissolved bug in script
that would occur if the filled out Multiplier column for one pokemon was followed by an empty field
2023-12-16 11:40:47 +01:00
Waldleufer 0e43d7730c verified omanyte, omastar kabuto and kabutops json 2023-12-16 11:07:06 +01:00
Waldleufer b5604686f2 fix: Updated all minecraft:nether_quartz to minecraft:quartz 2023-12-16 11:05:00 +01:00
Waldleufer e030dbfbf5 refactor: Made the script report more readable. 2023-12-16 11:03:56 +01:00
Lily 96647a9398 fix conflict in changelog 2023-12-15 19:09:58 +00:00
Charzard4261 33cfbf7d1c First implementation of storing OT UUID and Name. Updates for Starter Selection, Catching, and Shedninja creation. Needs thorough reviewing. 2023-12-13 22:30:42 +00:00
dhi_holo 9e2c0ab0db Balanced EXP Share Recipe
Closes #727
2023-12-14 06:48:43 +10:00
Lily 1bc953f3f3 lang update 2023-12-12 14:40:06 +00:00
jeffw773 d089eab60f - Start of a tweak to how spawns work in terms of scaling the level of Pokémon based off of player party highest level 2023-12-11 17:19:19 -08:00
JazzMcNade 09da392c36 Added quirk support for tank fetuses, added basic posers and variation jsons for a bunch of fossil mons 2023-12-11 00:10:28 -06:00
Paul 94ad2f1250 Added Waffle's particles but they're kinda busted ngl 2023-12-11 13:32:08 +10:00
Hiroku d18cab39a9 Merge branch 'kkeenanwong-main-patch-46161' into 'main'
Update garganacl.json quartz item ID

See merge request cable-mc/cobblemon!808
2023-12-11 03:21:09 +00:00
Keenan Wong 4492666f5a Update garganacl.json quartz item ID 2023-12-11 03:04:33 +00:00
Paul 6ddf048984 Started rework of battle dispatch construction for more context-aware interpreting 2023-12-11 10:15:18 +10:00
Hiroku 6a0985958b Merge branch 'reknot' into 'main'
Knot Flip

See merge request cable-mc/cobblemon!807
2023-12-10 23:37:43 +00:00
dhi_holo 308c5e6d32 Knot Flip
Destiny Knot recipe has been vertically flipped, to closer match the sprite.
2023-12-11 09:15:40 +10:00
MoeBoy76 bd83cc143b redo broken é 2023-12-09 23:43:12 +11:00
MoeBoy76 c9e6cb1022 fix line separator 2023-12-09 23:40:43 +11:00
MoeBoy76 74c75b7faa Applin evo data 2023-12-09 23:31:52 +11:00
MoeBoy76 45819a17f6 Teal Mask new data 2023-12-09 22:36:32 +11:00
Lily e3f84248b8 Added StructureLikeCondition.kt and a new StructureRequirement for evolutions. Closes #722 2023-12-05 19:35:30 -05:00
Lily 0ff518194f Fix grammar errors on certain pokeballs. made small fixes to Vivillon evolutions. Closes #724 2023-12-05 18:42:58 -05:00
Lily 634a1ad6fc Fixed Inkay evolution, fixed conflicting biome requirements for ocean, river, sun, and tundra vivillion variants. Closes #724 2023-12-05 16:58:39 +00:00
Lily 41217ebdcc Remove poke ball variant from the Vivillionaire advancement 2023-12-05 16:42:05 +00:00
JazzMcNade f396b63a34 Added FossilRegistrySyncPacket
Multiplayer clients can now see fossil tank fetuses
2023-12-05 01:17:44 -06:00
Hiroku a021ec1337 Merge branch 'sound' into 'main'
Fixed missing cries again

See merge request cable-mc/cobblemon!803
2023-12-04 20:30:00 +00:00
Sterrezo b03f95b7da Fixed missing cries again
Scatterbug and Spewpa lost their cries somewhere so I re-added them. No changelog because this happened during development, so it's as it was in 1.4
2023-12-04 17:55:26 +01:00
Paul d8cee44661 Changelog [skip-ci] 2023-12-02 14:56:45 +10:00
Hiroku 5dd2287441 Merge branch 'fastutil-crash' into 'main'
Fixed fastutil crash

See merge request cable-mc/cobblemon!802
2023-12-02 04:39:25 +00:00
Paul 1eb6af14c2 Changelog 2023-12-02 10:53:18 +10:00
Paul 61b73972d4 Merge branch '1.4.0a'
# Conflicts:
#	CHANGELOG.md
2023-12-02 10:39:31 +10:00
Hiroku f8bcf8c291 Merge branch 'rendercontext-additions' into 'main'
Add species and aspects to RenderContext

See merge request cable-mc/cobblemon!799
2023-12-02 00:28:20 +00:00
Waterpicker 543d408e63 Merge remote-tracking branch 'cable-mc/main' into rendercontext-additions 2023-12-01 00:46:35 -06:00
Apion 2cdc781e93 Merge branch 'battles-unlanguished' into 'main'
Added langs and update interpreter

See merge request cable-mc/cobblemon!801
2023-12-01 05:45:42 +00:00
Segfault Guy 8dc0a7f72d Interpreter trimmings and fixes. 2023-12-01 00:18:50 -05:00
Paul 8b5231d6f0 Alternative way to fix dupe issue to not crash (huge) 2023-12-01 12:07:00 +10:00
Hiroku 665c4cc26c Merge branch 'particle-command' into 'main'
Added /bedrockparticle command

See merge request cable-mc/cobblemon!798
2023-11-30 22:50:25 +00:00
Lily 253cfd55d8 Merge remote-tracking branch 'origin/archaeology' into archaeology 2023-11-30 15:27:35 -05:00
apion 7c860d8f91 Fix some of seg's review threads 2023-11-30 12:39:09 -05:00
apion 006e86f3c3 Fix my review threads 2023-11-30 11:37:52 -05:00
JazzMcNade e75d0c564f -onUse for the fossil tube top now redirects to the bottom half of the tube if it's available. (Allows for better client prediction.) 2023-11-29 21:25:10 -06:00
Lily 1e97143a6a poisonous potatoes now subtract from the fuel level because why not 2023-11-29 22:11:37 -05:00
MoeBoy76 91dec859e8 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into battles-unlanguished
# Conflicts:
#	CHANGELOG.md
2023-11-30 11:55:53 +11:00
Apion 85f08c9d28 Merge branch 'regionalise' into 'main'
Regionalise

See merge request cable-mc/cobblemon!800
2023-11-30 00:51:21 +00:00
MoeBoy76 d465f465c8 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into battles-unlanguished
# Conflicts:
#	CHANGELOG.md
2023-11-30 11:43:02 +11:00
MoeBoy76 a87bd35fd6 changelog time 2023-11-30 11:38:39 +11:00
MoeBoy76 0c32da0ce1 added species feature for all regional forms that were missing it 2023-11-30 08:51:54 +11:00
Waterpicker 2bdb110c92 Remove some debug code I missed! 2023-11-29 14:04:20 -06:00
Waterpicker d21f3747fc Add species and aspects to RenderContext 2023-11-29 13:56:53 -06:00
jeffw773 fb303fcd97 - Started basic functionality of Battle menu that can be controlled by WASD or keybinded keys. Still more todo on this, but wanted to make a branch for it now 2023-11-29 11:35:50 -08:00
JazzMcNade 7b4e63001b -Refactored comparator output and Trigger behavior into the multiblock structure.
-Ownership protection now prevents release via a redstone signal.
2023-11-29 01:25:55 -06:00
jeffw773 31b185b96c - Added -endability and -transform handlers 2023-11-28 00:06:52 -08:00
jeffw773 034a51b904 Merge remote-tracking branch 'origin/battles-unlanguished' into battles-unlanguished 2023-11-27 22:12:01 -08:00
jeffw773 9e1c491d9c - Moe said it was okay 2023-11-27 22:11:42 -08:00
jmmcp f695a99705 Added -swapboost langs for Guard Swap, Power Swap, and Heart Swap, as well as -start lang for Tar Shot. 2023-11-28 00:31:13 -05:00
jmmcp a8567f9190 Added check for optional effects in handleStartInstruction to allow for proper handling of moves like Reflect Type. 2023-11-27 23:39:27 -05:00
jmmcp 7d455b2dac Merge remote-tracking branch 'origin/battles-unlanguished' into battles-unlanguished
# Conflicts:
#	common/src/main/resources/assets/cobblemon/lang/en_us.json
2023-11-27 23:10:57 -05:00
jmmcp 1dffbd1b37 Added -start langs for embargo and general typeadd moves. 2023-11-27 23:10:10 -05:00
jeffw773 332e25fa76 Merge remote-tracking branch 'origin/battles-unlanguished' into battles-unlanguished 2023-11-27 20:07:53 -08:00
jeffw773 f080fb5639 - Added Substitute Start Language 2023-11-27 20:07:34 -08:00
jmmcp 769a1862e4 Added -copyboost lang, new copyboost instruction handler, new copy method to ContextManager, silent optional argument check to -clearnegativeboost instruction handler, and tweaked -enditem instruction handler in CobblemonHeldItemManager to allow for cases with null source (example: Fling). 2023-11-27 22:25:54 -05:00
Lily bd4df4485e added nether fire stone ores, and storage blocks for evo stones (need textures) 2023-11-27 21:39:03 -05:00
jmmcp 127c5e7a8b Merge branch 'main' into battles-unlanguished 2023-11-27 19:11:22 -05:00
JazzMcNade 58fba24f01 -Natural materials data is now synced with the client
-Allowed for improved client prediction in onUse()
-Fixed an issue in which a redstone signal into the machine wouldn't work if the machine was loaded in the completed state.
2023-11-27 01:48:36 -06:00
JazzMcNade f49265ae52 -Fixed return items not working with the Fossil Machine 2023-11-26 22:07:39 -06:00
Paul d1a71373c0 Added /bedrockparticle command 2023-11-27 13:26:26 +10:00
Hiroku 77def6de43 Merge branch 'mooshtank_fix_and_shuckle_nerf' into 'main'
Shuckle Berry Nerf + Brown Mooshtank Sus Stew Fix

See merge request cable-mc/cobblemon!792
2023-11-27 01:42:01 +00:00
jmmcp 973c6bb05f Merge remote-tracking branch 'origin/battles-unlanguished' into battles-unlanguished 2023-11-26 19:39:26 -05:00
jmmcp 5b83e49669 Added -start lang for type changing moves Camouflage, Conversion, and Conversion2, as well as -sidestart and -sideend langs for Lucky Chant and Mist. 2023-11-26 19:38:59 -05:00
Hiroku e01bc2eeab Merge branch 'nickname_invalid_format' into '1.4.0'
Resolves a bug in the format in which the nickname is saved in JSON.

See merge request cable-mc/cobblemon!797
2023-11-26 23:19:50 +00:00
Pedro Souza f6f3070b8e changelog 2023-11-26 20:18:37 -03:00
Pedro Souza 0f2301e668 Resolved nickname invalid format bug 2023-11-26 12:24:54 -03:00
jeffw773 80ce5bab58 - Added battle language for powertrick and powershift 2023-11-26 01:25:15 -08:00
Hiroku 8fb678b0f8 Merge branch 'battle_music_enhancements' into 'main'
Add new battle music features

Closes #587

See merge request cable-mc/cobblemon!790
2023-11-26 08:17:45 +00:00
jeffw773 c0a77aca23 - Added battle language for Stockpile 2023-11-26 00:02:37 -08:00
jmmcp e4c0eab8e2 Added -fieldactivate langs for Fairy Lock and Teatime, as well as a new handler for -invertboost instructions. 2023-11-26 00:02:04 -05:00
Hiroku b9ff46e1b2 Merge branch 'sirrfuchs-main-patch-53627' into 'main'
Added canFly true to Yveltal

See merge request cable-mc/cobblemon!796
2023-11-25 21:22:45 +00:00
sirrfuchs 45a998d3d7 Added canFly true to Yveltal 2023-11-25 16:27:57 +00:00
Hiroku a108d85531 Merge branch 'root-burn' into 'main'
Remedy Alternate Cooking

See merge request cable-mc/cobblemon!795
2023-11-25 07:22:27 +00:00
dhi_holo 0fae45f811 Remedy Alternate Cooking
Smokers and Campfires work now
2023-11-25 10:13:19 +10:00
Hiroku 88717d598d Merge branch 'Waldleufer/speciesJsonFixes' into 'main'
small species json fixes

See merge request cable-mc/cobblemon!794
2023-11-24 22:14:28 +00:00
WaldleuferandHiroku 33123b4a33 small species json fixes 2023-11-24 22:14:27 +00:00
JazzMcNade 001864e20c -Added a sound when a pokemon is kicked out of the fossil machine via a redstone signal. 2023-11-24 02:31:27 -06:00
Paul 0c9fe19da3 Merge remote-tracking branch 'origin/main' into scheduling-rework
# Conflicts:
#	CHANGELOG.md
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
2023-11-24 10:04:51 +10:00
Hiroku 74e0915ec8 Merge branch 'SmarterDrops' into 'main'
Corrected some drops, added missing drops to a bunch of base forms and forms.

See merge request cable-mc/cobblemon!789
2023-11-24 00:00:28 +00:00
WaldleuferandHiroku 39cd5e9726 Corrected some drops, added missing drops to a bunch of base forms and forms. 2023-11-24 00:00:28 +00:00
JazzMcNade 28ebd1dec1 The fossil mon rendered inside of the tank now always faces the opposite direction of the tank. 2023-11-23 17:03:18 -06:00
JazzMcNade 94bbc0e574 -Added "smart" hoppering for the fossil compartment. Hoppers can only insert into the compartment of the resulting inventory would be a valid subset of a fossil recipe. 2023-11-23 00:26:32 -06:00
jeffw773 876be2afcf - Brown Mooshtanks give Suspicious Stews like vanilla brown mooshrooms do (plus Pep Up Flower)
- Nerfed Infinite Berry Juice Shuckle
2023-11-22 19:07:39 -08:00
jeffw773 d693f452bc - Fixed Mooshtanks not giving mushroom stew in creative
- Nerfed Shuckle infinite Berry Juice
2023-11-22 15:49:54 -08:00
JazzMcNade 034e7d315c Fixed null pointer exceptions / sync issues from early return in onBreak 2023-11-22 02:39:02 -06:00
jeffw773 fb785b4204 - Hopper only sends fossils to machine when the machine doesn't already have a valid fossil combination inside 2023-11-21 23:18:27 -08:00
jeffw773 ac807ce25b - Hopper only sends fossils to machine when not full or not running 2023-11-21 23:11:06 -08:00
jeffw773 c065f0f8fd - Hoppers now dispense Fossil Items into Microwave of Fossil Machine 2023-11-21 22:42:30 -08:00
jmmcp a1e94b8200 Added -activate langs for eerie spell and crafty shield. 2023-11-22 01:04:11 -05:00
JazzMcNade 9c7d286dd8 -Sending a redstone signal to a tube that has completed the resurrection will cause the fossil pokemon to pop out as a wild pokemon.
-Replaced magic numbers with constants
-Added a bunch of TODOs
2023-11-21 02:00:18 -06:00
jeffw773 69d8e4fab9 - Removed Fossils from Consumable UI list 2023-11-20 21:52:37 -08:00
jeffw773 b788fe3984 - Fixed Skull Fossil lang 2023-11-20 21:08:56 -08:00
apion cfd90fac04 Fixed sherd names 2023-11-20 23:20:44 -05:00
apion 1cf2359195 Bumped ver number and fixed visual formation bug 2023-11-20 23:16:13 -05:00
JazzMcNade 6868d7f26c -Added Comparator output for the monitor of the fossil machine.
-Refactored tube comparator output to use a constant instead of a magic number.
2023-11-20 21:54:52 -06:00
apion 3e58229a89 Fixed another formation issue 2023-11-20 20:56:23 -05:00
apion d76f1524bd Added sherd items and a creative tab for archeology. 2023-11-20 06:44:18 -05:00
apion 58b5eb155d Fixed sounds and hoppers putting material in to finished machines 2023-11-20 04:07:32 -05:00
JazzMcNade fd9caa537b Added Comparator output for the tube 2023-11-20 02:52:44 -06:00
apion 5262972a8d Start working on hopper for tubes 2023-11-20 03:39:30 -05:00
apion 011a095314 Dumb style thing 2023-11-20 01:13:08 -05:00
apion 3520c50541 Fixed issue where adjacent machines didn't form properly 2023-11-20 01:01:39 -05:00
Paul 3eccac861f Migrated regular pose transitioning over to being a primary animation 2023-11-20 15:24:34 +10:00
Paul 7a85b0b690 Fixed dedicated transition animations not resetting the primary animation portion 2023-11-20 14:49:28 +10:00
jeffw773 ff3aa5d782 - Apricorns now work as organic material 2023-11-19 19:34:13 -08:00
Segfault Guy 8b4552a532 Unique wild encounter themes. 2023-11-19 22:33:26 -05:00
Segfault Guy 41673ba90f Battle music for spectators. 2023-11-19 22:33:26 -05:00
Segfault Guy 18f9942dc6 BattleStartedEvent rework and battle music override support. 2023-11-19 22:33:23 -05:00
Segfault Guy 875fe46d21 Player specific battle themes. 2023-11-19 22:32:42 -05:00
Segfault Guy 66c6f9bdd1 BattleMusicHandler upgrades and bug fixes. 2023-11-19 22:32:04 -05:00
jeffw773 9e6dec8605 - Fossil pokemon will become wild pokemon if the machine is broken when the machine is done running. 2023-11-19 18:29:19 -08:00
Paul 1fe223c772 Comments are good 2023-11-20 11:57:46 +10:00
Paul d89ccc110e Merge remote-tracking branch 'origin/main' into improved-transformed-parts 2023-11-20 11:57:40 +10:00
Paul 72c337195a Added the concept of a primary animation 2023-11-20 11:54:35 +10:00
Hiroku b72af84c8c Merge branch 'tooltip-fix' into 'main'
Tooltip fix

See merge request cable-mc/cobblemon!788
2023-11-20 00:32:18 +00:00
miasmus a5ee270b8b account for tooltips with only 1 element 2023-11-19 19:00:05 -05:00
miasmus c08ef4247d doing it this way cause the other way was bad 2023-11-19 18:24:47 -05:00
jmmcp 9424bafabb Merge remote-tracking branch 'origin/battles-unlanguished' into battles-unlanguished 2023-11-19 18:21:02 -05:00
jmmcp a96ecfcdf2 Added -fail instructions for Burn Up and Double Shock, as well as lang for healing moves and weight based moves against Dynamaxed mons failing 2023-11-19 18:20:07 -05:00
Hiroku b1d11e8c22 Merge branch 'HOLDY2' into 'main'
Fixed some minor errors in the newly added dropps

See merge request cable-mc/cobblemon!787
2023-11-19 22:05:02 +00:00
WaldleuferandHiroku c1fb1379a9 Fixed some minor errors in the newly added dropps 2023-11-19 22:05:02 +00:00
Hiroku 5a220e0ef0 Merge branch 'implement_pokemon' into 'main'
Implemented Drifloon line and minor asset updates.

See merge request cable-mc/cobblemon!786
2023-11-19 22:01:03 +00:00
Hiroku b379fc62b1 Merge branch 'Waldleufer/cry_checker_script' into 'main'
cry audio checker script

See merge request cable-mc/cobblemon!785
2023-11-19 21:55:53 +00:00
WaldleuferandHiroku d442e4e956 cry audio checker script 2023-11-19 21:55:53 +00:00
Tyzillion bb22c22db9 added "implemented": true to the species.json for the new Pokemon implemented. 2023-11-19 10:33:58 -05:00
JazzMcNade 09bc174401 Added code to display enditem.incinerate's message when it occurs. 2023-11-19 04:26:13 -06:00
Tyzillion e109a1d59f Implemented Drifloon line, Updated Dodrio textures, updated aegislash_shiny texture, Updated models for Geodude line. Added emissives for Noctowl. 2023-11-18 22:12:23 -05:00
jmmcp 3b97a0c847 Added -activate langs for Skill Swap and Wide Guard, -enditem langs for Corrosive Gas and Bug Bite, -fail lang for Aura Wheel, and allow for effectID to pass through as null in handle fail instruction for fails that don't have an effect, such as Baton Pass and Bide. 2023-11-18 16:02:58 -05:00
jeffw773 28a2ec3fc0 - Fossil pokemon and tank fluid now get removed from the tanks when player takes pokemon out with the pokeball 2023-11-18 10:11:48 -08:00
apion 72bba7fdfd Allowed for use of tags for natural materials 2023-11-18 06:19:08 -05:00
apion a258e48582 Pokemon now stay suspended in the tank when it finishes 2023-11-18 02:58:56 -05:00
apion 21a15686b2 Added full tube texture 2023-11-18 02:26:11 -05:00
jeffw773 5da7183ae3 - Fossils can be placed and removed from the Fossil Machine with an empty hand now 2023-11-17 23:04:10 -08:00
apion d847972bb1 Fixed issue where you couldn't form a multiblock from previously formed blocks, also fixed the no block update when fossils are inserted 2023-11-18 01:06:45 -05:00
jeffw773 5e88e73e3f - Fossil machine drops the fossils that are in the machine if the machine hasn't started yet 2023-11-17 21:48:02 -08:00
JazzMcNade 87e8fcd7f7 Added -end lang for Healblock and Skydrop. Added -fail for Skydrop 2023-11-17 22:47:41 -06:00
Hiroku b34f8a045d Merge branch 'null-safety-time' into 'main'
Fix to NullPointerException in PokemonOnShoulderHandler

Closes #677

See merge request cable-mc/cobblemon!783
2023-11-18 04:26:38 +00:00
jeffw773 e9086ec2bd - Prevented Fossil Tank from being overfilled which caused a crash and corrupted the world save 2023-11-17 20:00:07 -08:00
Paul 866db464c4 Merge remote-tracking branch 'origin/main' into improved-transformed-parts
# Conflicts:
#	CHANGELOG.md
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/BeldumModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
2023-11-18 13:40:36 +10:00
JPAKx4 4f79b9f8a7 Fix to https://gitlab.com/cable-mc/cobblemon/-/issues/677 2023-11-17 21:30:49 -06:00
JazzMcNade d1b651a876 Added -activate langs for Grudge, Speedswap and Switcheroo. 2023-11-17 21:13:55 -06:00
Hiroku b30a67651e Merge branch 'VillagerCropInteractionFix' into 'main'
Fix for villagers not being able to pick and plant mint seeds, vivichoke seeds...

Closes #647

See merge request cable-mc/cobblemon!760
2023-11-18 01:43:10 +00:00
JazzMcNade a1398e9495 Fixed capitalization. 2023-11-17 19:22:42 -06:00
jmmcp ca319764f0 Added -activate langs for Ingrain, Mist, Poltergeist, Powder, Quash, Quick Guard, Safeguard, and Sketch. 2023-11-17 19:00:12 -05:00
Hiroku ac03c68f41 Merge branch 'defaultIssueTemplate' into 'main'
Added a default Issue Template

See merge request cable-mc/cobblemon!769
2023-11-17 22:16:35 +00:00
Nick 0eb4b43b49 Merge branch 'updated-showdown' into 'main'
Updated Showdown version to latest master from Smogon

Closes #542

See merge request cable-mc/cobblemon!764
2023-11-17 21:18:05 +00:00
HirokuandNick b49376dba5 Updated Showdown version to latest master from Smogon 2023-11-17 21:18:03 +00:00
Nick 81f6e7b786 Merge branch 'shuckle_milk' into 'main'
Added ability for Shuckles to be milked for Berry Juice

See merge request cable-mc/cobblemon!770
2023-11-17 21:17:28 +00:00
Plastered_CrabandNick 574ee1ae4a Added ability for Shuckles to be milked for Berry Juice 2023-11-17 21:17:27 +00:00
Nick 07a83f54a2 Merge branch 'HOLDY-lite' into 'main'
It's holding time

See merge request cable-mc/cobblemon!777
2023-11-17 19:41:59 +00:00
JordanandNick 6f3b530d7b It's holding time 2023-11-17 19:41:59 +00:00
Nick 4b86dc1e58 Merge branch 'ability-optional-arguments' into 'main'
Implement method to properly handle showdown ability instructions with optional arguments.

Closes #499

See merge request cable-mc/cobblemon!778
2023-11-17 19:30:45 +00:00
JMMCPandNick bb141aee50 Implement method to properly handle showdown ability instructions with optional arguments. 2023-11-17 19:30:45 +00:00
Nick acb473c01f Merge branch 'Waldleufer/fixUndergroundSpawningAlgorithm' into 'main'
Underground Spawning Algorithm Improvements

See merge request cable-mc/cobblemon!737
2023-11-17 18:37:02 +00:00
WaldleuferandNick a8dc3f40a4 Underground Spawning Algorithm Improvements 2023-11-17 18:37:02 +00:00
Nick b55f11628d Merge branch 'Waldleufer/spawnSpreadsheetToCodeAutomation' into 'main'
Validated and corrected all Spawnfiles

See merge request cable-mc/cobblemon!755
2023-11-17 18:27:17 +00:00
WaldleuferandNick 150c03d4f5 Validated and corrected all Spawnfiles 2023-11-17 18:27:17 +00:00
Nick 1c092588f4 Merge branch 'HealingWishUnfaintPostBattleFix' into 'main'
HealingWishUnfaintPostBattleFix

See merge request cable-mc/cobblemon!779
2023-11-17 18:19:11 +00:00
JazzMcNade 683473c34c - Added activate.electricterrain 2023-11-17 02:43:36 -06:00
jeffw773 c7dee1bd53 - Added some more -start flags 2023-11-16 23:00:03 -08:00
jeffw773 d83a1086d3 - Added start.futuresight 2023-11-16 22:17:35 -08:00
Hiroku b34ca3d42b Merge branch 'HealthBarUpdateOnDamageFix' into 'main'
Fix for health bars not updating when a pokemon takes damage from commit 132a43c5

See merge request cable-mc/cobblemon!775
2023-11-17 05:04:34 +00:00
MoeBoy76 3a1389d719 start of missing battle messages 2023-11-17 10:18:44 +11:00
Hiroku e608dc84ae Merge branch 'mongodb-timestamp' into 'main'
Added timestamp to MongoDB store to signify when the save was created.

See merge request cable-mc/cobblemon!781
2023-11-16 14:49:52 +00:00
navneetset c987a5ba19 Added timestamp to MongoDB store to signify when the save was created. 2023-11-16 14:08:18 +01:00
apion 3dbcc2d28c Moved a bunch of stuff into the MultiblockStructure and out of the individual blockentities. Hopefully helps with the synchronization issues. 2023-11-16 06:41:38 -05:00
Hiroku d65090ce10 Merge branch 'main' into 'main'
Issue #699 - Fixed typo in Coba Berry tooltip.

See merge request cable-mc/cobblemon!780
2023-11-16 11:09:45 +00:00
Michael 206ec25a99 Issue #699 - Fixed typo in Coba Berry tooltip. 2023-11-16 03:22:47 -05:00
JazzMcNade ccd376c055 Refactoring 2023-11-14 22:19:40 -06:00
Lily b8e95bd210 Merge remote-tracking branch 'origin/archaeology' into archaeology 2023-11-13 16:45:57 -05:00
Lily b14465f2a1 advancements and recipe unlocks and so forth 2023-11-13 16:45:45 -05:00
JazzMcNade 6214fb1b97 The handleDamageInstruction inner dispatch is now placed at the head of the queue to make sure it stays ahead of the handleFaintInstruction dispatch. 2023-11-13 01:13:27 -06:00
JazzMcNade a65cee3e24 Fix for health bars not updating when a pokemon takes damage from commit 132a43c5 2023-11-13 00:51:50 -06:00
Waldleufer 1a0135c1fd Added a feature request issue template. 2023-11-12 10:25:44 +01:00
Waldleufer 23dab6546f Added requested changes 2023-11-12 10:25:16 +01:00
jmmcp 2a60048f7e Remove unnecessary test injection. 2023-11-11 23:46:01 -05:00
Waldleufer b4787b8db8 Added a default Issue Template 2023-11-11 19:44:02 +01:00
Paul eefc125f24 Changelog to confirm fix for pokeballs being locked open sometimes 2023-11-11 09:57:08 +10:00
Paul f95f17d0c6 Merge remote-tracking branch 'origin/main' into improved-transformed-parts 2023-11-11 09:46:52 +10:00
Paul ba7e98e95c Migrated more things to contained schedulers and handle animation duration more directly 2023-11-11 08:59:03 +10:00
Hiroku cdcc071ce0 Merge branch 'main' into 'VillagerCropInteractionFix'
# Conflicts:
#   CHANGELOG.md
2023-11-10 22:51:44 +00:00
Lily 02067929a2 add advancement for obtaining a fossil item 2023-11-10 18:46:31 +00:00
Lily 0bc3e8465b finish list of fossil machine fuels 2023-11-10 18:37:01 +00:00
Lily 0ebf5712b9 add item tag for fossil items 2023-11-10 16:04:02 +00:00
Lily 4020e28da9 add recipes to fossil machine blocks 2023-11-10 15:37:13 +00:00
Lily dbc074bfde Update protected message to show on action bar 2023-11-09 23:47:04 -05:00
Lily 17cdedf65f Rename ResurrectionMachineMultiblockBuilder to FossilMultiblockBuilder for consistency 2023-11-09 23:46:28 -05:00
Paul f96766505b Merge remote-tracking branch 'origin/scheduling-rework' into improved-transformed-parts
# Conflicts:
#	CHANGELOG.md
2023-11-10 14:32:44 +10:00
Paul fe96642be4 Conflict resolution 2023-11-10 14:31:53 +10:00
Lily 701af6cd8f Fix conflicting imports 2023-11-09 23:14:45 -05:00
Paul 5515fbfeda Merge remote-tracking branch 'origin/main' into improved-transformed-parts
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/GolbatModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/ZubatModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/CrobatModel.kt
2023-11-10 14:11:09 +10:00
Lily 41a0dce7fc Merge remote-tracking branch 'origin/main' into archaeology
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonBlockEntities.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
#	fabric/src/main/kotlin/com/cobblemon/mod/fabric/CobblemonFabric.kt
2023-11-09 23:07:30 -05:00
Lily 3b122b7bcc Add fossils to the creative inventory 2023-11-09 22:36:39 -05:00
Lily 2b3500dfc3 Add a sound for retrieving a fossil from the fossil machine 2023-11-09 22:05:32 -05:00
Lily e921253a57 Added the missing fossil jsons 2023-11-09 21:53:05 -05:00
Lily da45797022 Added a 5-minute protection period where only the player who input the fossil can claim the resulting Pokemon 2023-11-09 21:34:46 -05:00
Lily fc1f68711d Added more sounds to the fossil machine, and added a visual when done growing 2023-11-09 20:57:29 -05:00
Lily da9c1f440c Added sounds to the fossil machine 2023-11-09 19:48:26 -05:00
Paul ae10ca9541 Rebuilt scheduling mechanism to be better contained and avoid side issues 2023-11-10 08:48:13 +10:00
Lily 80d2f76dfc Merge remote-tracking branch 'origin/archaeology' into archaeology 2023-11-09 17:38:20 -05:00
Lily ebf3c9b82f Changed NaturalMaterial into a data class. Added a returnItem parameter for returning leftovers after using an item as fuel (e.g. a bowl when using mushroom stew) 2023-11-09 17:38:05 -05:00
Lily af57ac45a2 Added list of cobblemon items that can be used as fuel for the fossil machine. Also moved mint seeds to their own tag. 2023-11-09 17:35:37 -05:00
amo 0ad45df8f5 white glow happens but its buggy 2023-11-08 18:13:45 +00:00
JazzMcNade 1c25ae69a5 Fix for villagers not being able to pick and plant mint seeds, vivichoke seeds and revival herbs. Closes #647 2023-11-08 03:05:03 -06:00
Paul 7f464f2e3e Changelogfor prior change 2023-11-06 09:39:29 +10:00
Paul d8e209e4a2 Rebuilt transformed model parts, pose transitions are now smoother and interpolate active idle animations 2023-11-06 09:38:43 +10:00
Paul 41a87d0c8a Added baby fossil Pokémon rendering in the resurrection tube 2023-10-30 20:11:59 +10:00
Paul 45faed038f Merge remote-tracking branch 'origin/main' into archaeology 2023-10-30 17:06:19 +10:00
Deltric 30a78f978d textures didn't commit? 2023-10-23 20:22:21 -05:00
Deltric d8c1d50aa5 Progress on fossils 2023-10-23 20:20:17 -05:00
amo 03f377cf0a white glow happens but its buggy 2023-10-22 21:06:03 +01:00
Deltric eb7bf65e02 I probably missed this during rebase 2023-10-21 14:19:18 -05:00
amo 373092f572 interact gui upgrades 2023-10-21 19:55:13 +01:00
Deltric c7d3164ff4 Merge branch 'sus-archaeology' into archaeology
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
#	fabric/src/main/kotlin/com/cobblemon/mod/fabric/CobblemonFabric.kt
2023-10-21 13:44:00 -05:00
Paul e6da43be6d Merge remote-tracking branch 'origin/main' into spawn-rules
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/api/pokemon/PokemonProperties.kt
2023-10-21 12:59:57 +10:00
Paul 8bfc0fefaf Improvements to evolution effect 2023-10-21 08:13:56 +10:00
amo 4e44807523 new throwout sounds & timings 2023-10-20 19:02:55 +01:00
Paul 36251fea75 Merge remote-tracking branch 'origin/main' into evolution-effect
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/Cobblemon.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/LocatorAccess.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/PoseableEntityModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/command/TestCommand.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/net/messages/client/spawn/SpawnPokemonPacket.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/pokemon/Species.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/util/MoLangExtensions.kt
#	common/src/main/resources/assets/cobblemon/particles/snowstorm.json
#	deps/local/com/bedrockk/molang/1.1.5/molang-1.1.5.pom
2023-10-20 19:28:23 +10:00
amo 06206a7447 pokeball anim 2023-10-20 06:37:09 +01:00
amo 66e901f88d sync pokeball 2023-10-19 17:08:53 +01:00
amo 05f089d390 attempt to fix particle materials but fabric fucking sucks 2023-10-19 17:01:05 +01:00
Paul f52345036d Changelog again 2023-10-19 20:44:43 +10:00
Paul bd99ff2bfd Changelog 2023-10-19 20:38:21 +10:00
Paul 19510ca8ba Merge remote-tracking branch 'origin/main' into tracked-data-cleanup 2023-10-19 20:37:30 +10:00
amo 23df8f70cf testing 2023-10-19 02:39:48 +01:00
amo bd25e8682a Merge remote-tracking branch 'origin/tracked-data-cleanup' into amo/balls
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/client/entity/PokemonClientDelegate.kt
2023-10-18 13:16:01 +01:00
Paul 0ece90bcf1 Reworked our use of data trackers to be more like vanilla (maybe no T-pose anymore?), added battle ID to spawn packet so battle poses always work 2023-10-17 21:53:31 +10:00
amo 906cd54c98 initial mockup 2023-10-17 03:15:06 +01:00
MoeBoy76 c2894b4bf1 Fix mixin double up 2023-10-09 09:53:09 +11:00
MoeBoy76 8c3958cdf0 Update from main and added fossil structures from Slippy 2023-10-09 09:42:47 +11:00
MoeBoy76 92cb847755 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into sus-archaeology
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
2023-10-09 09:15:05 +11:00
Paul fc4fed42b5 Added (most of) a spawn rule system for datapacking spawning systems 2023-10-02 15:26:37 +10:00
MoeBoy76 ea332515c4 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into sus-archaeology
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonBlockEntities.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonItems.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/CobblemonClient.kt
#	common/src/main/resources/mixins.cobblemon-common.json
2023-09-05 12:45:53 +10:00
MoeBoy76 49965d6856 fossil structures from build team 2023-09-05 12:42:11 +10:00
Paul a1897f69ca Improved generic bedrock entity initializing and evolution entity handling so it crashes fewer times 2023-09-01 16:39:48 +10:00
Paul a88700969d Fixed positioning of generic bedrock entities and particle locator matrices 2023-09-01 16:39:05 +10:00
Paul 91eb9e597e Improved scaling of evolution particles 2023-09-01 16:38:19 +10:00
Paul e762542e49 Merge branch 'main' into evolution-effect
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/PoseableEntityModel.kt
2023-09-01 09:02:33 +10:00
apion 6e7694d650 Move some multiblock stuff into api, add licenses 2023-08-28 19:28:12 -04:00
apion a301779a42 Hopefully finalized system for synchronizing multiblocks 2023-08-28 17:14:20 -04:00
apion 440a07d1de Fixed synchronization issue 2023-08-28 15:24:57 -04:00
Paul b3e5734f39 Merge remote-tracking branch 'origin/main' into evolution-effect
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/client/particle/ParticleStorm.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/bedrock/animation/BedrockAnimation.kt
2023-08-28 18:35:09 +10:00
apion fc7951cbcd Changed multiblock formation logic to use VoxelShape instead of Box, fix some misc rendering issues with the fossil block 2023-08-27 23:29:02 -04:00
jmmcp 2d5296288f Cleaned up evolution code 2023-08-27 22:55:28 -04:00
apion 44b58ab9a0 Added the connecting bit to the fossil tube 2023-08-27 18:31:10 -04:00
jmmcp cab3f2bf38 Adjusted timing of evolution when outside poke ball 2023-08-27 17:47:54 -04:00
apion d24a6fa75c Added monitor animation 2023-08-27 16:40:16 -04:00
apion fca867a8b8 Asset organization stuff 2023-08-27 15:37:33 -04:00
apion 9514c48eaa Add staged filling to the fossil tube 2023-08-27 11:42:45 -04:00
Paul 31efdc4254 Made evolution particle appropriately scale with entity size 2023-08-27 15:15:35 +10:00
Paul 34aace8a1b Fixed compile errors 2023-08-27 14:21:52 +10:00
Paul a877ad5a69 Merge branch 'berry' into evolution-effect
# Conflicts:
#	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/VaryingModelRepository.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/util/MoLangExtensions.kt
2023-08-27 14:11:55 +10:00
Paul 5a8c090055 Merge branch 'main' into evolution-effect
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/util/MoLangExtensions.kt
2023-08-27 14:10:10 +10:00
jmmcp 98ccf39728 Progress towards implementing evolution effects when evolved outside a poke ball 2023-08-27 00:04:46 -04:00
apion d029b4380a Separate some textures/models 2023-08-26 19:58:55 -04:00
apion 4c29c9726b Fix some desync stuff 2023-08-26 16:33:35 -04:00
apion af9fff9793 Added a system for forcing models to be baked, more progress on rendering fossil tube 2023-08-26 14:25:08 -04:00
apion a8d84c4a28 More messing with animations 2023-08-25 19:45:33 -04:00
apion 5215388e33 Start working on adding the animations to the fossil blocks 2023-08-25 15:51:19 -04:00
apion 93c7685ef7 Added loading/saving of multiblock structures 2023-08-25 11:04:13 -04:00
apion 5c395a1987 Added fossil tube animations 2023-08-24 19:24:23 -04:00
apion 755d367760 Added break functionality to multiblocks, fixed a few issues 2023-08-24 16:18:46 -04:00
apion 3b26d24958 Add the actual functionality of the fossil machine multiblock. Can now insert organic material 2023-08-24 15:13:55 -04:00
apion 27afe40892 Add the fossil tube to the resurrection machine multiblock 2023-08-24 12:48:24 -04:00
apion fcd4dccdad Split resurrection machine into three blocks, add a system for multiblock structure formation (this is pretty freaking cool) 2023-08-24 12:19:08 -04:00
apion 35e206a5d6 Implemented the insertion of organic material into the resurrection machine and data-driven organic material values 2023-08-24 07:10:32 -04:00
apion b51d007341 Start working on resurrection machine 2023-08-23 19:59:19 -04:00
jmmcp a85fd79818 Experimenting with the proper function to add to pre-existing archaeology loot tables. 2023-08-21 17:19:09 -04:00
Paul 3222e2ebca Fixed crash with generic bedrock entities + updated evolve sound for timing 2023-07-18 19:20:52 +10:00
Paul ba89ed1574 Merge remote-tracking branch 'origin/main' into evolution-effect 2023-07-17 19:02:28 +10:00
Paul 68ab953644 Heaps of fixes for particle engine 2023-07-17 19:02:13 +10:00
Paul 4d3030e20e Merge stuff 2023-07-15 18:37:47 +10:00
JosephBedsole 2e324e65a1 Added a fallback locator for particle animations 2023-07-08 07:47:02 -05:00
Paul a34b7481f5 Updated explanation of look_at_direction camera mode [skip-ci] 2023-06-30 09:46:53 +10:00
Paul d2a3905b03 Fixed look_at_direction camera mode for particles 2023-06-29 22:02:38 +10:00
Paul 16b3d76504 Gotten closer to fixing look_at_direction camera mode 2023-06-16 10:55:00 +10:00
Paul 363fe76dd1 Merge remote-tracking branch 'origin/main' into evolution-effect
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonNetwork.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/command/TestCommand.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/util/DataKeys.kt
2023-06-11 21:58:45 +10:00
Paul 040a29f66e Added generic bedrock entity system, updated molang for fix, added test evo effect, and fixed some particle issues 2023-05-28 06:39:55 +10:00
3626 changed files with 85297 additions and 11571 deletions
+1
View File
@@ -33,3 +33,4 @@ common/src/main/resources/assets/cobblemon/showdown
# Generated files
*/generated/resources/*
/fabric/src/generated/resources/cobblemon-common.accesswidener
/.ignored/
+30
View File
@@ -0,0 +1,30 @@
<!-- 1. START HERE: (Before filling all this out, please quickly go to the list of all issues: (https://gitlab.com/cable-mc/cobblemon/-/issues/?sort=created_date&state=all) and do a quick search to see if your issue has already been reported. If it has, please add a comment to the existing issue instead of creating a new one.)-->
<!-- 2. If the issue was not already reported, please fill out the following template. -->
<!-- 3. If you do not know something, don't worry! Just fill out as much as you can to make sure the issue can get fixed asap. -->
## Summary
(Please summarize the bug encountered concisely)
## Steps to reproduce
(How one can reproduce the issue - this is very important)
## What is the current bug behavior?
(What actually happens)
## What is the expected correct behavior?
(What you should see instead)
## Cobblemon Version and Mod Loader
(Are you using Forge or Fabric? And what version of Cobblemon are you using?)
## Mods used besides Cobblemon
(Did you have any other mods installed besides Cobblemon? If so, please list them here)
## Relevant logs, screenshots and/or videos
(Paste any relevant logs - use code blocks (```) at the start and end to format console output, logs, and code, as
it's very hard to read otherwise. Or just put a link here)
## Additional Information
(If you can, link to the line of code that might be responsible for the problem, or any other info that might be useful)
/label ~bug
@@ -0,0 +1,31 @@
<!-- 1. START HERE: (Before filling all this out, please quickly go to the list of all issues: (https://gitlab.com/cable-mc/cobblemon/-/issues/?sort=created_date&state=all) and do a quick search to see if your feature was already requested. If it is, please add a comment to the existing issue instead of creating a new one.)-->
<!-- 2. If the feature request was not already reported, please fill out the following template. -->
<!-- 3. If you do not know something, don't worry! Just fill out as much as you can. -->
<!-- 4. The more info you provide here, the greater the chance of it being considered by the Design team. -->
## Summary
(Please summarize your feature request concisely)
## What are the projected benefits of this feature?
- (List)
- (benefits)
- (here)
## What could speak against this feature?
- (List)
- (possible)
- (cons)
## Why do you think the benefits outweigh the cons?
(Explain why you think the benefits outweigh the cons)
## Mods involved besides Cobblemon
(Does your suggestion require any other mods besides Cobblemon? If so, please list them here)
## Sketches, screenshots and/or videos
(Feel free to add any sketches, screenshots or videos that might help the Design team understand your suggestion)
## Additional Information
(Is there anything else you would like to add?)
/label ~feature ~suggestion ~needs-design
+197 -59
View File
@@ -1,68 +1,172 @@
# Changelog
## [1.4.1](#1-4-1)
## [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.
- Added the Data Monitor, Fossil Compartment, and Restoration Tank. Placed in the correct formation, you can use these to create a Restoration Machine where you can bring fossils back to life.
- Added 3 variants of Tumblestones, which can be planted near Lava or Magma to grow harvestable Tumblestone Clusters.
- Added Tumblestone Blocks, a storage block crafted from 9 Tumblestones.
- Added Ancient Poké Balls, which are aesthetic variants crafted from Tumblestones.
- Added the Ancient Feather, Wing, and Jet Balls, which fly further than regular Poké Balls.
- Added the Ancient Heavy, Leaden, and Gigaton Balls, which are heavier and don't fly as far as regular Poké Balls. These will receive more functionality in a future update.
- Added Original Trainer functionality. To edit the OT through commands, you must specify originaltrainertype=<Player/NPC>, and originaltrainer=<Username or UUID/NPC Name>
- Added support for planting Apricorn trees, berries, and mints in [Botany Pots](https://modrinth.com/mod/botany-pots)
- 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 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.
- 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.
### Changes
- Slightly lowered the volume of all cries
- Updated Pokeball animations and model.
- Turtwig can now be put on shoulder.
- Updated Zubat line model, texture, and animations.
- Added animations for Hitmontop, Tyrogue, and Mightyena.
- Tweaked animations for Dusknoir, Ratatta, Bewear, Exeggutor, and Alolan Exeggutor.
- Sized Kantonian Exeggutor down. Still big but not TOO BIG.
- Tweaked cries for Pikachu, Raichu and Alolan Raichu.
- Pasture blocks will now also connect their bottom left and right sides to walls, iron bars, glass panes and any other modded block that follows the same connection rules.
- The config option `consumeHeldItems` has been removed, please see the Datapack & Resourcepack Creators for instructions on the updated method.
- Using Potions, Status Heals, Ethers, and Antidotes will now return a glass bottle
- Using a Remedy, Fine Remedy, or Superb Remedy will no longer lower friendship with a Pokémon
- The Healing Machine now has a more difficult recipe, placing it later game.
- Heal Powder can now be composted with a 75% chance of adding a layer
- Mental, Power, White, and Mirror Herbs can now be composted with a 100% chance of adding a layer.
- Added emissive to Hoothoot.
- Mining Evolution Stone Ores with a Fortune pickaxe will now increase the amount of items recieved
- Black Augurite can now be used to craft stone axes and obsidian.
- Using Experience Candies brings up the Party Pokémon Select screen when not targeting a Pokémon.
- Added tab completion for statuses to commands
### Additions
- Added battle spectating, can disable in config
- Cobblemon now has compatibility with [Adorn](https://modrinth.com/mod/adorn) allowing you to craft Apricorn wood furniture.
- Berries can now be used in recipes from [Farmer's Delight](https://modrinth.com/mod/farmers-delight) and [Farmer's Delight (Fabric)](https://modrinth.com/mod/farmers-delight-fabric), as well as any other mods using the same berry tags.
- The nature of cobblemon will now be displayed italicized when a mint has been applied. Hovering over the nature will display the mint that was applied. This is the intended behaviour, because the original nature and taste of the Cobblemon does not change when a mint is applied.
- Giving Pokémon items now plays a sound
- A boat, sign and hanging sign is now craftable with Apricorn wood. The recipes are the same shape as Minecraft's equivalent with Apricorn planks as replacements.
- Added the Cleanse Tag held item.
- Added the Inferno, Void, and Forsaken patterns for Vivillon. These can be obtained by evolving a Spewpa in the Nether, End, or Deep Dark respectively.
- Added the Litwick line.
- Bees can now be fed using Pep-Up Flowers.
- Mooshtank can now be milked with a bowl for Mushroom Stew.
- Added cries to Beldum, Metang and Metagross.
- Pokémon now transition more smoothly between different poses.
- 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.
- You can now punch grown apricorns to harvest them.
- Renamed the "Vivillionaire" advancement to "Aspiring Vivillionaire"
- Removed the Inferno, Forsaken, Poké Ball, and Void patterns from the Aspiring Vivillionaire advancement.
- Updated movesets to add Gen 9 DLC moves.
- 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.
### Fixes
- Fixed various stone related blocks not being valid for Big Roots to spread on the Fabric version.
- 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.
- Fixed battle lang for Poison Touch Ability
- Fixed Cubone not being able to evolve into Alolan Marowak.
- Fixed Squawkabilly forms not being recognized.
- Fixed the bounce animation for Poké Balls being delayed by like, a full second.
- Note blocks now play the correct sound on the Apricorn Plank based blocks.
- Fixed an issue with transformed parts in posers causing whacky positional issues.
- Fixed Poké Balls freezing in an open state if you look away when it's meant to close.
- Adds a translation string name to the Empty Pokeball entity.
- Fixed very many issues with Bedrock particle effects.
### Developer
- Significantly changed the way properties in PokemonEntity work. This could break some plugins (not in a big way, but changes will be needed).
- Rebuilt the scheduling API to more clearly force side choices and temporal frames of reference for tasks.
- Added dialogue API and data registry.
- Opened up the ItemDropEntry class to allow for it to be extended.
- Added a new "advancement" evolution variant that takes an advancement identifier and succeeds if the player has the advancement.
- Made spawning API capable of non-entity spawning
- 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.
### Datapack & Resourcepack Creators
- The maximum amount of fossils that can fit in the Fossil Analyzer can be adjusted in the config.
- Custom fossils can be defined using a list of items and the resulting Pokémon. An example of `aerodactyl.json`:
```JSON
{
"result": "aerodactyl",
"fossils": [
"cobblemon:old_amber_fossil"
]
}
```
- Fetus models can be defined in `bedrock/fossils`.
- Fetus textures can be defined in `textures/fossils`.
- Fuel for the Restoration Machine is registered inside the `natural_materials` folder. To register more fuels, create a JSON file containing an array of objects. Each object supports the following fields:
- `content`: Integer containing the amount of fuel to add.
- `item` OR `tag`: Identifier of the item or item tag to be inserted.
- `returnItem`: Identifier of an item to return to the player after consumption.
- Added 3 new item tags: `ancient_poke_balls`, `fossils`, and `tumblestones`.
- Added a spawn rules system to modify general spawning behaviour, see the [wiki](https://wiki.cobblemon.com/index.php/Spawn_Rules) for more information.
- Added dialogue datapack folder and /opendialogue command.
- Added the item tag ``cobblemon:held/leaves_leftovers`` this can be used to flag apple-like items that can create leftovers when eaten.
- You can now add support for dynamic lighting implementations, Cobblemon ships with a default implementation for [LambDynamicLights](https://modrinth.com/mod/lambdynamiclights) and the [Dynamic Lights Reforged](https://www.curseforge.com/minecraft/mc-mods/dynamiclights-reforged), add the following to any species or form:
```JSON
{
"lightingData": {
"lightLevel": 14,
"_lightLevelCommentRemoveMe": "Above supports 0 to 15",
"liquidGlowMode": "LAND",
"_liquidGlowModeCommentRemoveMe": "Above supports LAND, UNDERWATER or BOTH"
}
}
```
- 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.
## [1.4.1 (December 23rd, 2023)](#1-4-1)
### Additions
- Added battle spectating. Press R on a player in a battle and you can spectate and bully them for their tactics.
- Added the Litwick and Drifloon lines.
- Cobblemon now has compatibility with [Adorn](https://modrinth.com/mod/adorn), allowing you to craft Apricorn wood furniture.
- Berries can now be used in recipes from [Farmer's Delight](https://modrinth.com/mod/farmers-delight) and [Farmer's Delight (Fabric)](https://modrinth.com/mod/farmers-delight-fabric), as well as any other mods using the same berry tags.
- Boats, signs and hanging signs are now craftable with Apricorn wood.
- Added the Fairy Feather, Iron Ball, Cleanse Tag, Flame Orb, Life Orb, Smoke Ball, and Toxic Orb held items.
- Added the Inferno, Void, and Forsaken patterns for Vivillon. These can be obtained by evolving a Spewpa in the Nether, End, or Deep Dark respectively.
- Bees can now be fed using Pep-Up Flowers.
- Mooshtank can now be milked with a bowl for Mushroom Stew.
- Updated Showdown version to use generation 9 battle data.
- Added cries to Beldum, Metang and Metagross.
- Added a /bedrockparticle command to run Snowstorm-format particle effects.
- Added data for Dipplin, Fezandipiti, Munkidori, Ogerpon, Okidogi, Poltchageist and Sinistcha.
- Added additional nickname trigger "Grumm" for Inkay's evolution.
### Changes
- Using Potions, Status Heals, Ethers, and Antidotes will now return a glass bottle
- Using a Remedy, Fine Remedy, or Superb Remedy will no longer lower friendship with a Pokémon.
- The Healing Machine now has a [much more difficult recipe](https://wiki.cobblemon.com/index.php/Healing_Machine), placing it later game.
- Made the EXP. Share recipe cheaper.
- Turtwig can now be put on your shoulder.
- Updated Zubat line model, texture, and animations.
- Updated Geodude line models and textures.
- Added animations for Hitmontop, Tyrogue, and Mightyena.
- Tweaked animations for Dusknoir, Ratatta, Bewear, Exeggutor, and Alolan Exeggutor.
- Sized Kantonian Exeggutor down. Still big, but not TOO big.
- Tweaked cries for Pikachu, Raichu and Alolan Raichu.
- Fixed Swimming behaviors for Wimpod line, Oshawott line, Quaxly line, and Clodsire
- Changed the way level scaling works in spawning. By default, anything with a spawn range of up to 5 either side of the party highest level and everything else will spawn per its specified ranges.
- The nature of Pokémon will now be displayed italicized when a mint has been applied. Hovering over the nature will display the mint that was applied.
- Slightly lowered the volume of all cries.
- Giving Pokémon items now plays a sound
- Updated the Poké Ball model and animations.
- Pasture blocks will now also connect their bottom left and right sides to walls, iron bars, glass panes, and any other modded block that follows the same connection rules.
- The config option `consumeHeldItems` has been removed, please see the Datapack & Resourcepack Creators section for instructions on the updated method.
- Heal Powder can now be composted with a 75% chance of adding a layer
- Mental, Power, White, and Mirror Herbs can now be composted with a 100% chance of adding a layer.
- Added glowing eyes to Hoothoot and Noctowl.
- Mining Evolution Stone Ores with a Fortune pickaxe will now increase the amount of items received.
- Black Augurite can now be used to craft stone axes and obsidian.
- Using Experience Candies brings up the Party Pokémon Select screen when not targeting a Pokémon.
- Added tab completion for statuses to commands.
- Remedies can now be cooked in a Smoker and on a Campfire.
- Vertically flipped the Destiny Knot recipe.
### Fixes
- Fixed Raticate, Onix, Unfezant, Bergmite, Avalugg, Boltund and Revavroom cries not playing.
- Fixed Alolan Ratticate animations causing a crash.
- Fixed Quaxwell not doing its cry.
- Fixed Shroomish not using its idle.
- Fixed how Weight and Height is calculated for Pokémon, fixing the damage from moves like Low Kick.
- Fixed a staggering number of battle messages.
- Fixed various stone related blocks not being valid for Big Roots to spread onto on the Fabric version.
- Updated the registration of compostable items to improve compatibility with Fabric forks such as Quilt. Please note this does not mean we officially support Quilt, this change was only done since it was possible by correcting the registration to use the new intended way in the Fabric API.
- Fixed Dispensers being unable to shear grown Apricorns.
- Fixed Bowl not being given back to player after using Berry Juice
- Added context for -fail and -block handlers for battle text and added 16 related battle texts for them
- Fixed Battle text for Disable, Laser Focus, Foresight, Fire Spin, Telekinesis, Curse, Recharge and Encore
- Fixed missing text for snowy weather in battles
- Fixed missing text for attempting to catch an uncatchable Pokémon
- Fixed Moonphases for Clefairy line
- Fixed issue where Potions, Super Potions, and Hyper Potions did not work during battle
- Fixed the compatibility patch with the Forge version of [Carry On](https://modrinth.com/mod/carry-on) due to a bug on the mod, the Fabric version was unchanged and is still compatible.
- Added the ability to place Berries on modded Farmland blocks.
- Shouldered Pokémon now hop off when selected in team and r is pressed. This also is in effect in battles leading to shouldered Pokémon jumping of the shoulder of the trainer when it is their turn.
- Shouldered Pokémon now hop off when selected in team and R is pressed. This also is in effect in battles leading to shouldered Pokémon jumping of the shoulder of the trainer when it is their turn.
- Made more items compostable and changed the process for making items compostable.
- Added the ability for Hoppers to fill Brewing Stands with Medicinal Brews and Potions.
- Apricorn blocks are now flammable.
- Apricorn blocks are now flammable. Probably should have started that way, but we got there.
- The default pose for Pokémon being passengers is now "standing".
- Fixed issue where some IVs were changing every player relog.
- Fixed cursed battle message
- Fixed mistakes in pokemon spawning JSONs
- Fixed issue where some IVs were changing every time a player logged back in.
- Fixed advancement crash from bad datapack evolution data.
- Fixed global influences being applied to TickingSpawners twice.
- Reverted the default SpawningSelector back to FlatContextWeightedSelector. This fixes multiple weight related issues, including weights with SpawningInfluences.
- Apricorn Planting advancement should work again.
- Advancement "Patterned Wings" should now allow High Plains and Icy Snow Vivillon to register.
- Advancement "Vivillonaire" should now allow High Plains and Icy Snow Vivillon to register.
- Fixed the last battle critical hits evolution requirement not working.
- Fixed the damage taken evolution requirement not saving progress.
- Fixed the defeated Pokémon evolution requirement not saving progress.
@@ -70,20 +174,54 @@
- Fixed an exploit that could convert a single piece of Blaze Powder into an extra Medicinal Brew on the Forge version.
- Fixed an issue where health percentages would show incorrectly after healing
- Fixed the move Revival Blessing not allowing you to select from fainted party members.
- Fixed villagers not being able to pick up and plant mint seeds, vivichoke seeds, and revival herbs.
- Fixed Exeggcute faint.
- Fixed Raticate, Onix, Unfezant, Bergmite, Avalugg, Boltund and Revavroom cries not playing.
- Fixed Alolan Ratticate animations causing a crash.
- Fixed Quaxwell not doing its cry.
- Fixed Shroomish not using its idle.
- Fixed various spawn configuration issues across the board.
- Fixed a possible visual duplication of sent out Pokémon.
- Fixed battle text for Trace, Receiver, and Power of Alchemy.
- Fixed tooltips being appended too late in items.
- Fixed battles ending background music when battle music is not present.
- Fixed battles ending background music, instead of pausing, when battle music is played.
- Fixed a bunch of regionals to actually be obtainable, namely the unmodelled ones
- Fixed battle text for moves that were missing.
- Fixed a formatting error that affected Pokémon nicknames when the storage type is JSON.
- Fixed a crash that could occur on some servers relating to chunk loading and teleporting.
- Fixed an issue with Inkay's evolution requirement.
- Fixed conflicting evolution requirements that would cause the Ocean, River, Sun, and Tundra variants of Vivillon to be unobtainable through evolution.
- Fixed the Modern variant of Vivillon not being obtainable through evolution.
- Fixed Pokémon pathing through berry bushes, harming themselves in the process.
### Developer
- Fixed the `SpawnEvent` not respecting usage of `Cancelable#cancel`.
- Added the `EvolutionTestedEvent`, this allows listening and overriding the final result of evolution requirement tests.
- Rebuilt the scheduling API to more clearly force side choices and allow more local temporal frames of reference for tasks.
- Added utility script that can be used to generate all Spawn JSONS for all pokemon from the spawning spreadsheet in 1 click ([cobblemon_spawn_csv_to_json.py](utilityscripts%2Fcobblemon_spawn_csv_to_json.py)).
- The `HeldItemManager` has a new method `shouldConsumeItem`, this will return false by default to prevent breaking changes, see the documentation and update your implementations as needed.
- Added and implemented minSkyLight and maxSkyLight as config options for SpawnConditions
- Player specific battle themes can now be assigned to `PlayerData#battleTheme`.
- Changed design of `BattleStartedPreEvent`. Will now expose the `PokemonBattle`.
### Datapack & Resourcepack Creators
- Added 3 new item tags: `cobblemon:held/consumed_in_npc_battle`, `cobblemon:held/consumed_in_pvp_battle` & `cobblemon:held/consumed_in_wild_battle` these will determine which items get consumed in the implied battle types by Cobblemon, keep in mind the controller for this behaviour can be overriden by 3rd party.
- Unique wild encounter themes can now be associated with a specific species (or form) by assigning a SoundEvent identifier to the `battleTheme` field in the species' data configuration.
- Added a `structure` evolution condition, used to check if a Pokémon is in a given structure.
### Localization
- Updated translations for:
- French and Canadian French
- Simplified and Traditional Chinese
- Spanish and Mexican Spanish
- Pirate English
- German
- Thai
- Portuguese and Brazilian Portuguese
- Polish
- Italian
- Dutch
- Ukrainian
- Russian
Thank you so much to all of our community translators that bring the mod to the rest of the world!
## [1.4.0 - The Friends and Farms Update (October 13th, 2023)](#1-4-0)
### Additions
@@ -872,17 +1010,17 @@
- Fixed spawning in several biome tag categories.
- Fixed resource pack support for Pokémon models and textures.
- **Model Fixes**
- Fixed Paras and Nidoqueen looking very weird.
- Fixed Hitmonchan asserting dominance with a T-pose as well as Grimer and Muk pointing their hands to the sky.
- Fixed specific Pokémon suddenly pausing their animation after staying still for a long time.
- Fixed Mankey's feet being buried in the ground.
- Updated the Substitute model and updated its shiny texture to be better for the red-green colorblind.
- Improved Horsea, Seadra, and Kingdra animations, especially on land.
- Fixed Paras and Nidoqueen looking very weird.
- Fixed Hitmonchan asserting dominance with a T-pose as well as Grimer and Muk pointing their hands to the sky.
- Fixed specific Pokémon suddenly pausing their animation after staying still for a long time.
- Fixed Mankey's feet being buried in the ground.
- Updated the Substitute model and updated its shiny texture to be better for the red-green colorblind.
- Improved Horsea, Seadra, and Kingdra animations, especially on land.
- **Battle Fixes**
- Fixed an issue with battles where Pokémon had a different max HP causing some desync issues with the health bars.
- Fixed Magnitude battle messages.
- Moves that are disabled or out of PP now show transparently in the battle GUI instead of being hidden completely.
- Statuses like sleep and frozen no longer last forever if it was carried over from a previous battle.
- Fixed an issue with battles where Pokémon had a different max HP causing some desync issues with the health bars.
- Fixed Magnitude battle messages.
- Moves that are disabled or out of PP now show transparently in the battle GUI instead of being hidden completely.
- Statuses like sleep and frozen no longer last forever if it was carried over from a previous battle.
### Localization
- Added species, ability, and move translations for `ko_ko`, `jp_jp`, `fr_fr`, `es_es`, `it_it`, and `zh_cn`.
+2 -1
View File
@@ -1,6 +1,7 @@
plugins {
base
id("cobblemon.root-conventions")
id ("net.nemerosa.versioning") version "2.8.2"
}
group = "com.cobblemon.mod"
@@ -8,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"
version = "$version-SNAPSHOT-${versioning.info.branch}-${versioning.info.build}"
}
+1
View File
@@ -33,6 +33,7 @@ dependencies {
modApi(libs.molang)
compileOnlyApi(libs.jeiApi)
modCompileOnly(libs.adornFabric)
modCompileOnly(libs.lambDynamicLights) { isTransitive = false }
// For Showdown
modCompileOnly(libs.graal)
@@ -8,12 +8,9 @@
package com.cobblemon.mod.common.client.render.models.blockbench.pose;
import com.cobblemon.mod.common.client.render.models.blockbench.PoseableEntityModel;
import com.cobblemon.mod.common.client.render.models.blockbench.repository.RenderContext;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
@@ -0,0 +1,96 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.compat;
import com.cobblemon.mod.common.CobblemonEntities;
import com.cobblemon.mod.common.client.render.layer.PokemonOnShoulderRenderer;
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity;
import com.cobblemon.mod.common.pokemon.FormData;
import com.cobblemon.mod.common.pokemon.lighthing.LightingData;
import dev.lambdaurora.lambdynlights.api.DynamicLightHandler;
import dev.lambdaurora.lambdynlights.api.DynamicLightHandlers;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Pair;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Optional;
// Java class due to relying on entrypoint on Fabric side
public class LambDynamicLightsCompat {
// This is all called on client side
// These things are checked every tick so try to keep it as free as possible
// That being said it's unlikely school Toshiba person is running dynamic lighting and shaders to enjoy this
// Make sure not to call anything Fabric specific :)
public static void hookCompat() {
// Pokémon entities
DynamicLightHandlers.registerDynamicLightHandler(
CobblemonEntities.POKEMON,
DynamicLightHandler.makeHandler(
pokemon -> resolvedPokemonLightLevel(pokemon, false),
pokemon -> true
)
);
DynamicLightHandlers.registerDynamicLightHandler(
CobblemonEntities.POKEMON,
DynamicLightHandler.makeHandler(
pokemon -> resolvedPokemonLightLevel(pokemon, true),
pokemon -> false
)
);
// Shouldered Pokémon
DynamicLightHandlers.registerDynamicLightHandler(
EntityType.PLAYER,
DynamicLightHandler.makeHandler(
player -> resolvedShoulderLightLevel(player, false),
player -> true
)
);
DynamicLightHandlers.registerDynamicLightHandler(
EntityType.PLAYER,
DynamicLightHandler.makeHandler(
player -> resolvedShoulderLightLevel(player, true),
player -> false
)
);
}
private static int resolvedPokemonLightLevel(PokemonEntity pokemon, boolean underwater) {
return extractFormLightLevel(pokemon.getForm(), underwater).orElse(0);
}
private static int resolvedShoulderLightLevel(PlayerEntity player, boolean underwater) {
final Pair<PokemonOnShoulderRenderer.ShoulderData, PokemonOnShoulderRenderer.ShoulderData> shoulderDataPair = PokemonOnShoulderRenderer.shoulderDataOf(player);
final Optional<Integer> leftLightLevel = extractShoulderLightLevel(shoulderDataPair.getLeft(), underwater);
final Optional<Integer> rightLightLevel = extractShoulderLightLevel(shoulderDataPair.getRight(), underwater);
return Math.max(leftLightLevel.orElse(0), rightLightLevel.orElse(0));
}
private static Optional<Integer> extractFormLightLevel(@NotNull FormData form, boolean underwater) {
if (form.getLightingData() == null || !liquidGlowModeSupport(form.getLightingData().getLiquidGlowMode(), underwater)) {
return Optional.empty();
}
return Optional.of(form.getLightingData().getLightLevel());
}
private static Optional<Integer> extractShoulderLightLevel(@Nullable PokemonOnShoulderRenderer.ShoulderData shoulderData, boolean underwater) {
if (shoulderData == null) {
return Optional.empty();
}
return extractFormLightLevel(shoulderData.getForm(), underwater);
}
private static boolean liquidGlowModeSupport(@NotNull LightingData.LiquidGlowMode liquidGlowMode, boolean underwater) {
return underwater ? liquidGlowMode.getGlowsUnderwater() : liquidGlowMode.getGlowsInLand();
}
}
@@ -0,0 +1,20 @@
/*
* 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.duck;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
public interface SoundManagerDuck {
void pauseSounds(@Nullable Identifier id, @Nullable SoundCategory category);
void resumeSounds(@Nullable Identifier id, @Nullable SoundCategory category);
}
@@ -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.duck;
import net.minecraft.client.sound.SoundInstance;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
public interface SoundSystemDuck {
void pauseSounds(@Nullable Identifier id, @Nullable SoundCategory category);
void resumeSounds(@Nullable Identifier id, @Nullable SoundCategory category);
Collection<SoundInstance> getSounds(@Nullable SoundCategory category);
}
@@ -0,0 +1,30 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.mixin;
import com.cobblemon.mod.common.sherds.CobblemonSherds;
import net.minecraft.block.DecoratedPotPatterns;
import net.minecraft.item.Item;
import net.minecraft.registry.RegistryKey;
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.CallbackInfoReturnable;
@Mixin(DecoratedPotPatterns.class)
public abstract class DecoratedPotPatternsMixin {
@Inject(method = "fromSherd", at=@At("HEAD"), cancellable = true)
private static void cobblemon$getCobblemonSherdTexture(Item sherd,
CallbackInfoReturnable<RegistryKey<String>> cir) {
if (CobblemonSherds.INSTANCE.getSherdToPattern().containsKey(sherd)) {
cir.setReturnValue(CobblemonSherds.INSTANCE.getSherdToPattern().get(sherd));
return;
}
}
}
@@ -0,0 +1,33 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.mixin;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.village.VillagerProfession;
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.CallbackInfoReturnable;
import com.cobblemon.mod.common.villager.VillagerGatherableItems;
import java.util.Objects;
@Mixin(VillagerEntity.class)
public abstract class EntityVillagerMixin {
@Inject(method = "canGather", at = @At(value = "RETURN"), cancellable = true)
private void cobblemon$canGather(ItemStack stack, CallbackInfoReturnable<Boolean> ci) {
final VillagerEntity villager = (VillagerEntity) (Object) this;
if(ci.getReturnValue() == false && Objects.equals(villager.getVillagerData().getProfession(), VillagerProfession.FARMER) && villager.getInventory().canInsert(stack)) {
if(VillagerGatherableItems.INSTANCE.getVillagerGatherableItems().contains(stack.getItem()))
ci.setReturnValue(true);
}
}
}
@@ -8,20 +8,37 @@
package com.cobblemon.mod.common.mixin;
import com.cobblemon.mod.common.api.scheduling.ScheduledTaskTracker;
import com.cobblemon.mod.common.api.scheduling.ClientTaskTracker;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.GameRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(GameRenderer.class)
public class GameRendererMixin {
@Unique
long lastTime = -1;
@Inject(
method = "render",
at = @At(value = "TAIL")
)
public void render(float tickDelta, long startTime, boolean tick, CallbackInfo ci) {
ScheduledTaskTracker.INSTANCE.update();
MinecraftClient client = MinecraftClient.getInstance();
long newTime = System.currentTimeMillis();
// Don't play scheduled animations when the game is paused
if (client.isPaused()) {
lastTime = newTime;
return;
}
if (lastTime != -1) {
ClientTaskTracker.INSTANCE.update((newTime - lastTime) / 1000F);
}
lastTime = newTime;
}
}
@@ -0,0 +1,69 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.mixin;
import com.cobblemon.mod.common.client.CobblemonBakingOverrides;
import java.io.IOException;
import java.util.Arrays;
import java.util.Map;
import net.minecraft.client.color.block.BlockColors;
import net.minecraft.client.render.model.ModelLoader;
import net.minecraft.client.render.model.UnbakedModel;
import net.minecraft.client.render.model.json.JsonUnbakedModel;
import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.util.Identifier;
import net.minecraft.util.profiler.Profiler;
import org.slf4j.Logger;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.InjectionPoint;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.points.BeforeStringInvoke;
@Mixin(ModelLoader.class)
public abstract class ModelLoaderMixin {
@Shadow protected abstract void addModel(ModelIdentifier modelId);
@Final
@Shadow
private Map<Identifier, UnbakedModel> unbakedModels;
@Final
@Shadow
private static Logger LOGGER;
@Inject(
method = "<init>",
at = @At("TAIL")
)
public void init(BlockColors blockColors,
Profiler profiler,
Map jsonUnbakedModels,
Map blockStates,
CallbackInfo ci) {
CobblemonBakingOverrides.INSTANCE.getModels().forEach(bakingOverride -> {
try {
this.unbakedModels.put(bakingOverride.getModelIdentifier(), this.loadModelFromJson(bakingOverride.getModelLocation()));
this.addModel(bakingOverride.getModelIdentifier());
} catch (IOException e) {
LOGGER.error("Error loading a Cobblemon BakedModel:", e);
throw new RuntimeException(e);
}
});
}
@Shadow
private JsonUnbakedModel loadModelFromJson(Identifier id) throws IOException {
return null;
}
}
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.mixin;
import com.cobblemon.mod.common.client.sound.battle.BattleMusicController;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.sound.MusicTracker;
import net.minecraft.client.sound.SoundInstance;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MusicTracker.class)
public class MusicTrackerMixin {
@Shadow @Final
private MinecraftClient client;
@Shadow @Nullable
private SoundInstance current;
/** Freezes the tracker while a BattleMusicInstance is in progress. Current SoundInstance being tracked will be paused by BattleMusicHandler. */
@Inject(method = "tick()V", at = @At("HEAD"), cancellable = true)
public void tick(CallbackInfo cb) {
if (this.client.getSoundManager().isPlaying(BattleMusicController.INSTANCE.getMusic())) cb.cancel();
}
}
@@ -0,0 +1,37 @@
/*
* 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.api.snowstorm.ParticleMaterials;
import com.google.common.collect.ImmutableList;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.particle.ParticleTextureSheet;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.List;
@Mixin(ParticleManager.class)
final class ParticleManagerMixin {
@Mutable
@Final
@Shadow
private static List<ParticleTextureSheet> PARTICLE_TEXTURE_SHEETS;
@Inject(at = @At("RETURN"), method = "<clinit>")
private static void lodestone$addTypes(CallbackInfo ci) {
PARTICLE_TEXTURE_SHEETS = ImmutableList.<ParticleTextureSheet>builder().addAll(PARTICLE_TEXTURE_SHEETS)
.add(ParticleMaterials.INSTANCE.getADD(), ParticleMaterials.INSTANCE.getALPHA(), ParticleMaterials.INSTANCE.getBLEND(), ParticleMaterials.INSTANCE.getOPAQUE()).build();
}
}
@@ -14,6 +14,7 @@ import com.cobblemon.mod.common.api.events.CobblemonEvents;
import com.cobblemon.mod.common.api.events.item.LeftoversCreatedEvent;
import com.cobblemon.mod.common.api.storage.NoPokemonStoreException;
import com.cobblemon.mod.common.api.storage.party.PartyStore;
import com.cobblemon.mod.common.api.tags.CobblemonItemTags;
import com.cobblemon.mod.common.pokemon.Pokemon;
import com.cobblemon.mod.common.util.CompoundTagExtensionsKt;
import com.cobblemon.mod.common.util.DataKeys;
@@ -22,11 +23,8 @@ import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text;
import net.minecraft.world.World;
import org.objectweb.asm.Opcodes;
@@ -40,8 +38,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.Objects;
import java.util.UUID;
import static com.cobblemon.mod.common.util.LocalizationUtilsKt.lang;
@Mixin(PlayerEntity.class)
public abstract class PlayerMixin extends LivingEntity {
@@ -144,7 +140,7 @@ public abstract class PlayerMixin extends LivingEntity {
)
public void onEatFood(World world, ItemStack stack, CallbackInfoReturnable<ItemStack> cir) {
if (!getWorld().isClient) {
if (stack.getItem() == Items.APPLE && getWorld().random.nextDouble() < Cobblemon.config.getAppleLeftoversChance()) {
if (stack.isIn(CobblemonItemTags.LEAVES_LEFTOVERS) && getWorld().random.nextDouble() < Cobblemon.config.getAppleLeftoversChance()) {
ItemStack leftovers = new ItemStack(CobblemonItems.LEFTOVERS);
ServerPlayerEntity player = Objects.requireNonNull(getServer()).getPlayerManager().getPlayer(uuid);
assert player != null;
@@ -8,36 +8,77 @@
package com.cobblemon.mod.common.mixin;
import com.cobblemon.mod.common.access.SoundManagerDuck;
import net.minecraft.client.sound.SoundInstance;
import net.minecraft.client.sound.SoundManager;
import com.cobblemon.mod.common.client.sound.battle.BattleMusicController;
import com.cobblemon.mod.common.duck.SoundManagerDuck;
import com.cobblemon.mod.common.duck.SoundSystemDuck;
import net.minecraft.client.sound.*;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(SoundManager.class)
public class SoundManagerMixin implements SoundManagerDuck {
public abstract class SoundManagerMixin implements SoundManagerDuck {
private boolean[] blockedCategories = new boolean[SoundCategory.values().length];
@Shadow
public abstract boolean isPlaying(SoundInstance sound);
@Override
public void toggleCategories(SoundCategory... categories) {
for (SoundCategory category : categories) {
int index = category.ordinal();
boolean blocked = blockedCategories[index];
blockedCategories[index] = !blocked;
}
@Shadow @Final
private SoundSystem soundSystem;
// Never-ending ambient loops are a special exception (they are only initiated once) and should always be paused if filtered.
private boolean isAmbientLoop(SoundInstance sound) {
return sound instanceof BiomeEffectSoundPlayer.MusicLoop || sound instanceof AmbientSoundLoops.Underwater;
}
private boolean filterCondition(SoundInstance sound) {
return !isAmbientLoop(sound) &&
this.isPlaying(BattleMusicController.INSTANCE.getMusic()) &&
BattleMusicController.INSTANCE.getFilteredCategories().contains(sound.getCategory());
}
private boolean ambientLoopCondition(SoundInstance sound) {
return isAmbientLoop(sound) &&
this.isPlaying(BattleMusicController.INSTANCE.getMusic()) &&
BattleMusicController.INSTANCE.getFilteredCategories().contains(sound.getCategory());
}
/** Pauses the queried SoundInstance(s). If id is null, will pause all sounds belonging to the SoundCategory. */
@Override
public void pauseSounds(@Nullable Identifier id, @Nullable SoundCategory category) {
((SoundSystemDuck)soundSystem).pauseSounds(id, category);
}
/** Resumes the queried SoundInstance(s). If id is null, will resume all sounds belonging to the SoundCategory. */
@Override
public void resumeSounds(@Nullable Identifier id, @Nullable SoundCategory category) {
((SoundSystemDuck)soundSystem).resumeSounds(id, category);
}
/** Blocks filtered sounds from being played while a BattleMusicInstance is in progress. */
@Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;)V", at = @At("HEAD"), cancellable = true)
public void play(SoundInstance sound, CallbackInfo cb) {
if (blockedCategories[sound.getCategory().ordinal()]) cb.cancel();
public void playStart(SoundInstance sound, CallbackInfo cb) {
if (filterCondition(sound)) cb.cancel();
}
@Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;I)V", at = @At("HEAD"), cancellable = true)
public void play(SoundInstance sound, int delay, CallbackInfo cb) {
if (blockedCategories[sound.getCategory().ordinal()]) cb.cancel();
public void playStart(SoundInstance sound, int delay, CallbackInfo cb) {
if (filterCondition(sound)) cb.cancel();
}
/** Pauses ambient loops while a BattleMusicInstance is in progress. */
@Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;)V", at = @At("TAIL"))
public void playEnd(SoundInstance sound, CallbackInfo cb) {
if (ambientLoopCondition(sound)) this.pauseSounds(sound.getId(), SoundCategory.AMBIENT);
}
@Inject(method = "play(Lnet/minecraft/client/sound/SoundInstance;I)V", at = @At("TAIL"))
public void playEnd(SoundInstance sound, int delay, CallbackInfo cb) {
if (ambientLoopCondition(sound)) this.pauseSounds(sound.getId(), SoundCategory.AMBIENT);
}
}
@@ -8,31 +8,102 @@
package com.cobblemon.mod.common.mixin;
import com.cobblemon.mod.common.client.sound.battle.BattleMusicController;
import com.cobblemon.mod.common.duck.SoundSystemDuck;
import com.google.common.collect.Multimap;
import net.minecraft.client.sound.SoundInstance;
import net.minecraft.client.sound.SoundSystem;
import net.minecraft.client.sound.*;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Map;
@Mixin(SoundSystem.class)
public abstract class SoundSystemMixin {
public abstract class SoundSystemMixin implements SoundSystemDuck {
@Shadow
private boolean started;
@Shadow
private Multimap<SoundCategory, SoundInstance> sounds;
@Shadow @Final
private Map<SoundInstance, Channel.SourceManager> sources;
@Shadow
protected abstract void stop(SoundInstance sound);
@Shadow
public abstract boolean isPlaying(SoundInstance sound);
/** Resumes the Source belonging to the queried SoundInstance. */
private void resume(SoundInstance sound) {
Channel.SourceManager sourceManager = this.sources.get(sound);
if (this.started && sourceManager != null) sourceManager.run(Source::resume);
}
/** Pauses the Source belonging to the queried SoundInstance. */
private void pause(SoundInstance sound) {
Channel.SourceManager sourceManager = this.sources.get(sound);
if (this.started && sourceManager != null) sourceManager.run(Source::pause);
}
/** Resumes the SoundInstance(s) queried by id and/or category. */
@Override
public void resumeSounds(@Nullable Identifier id, @Nullable SoundCategory category) {
if (category != null) {
this.sounds.get(category).forEach((sound) -> {
if (id == null || sound.getId().equals(id)) resume(sound);
});
} else if (id == null) {
this.sources.keySet().forEach(this::resume);
} else {
this.sources.keySet().forEach(sound -> {
if (sound.getId().equals(id)) resume(sound);
});
}
}
/** Pauses the SoundInstances queried by id and/or category. */
@Override
public void pauseSounds(@Nullable Identifier id, @Nullable SoundCategory category) {
if (category != null) {
this.sounds.get(category).forEach((sound) -> {
if (id == null || sound.getId().equals(id)) pause(sound);
});
} else if (id == null) {
this.sources.keySet().forEach(this::pause);
} else {
this.sources.keySet().forEach(sound -> {
if (sound.getId().equals(id)) pause(sound);
});
}
}
/** Allows stopping all SoundInstances that belong to a queried category. */
@Inject(method = "stopSounds(Lnet/minecraft/util/Identifier;Lnet/minecraft/sound/SoundCategory;)V", at = @At("HEAD"), cancellable = true)
public void stopSounds(@Nullable Identifier id, @Nullable SoundCategory category, CallbackInfo cb) {
if (id == null && category != null) {
sounds.get(category).forEach(this::stop);
this.sounds.get(category).forEach(this::stop);
cb.cancel();
}
}
/** Different behavior for resuming SoundInstances while a BattleMusicInstance is being played. We do not want to resume filtered sounds. */
@Inject(method = "resumeAll()V", at = @At("HEAD"), cancellable = true)
public void resumeAll(CallbackInfo cb) {
if (this.isPlaying(BattleMusicController.INSTANCE.getMusic())) {
this.sounds.values().forEach(sound -> {
if (sound == BattleMusicController.INSTANCE.getMusic() || !BattleMusicController.INSTANCE.getFilteredCategories().contains(sound.getCategory())) {
resume(sound);
}
});
cb.cancel();
}
}
@@ -1,22 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.mixin.accessor;
import net.minecraft.client.sound.MusicTracker;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(MusicTracker.class)
public interface MusicTrackerAccessor {
@Accessor("timeUntilNextSong")
int timeUntilNextSong();
@Accessor("timeUntilNextSong")
void setTimeUntilNextSong(int timeUntilNextSong);
}
@@ -0,0 +1,29 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common
import net.minecraft.client.MinecraftClient
import net.minecraft.client.render.model.BakedModel
import net.minecraft.client.util.ModelIdentifier
import net.minecraft.util.Identifier
/**
* Contains information for forcing a model to be baked
*
* @param modelLocation The location of the model
* @param modelIdentifier The identifier that the BakedModel will be registered to
*/
data class BakingOverride(
val modelLocation: Identifier,
val modelIdentifier: ModelIdentifier
) {
fun getModel(): BakedModel {
return MinecraftClient.getInstance().bakedModelManager.getModel(modelIdentifier)
}
}
@@ -22,6 +22,7 @@ import com.cobblemon.mod.common.api.events.CobblemonEvents.EVOLUTION_COMPLETE
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
import com.cobblemon.mod.common.api.net.serializers.IdentifierDataSerializer
import com.cobblemon.mod.common.api.net.serializers.PoseTypeDataSerializer
import com.cobblemon.mod.common.api.net.serializers.StringSetDataSerializer
import com.cobblemon.mod.common.api.net.serializers.Vec3DataSerializer
@@ -41,11 +42,17 @@ import com.cobblemon.mod.common.api.pokemon.stats.EvCalculator
import com.cobblemon.mod.common.api.pokemon.stats.Generation8EvCalculator
import com.cobblemon.mod.common.api.pokemon.stats.StatProvider
import com.cobblemon.mod.common.api.properties.CustomPokemonProperty
import com.cobblemon.mod.common.api.scheduling.ScheduledTaskTracker
import com.cobblemon.mod.common.api.scheduling.ServerRealTimeTaskTracker
import com.cobblemon.mod.common.api.scheduling.ServerTaskTracker
import com.cobblemon.mod.common.api.spawning.BestSpawner
import com.cobblemon.mod.common.api.spawning.CobblemonSpawningProspector
import com.cobblemon.mod.common.api.spawning.WorldSlice
import com.cobblemon.mod.common.api.spawning.context.AreaContextResolver
import com.cobblemon.mod.common.api.spawning.context.AreaSpawningContext
import com.cobblemon.mod.common.api.spawning.context.calculators.AreaSpawningContextCalculator
import com.cobblemon.mod.common.api.spawning.context.calculators.AreaSpawningInput
import com.cobblemon.mod.common.api.spawning.prospecting.SpawningProspector
import com.cobblemon.mod.common.api.spawning.spawner.Spawner
import com.cobblemon.mod.common.api.starter.StarterHandler
import com.cobblemon.mod.common.api.storage.PokemonStoreManager
import com.cobblemon.mod.common.api.storage.adapter.conversions.ReforgedConversion
@@ -54,6 +61,7 @@ import com.cobblemon.mod.common.api.storage.adapter.flatfile.FileStoreAdapter
import com.cobblemon.mod.common.api.storage.adapter.flatfile.JSONStoreAdapter
import com.cobblemon.mod.common.api.storage.adapter.flatfile.NBTStoreAdapter
import com.cobblemon.mod.common.api.storage.factory.FileBackedPokemonStoreFactory
import com.cobblemon.mod.common.api.storage.molang.NbtMoLangDataStoreFactory
import com.cobblemon.mod.common.api.storage.pc.PCStore
import com.cobblemon.mod.common.api.storage.pc.link.PCLinkManager
import com.cobblemon.mod.common.api.storage.player.PlayerDataStoreManager
@@ -67,6 +75,7 @@ import com.cobblemon.mod.common.battles.BattleSide
import com.cobblemon.mod.common.battles.ShowdownThread
import com.cobblemon.mod.common.battles.actor.PokemonBattleActor
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
import com.cobblemon.mod.common.command.argument.DialogueArgumentType
import com.cobblemon.mod.common.command.argument.MoveArgumentType
import com.cobblemon.mod.common.command.argument.PartySlotArgumentType
import com.cobblemon.mod.common.command.argument.PokemonArgumentType
@@ -94,15 +103,10 @@ 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
import com.cobblemon.mod.common.pokemon.stat.CobblemonStatProvider
import com.cobblemon.mod.common.sherds.CobblemonSherds
import com.cobblemon.mod.common.starter.CobblemonStarterHandler
import com.cobblemon.mod.common.trade.TradeManager
import com.cobblemon.mod.common.util.DataKeys
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.ifDedicatedServer
import com.cobblemon.mod.common.util.isLaterVersion
import com.cobblemon.mod.common.util.party
import com.cobblemon.mod.common.util.removeAmountIf
import com.cobblemon.mod.common.util.server
import com.cobblemon.mod.common.util.*
import com.cobblemon.mod.common.world.feature.CobblemonPlacedFeatures
import com.cobblemon.mod.common.world.feature.ore.CobblemonOrePlacedFeatures
import com.cobblemon.mod.common.world.gamerules.CobblemonGameRules
@@ -126,6 +130,7 @@ import net.minecraft.item.Items
import net.minecraft.item.NameTagItem
import net.minecraft.registry.RegistryKey
import net.minecraft.util.WorldSavePath
import net.minecraft.util.math.BlockPos
import net.minecraft.world.World
import org.apache.logging.log4j.LogManager
@@ -153,6 +158,7 @@ object Cobblemon {
val bestSpawner = BestSpawner
val battleRegistry = BattleRegistry
var storage = PokemonStoreManager()
var molangData = NbtMoLangDataStoreFactory
lateinit var playerData: PlayerDataStoreManager
lateinit var starterConfig: StarterConfig
val dataProvider: DataProvider = CobblemonDataProvider
@@ -231,6 +237,7 @@ object Cobblemon {
TrackedDataHandlerRegistry.register(Vec3DataSerializer)
TrackedDataHandlerRegistry.register(StringSetDataSerializer)
TrackedDataHandlerRegistry.register(PoseTypeDataSerializer)
TrackedDataHandlerRegistry.register(IdentifierDataSerializer)
HeldItemProvider.register(CobblemonHeldItemManager, Priority.LOWEST)
}
@@ -260,9 +267,15 @@ object Cobblemon {
ifDedicatedServer {
isDedicatedServer = true
PlatformEvents.SERVER_TICK_POST.subscribe { ScheduledTaskTracker.update() }
}
PlatformEvents.SERVER_TICK_POST.subscribe {
ServerTaskTracker.update(1/20F)
ServerRealTimeTaskTracker.update()
}
PlatformEvents.SERVER_TICK_PRE.subscribe {
ServerRealTimeTaskTracker.update()
}
PlatformEvents.SERVER_STARTING.subscribe { event ->
val server = event.server
playerData = PlayerDataStoreManager().also { it.setup(server) }
@@ -371,9 +384,12 @@ object Cobblemon {
battleRegistry.startBattle(
BattleFormat.GEN_9_SINGLES,
BattleSide(PokemonBattleActor(UUID.randomUUID(), BattlePokemon(Pokemon().initialize()), -1F)),
BattleSide(PokemonBattleActor(UUID.randomUUID(), BattlePokemon(Pokemon().initialize()), -1F))
).apply { mute = true }
BattleSide(PokemonBattleActor(UUID.randomUUID(), BattlePokemon(Pokemon().initialize()), -1F)),
true
).ifSuccessful { it.mute = true }
}
CobblemonSherds.registerSherds()
}
fun getLevel(dimension: RegistryKey<World>): World? {
@@ -477,6 +493,7 @@ object Cobblemon {
this.implementation.registerCommandArgument(cobblemonResource("move"), MoveArgumentType::class, ConstantArgumentSerializer.of(MoveArgumentType::move))
this.implementation.registerCommandArgument(cobblemonResource("party_slot"), PartySlotArgumentType::class, ConstantArgumentSerializer.of(PartySlotArgumentType::partySlot))
this.implementation.registerCommandArgument(cobblemonResource("pokemon_store"), PokemonStoreArgumentType::class, ConstantArgumentSerializer.of(PokemonStoreArgumentType::pokemonStore))
this.implementation.registerCommandArgument(cobblemonResource("dialogue"), DialogueArgumentType::class, ConstantArgumentSerializer.of(DialogueArgumentType::dialogue))
}
}
@@ -0,0 +1,21 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common
import net.minecraft.entity.ai.brain.Activity
object CobblemonActivities {
val activities = mutableListOf<Activity>()
val BATTLING_ACTIVITY = Activity("pokemon_battling")
fun register(activity: Activity): Activity {
activities.add(activity)
return activity
}
}
@@ -8,6 +8,14 @@
package com.cobblemon.mod.common
import com.cobblemon.mod.common.block.entity.BerryBlockEntity
import com.cobblemon.mod.common.block.entity.HealingMachineBlockEntity
import com.cobblemon.mod.common.block.entity.PCBlockEntity
import com.cobblemon.mod.common.block.entity.PokemonPastureBlockEntity
import com.cobblemon.mod.common.block.entity.FossilAnalyzerBlockEntity
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.platform.PlatformRegistry
import net.minecraft.block.entity.BlockEntityType
@@ -23,9 +31,13 @@ object CobblemonBlockEntities : PlatformRegistry<Registry<BlockEntityType<*>>, R
@JvmField
val HEALING_MACHINE: BlockEntityType<HealingMachineBlockEntity> = this.create("healing_machine", BlockEntityType.Builder.create(::HealingMachineBlockEntity, CobblemonBlocks.HEALING_MACHINE).build(null))
@JvmField
val PC: BlockEntityType<PCBlockEntity> = this.create("pc", BlockEntityType.Builder.create(::PCBlockEntity, CobblemonBlocks.PC).build(null))
@JvmField
val BERRY = this.create("berry", BlockEntityType.Builder.create(::BerryBlockEntity, *CobblemonBlocks.berries().values.toTypedArray()).build(null))
@JvmField
val PASTURE: BlockEntityType<PokemonPastureBlockEntity> = this.create("pasture", BlockEntityType.Builder.create(::PokemonPastureBlockEntity, CobblemonBlocks.PASTURE).build(null))
@JvmField
@@ -33,4 +45,30 @@ object CobblemonBlockEntities : PlatformRegistry<Registry<BlockEntityType<*>>, R
@JvmField
val HANGING_SIGN: BlockEntityType<CobblemonHangingSignBlockEntity> = this.create("hanging_sign", BlockEntityType.Builder.create(::CobblemonHangingSignBlockEntity, CobblemonBlocks.APRICORN_HANGING_SIGN, CobblemonBlocks.APRICORN_WALL_HANGING_SIGN).build(null))
}
@JvmField
val FOSSIL_MULTIBLOCK: BlockEntityType<FossilMultiblockEntity> = this.create("fossil_multiblock",
BlockEntityType.Builder.create({ pos, state -> FossilMultiblockEntity(pos, state, FossilMultiblockBuilder(pos)) },
CobblemonBlocks.MONITOR
).build(null)
)
@JvmField
val RESTORATION_TANK: BlockEntityType<RestorationTankBlockEntity> = this.create("restoration_tank",
BlockEntityType.Builder.create({ pos, state -> RestorationTankBlockEntity(pos, state, FossilMultiblockBuilder(pos)) },
CobblemonBlocks.RESTORATION_TANK
).build(null)
)
@JvmField
val FOSSIL_ANALYZER: BlockEntityType<FossilAnalyzerBlockEntity> = this.create("fossil_analyzer",
BlockEntityType.Builder.create({ pos, state -> FossilAnalyzerBlockEntity(pos, state, FossilMultiblockBuilder(pos)) },
CobblemonBlocks.FOSSIL_ANALYZER
).build(null)
)
@JvmField
val DYNITE_ORE: BlockEntityType<DyniteOreBlockEntity> = this.create("dynite_ore",
BlockEntityType.Builder.create(::DyniteOreBlockEntity, CobblemonBlocks.DYNITE_ORE)
.build(null)
)
}
@@ -11,6 +11,9 @@ package com.cobblemon.mod.common
import com.cobblemon.mod.common.api.apricorn.Apricorn
import com.cobblemon.mod.common.block.*
import com.cobblemon.mod.common.block.MintBlock.MintType
import com.cobblemon.mod.common.block.FossilAnalyzerBlock
import com.cobblemon.mod.common.block.MonitorBlock
import com.cobblemon.mod.common.block.RestorationTankBlock
import com.cobblemon.mod.common.mixin.invoker.DoorBlockInvoker
import com.cobblemon.mod.common.mixin.invoker.PressurePlateBlockInvoker
import com.cobblemon.mod.common.mixin.invoker.StairsBlockInvoker
@@ -24,6 +27,7 @@ import com.cobblemon.mod.common.block.sign.CobblemonSignBlock
import com.cobblemon.mod.common.block.sign.CobblemonWallHangingSignBlock
import com.cobblemon.mod.common.block.sign.CobblemonWallSignBlock
import net.minecraft.block.*
import net.minecraft.block.enums.Instrument
import net.minecraft.block.piston.PistonBehavior
import net.minecraft.entity.effect.StatusEffects
import net.minecraft.registry.Registries
@@ -53,6 +57,8 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
@JvmField
val FIRE_STONE_ORE = evolutionStoneOre("fire_stone_ore")
@JvmField
val NETHER_FIRE_STONE_ORE = evolutionStoneOre("nether_fire_stone_ore")
@JvmField
val ICE_STONE_ORE = evolutionStoneOre("ice_stone_ore")
@JvmField
val LEAF_STONE_ORE = evolutionStoneOre("leaf_stone_ore")
@@ -90,6 +96,15 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
@JvmField
val DEEPSLATE_WATER_STONE_ORE = this.deepslateEvolutionStoneOre("deepslate_water_stone_ore")
@JvmField
val DYNITE_ORE = this.create("dynite_ore", DyniteOreBlock(
AbstractBlock.Settings.create()
.mapColor(MapColor.BRIGHT_RED)
.strength(4.5f, 3f)
.requiresTool()
.sounds(BlockSoundGroup.METAL)
))
// Apricorns
@JvmField
val APRICORN_LOG = log("apricorn_log", arg2 = MapColor.BROWN)
@@ -100,17 +115,17 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
@JvmField
val STRIPPED_APRICORN_WOOD = log("stripped_apricorn_wood")
@JvmField
val APRICORN_PLANKS = this.create("apricorn_planks", Block(AbstractBlock.Settings.create().mapColor(MapColor.DIRT_BROWN).strength(2.0f, 3.0f).sounds(BlockSoundGroup.WOOD)))
val APRICORN_PLANKS = this.create("apricorn_planks", Block(AbstractBlock.Settings.create().mapColor(MapColor.DIRT_BROWN).instrument(Instrument.BASS).strength(2.0f, 3.0f).sounds(BlockSoundGroup.WOOD)))
@JvmField
val APRICORN_LEAVES = leaves("apricorn_leaves")
@JvmField
val APRICORN_FENCE = this.create("apricorn_fence", FenceBlock(AbstractBlock.Settings.create().mapColor(APRICORN_PLANKS.defaultMapColor).strength(2.0f, 3.0f).sounds(BlockSoundGroup.WOOD)))
val APRICORN_FENCE = this.create("apricorn_fence", FenceBlock(AbstractBlock.Settings.create().mapColor(APRICORN_PLANKS.defaultMapColor).instrument(Instrument.BASS).strength(2.0f, 3.0f).sounds(BlockSoundGroup.WOOD)))
@JvmField
val APRICORN_FENCE_GATE = this.create("apricorn_fence_gate", FenceGateBlock(AbstractBlock.Settings.create().mapColor(APRICORN_PLANKS.defaultMapColor).strength(2.0f, 3.0f).sounds(BlockSoundGroup.WOOD), APRICORN_WOOD_TYPE))
val APRICORN_FENCE_GATE = this.create("apricorn_fence_gate", FenceGateBlock(AbstractBlock.Settings.create().mapColor(APRICORN_PLANKS.defaultMapColor).instrument(Instrument.BASS).strength(2.0f, 3.0f).sounds(BlockSoundGroup.WOOD), APRICORN_WOOD_TYPE))
@JvmField // Note At the time of 1.20.0 we don't need our own BlockSetType for Apricorn wood
val APRICORN_BUTTON = this.create("apricorn_button", BlocksInvoker.createWoodenButtonBlock(BlockSetType.OAK))
@JvmField
val APRICORN_PRESSURE_PLATE = this.create("apricorn_pressure_plate", PressurePlateBlockInvoker.`cobblemon$create`(PressurePlateBlock.ActivationRule.EVERYTHING, AbstractBlock.Settings.create().mapColor(APRICORN_PLANKS.defaultMapColor).noCollision().strength(0.5f).sounds(BlockSoundGroup.WOOD), APRICORN_BLOCK_SET_TYPE))
val APRICORN_PRESSURE_PLATE = this.create("apricorn_pressure_plate", PressurePlateBlockInvoker.`cobblemon$create`(PressurePlateBlock.ActivationRule.EVERYTHING, AbstractBlock.Settings.create().mapColor(APRICORN_PLANKS.defaultMapColor).instrument(Instrument.BASS).noCollision().strength(0.5f).sounds(BlockSoundGroup.WOOD), APRICORN_BLOCK_SET_TYPE))
@JvmField
val APRICORN_SIGN = this.create("apricorn_sign", CobblemonSignBlock(AbstractBlock.Settings.copy(Blocks.OAK_SIGN), APRICORN_WOOD_TYPE))
@JvmField
@@ -120,13 +135,13 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
@JvmField
val APRICORN_WALL_HANGING_SIGN = this.create("apricorn_wall_hanging_sign", CobblemonWallHangingSignBlock(AbstractBlock.Settings.copy(Blocks.OAK_HANGING_SIGN), APRICORN_WOOD_TYPE))
@JvmField
val APRICORN_SLAB = this.create("apricorn_slab", SlabBlock(AbstractBlock.Settings.create().mapColor(MapColor.OAK_TAN).strength(2.0f, 3.0f).sounds(BlockSoundGroup.WOOD)))
val APRICORN_SLAB = this.create("apricorn_slab", SlabBlock(AbstractBlock.Settings.create().mapColor(MapColor.OAK_TAN).instrument(Instrument.BASS).strength(2.0f, 3.0f).sounds(BlockSoundGroup.WOOD)))
@JvmField
val APRICORN_STAIRS = this.create("apricorn_stairs", StairsBlockInvoker.`cobblemon$create`(APRICORN_PLANKS.defaultState, AbstractBlock.Settings.copy(APRICORN_PLANKS)))
@JvmField
val APRICORN_DOOR = this.create("apricorn_door", DoorBlockInvoker.`cobblemon$create`(AbstractBlock.Settings.create().mapColor(APRICORN_PLANKS.defaultMapColor).strength(3.0F).sounds(BlockSoundGroup.WOOD).nonOpaque(), APRICORN_BLOCK_SET_TYPE))
val APRICORN_DOOR = this.create("apricorn_door", DoorBlockInvoker.`cobblemon$create`(AbstractBlock.Settings.create().mapColor(APRICORN_PLANKS.defaultMapColor).instrument(Instrument.BASS).strength(3.0F).sounds(BlockSoundGroup.WOOD).nonOpaque(), APRICORN_BLOCK_SET_TYPE))
@JvmField
val APRICORN_TRAPDOOR = this.create("apricorn_trapdoor", TrapdoorBlockInvoker.`cobblemon$create`(AbstractBlock.Settings.create().mapColor(MapColor.OAK_TAN).strength(3.0F).sounds(BlockSoundGroup.WOOD).nonOpaque().allowsSpawning { _, _, _, _ -> false }, APRICORN_BLOCK_SET_TYPE))
val APRICORN_TRAPDOOR = this.create("apricorn_trapdoor", TrapdoorBlockInvoker.`cobblemon$create`(AbstractBlock.Settings.create().mapColor(MapColor.OAK_TAN).instrument(Instrument.BASS).strength(3.0F).sounds(BlockSoundGroup.WOOD).nonOpaque().allowsSpawning { _, _, _, _ -> false }, APRICORN_BLOCK_SET_TYPE))
private val PLANT_PROPERTIES = AbstractBlock.Settings.create().mapColor(MapColor.DARK_GREEN).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.GRASS).pistonBehavior(PistonBehavior.DESTROY)
@JvmField
@@ -153,6 +168,55 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
@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)))
@JvmField
val TUMBLESTONE_CLUSTER = tumblestoneBlock("tumblestone_cluster", GrowableStoneBlock.STAGE_3, 7, 3, null)
@JvmField
val LARGE_BUDDING_TUMBLESTONE = tumblestoneBlock("large_budding_tumblestone", GrowableStoneBlock.STAGE_2, 5, 3, TUMBLESTONE_CLUSTER)
@JvmField
val MEDIUM_BUDDING_TUMBLESTONE = tumblestoneBlock("medium_budding_tumblestone", GrowableStoneBlock.STAGE_1, 4, 3, LARGE_BUDDING_TUMBLESTONE)
@JvmField
val SMALL_BUDDING_TUMBLESTONE = tumblestoneBlock("small_budding_tumblestone", GrowableStoneBlock.STAGE_0, 3, 4, MEDIUM_BUDDING_TUMBLESTONE)
@JvmField
val SKY_TUMBLESTONE_CLUSTER = tumblestoneBlock("sky_tumblestone_cluster", GrowableStoneBlock.STAGE_3, 7, 3, null)
@JvmField
val LARGE_BUDDING_SKY_TUMBLESTONE = tumblestoneBlock("large_budding_sky_tumblestone", GrowableStoneBlock.STAGE_2, 5, 3, SKY_TUMBLESTONE_CLUSTER)
@JvmField
val MEDIUM_BUDDING_SKY_TUMBLESTONE = tumblestoneBlock("medium_budding_sky_tumblestone", GrowableStoneBlock.STAGE_1, 4, 3, LARGE_BUDDING_SKY_TUMBLESTONE)
@JvmField
val SMALL_BUDDING_SKY_TUMBLESTONE = tumblestoneBlock("small_budding_sky_tumblestone", GrowableStoneBlock.STAGE_0, 3, 4, MEDIUM_BUDDING_SKY_TUMBLESTONE)
@JvmField
val BLACK_TUMBLESTONE_CLUSTER = tumblestoneBlock("black_tumblestone_cluster", GrowableStoneBlock.STAGE_3, 7, 3, null)
@JvmField
val LARGE_BUDDING_BLACK_TUMBLESTONE = tumblestoneBlock("large_budding_black_tumblestone", GrowableStoneBlock.STAGE_2, 5, 3, BLACK_TUMBLESTONE_CLUSTER)
@JvmField
val MEDIUM_BUDDING_BLACK_TUMBLESTONE = tumblestoneBlock("medium_budding_black_tumblestone", GrowableStoneBlock.STAGE_1, 4, 3, LARGE_BUDDING_BLACK_TUMBLESTONE)
@JvmField
val SMALL_BUDDING_BLACK_TUMBLESTONE = tumblestoneBlock("small_budding_black_tumblestone", GrowableStoneBlock.STAGE_0, 3, 4, MEDIUM_BUDDING_BLACK_TUMBLESTONE)
@JvmField
val TUMBLESTONE_BLOCK = this.create("tumblestone_block", Block(AbstractBlock.Settings.create()
.mapColor(MapColor.TERRACOTTA_ORANGE)
.strength(1.0F)
.sounds(CobblemonSounds.TUMBLESTONE_BLOCK_SOUNDS)
.instrument(Instrument.BASEDRUM)
))
@JvmField
val SKY_TUMBLESTONE_BLOCK = this.create("sky_tumblestone_block", Block(AbstractBlock.Settings.create()
.mapColor(MapColor.LIGHT_BLUE)
.strength(1.0F)
.sounds(CobblemonSounds.TUMBLESTONE_BLOCK_SOUNDS)
.instrument(Instrument.BASEDRUM)
))
@JvmField
val BLACK_TUMBLESTONE_BLOCK = this.create("black_tumblestone_block", Block(AbstractBlock.Settings.create()
.mapColor(MapColor.TERRACOTTA_BLACK)
.strength(1.0F)
.sounds(CobblemonSounds.TUMBLESTONE_BLOCK_SOUNDS)
.instrument(Instrument.BASEDRUM)
))
@JvmField
val BLACK_APRICORN = apricornBlock("black_apricorn", Apricorn.BLACK)
@JvmField
@@ -168,6 +232,45 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
@JvmField
val YELLOW_APRICORN = apricornBlock("yellow_apricorn", Apricorn.YELLOW)
@JvmField
val MONITOR = create(
"monitor",
MonitorBlock(
AbstractBlock.Settings.create()
.mapColor(MapColor.IRON_GRAY)
.sounds(BlockSoundGroup.METAL)
.pistonBehavior(PistonBehavior.BLOCK)
.requiresTool()
.strength(5.0F, 6.0F)
.luminance { if (it.get(MonitorBlock.SCREEN) != MonitorBlock.MonitorScreen.OFF) 15 else 0 }
)
)
@JvmField
val FOSSIL_ANALYZER = create(
"fossil_analyzer",
FossilAnalyzerBlock(
AbstractBlock.Settings.create()
.mapColor(MapColor.IRON_GRAY)
.sounds(BlockSoundGroup.METAL)
.pistonBehavior(PistonBehavior.BLOCK)
.requiresTool()
.strength(5.0F, 6.0F)
.nonOpaque()
)
)
@JvmField
val RESTORATION_TANK = create(
"restoration_tank",
RestorationTankBlock(
AbstractBlock.Settings.create()
.mapColor(MapColor.IRON_GRAY)
.sounds(BlockSoundGroup.METAL)
.pistonBehavior(PistonBehavior.BLOCK)
.requiresTool()
.strength(5.0F, 6.0F)
.nonOpaque()
)
)
@JvmField
val HEALING_MACHINE = create(
"healing_machine",
@@ -243,6 +346,15 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
private fun apricornBlock(name: String, apricorn: Apricorn): ApricornBlock = this.create(name, ApricornBlock(AbstractBlock.Settings.create().mapColor(apricorn.mapColor()).ticksRandomly().strength(Blocks.OAK_LOG.hardness, Blocks.OAK_LOG.blastResistance).sounds(BlockSoundGroup.WOOD).nonOpaque(), apricorn))
private fun tumblestoneBlock(name: String, stage: Int, height: Int, xzOffset: Int, nextStage: Block?) : Block {
return this.create(name, TumblestoneBlock(AbstractBlock.Settings.create()
.pistonBehavior(PistonBehavior.DESTROY)
.nonOpaque()
.strength(1.5F)
.sounds(CobblemonSounds.TUMBLESTONE_SOUNDS),
stage, height, xzOffset, nextStage))
}
private val berries = mutableMapOf<Identifier, BerryBlock>()
val AGUAV_BERRY = this.berryBlock("aguav")
@@ -46,5 +46,7 @@ object CobblemonCommands {
ClearPartyCommand.register(dispatcher)
ClearPCCommand.register(dispatcher)
PokemonRestartCommand.register(dispatcher)
BedrockParticleCommand.register(dispatcher)
OpenDialogueCommand.register(dispatcher)
}
}
@@ -11,6 +11,9 @@ package com.cobblemon.mod.common
import com.cobblemon.mod.common.api.pokeball.PokeBalls
import com.cobblemon.mod.common.entity.boat.CobblemonBoatEntity
import com.cobblemon.mod.common.entity.boat.CobblemonChestBoatEntity
import com.cobblemon.mod.common.entity.fallingstar.FallingStarEntity
import com.cobblemon.mod.common.entity.generic.GenericBedrockEntity
import com.cobblemon.mod.common.entity.fishing.PokeRodFishingBobberEntity
import com.cobblemon.mod.common.entity.pokeball.EmptyPokeBallEntity
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.platform.PlatformRegistry
@@ -65,6 +68,33 @@ object CobblemonEntities : PlatformRegistry<Registry<EntityType<*>>, RegistryKey
.build(CHEST_BOAT_KEY.toString())
)
@JvmField
val GENERIC_BEDROCK_ENTITY_KEY = cobblemonResource("generic_bedrock")
@JvmField
val GENERIC_BEDROCK_ENTITY: EntityType<GenericBedrockEntity> = this.create(
GENERIC_BEDROCK_ENTITY_KEY.path,
EntityType.Builder.create({ _, world -> GenericBedrockEntity(world) }, SpawnGroup.MISC)
.build(GENERIC_BEDROCK_ENTITY_KEY.toString())
)
@JvmField
val FALLING_STAR_ENTITY_KEY = cobblemonResource("falling_star")
@JvmField
val FALLING_STAR_ENTITY: EntityType<FallingStarEntity> = this.create(
FALLING_STAR_ENTITY_KEY.path,
EntityType.Builder.create({ _, world -> FallingStarEntity(world) }, SpawnGroup.MISC)
.build(FALLING_STAR_ENTITY_KEY.toString())
)
@JvmField
val POKE_BOBBER_KEY = cobblemonResource("poke_bobber")
@JvmField
val POKE_BOBBER: EntityType<PokeRodFishingBobberEntity> = this.create(
POKE_BOBBER_KEY.path,
EntityType.Builder.create(::PokeRodFishingBobberEntity, SpawnGroup.MISC).setDimensions(0.5F, 0.5F).maxTrackingRange(10)
.build(POKE_BOBBER_KEY.toString())
)
fun registerAttributes(consumer: (EntityType<out LivingEntity>, DefaultAttributeContainer.Builder) -> Unit) {
consumer(POKEMON, PokemonEntity.createAttributes())
}
@@ -18,6 +18,7 @@ import com.cobblemon.mod.common.block.MintBlock
import com.cobblemon.mod.common.block.MintBlock.MintType
import com.cobblemon.mod.common.entity.boat.CobblemonBoatType
import com.cobblemon.mod.common.item.*
import com.cobblemon.mod.common.item.armor.CobblemonArmorTrims
import com.cobblemon.mod.common.item.battle.DireHitItem
import com.cobblemon.mod.common.item.battle.GuardSpecItem
import com.cobblemon.mod.common.item.battle.XStatItem
@@ -38,6 +39,14 @@ import net.minecraft.entity.LivingEntity
import net.minecraft.entity.effect.StatusEffectInstance
import net.minecraft.entity.effect.StatusEffects
import net.minecraft.item.*
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.registry.Registries
import net.minecraft.registry.Registry
import net.minecraft.registry.RegistryKey
@@ -116,6 +125,38 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
val MASTER_BALL = pokeBallItem(PokeBalls.MASTER_BALL)
@JvmField
val CHERISH_BALL = pokeBallItem(PokeBalls.CHERISH_BALL)
@JvmField
val ANCIENT_POKE_BALL = pokeBallItem(PokeBalls.ANCIENT_POKE_BALL)
@JvmField
val ANCIENT_CITRINE_BALL = pokeBallItem(PokeBalls.ANCIENT_CITRINE_BALL)
@JvmField
val ANCIENT_VERDANT_BALL = pokeBallItem(PokeBalls.ANCIENT_VERDANT_BALL)
@JvmField
val ANCIENT_AZURE_BALL = pokeBallItem(PokeBalls.ANCIENT_AZURE_BALL)
@JvmField
val ANCIENT_ROSEATE_BALL = pokeBallItem(PokeBalls.ANCIENT_ROSEATE_BALL)
@JvmField
val ANCIENT_SLATE_BALL = pokeBallItem(PokeBalls.ANCIENT_SLATE_BALL)
@JvmField
val ANCIENT_IVORY_BALL = pokeBallItem(PokeBalls.ANCIENT_IVORY_BALL)
@JvmField
val ANCIENT_GREAT_BALL = pokeBallItem(PokeBalls.ANCIENT_GREAT_BALL)
@JvmField
val ANCIENT_ULTRA_BALL = pokeBallItem(PokeBalls.ANCIENT_ULTRA_BALL)
@JvmField
val ANCIENT_FEATHER_BALL = pokeBallItem(PokeBalls.ANCIENT_FEATHER_BALL)
@JvmField
val ANCIENT_WING_BALL = pokeBallItem(PokeBalls.ANCIENT_WING_BALL)
@JvmField
val ANCIENT_JET_BALL = pokeBallItem(PokeBalls.ANCIENT_JET_BALL)
@JvmField
val ANCIENT_HEAVY_BALL = pokeBallItem(PokeBalls.ANCIENT_HEAVY_BALL)
@JvmField
val ANCIENT_LEADEN_BALL = pokeBallItem(PokeBalls.ANCIENT_LEADEN_BALL)
@JvmField
val ANCIENT_GIGATON_BALL = pokeBallItem(PokeBalls.ANCIENT_GIGATON_BALL)
@JvmField
val ANCIENT_ORIGIN_BALL = pokeBallItem(PokeBalls.ANCIENT_ORIGIN_BALL)
@JvmField
val VIVICHOKE = compostableItem("vivichoke")
@@ -139,19 +180,19 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
val WHITE_APRICORN = apricornItem("white", ApricornItem(CobblemonBlocks.WHITE_APRICORN))
@JvmField
val RED_APRICORN_SEED = apricornSeedItem("red", ApricornSeedItem(CobblemonBlocks.RED_APRICORN_SAPLING))
val RED_APRICORN_SEED = apricornSeedItem("red", ApricornSeedItem(CobblemonBlocks.RED_APRICORN_SAPLING, CobblemonBlocks.RED_APRICORN))
@JvmField
val YELLOW_APRICORN_SEED = apricornSeedItem("yellow", ApricornSeedItem(CobblemonBlocks.YELLOW_APRICORN_SAPLING))
val YELLOW_APRICORN_SEED = apricornSeedItem("yellow", ApricornSeedItem(CobblemonBlocks.YELLOW_APRICORN_SAPLING, CobblemonBlocks.YELLOW_APRICORN))
@JvmField
val GREEN_APRICORN_SEED = apricornSeedItem("green", ApricornSeedItem(CobblemonBlocks.GREEN_APRICORN_SAPLING))
val GREEN_APRICORN_SEED = apricornSeedItem("green", ApricornSeedItem(CobblemonBlocks.GREEN_APRICORN_SAPLING, CobblemonBlocks.GREEN_APRICORN))
@JvmField
val BLUE_APRICORN_SEED = apricornSeedItem("blue", ApricornSeedItem(CobblemonBlocks.BLUE_APRICORN_SAPLING))
val BLUE_APRICORN_SEED = apricornSeedItem("blue", ApricornSeedItem(CobblemonBlocks.BLUE_APRICORN_SAPLING, CobblemonBlocks.BLUE_APRICORN))
@JvmField
val PINK_APRICORN_SEED = apricornSeedItem("pink", ApricornSeedItem(CobblemonBlocks.PINK_APRICORN_SAPLING))
val PINK_APRICORN_SEED = apricornSeedItem("pink", ApricornSeedItem(CobblemonBlocks.PINK_APRICORN_SAPLING, CobblemonBlocks.PINK_APRICORN))
@JvmField
val BLACK_APRICORN_SEED = apricornSeedItem("black", ApricornSeedItem(CobblemonBlocks.BLACK_APRICORN_SAPLING))
val BLACK_APRICORN_SEED = apricornSeedItem("black", ApricornSeedItem(CobblemonBlocks.BLACK_APRICORN_SAPLING, CobblemonBlocks.BLACK_APRICORN))
@JvmField
val WHITE_APRICORN_SEED = apricornSeedItem("white", ApricornSeedItem(CobblemonBlocks.WHITE_APRICORN_SAPLING))
val WHITE_APRICORN_SEED = apricornSeedItem("white", ApricornSeedItem(CobblemonBlocks.WHITE_APRICORN_SAPLING, CobblemonBlocks.WHITE_APRICORN))
@JvmField
val APRICORN_LOG = blockItem("apricorn_log", CobblemonBlocks.APRICORN_LOG)
@@ -191,6 +232,12 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
@JvmField
val APRICORN_HANGING_SIGN = this.create("apricorn_hanging_sign", HangingSignItem(CobblemonBlocks.APRICORN_HANGING_SIGN, CobblemonBlocks.APRICORN_WALL_HANGING_SIGN, Item.Settings().maxCount(16)))
@JvmField
val RESTORATION_TANK = blockItem("restoration_tank", CobblemonBlocks.RESTORATION_TANK)
@JvmField
val FOSSIL_ANALYZER = blockItem("fossil_analyzer", CobblemonBlocks.FOSSIL_ANALYZER)
@JvmField
val MONITOR = blockItem("monitor", CobblemonBlocks.MONITOR)
@JvmField
val HEALING_MACHINE = blockItem("healing_machine", CobblemonBlocks.HEALING_MACHINE)
@JvmField
@@ -530,6 +577,12 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
val DEEPSLATE_WATER_STONE_ORE = blockItem("deepslate_water_stone_ore", CobblemonBlocks.DEEPSLATE_WATER_STONE_ORE)
@JvmField
val DRIPSTONE_MOON_STONE_ORE = blockItem("dripstone_moon_stone_ore", CobblemonBlocks.DRIPSTONE_MOON_STONE_ORE)
@JvmField
val NETHER_FIRE_STONE_ORE = blockItem("nether_fire_stone_ore", CobblemonBlocks.NETHER_FIRE_STONE_ORE)
@JvmField
val DYNITE_ORE = blockItem("dynite_ore", CobblemonBlocks.DYNITE_ORE)
@JvmField
val DAWN_STONE = noSettingsItem("dawn_stone")
@JvmField
@@ -652,6 +705,14 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
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")
// Mulch
@JvmField
@@ -673,6 +734,101 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
@JvmField
val SURPRISE_MULCH = mulchItem("surprise_mulch", MulchVariant.SURPRISE)
// Archaeology
@JvmField
val ARMOR_FOSSIL = noSettingsItem("armor_fossil")
@JvmField
val BIRD_FOSSIL = noSettingsItem("bird_fossil")
@JvmField
val CLAW_FOSSIL = noSettingsItem("claw_fossil")
@JvmField
val COVER_FOSSIL = noSettingsItem("cover_fossil")
@JvmField
val DINO_FOSSIL = noSettingsItem("dino_fossil")
@JvmField
val DOME_FOSSIL = noSettingsItem("dome_fossil")
@JvmField
val DRAKE_FOSSIL = noSettingsItem("drake_fossil")
@JvmField
val FISH_FOSSIL = noSettingsItem("fish_fossil")
@JvmField
val HELIX_FOSSIL = noSettingsItem("helix_fossil")
@JvmField
val JAW_FOSSIL = noSettingsItem("jaw_fossil")
@JvmField
val OLD_AMBER_FOSSIL = noSettingsItem("old_amber_fossil")
@JvmField
val PLUME_FOSSIL = noSettingsItem("plume_fossil")
@JvmField
val ROOT_FOSSIL = noSettingsItem("root_fossil")
@JvmField
val SAIL_FOSSIL = noSettingsItem("sail_fossil")
@JvmField
val SKULL_FOSSIL = noSettingsItem("skull_fossil")
@JvmField
val BYGONE_SHERD = noSettingsItem("bygone_sherd")
@JvmField
val CAPTURE_SHERD = noSettingsItem("capture_sherd")
@JvmField
val DOME_SHERD = noSettingsItem("dome_sherd")
@JvmField
val HELIX_SHERD = noSettingsItem("helix_sherd")
@JvmField
val NOSTALGIC_SHERD = noSettingsItem("nostalgic_sherd")
@JvmField
val SUSPICIOUS_SHERD = noSettingsItem("suspicious_sherd")
@JvmField
val TUMBLESTONE = this.create("tumblestone", TumblestoneItem(Item.Settings(), CobblemonBlocks.SMALL_BUDDING_TUMBLESTONE))
@JvmField
val BLACK_TUMBLESTONE = this.create("black_tumblestone", TumblestoneItem(Item.Settings(), CobblemonBlocks.SMALL_BUDDING_BLACK_TUMBLESTONE))
@JvmField
val SKY_TUMBLESTONE = this.create("sky_tumblestone", TumblestoneItem(Item.Settings(), CobblemonBlocks.SMALL_BUDDING_SKY_TUMBLESTONE))
@JvmField
val SMALL_BUDDING_TUMBLESTONE = blockItem("small_budding_tumblestone", CobblemonBlocks.SMALL_BUDDING_TUMBLESTONE)
@JvmField
val MEDIUM_BUDDING_TUMBLESTONE = blockItem("medium_budding_tumblestone", CobblemonBlocks.MEDIUM_BUDDING_TUMBLESTONE)
@JvmField
val LARGE_BUDDING_TUMBLESTONE = blockItem("large_budding_tumblestone", CobblemonBlocks.LARGE_BUDDING_TUMBLESTONE)
@JvmField
val TUMBLESTONE_CLUSTER = blockItem("tumblestone_cluster", CobblemonBlocks.TUMBLESTONE_CLUSTER)
@JvmField
val SMALL_BUDDING_SKY_TUMBLESTONE = blockItem("small_budding_sky_tumblestone", CobblemonBlocks.SMALL_BUDDING_SKY_TUMBLESTONE)
@JvmField
val MEDIUM_BUDDING_SKY_TUMBLESTONE = blockItem("medium_budding_sky_tumblestone", CobblemonBlocks.MEDIUM_BUDDING_SKY_TUMBLESTONE)
@JvmField
val LARGE_BUDDING_SKY_TUMBLESTONE = blockItem("large_budding_sky_tumblestone", CobblemonBlocks.LARGE_BUDDING_SKY_TUMBLESTONE)
@JvmField
val SKY_TUMBLESTONE_CLUSTER = blockItem("sky_tumblestone_cluster", CobblemonBlocks.SKY_TUMBLESTONE_CLUSTER)
@JvmField
val SMALL_BUDDING_BLACK_TUMBLESTONE = blockItem("small_budding_black_tumblestone", CobblemonBlocks.SMALL_BUDDING_BLACK_TUMBLESTONE)
@JvmField
val MEDIUM_BUDDING_BLACK_TUMBLESTONE = blockItem("medium_budding_black_tumblestone", CobblemonBlocks.MEDIUM_BUDDING_BLACK_TUMBLESTONE)
@JvmField
val LARGE_BUDDING_BLACK_TUMBLESTONE = blockItem("large_budding_black_tumblestone", CobblemonBlocks.LARGE_BUDDING_BLACK_TUMBLESTONE)
@JvmField
val BLACK_TUMBLESTONE_CLUSTER = blockItem("black_tumblestone_cluster", CobblemonBlocks.BLACK_TUMBLESTONE_CLUSTER)
@JvmField
val TUMBLESTONE_BLOCK = blockItem("tumblestone_block", CobblemonBlocks.TUMBLESTONE_BLOCK)
@JvmField
val SKY_TUMBLESTONE_BLOCK = blockItem("sky_tumblestone_block", CobblemonBlocks.SKY_TUMBLESTONE_BLOCK)
@JvmField
val BLACK_TUMBLESTONE_BLOCK = blockItem("black_tumblestone_block", CobblemonBlocks.BLACK_TUMBLESTONE_BLOCK)
@JvmField
val AUTOMATON_ARMOR_TRIM_SMITHING_TEMPLATE: SmithingTemplateItem = this.create(
"automaton_armor_trim_smithing_template",
SmithingTemplateItem.of(CobblemonArmorTrims.AUTOMATON)
)
@JvmField
val POKEROD = pokerodItem("pokerod")
// Misc
@JvmField
val POKEMON_MODEL = this.create("pokemon_model", PokemonItem())
@@ -694,6 +850,12 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
private fun candyItem(name: String, calculator: CandyItem.Calculator): CandyItem = this.create(name, CandyItem(calculator))
private fun pokerodItem(name: String): PokerodItem {
var settings = Item.Settings()
val item = create(name, PokerodItem(settings))
return item
}
private fun heldItem(name: String, remappedName: String? = null): CobblemonItem = create(
name,
CobblemonItem(Item.Settings()).also {
@@ -13,6 +13,7 @@ import com.cobblemon.mod.common.api.net.NetworkPacket
import com.cobblemon.mod.common.api.net.ServerNetworkPacketHandler
import com.cobblemon.mod.common.client.net.PlayerInteractOptionsHandler
import com.cobblemon.mod.common.client.net.SetClientPlayerDataHandler
import com.cobblemon.mod.common.client.net.animation.PlayPoseableAnimationHandler
import com.cobblemon.mod.common.client.net.battle.BattleApplyPassResponseHandler
import com.cobblemon.mod.common.client.net.battle.BattleCaptureEndHandler
import com.cobblemon.mod.common.client.net.battle.BattleCaptureShakeHandler
@@ -37,6 +38,10 @@ import com.cobblemon.mod.common.client.net.callback.party.OpenPartyCallbackHandl
import com.cobblemon.mod.common.client.net.callback.partymove.OpenPartyMoveCallbackHandler
import com.cobblemon.mod.common.client.net.data.DataRegistrySyncPacketHandler
import com.cobblemon.mod.common.client.net.data.UnlockReloadPacketHandler
import com.cobblemon.mod.common.client.net.effect.RunPosableMoLangHandler
import com.cobblemon.mod.common.client.net.dialogue.DialogueClosedHandler
import com.cobblemon.mod.common.client.net.dialogue.DialogueOpenedHandler
import com.cobblemon.mod.common.client.net.effect.SpawnSnowstormEntityParticleHandler
import com.cobblemon.mod.common.client.net.effect.SpawnSnowstormParticleHandler
import com.cobblemon.mod.common.client.net.gui.InteractPokemonUIPacketHandler
import com.cobblemon.mod.common.client.net.gui.SummaryUIPacketHandler
@@ -46,7 +51,6 @@ import com.cobblemon.mod.common.client.net.pasture.PokemonPasturedHandler
import com.cobblemon.mod.common.client.net.pasture.PokemonUnpasturedHandler
import com.cobblemon.mod.common.client.net.pokemon.update.PokemonUpdatePacketHandler
import com.cobblemon.mod.common.client.net.settings.ServerSettingsPacketHandler
import com.cobblemon.mod.common.client.net.sound.PokemonCryHandler
import com.cobblemon.mod.common.client.net.sound.UnvalidatedPlaySoundS2CPacketHandler
import com.cobblemon.mod.common.client.net.spawn.SpawnExtraDataEntityHandler
import com.cobblemon.mod.common.client.net.starter.StarterUIPacketHandler
@@ -71,6 +75,7 @@ import com.cobblemon.mod.common.client.net.trade.TradeOfferNotificationHandler
import com.cobblemon.mod.common.client.net.trade.TradeStartedHandler
import com.cobblemon.mod.common.client.net.trade.TradeUpdatedHandler
import com.cobblemon.mod.common.net.messages.client.PlayerInteractOptionsPacket
import com.cobblemon.mod.common.net.messages.client.animation.PlayPoseableAnimationPacket
import com.cobblemon.mod.common.net.messages.client.battle.*
import com.cobblemon.mod.common.net.messages.client.callback.OpenMoveCallbackPacket
import com.cobblemon.mod.common.net.messages.client.callback.OpenPartyCallbackPacket
@@ -81,7 +86,13 @@ import com.cobblemon.mod.common.net.messages.client.data.MovesRegistrySyncPacket
import com.cobblemon.mod.common.net.messages.client.data.PropertiesCompletionRegistrySyncPacket
import com.cobblemon.mod.common.net.messages.client.data.SpeciesRegistrySyncPacket
import com.cobblemon.mod.common.net.messages.client.data.UnlockReloadPacket
import com.cobblemon.mod.common.net.messages.client.dialogue.DialogueClosedPacket
import com.cobblemon.mod.common.net.messages.client.dialogue.DialogueOpenedPacket
import com.cobblemon.mod.common.net.messages.client.effect.RunPosableMoLangPacket
import com.cobblemon.mod.common.net.messages.client.effect.SpawnSnowstormEntityParticlePacket
import com.cobblemon.mod.common.net.messages.client.effect.SpawnSnowstormParticlePacket
import com.cobblemon.mod.common.net.messages.client.fossil.FossilRegistrySyncPacket
import com.cobblemon.mod.common.net.messages.client.fossil.NaturalMaterialRegistrySyncPacket
import com.cobblemon.mod.common.net.messages.client.pasture.ClosePasturePacket
import com.cobblemon.mod.common.net.messages.client.pasture.OpenPasturePacket
import com.cobblemon.mod.common.net.messages.client.pasture.PokemonPasturedPacket
@@ -91,8 +102,8 @@ import com.cobblemon.mod.common.net.messages.client.pokemon.update.evolution.Add
import com.cobblemon.mod.common.net.messages.client.pokemon.update.evolution.ClearEvolutionsPacket
import com.cobblemon.mod.common.net.messages.client.pokemon.update.evolution.RemoveEvolutionPacket
import com.cobblemon.mod.common.net.messages.client.settings.ServerSettingsPacket
import com.cobblemon.mod.common.net.messages.client.sound.PokemonCryPacket
import com.cobblemon.mod.common.net.messages.client.sound.UnvalidatedPlaySoundS2CPacket
import com.cobblemon.mod.common.net.messages.client.spawn.SpawnGenericBedrockPacket
import com.cobblemon.mod.common.net.messages.client.spawn.SpawnPokeballPacket
import com.cobblemon.mod.common.net.messages.client.spawn.SpawnPokemonPacket
import com.cobblemon.mod.common.net.messages.client.starter.OpenStarterUIPacket
@@ -129,6 +140,8 @@ import com.cobblemon.mod.common.net.messages.server.callback.party.PartyPokemonS
import com.cobblemon.mod.common.net.messages.server.callback.party.PartySelectCancelledPacket
import com.cobblemon.mod.common.net.messages.server.callback.partymove.PartyMoveSelectCancelledPacket
import com.cobblemon.mod.common.net.messages.server.callback.partymove.PartyPokemonMoveSelectedPacket
import com.cobblemon.mod.common.net.messages.server.dialogue.EscapeDialoguePacket
import com.cobblemon.mod.common.net.messages.server.dialogue.InputToDialoguePacket
import com.cobblemon.mod.common.net.messages.server.pasture.PasturePokemonPacket
import com.cobblemon.mod.common.net.messages.server.pasture.UnpastureAllPokemonPacket
import com.cobblemon.mod.common.net.messages.server.pasture.UnpasturePokemonPacket
@@ -162,6 +175,8 @@ import com.cobblemon.mod.common.net.serverhandling.callback.party.PartyPokemonSe
import com.cobblemon.mod.common.net.serverhandling.callback.party.PartySelectCancelledHandler
import com.cobblemon.mod.common.net.serverhandling.callback.partymove.PartyMoveSelectCancelledHandler
import com.cobblemon.mod.common.net.serverhandling.callback.partymove.PartyPokemonMoveSelectedHandler
import com.cobblemon.mod.common.net.serverhandling.dialogue.EscapeDialogueHandler
import com.cobblemon.mod.common.net.serverhandling.dialogue.InputToDialogueHandler
import com.cobblemon.mod.common.net.serverhandling.evolution.AcceptEvolutionHandler
import com.cobblemon.mod.common.net.serverhandling.pasture.PasturePokemonHandler
import com.cobblemon.mod.common.net.serverhandling.pasture.UnpastureAllPokemonHandler
@@ -233,6 +248,7 @@ object CobblemonNetwork : NetworkManager {
this.createClientBound(PokemonStateUpdatePacket.ID, PokemonStateUpdatePacket::decode, PokemonUpdatePacketHandler())
this.createClientBound(TetheringUpdatePacket.ID, TetheringUpdatePacket::decode, PokemonUpdatePacketHandler())
this.createClientBound(TradeableUpdatePacket.ID, TradeableUpdatePacket::decode, PokemonUpdatePacketHandler())
this.createClientBound(OriginalTrainerUpdatePacket.ID, OriginalTrainerUpdatePacket::decode, PokemonUpdatePacketHandler())
// Evolution start
this.createClientBound(AddEvolutionPacket.ID, AddEvolutionPacket::decode, PokemonUpdatePacketHandler())
@@ -298,15 +314,20 @@ object CobblemonNetwork : NetworkManager {
this.createClientBound(PropertiesCompletionRegistrySyncPacket.ID, PropertiesCompletionRegistrySyncPacket::decode, DataRegistrySyncPacketHandler())
this.createClientBound(UnlockReloadPacket.ID, UnlockReloadPacket::decode, UnlockReloadPacketHandler)
this.createClientBound(BerryRegistrySyncPacket.ID, BerryRegistrySyncPacket::decode, DataRegistrySyncPacketHandler())
this.createClientBound(NaturalMaterialRegistrySyncPacket.ID, NaturalMaterialRegistrySyncPacket::decode, DataRegistrySyncPacketHandler())
this.createClientBound(FossilRegistrySyncPacket.ID, FossilRegistrySyncPacket::decode, DataRegistrySyncPacketHandler())
// Effects
this.createClientBound(SpawnSnowstormParticlePacket.ID, SpawnSnowstormParticlePacket::decode, SpawnSnowstormParticleHandler)
this.createClientBound(SpawnSnowstormEntityParticlePacket.ID, SpawnSnowstormEntityParticlePacket::decode, SpawnSnowstormEntityParticleHandler)
this.createClientBound(RunPosableMoLangPacket.ID, RunPosableMoLangPacket::decode, RunPosableMoLangHandler)
// Hax
this.createClientBound(UnvalidatedPlaySoundS2CPacket.ID, UnvalidatedPlaySoundS2CPacket::decode, UnvalidatedPlaySoundS2CPacketHandler)
this.createClientBound(SpawnPokemonPacket.ID, SpawnPokemonPacket::decode, SpawnExtraDataEntityHandler())
this.createClientBound(SpawnPokeballPacket.ID, SpawnPokeballPacket::decode, SpawnExtraDataEntityHandler())
this.createClientBound(ToastPacket.ID, ToastPacket::decode, ToastPacketHandler)
this.createClientBound(SpawnGenericBedrockPacket.ID, SpawnGenericBedrockPacket::decode, SpawnExtraDataEntityHandler())
// Trade packets
this.createClientBound(TradeAcceptanceChangedPacket.ID, TradeAcceptanceChangedPacket::decode, TradeAcceptanceChangedHandler)
@@ -324,7 +345,7 @@ object CobblemonNetwork : NetworkManager {
this.createClientBound(PokemonUnpasturedPacket.ID, PokemonUnpasturedPacket::decode, PokemonUnpasturedHandler)
// Behaviours
this.createClientBound(PokemonCryPacket.ID, PokemonCryPacket::decode, PokemonCryHandler)
this.createClientBound(PlayPoseableAnimationPacket.ID, PlayPoseableAnimationPacket::decode, PlayPoseableAnimationHandler)
// Move select packets
this.createClientBound(OpenMoveCallbackPacket.ID, OpenMoveCallbackPacket::decode, OpenMoveCallbackHandler)
@@ -334,6 +355,10 @@ object CobblemonNetwork : NetworkManager {
// Party move select packets
this.createClientBound(OpenPartyMoveCallbackPacket.ID, OpenPartyMoveCallbackPacket::decode, OpenPartyMoveCallbackHandler)
// Dialogue packets
this.createClientBound(DialogueClosedPacket.ID, DialogueClosedPacket::decode, DialogueClosedHandler)
this.createClientBound(DialogueOpenedPacket.ID, DialogueOpenedPacket::decode, DialogueOpenedHandler)
}
override fun registerServerBound() {
@@ -399,6 +424,10 @@ object CobblemonNetwork : NetworkManager {
// Party move select packets
this.createServerBound(PartyPokemonMoveSelectedPacket.ID, PartyPokemonMoveSelectedPacket::decode, PartyPokemonMoveSelectedHandler)
this.createServerBound(PartyMoveSelectCancelledPacket.ID, PartyMoveSelectCancelledPacket::decode, PartyMoveSelectCancelledHandler)
// Dialogue packets
this.createServerBound(EscapeDialoguePacket.ID, EscapeDialoguePacket::decode, EscapeDialogueHandler)
this.createServerBound(InputToDialoguePacket.ID, InputToDialoguePacket::decode, InputToDialogueHandler)
}
private inline fun <reified T : NetworkPacket<T>> createClientBound(identifier: Identifier, noinline decoder: (PacketByteBuf) -> T, handler: ClientNetworkPacketHandler<T>) {
@@ -14,6 +14,7 @@ import net.minecraft.registry.Registries
import net.minecraft.registry.Registry
import net.minecraft.registry.RegistryKey
import net.minecraft.registry.RegistryKeys
import net.minecraft.sound.BlockSoundGroup
import net.minecraft.sound.SoundEvent
object CobblemonSounds : PlatformRegistry<Registry<SoundEvent>, RegistryKey<Registry<SoundEvent>>, SoundEvent>() {
@@ -54,6 +55,10 @@ object CobblemonSounds : PlatformRegistry<Registry<SoundEvent>, RegistryKey<Regi
val POKE_BALL_SEND_OUT = this.create("poke_ball.send_out")
@JvmField
val POKE_BALL_RECALL = this.create("poke_ball.recall")
@JvmField
val POKE_BALL_THROW = this.create("poke_ball.throw")
@JvmField
val POKE_BALL_TRAIL = this.create("poke_ball.trail")
@JvmField
val ITEM_USE = this.create("item.use")
@@ -61,6 +66,8 @@ object CobblemonSounds : PlatformRegistry<Registry<SoundEvent>, RegistryKey<Regi
val CAN_EVOLVE = this.create("pokemon.can_evolve")
@JvmField
val EVOLVING = this.create("pokemon.evolving")
@JvmField
val EVOLVE = this.create("evolution.evolve")
@JvmField
val PVN_BATTLE = this.create("battle.pvn.default")
@@ -88,6 +95,94 @@ object CobblemonSounds : PlatformRegistry<Registry<SoundEvent>, RegistryKey<Regi
@JvmField
val MULCH_REMOVE = this.create("mulch.remove")
@JvmField
val FOSSIL_MACHINE_ACTIVATE = this.create("fossilmachine.activate")
@JvmField
val FOSSIL_MACHINE_ACTIVE_LOOP = this.create("fossilmachine.active_loop")
@JvmField
val FOSSIL_MACHINE_ASSEMBLE = this.create("fossilmachine.assemble")
@JvmField
val FOSSIL_MACHINE_DNA_FULL = this.create("fossilmachine.dna_full")
@JvmField
val FOSSIL_MACHINE_FINISHED = this.create("fossilmachine.finished")
@JvmField
val FOSSIL_MACHINE_INSERT_DNA = this.create("fossilmachine.insert_dna")
@JvmField
val FOSSIL_MACHINE_INSERT_DNA_SMALL = this.create("fossilmachine.insert_dna_small")
@JvmField
val FOSSIL_MACHINE_INSERT_FOSSIL = this.create("fossilmachine.insert_fossil")
@JvmField
val FOSSIL_MACHINE_RETRIEVE_FOSSIL = this.create("fossilmachine.retrieve_fossil")
@JvmField
val FOSSIL_MACHINE_RETRIEVE_POKEMON = this.create("fossilmachine.retrieve_pokemon")
@JvmField
val FOSSIL_MACHINE_UNPROTECTED = this.create("fossilmachine.unprotected")
@JvmField
val TUMBLESTONE_BREAK = this.create("tumblestone.break")
@JvmField
val TUMBLESTONE_BLOCK_BREAK = this.create("tumblestone.block_break")
@JvmField
val TUMBLESTONE_HIT = this.create("tumblestone.hit")
@JvmField
val TUMBLESTONE_PLACE = this.create("tumblestone.place")
@JvmField
val TUMBLESTONE_STEP = this.create("tumblestone.step")
@JvmField
val IMPACT_NORMAL = this.create("impact.normal")
@JvmField
val IMPACT_BUG = this.create("impact.bug")
@JvmField
val IMPACT_DARK = this.create("impact.dark")
@JvmField
val IMPACT_DRAGON = this.create("impact.dragon")
@JvmField
val IMPACT_ELECTRIC = this.create("impact.electric")
@JvmField
val IMPACT_FAIRY = this.create("impact.fairy")
@JvmField
val IMPACT_FIGHTING = this.create("impact.fighting")
@JvmField
val IMPACT_FIRE = this.create("impact.fire")
@JvmField
val IMPACT_FLYING = this.create("impact.flying")
@JvmField
val IMPACT_GHOST = this.create("impact.ghost")
@JvmField
val IMPACT_GRASS = this.create("impact.grass")
@JvmField
val IMPACT_GROUND = this.create("impact.ground")
@JvmField
val IMPACT_ICE = this.create("impact.ice")
@JvmField
val IMPACT_POISON = this.create("impact.poison")
@JvmField
val IMPACT_PSYCHIC = this.create("impact.psychic")
@JvmField
val IMPACT_ROCK = this.create("impact.rock")
@JvmField
val IMPACT_STEEL = this.create("impact.steel")
@JvmField
val IMPACT_WATER = this.create("impact.water")
@JvmField
val TUMBLESTONE_SOUNDS = BlockSoundGroup(1f, 1f,
TUMBLESTONE_BREAK,
TUMBLESTONE_STEP,
TUMBLESTONE_PLACE,
TUMBLESTONE_HIT,
TUMBLESTONE_STEP
)
@JvmField
val TUMBLESTONE_BLOCK_SOUNDS = BlockSoundGroup(1f, 1f,
TUMBLESTONE_BLOCK_BREAK,
TUMBLESTONE_STEP,
TUMBLESTONE_PLACE,
TUMBLESTONE_HIT,
TUMBLESTONE_STEP
)
private fun create(name: String): SoundEvent = this.create(name, SoundEvent.of(cobblemonResource(name)))
}
@@ -99,6 +99,13 @@ object CobblemonCriteria {
)
)
val RESURRECT_POKEMON = this.create(
SimpleCriterionTrigger(
cobblemonResource("resurrect_pokemon"),
PickStarterCriterionCondition::class.java
)
)
val TRADE_POKEMON = this.create(
SimpleCriterionTrigger(
cobblemonResource("trade_pokemon"),
@@ -8,9 +8,13 @@
package com.cobblemon.mod.common.api.battles.model
import com.bedrockk.molang.runtime.MoLangEnvironment
import com.bedrockk.molang.runtime.struct.QueryStruct
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.Cobblemon.LOGGER
import com.cobblemon.mod.common.CobblemonNetwork
import com.cobblemon.mod.common.Environment
import com.cobblemon.mod.common.api.battles.interpreter.BattleMessage
import com.cobblemon.mod.common.api.battles.model.actor.ActorType
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor
@@ -18,6 +22,8 @@ import com.cobblemon.mod.common.api.battles.model.actor.EntityBackedBattleActor
import com.cobblemon.mod.common.api.battles.model.actor.FleeableBattleActor
import com.cobblemon.mod.common.api.events.CobblemonEvents
import com.cobblemon.mod.common.api.events.battles.BattleFledEvent
import com.cobblemon.mod.common.api.molang.MoLangFunctions.addFunction
import com.cobblemon.mod.common.api.molang.MoLangFunctions.getQueryStruct
import com.cobblemon.mod.common.api.net.NetworkPacket
import com.cobblemon.mod.common.api.tags.CobblemonItemTags
import com.cobblemon.mod.common.api.text.red
@@ -46,9 +52,9 @@ import com.cobblemon.mod.common.util.battleLang
import com.cobblemon.mod.common.util.getPlayer
import java.io.File
import java.util.UUID
import java.util.concurrent.ConcurrentLinkedQueue
import net.minecraft.server.network.ServerPlayerEntity
import net.minecraft.text.Text
import java.util.concurrent.ConcurrentLinkedDeque
/**
* Individual battle instance
@@ -69,6 +75,7 @@ open class PokemonBattle(
side1.battle = this
side2.battle = this
this.actors.forEach { actor ->
actor.battle = this
actor.pokemonList.forEach { battlePokemon ->
battlePokemon.effectedPokemon.evolutionProxy.current().progress()
.filterIsInstance<LastBattleCriticalHitsEvolutionProgress>()
@@ -102,7 +109,7 @@ open class PokemonBattle(
var dispatchResult = GO
val dispatches = ConcurrentLinkedQueue<BattleDispatch>()
val dispatches = ConcurrentLinkedDeque<BattleDispatch>()
val afterDispatches = mutableListOf<() -> Unit>()
val captureActions = mutableListOf<BattleCaptureAction>()
@@ -252,7 +259,6 @@ open class PokemonBattle(
}
}
sendUpdate(BattleEndPacket())
sendUpdate(BattleMusicPacket(null))
BattleRegistry.closeBattle(this)
}
@@ -319,6 +325,12 @@ open class PokemonBattle(
fun dispatch(dispatcher: () -> DispatchResult) {
dispatches.add(BattleDispatch { dispatcher() })
}
fun dispatchToFront(dispatcher: () -> DispatchResult) {
dispatches.addFirst(BattleDispatch { dispatcher() })
}
fun dispatchGo(dispatcher: () -> Unit) {
@@ -350,6 +362,10 @@ open class PokemonBattle(
dispatches.add(dispatcher)
}
fun dispatchToFront(dispatcher: BattleDispatch) {
dispatches.addFirst(dispatcher)
}
fun doWhenClear(action: () -> Unit) {
afterDispatches.add(action)
}
@@ -454,4 +470,13 @@ open class PokemonBattle(
LOGGER.error("Missing interpretation on '{}' action: \nPublic » {}\nPrivate » {}", publicMessage.id, publicMessage.rawMessage, privateMessage.rawMessage)
return Text.literal("Missing interpretation on '${publicMessage.id}' action please report to the developers").red()
}
fun addQueryFunctions(queryStruct: QueryStruct): QueryStruct {
queryStruct.addFunction("pvp") { DoubleValue(isPvP) }
queryStruct.addFunction("pvn") { DoubleValue(isPvN) }
queryStruct.addFunction("pvw") { DoubleValue(isPvW) }
queryStruct.addFunction("has_rule") { params -> DoubleValue(params.getString(0) in format.ruleSet) }
return queryStruct
}
}
@@ -0,0 +1,125 @@
/*
* 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.dialogue
import com.bedrockk.molang.runtime.MoLangRuntime
import com.bedrockk.molang.runtime.struct.MoStruct
import com.bedrockk.molang.runtime.struct.QueryStruct
import com.bedrockk.molang.runtime.value.DoubleValue
import com.bedrockk.molang.runtime.value.MoValue
import com.bedrockk.molang.runtime.value.StringValue
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.CobblemonNetwork.sendPacket
import com.cobblemon.mod.common.api.dialogue.input.ActiveInput
import com.cobblemon.mod.common.api.molang.MoLangFunctions.addFunctions
import com.cobblemon.mod.common.api.molang.MoLangFunctions.addStandardFunctions
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMoLangValue
import com.cobblemon.mod.common.api.molang.MoLangFunctions.getQueryStruct
import com.cobblemon.mod.common.api.molang.MoLangFunctions.setup
import com.cobblemon.mod.common.api.scheduling.ServerRealTimeTaskTracker
import com.cobblemon.mod.common.net.messages.client.dialogue.DialogueOpenedPacket
import java.util.UUID
import net.minecraft.server.network.ServerPlayerEntity
/**
* An active instance of [Dialogue]. Bound to a player. These all need to be created through DialogueManager
* or things will go to shit.
*
* @author Hiroku
* @since December 27th, 2023
*/
class ActiveDialogue(var playerEntity: ServerPlayerEntity, var dialogueReference: Dialogue) {
val dialogueId = UUID.randomUUID()
val runtime = MoLangRuntime().setup()
var currentPage = dialogueReference.pages[0]
val playerStruct = playerEntity.asMoLangValue()
var activeInput = ActiveInput(this, currentPage.input)
init {
runtime.environment.getQueryStruct().addFunctions(
mapOf(
"dialogue" to java.util.function.Function { _ -> toMoLangStruct() },
"player" to java.util.function.Function { _ -> playerStruct }
)
)
}
val currentPageIndex
get() = dialogueReference.pages.indexOf(currentPage)
fun setPage(value: MoValue) {
val page = if (value is StringValue) {
dialogueReference.pages.find { it.id == value.value }
?: return Cobblemon.LOGGER.error("Dialogue requested page ${value.value} but it doesn't exist")
} else {
val pageNum = value.asDouble().toInt()
if (pageNum < 0 || pageNum >= dialogueReference.pages.size) {
return Cobblemon.LOGGER.error("Dialogue requested page $pageNum but it doesn't exist")
} else {
dialogueReference.pages[pageNum]
}
}
setPage(page)
}
fun isActive() = DialogueManager.activeDialogues[playerEntity.uuid] == this
fun incrementPage() {
setPage(currentPageIndex + 1)
}
fun setPage(page: DialoguePage) {
currentPage = page
activeInput = ActiveInput(this, currentPage.input)
val deadline = currentPage.input.timeout?.duration
val inputId = activeInput.inputId
if (deadline != null && deadline > 0) {
ServerRealTimeTaskTracker.after(seconds = deadline) {
if (inputId == activeInput.inputId && isActive()) {
activeInput.dialogueInput.timeout?.action?.invoke(this, null)
}
}
}
playerEntity.sendPacket(DialogueOpenedPacket(this, false))
}
fun setPage(index: Int) {
if (index == dialogueReference.pages.size) {
return close()
}
if (index < 0 || index > dialogueReference.pages.size) {
return Cobblemon.LOGGER.error("Dialogue requested page $index but it doesn't exist")
}
setPage(dialogueReference.pages[index])
}
fun toMoLangStruct(): MoStruct {
return QueryStruct(
hashMapOf(
"current_page" to java.util.function.Function { _ -> currentPage.toMoLangStruct(this) },
"current_page_number" to java.util.function.Function { _ -> DoubleValue(currentPageIndex) },
"next_page" to java.util.function.Function { _ -> incrementPage() },
"set_page" to java.util.function.Function { args -> setPage(args[0]) },
"close" to java.util.function.Function { _ -> close() },
"input" to java.util.function.Function { params -> activeInput.handle(if (params.params.size > 0) params.get<MoValue>(0).asString() else "") },
)
).addStandardFunctions()
}
fun close() {
DialogueManager.stopDialogue(playerEntity)
}
fun escape() {
val action = currentPage.escapeAction ?: dialogueReference.escapeAction
action(this, null)
}
}
@@ -0,0 +1,50 @@
/*
* 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.dialogue
import com.cobblemon.mod.common.api.molang.ExpressionLike
/**
* A dialogue that could be sent to players.
*
* @author Hiroku
* @since December 27th, 2023
*/
class Dialogue(
val pages: List<DialoguePage> = mutableListOf(),
val escapeAction: DialogueAction = FunctionDialogueAction { dialogue, _ -> dialogue.close() },
val speakers: Map<String, DialogueSpeaker> = emptyMap()
) {
companion object {
fun of(
pages: Iterable<DialoguePage>,
escapeAction: ExpressionLike,
speakers: Map<String, DialogueSpeaker>
): Dialogue {
return Dialogue(
pages = pages.toList(),
escapeAction = ExpressionLikeDialogueAction(escapeAction),
speakers = speakers
)
}
fun of(
pages: Iterable<DialoguePage>,
escapeAction: (ActiveDialogue) -> Unit,
speakers: Map<String, DialogueSpeaker>
): Dialogue {
val dialogue = Dialogue(
pages = pages.toList(),
escapeAction = FunctionDialogueAction { activeDialogue, _ -> escapeAction(activeDialogue) },
speakers = speakers
)
return dialogue
}
}
}
@@ -0,0 +1,44 @@
/*
* 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.dialogue
import com.bedrockk.molang.runtime.value.StringValue
import com.cobblemon.mod.common.api.molang.ExpressionLike
import com.cobblemon.mod.common.util.resolve
/**
* Something that can happen in the context of an [ActiveDialogue]. The input field is nullable because I'm reusing
* this for dialogue input timeouts which don't have an input. It'll be fine.
*
* @author Hiroku
* @since December 29th, 2023
*/
interface DialogueAction {
companion object {
@JvmStatic
val types = mutableMapOf<String, Class<out DialogueAction>>()
}
operator fun invoke(dialogue: ActiveDialogue, input: String? = null)
}
class FunctionDialogueAction(val consumer: (ActiveDialogue, String?) -> Unit) : DialogueAction {
override fun invoke(dialogue: ActiveDialogue, input: String?) {
consumer(dialogue, input)
}
}
class ExpressionLikeDialogueAction(val expression: ExpressionLike) : DialogueAction {
override fun invoke(dialogue: ActiveDialogue, input: String?) {
if (input != null) {
dialogue.runtime.environment.setSimpleVariable("selected_option", StringValue(input))
}
dialogue.runtime.resolve(expression)
}
}
@@ -0,0 +1,46 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.dialogue
import com.cobblemon.mod.common.api.molang.ExpressionLike
import com.cobblemon.mod.common.util.cobblemonResource
import java.util.UUID
import net.minecraft.util.Identifier
/**
* Something that produces a dialogue's renderable face. This is sealed because the client has very particular handling for this.
*
* @author Hiroku
* @since January 1st, 2024
*/
sealed interface DialogueFaceProvider {
companion object {
val types = mutableMapOf(
"player" to PlayerDialogueFaceProvider::class.java,
"standard" to ArtificialDialogueFaceProvider::class.java,
"expression" to ExpressionLikeDialogueFaceProvider::class.java
)
}
}
class ArtificialDialogueFaceProvider(
val modelType: String = "",
val identifier: Identifier = cobblemonResource("bulbasaur"),
val aspects: Set<String> = setOf()
) : DialogueFaceProvider
class ReferenceDialogueFaceProvider(
val entityId: Int
): DialogueFaceProvider
class PlayerDialogueFaceProvider(val playerId: UUID) : DialogueFaceProvider
class ExpressionLikeDialogueFaceProvider(
val providerExpression: ExpressionLike
): DialogueFaceProvider
@@ -0,0 +1,41 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.dialogue
import com.cobblemon.mod.common.CobblemonNetwork.sendPacket
import com.cobblemon.mod.common.net.messages.client.dialogue.DialogueClosedPacket
import com.cobblemon.mod.common.net.messages.client.dialogue.DialogueOpenedPacket
import com.cobblemon.mod.common.util.activeDialogue
import java.util.UUID
import net.minecraft.server.network.ServerPlayerEntity
/**
* Manages the active dialogues for players. Map is indexed by player UUID.
* You really need to make sure any dialogues you start with a player go through this otherwise
* the player won't be able to close the dialogue.
*
* @author Hiroku
* @since December 27th, 2023
*/
object DialogueManager {
val activeDialogues = mutableMapOf<UUID, ActiveDialogue>()
fun startDialogue(playerEntity: ServerPlayerEntity, dialogue: Dialogue) {
val activeDialogue = ActiveDialogue(playerEntity, dialogue)
activeDialogues[playerEntity.uuid] = activeDialogue
val packet = DialogueOpenedPacket(activeDialogue, includeFaces = true)
playerEntity.sendPacket(packet)
}
fun stopDialogue(playerEntity: ServerPlayerEntity) {
val activeDialogue = playerEntity.activeDialogue ?: return
DialogueClosedPacket(activeDialogue.dialogueId).sendToPlayer(playerEntity)
activeDialogues.remove(activeDialogue.dialogueId)
}
}
@@ -0,0 +1,71 @@
/*
* 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.dialogue
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.struct.MoStruct
import com.bedrockk.molang.runtime.struct.QueryStruct
import com.bedrockk.molang.runtime.value.MoValue
import com.bedrockk.molang.runtime.value.StringValue
import com.cobblemon.mod.common.api.dialogue.input.DialogueInput
import com.cobblemon.mod.common.api.dialogue.input.DialogueNoInput
import com.google.gson.JsonArray
import net.minecraft.text.MutableText
/**
* A page of a dialogue. This has lines of text and also some kind of input expected from the player.
*
* @author Hiroku
* @since December 27th, 2023
*/
class DialoguePage(
var id: String = "",
var speaker: String? = null,
var lines: MutableList<DialogueText> = mutableListOf(),
var input: DialogueInput = DialogueNoInput(),
var clientActions: MutableList<Expression> = mutableListOf(),
var escapeAction: DialogueAction? = null,
) {
companion object {
@JvmOverloads
fun of(
/** The ID is optional, but if you want to be able to jump to this page from other pages then you probably want to set this. */
id: String = "",
speaker: String? = null,
lines: Iterable<MutableText>,
input: DialogueInput = DialogueNoInput(),
clientActions: Iterable<Expression> = emptyList(),
/** The thing to do when the player presses ESC while on this page. If null, falls back to the same property on [Dialogue]. */
escapeAction: ((ActiveDialogue) -> Unit)? = null,
): DialoguePage {
return DialoguePage(
id = id,
speaker = speaker,
lines = lines.map { WrappedDialogueText(it) }.toMutableList(),
input = input,
clientActions = clientActions.toMutableList(),
escapeAction = escapeAction?.let { func -> FunctionDialogueAction { activeDialogue, _ -> func(activeDialogue) } }
)
}
}
fun toMoLangStruct(activeDialogue: ActiveDialogue): MoStruct {
return QueryStruct(
hashMapOf(
"id" to java.util.function.Function { _ -> StringValue(id) },
"input" to java.util.function.Function { _ -> activeDialogue.activeInput.struct },
"lines" to java.util.function.Function { _ ->
val array = JsonArray()
lines.forEach { array.add(it(activeDialogue).string) }
MoValue.of(array)
}
)
)
}
}
@@ -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.api.dialogue
import com.cobblemon.mod.common.api.molang.ExpressionLike
import com.cobblemon.mod.common.util.asExpressionLike
import com.cobblemon.mod.common.util.resolveBoolean
/**
* A predicate loaded for a particular dialogue. Tests arbitrary conditions about the dialogue context.
*
* @author Hiroku
* @since December 29th, 2023
*/
interface DialoguePredicate {
companion object {
val types = mutableMapOf<String, Class<out DialoguePredicate>>()
}
operator fun invoke(dialogue: ActiveDialogue): Boolean
}
class ExpressionLikeDialoguePredicate(val expression: ExpressionLike = "true".asExpressionLike()) : DialoguePredicate {
override fun invoke(dialogue: ActiveDialogue) = dialogue.runtime.resolveBoolean(expression)
}
class FunctionDialoguePredicate(val predicate: (ActiveDialogue) -> Boolean = { true }) : DialoguePredicate {
override fun invoke(dialogue: ActiveDialogue) = predicate(dialogue)
}
@@ -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.dialogue
import com.cobblemon.mod.common.api.text.text
import net.minecraft.text.MutableText
/**
* A kind of speaker in a dialogue. They include a name and a face, each optional.
*
* @author Hiroku
* @since January 1st, 2024
*/
class DialogueSpeaker(
val name: DialogueText? = null,
val face: DialogueFaceProvider? = null
) {
fun of(name: MutableText = "".text(), face: DialogueFaceProvider? = null) = DialogueSpeaker(WrappedDialogueText(name), face)
}
@@ -0,0 +1,47 @@
/*
* 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.dialogue
import com.cobblemon.mod.common.api.molang.ExpressionLike
import com.cobblemon.mod.common.api.text.text
import com.cobblemon.mod.common.util.asExpressionLike
import com.cobblemon.mod.common.util.resolveString
import net.minecraft.text.MutableText
/**
* Some kind of text-resolving property. This is to hide where sometimes we want literals,
* sometimes we want the text to come from a function, and sometimes we want it to be the
* product of a MoLang script.
*
* @author Hiroku
* @since December 29th, 2023
*/
interface DialogueText {
companion object {
val types = mutableMapOf<String, Class<out DialogueText>>(
"expression" to ExpressionLikeDialogueText::class.java,
)
}
operator fun invoke(activeDialogue: ActiveDialogue): MutableText
}
class FunctionDialogueText(val function: (ActiveDialogue) -> MutableText = { "".text() }) : DialogueText {
override fun invoke(activeDialogue: ActiveDialogue) = function(activeDialogue)
}
class WrappedDialogueText(val text: MutableText = "".text()) : DialogueText {
override fun invoke(activeDialogue: ActiveDialogue) = text.copy()
}
class ExpressionLikeDialogueText(val expression: ExpressionLike = "''".asExpressionLike()) : DialogueText {
override fun invoke(activeDialogue: ActiveDialogue): MutableText {
return activeDialogue.runtime.resolveString(expression).text()
}
}
@@ -0,0 +1,72 @@
/*
* 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.dialogue
import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.api.data.JsonDataRegistry
import com.cobblemon.mod.common.api.dialogue.input.DialogueInput
import com.cobblemon.mod.common.api.molang.ExpressionLike
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.util.adapters.DialogueActionAdapter
import com.cobblemon.mod.common.util.adapters.DialogueFaceProviderAdapter
import com.cobblemon.mod.common.util.adapters.DialogueInputAdapter
import com.cobblemon.mod.common.util.adapters.DialoguePredicateAdapter
import com.cobblemon.mod.common.util.adapters.DialogueTextAdapter
import com.cobblemon.mod.common.util.adapters.ExpressionAdapter
import com.cobblemon.mod.common.util.adapters.ExpressionLikeAdapter
import com.cobblemon.mod.common.util.adapters.IdentifierAdapter
import com.cobblemon.mod.common.util.adapters.TextAdapter
import com.cobblemon.mod.common.util.cobblemonResource
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import net.minecraft.resource.ResourceType
import net.minecraft.server.network.ServerPlayerEntity
import net.minecraft.text.MutableText
import net.minecraft.text.Text
import net.minecraft.util.Identifier
/**
* Registry for dialogue data.
*
* @see Dialogue
* @since December 29th, 2023
* @author Hiroku
*/
object Dialogues : JsonDataRegistry<Dialogue> {
override val id = cobblemonResource("dialogues")
override val type = ResourceType.SERVER_DATA
override val observable = SimpleObservable<Dialogues>()
val dialogues = mutableMapOf<Identifier, Dialogue>()
/** If you need custom adapters registered, subscribe to this and register them. */
val gsonObservable: SimpleObservable<GsonBuilder> = SimpleObservable()
override fun sync(player: ServerPlayerEntity) {}
override val gson = GsonBuilder()
.registerTypeAdapter(DialogueAction::class.java, DialogueActionAdapter)
.registerTypeAdapter(DialoguePredicate::class.java, DialoguePredicateAdapter)
.registerTypeAdapter(DialogueInput::class.java, DialogueInputAdapter)
.registerTypeAdapter(DialogueFaceProvider::class.java, DialogueFaceProviderAdapter)
.registerTypeAdapter(DialogueText::class.java, DialogueTextAdapter)
.registerTypeAdapter(Expression::class.java, ExpressionAdapter)
.registerTypeAdapter(ExpressionLike::class.java, ExpressionLikeAdapter)
.registerTypeAdapter(MutableText::class.java, TextAdapter)
.registerTypeAdapter(Identifier::class.java, IdentifierAdapter)
.also { gsonObservable.emit(it) }
.create()
override val typeToken = TypeToken.get(Dialogue::class.java)
override val resourcePath = "dialogues"
override fun reload(data: Map<Identifier, Dialogue>) {
dialogues.putAll(data)
observable.emit(this)
}
}
@@ -0,0 +1,42 @@
/*
* 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.dialogue.input
import com.bedrockk.molang.runtime.value.DoubleValue
import com.bedrockk.molang.runtime.value.MoValue
import com.cobblemon.mod.common.api.dialogue.ActiveDialogue
import com.cobblemon.mod.common.util.server
import java.util.UUID
/**
* An active input waiting for the player as part of an [ActiveDialogue]. The purpose of this is to
* maintain some data integrity and track how long it's taken to choose an action.
*
* @author Hiroku
* @since December 27th, 2023
*/
class ActiveInput(
val activeDialogue: ActiveDialogue,
val dialogueInput: DialogueInput
) {
val inputId = UUID.randomUUID()
val startTime = server()!!.overworld.time
val struct = toMoLangStruct()
fun handle(input: String) {
val secondsToChoose = (server()!!.overworld.time - startTime) / 20F
activeDialogue.runtime.environment.setSimpleVariable("seconds_taken_to_input", DoubleValue(secondsToChoose))
dialogueInput.handle(this, input)
}
fun toMoLangStruct(): MoValue {
return dialogueInput.toMoLangStruct(this)
}
}
@@ -0,0 +1,43 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.dialogue.input
import com.bedrockk.molang.runtime.struct.QueryStruct
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.dialogue.DialogueAction
import com.cobblemon.mod.common.api.dialogue.FunctionDialogueAction
/**
* Input that has no input but has an action that will run after a delay.
*
* @author Hiroku
* @since December 27th, 2023
*/
class DialogueAutoContinueInput : DialogueInput {
val delay = 5F
/** Whether the player can click to move on in a hurry or if they must wait. */
var allowSkip = true
var showTimer = false
val action: DialogueAction = FunctionDialogueAction { dialogue, _ -> dialogue.incrementPage() }
override var timeout: DialogueTimeout?
get() = DialogueTimeout(duration = delay, showTimer = showTimer, action)
set(_) {}
override fun toMoLangStruct(activeInput: ActiveInput) = QueryStruct(hashMapOf())
override fun handle(activeInput: ActiveInput, value: String) {
if (!allowSkip) {
return Cobblemon.LOGGER.warn("A no-skip dialogue received input from ${activeInput.activeDialogue.playerEntity.gameProfile.name}, is this person a hacker or something")
}
action.invoke(activeInput.activeDialogue)
}
}
@@ -0,0 +1,24 @@
/*
* 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.dialogue.input
import com.bedrockk.molang.runtime.struct.MoStruct
import com.cobblemon.mod.common.api.dialogue.DialoguePage
/**
* A type of input to [DialoguePage]s. This is sealed because the client needs to know about it. Sorry.
*
* @author Hiroku
* @since December 27th, 2023
*/
sealed interface DialogueInput {
var timeout: DialogueTimeout?
fun toMoLangStruct(activeInput: ActiveInput): MoStruct
fun handle(activeInput: ActiveInput, value: String)
}
@@ -0,0 +1,33 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.dialogue.input
import com.bedrockk.molang.runtime.struct.VariableStruct
import com.cobblemon.mod.common.api.dialogue.DialogueAction
import com.cobblemon.mod.common.api.dialogue.FunctionDialogueAction
/**
* An input type that's really just waiting for the player to click or something.
*
* @author Hiroku
* @since December 27th, 2023
*/
class DialogueNoInput(
var action: DialogueAction = FunctionDialogueAction { dialogue, _ -> dialogue.incrementPage() }
) : DialogueInput {
override var timeout: DialogueTimeout?
get() = null
set(_) {}
override fun toMoLangStruct(activeInput: ActiveInput) = VariableStruct()
override fun handle(activeInput: ActiveInput, value: String) {
action(activeInput.activeDialogue)
}
}
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.dialogue.input
import com.cobblemon.mod.common.api.dialogue.DialogueAction
import com.cobblemon.mod.common.api.dialogue.DialoguePredicate
import com.cobblemon.mod.common.api.dialogue.DialogueText
import com.cobblemon.mod.common.api.dialogue.FunctionDialogueAction
import com.cobblemon.mod.common.api.dialogue.FunctionDialoguePredicate
import com.cobblemon.mod.common.api.dialogue.WrappedDialogueText
/**
* A choosable option as part of a [DialogueOptionSetInput].
*
* @author Hiroku
* @since December 27th, 2023
*/
class DialogueOption(
var text: DialogueText = WrappedDialogueText(),
/** The value is a unique identifier so the client can tell the server what they selected. Don't forget this. */
var value: String = "",
/** The action to run when they click it. */
var action: DialogueAction = FunctionDialogueAction { _, _ -> },
val isVisible: DialoguePredicate = FunctionDialoguePredicate(),
val isSelectable: DialoguePredicate = FunctionDialoguePredicate()
)
@@ -0,0 +1,49 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.dialogue.input
import com.bedrockk.molang.runtime.struct.QueryStruct
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.dialogue.ActiveDialogue
/**
* A type of [DialogueInput] that has the player choose from a list of options.
*
* @author Hiroku
* @since December 27th, 2023
*/
class DialogueOptionSetInput(
var options: MutableList<DialogueOption>,
override var timeout: DialogueTimeout? = null,
/** Whether the buttons should be stacked vertically. */
var vertical: Boolean = false,
) : DialogueInput {
// JSON uses this. Basically so that the main constructor can force people to specify options
constructor() : this(mutableListOf(), null, false)
fun getVisibleOptions(activeDialogue: ActiveDialogue) = options.filter { it.isVisible(activeDialogue) }
override fun toMoLangStruct(activeInput: ActiveInput) = QueryStruct(hashMapOf())
override fun handle(activeInput: ActiveInput, value: String) {
val option = options.firstOrNull { it.value == value }
if (option != null) {
if (!option.isSelectable(activeInput.activeDialogue)) {
Cobblemon.LOGGER.warn("Dialogue option $value is not selectable but ${activeInput.activeDialogue.playerEntity.gameProfile.name} selected it anyway")
activeInput.activeDialogue.close()
} else if (!option.isVisible(activeInput.activeDialogue)) {
Cobblemon.LOGGER.warn("Dialogue option $value is not visible but ${activeInput.activeDialogue.playerEntity.gameProfile.name} selected it anyway")
activeInput.activeDialogue.close()
}
option.action(activeInput.activeDialogue, value)
} else {
Cobblemon.LOGGER.warn("No option with value $value found in dialogue option set")
}
}
}
@@ -0,0 +1,29 @@
/*
* 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.dialogue.input
import com.bedrockk.molang.runtime.struct.QueryStruct
import com.cobblemon.mod.common.api.dialogue.DialogueAction
import com.cobblemon.mod.common.api.dialogue.FunctionDialogueAction
/**
* A text input for dialogues where the player can enter free text.
*
* @author Hiroku
* @since December 27th, 2023
*/
class DialogueTextInput : DialogueInput {
override var timeout: DialogueTimeout? = null
val action: DialogueAction = FunctionDialogueAction { dialogue, _ -> dialogue.setPage(dialogue.currentPageIndex + 1) }
override fun toMoLangStruct(activeInput: ActiveInput) = QueryStruct(hashMapOf())
override fun handle(activeInput: ActiveInput, value: String) {
action.invoke(activeInput.activeDialogue, value)
}
}
@@ -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.dialogue.input
import com.cobblemon.mod.common.api.dialogue.DialogueAction
import com.cobblemon.mod.common.api.dialogue.FunctionDialogueAction
/**
* A deadline for dialogue input. This is used to have something occur if the player spends
* too long on one page of dialogue.
*
* @author Hiroku
* @since December 27th, 2023
*/
class DialogueTimeout(
var duration: Float = 10F,
var showTimer: Boolean = true,
var action: DialogueAction = FunctionDialogueAction { dialogue, _ -> dialogue.close() }
)
@@ -31,14 +31,14 @@ import net.minecraft.util.math.Vec3d
* @author Hiroku
* @since July 24th, 2022
*/
class ItemDropEntry : DropEntry {
open class ItemDropEntry : DropEntry {
override val percentage = 100F
override val quantity = 1
val quantityRange: IntRange? = null
open val quantityRange: IntRange? = null
override val maxSelectableTimes = 1
val dropMethod: ItemDropMethod? = null
val item = Identifier("minecraft:fish")
val nbt: NbtCompound? = null
open val dropMethod: ItemDropMethod? = null
open val item = Identifier("minecraft:fish")
open val nbt: NbtCompound? = null
override fun drop(entity: LivingEntity?, world: ServerWorld, pos: Vec3d, player: ServerPlayerEntity?) {
val item = world.registryManager.get(RegistryKeys.ITEM).get(item) ?: return LOGGER.error("Unable to load drop item: $item")
@@ -9,6 +9,7 @@
package com.cobblemon.mod.common.api.entity
import net.minecraft.entity.Entity
import net.minecraft.entity.data.TrackedData
/**
* Represents a delegation of a portion of an entity's logic to a particular side.
@@ -16,4 +17,5 @@ import net.minecraft.entity.Entity
interface EntitySideDelegate<T : Entity> {
fun initialize(entity: T) {}
fun tick(entity: T) {}
fun onTrackedDataSet(data: TrackedData<*>) {}
}
@@ -33,6 +33,7 @@ import com.cobblemon.mod.common.api.events.pokemon.evolution.EvolutionCompleteEv
import com.cobblemon.mod.common.api.events.pokemon.evolution.EvolutionDisplayEvent
import com.cobblemon.mod.common.api.events.pokemon.evolution.EvolutionTestedEvent
import com.cobblemon.mod.common.api.events.pokemon.interaction.ExperienceCandyUseEvent
import com.cobblemon.mod.common.api.events.pokemon.interaction.PokemonInteractionGUICreationEvent
import com.cobblemon.mod.common.api.events.starter.StarterChosenEvent
import com.cobblemon.mod.common.api.events.storage.ReleasePokemonEvent
import com.cobblemon.mod.common.api.events.world.BigRootPropagatedEvent
@@ -100,6 +101,9 @@ object CobblemonEvents {
@JvmField
val LEVEL_UP_EVENT = EventObservable<LevelUpEvent>()
@JvmField
/** CLIENT ONLY! */
val POKEMON_INTERACTION_GUI_CREATION = EventObservable<PokemonInteractionGUICreationEvent>()
@JvmField
val POKEMON_ENTITY_SAVE = EventObservable<PokemonEntitySaveEvent>()
@JvmField
@@ -153,4 +157,8 @@ object CobblemonEvents {
val LEFTOVERS_CREATED = CancelableObservable<LeftoversCreatedEvent>()
@JvmField
val BIG_ROOT_PROPAGATED = CancelableObservable<BigRootPropagatedEvent>()
@JvmField
val HELD_ITEM_PRE = CancelableObservable<HeldItemEvent.Pre>()
@JvmField
val HELD_ITEM_POST = EventObservable<HeldItemEvent.Post>()
}
@@ -9,26 +9,19 @@
package com.cobblemon.mod.common.api.events.battles
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor
import com.cobblemon.mod.common.api.events.Cancelable
import com.cobblemon.mod.common.battles.BattleFormat
import net.minecraft.text.MutableText
/**
* Event fired before a [PokemonBattle] is started. Canceling this event prevents the battle from being
* created and launched.
*
* @property reason The text used to inform the participants why the battle was canceled. Keep null for a default error.
*
* @author Segfault Guy
* @since March 26th 2023
*/
data class BattleStartedPreEvent (
val participants: Collection<BattleActor>,
val format: BattleFormat,
val isPvP: Boolean,
val isPvN: Boolean,
val isPvW: Boolean
) : Cancelable()
data class BattleStartedPreEvent (override val battle: PokemonBattle, var reason: MutableText? = null) : BattleEvent, Cancelable()
/**
* Event fired after a [PokemonBattle] starts.
@@ -36,8 +29,4 @@ data class BattleStartedPreEvent (
* @author Segfault Guy
* @since March 26th 2023
*/
data class BattleStartedPostEvent (
override val battle: PokemonBattle
) : BattleEvent
data class BattleStartedPostEvent (override val battle: PokemonBattle) : BattleEvent
@@ -0,0 +1,56 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.events.pokemon
import com.cobblemon.mod.common.api.events.Cancelable
import com.cobblemon.mod.common.pokemon.Pokemon
import net.minecraft.item.ItemStack
/**
* The base for all the events related to held items.
*
* @see [Pre]
* @see [Post]
*/
interface HeldItemEvent {
/**
* The [Pokemon] triggering this event.
*/
val pokemon: Pokemon
/**
* Fired at the start of [Pokemon.swapHeldItem].
*
* This event should be used to mutate the results of this transaction.
*
* Canceling this event will prevent the operation and causes the return to be item attempted to be given originally.
*
* @property pokemon The [Pokemon] triggering this event.
* @property receiving The [ItemStack] being sent received from the transaction. By default, this is the item that triggered the interaction.
* @property returning The [ItemStack] being sent back from the transaction. By default, this is the currently held item.
* @property decrement If the operation should decrement the [receiving] [ItemStack.count], this is handled in the implementation.
*
* @see [Post]
*/
data class Pre(override val pokemon: Pokemon, var receiving: ItemStack, var returning: ItemStack, var decrement: Boolean) : HeldItemEvent, Cancelable()
/**
* Fired at the end of [Pokemon.swapHeldItem].
*
* @property pokemon The [Pokemon] triggering this event.
* @property received The [ItemStack] considered as received and set to the [pokemon]. This is a copy and mutation will not be taken into account.
* @property returned The [ItemStack] returned by the method call. This is a copy and mutation will not be taken into account.
* @property decremented If the [received] [ItemStack] got decremented.
*
* @see [Pre]
*/
data class Post(override val pokemon: Pokemon, val received: ItemStack, val returned: ItemStack, val decremented: Boolean) : HeldItemEvent
}
@@ -0,0 +1,42 @@
/*
* 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.events.pokemon.interaction
import com.cobblemon.mod.common.client.gui.interact.wheel.InteractWheelOption
import com.cobblemon.mod.common.client.gui.interact.wheel.Orientation
import com.google.common.collect.Multimap
import java.util.UUID
data class PokemonInteractionGUICreationEvent(
val pokemonID: UUID,
val mountShoulder: Boolean,
val options: Multimap<Orientation, InteractWheelOption>
) {
fun addFillingOption(option: InteractWheelOption) {
options.put(getNextFreeOrientation(), option)
}
fun addOption(orientation: Orientation, option: InteractWheelOption) {
options.put(orientation, option)
}
private fun getNextFreeOrientation(): Orientation {
var largest = Orientation.TOP_LEFT
for(orientation in Orientation.values()) {
if(!options.containsKey(orientation)) {
return orientation
} else {
if(options.get(orientation).size < options.get(largest).size) {
largest = orientation
}
}
}
return largest
}
}
@@ -0,0 +1,80 @@
/*
* 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.fossil
import com.cobblemon.mod.common.api.pokemon.PokemonProperties
import com.cobblemon.mod.common.pokemon.evolution.predicate.NbtItemPredicate
import net.minecraft.item.ItemStack
import net.minecraft.registry.Registries
import net.minecraft.text.MutableText
import net.minecraft.text.Text
import net.minecraft.util.Identifier
import net.minecraft.util.StringIdentifiable
class Fossil(
identifier: Identifier,
val result: PokemonProperties,
val fossils: List<NbtItemPredicate>
): StringIdentifiable {
@Transient
var identifier: Identifier = identifier
internal set
override fun asString(): String {
return identifier.toString()
}
/**
* Gets the name of the fossil.
* @return The name of the fossil.
*/
fun getName(): MutableText = Text.translatable("${identifier.namespace}.fossil.${identifier.path}.name")
/**
* Whether the fossil ingredients match this fossil.
* @param ingredients The ingredients to check.
* @return True if the ingredients match, false otherwise.
*/
fun matchesIngredients(ingredients: List<ItemStack>): Boolean {
if (this.fossils.size != ingredients.size) {
return false
}
return this.fossils.all { fossil ->
ingredients.any { fossil.item.fits(it.item, Registries.ITEM) && fossil.nbt.test(it) }
}
}
/**
* Whether the fossil ingredients match a subset of this fossil.
* @param ingredients The ingredients to check.
* @return True if the ingredients are a subset, false otherwise.
*/
fun matchesIngredientsSubSet(ingredients: List<ItemStack>): Boolean {
if (this.fossils.size < ingredients.size) {
return false
}
return ingredients.all { ingredient ->
ingredients.count { item -> ingredient.itemMatches(item.registryEntry) } <=
this.fossils.count { fossil -> fossil.item.fits(ingredient.item, Registries.ITEM) && fossil.nbt.test(ingredient) }
}
}
/**
* Whether the [ItemStack] is an ingredient for this fossil.
* @param itemStack The [ItemStack] to check.
* @return True if the [ItemStack] is an ingredient, false otherwise.
*/
fun isIngredient(itemStack: ItemStack): Boolean {
return this.fossils.any { it.item.fits(itemStack.item, Registries.ITEM) && it.nbt.test(itemStack) }
}
}
@@ -0,0 +1,107 @@
/*
* 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.fossil
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.conditional.RegistryLikeCondition
import com.cobblemon.mod.common.api.data.JsonDataRegistry
import com.cobblemon.mod.common.api.pokemon.PokemonProperties
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.net.messages.client.fossil.FossilRegistrySyncPacket
import com.cobblemon.mod.common.pokemon.evolution.adapters.NbtItemPredicateAdapter
import com.cobblemon.mod.common.pokemon.evolution.predicate.NbtItemPredicate
import com.cobblemon.mod.common.util.adapters.IdentifierAdapter
import com.cobblemon.mod.common.util.adapters.ItemLikeConditionAdapter
import com.cobblemon.mod.common.util.adapters.pokemonPropertiesShortAdapter
import com.cobblemon.mod.common.util.cobblemonResource
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
import net.minecraft.resource.ResourceType
import net.minecraft.server.network.ServerPlayerEntity
import net.minecraft.util.Identifier
object Fossils: JsonDataRegistry<Fossil> {
override val id: Identifier = cobblemonResource("fossils")
override val type: ResourceType = ResourceType.SERVER_DATA
override val observable = SimpleObservable<Fossils>()
override val gson = GsonBuilder()
.disableHtmlEscaping()
.setPrettyPrinting()
.registerTypeAdapter(Identifier::class.java, IdentifierAdapter)
.registerTypeAdapter(PokemonProperties::class.java, pokemonPropertiesShortAdapter)
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Item::class.java).type, ItemLikeConditionAdapter)
.registerTypeAdapter(NbtItemPredicate::class.java, NbtItemPredicateAdapter)
.create()
override val typeToken: TypeToken<Fossil> = TypeToken.get(Fossil::class.java)
override val resourcePath: String = "fossils"
private val fossils = hashMapOf<Identifier, Fossil>()
override fun reload(data: Map<Identifier, Fossil>) {
this.fossils.clear()
data.forEach { (identifier, fossil) ->
try {
fossil.identifier = identifier
this.fossils[identifier] = fossil
} catch (e: Exception) {
Cobblemon.LOGGER.error("Skipped loading the {} fossil", identifier, e)
}
}
Cobblemon.LOGGER.info("Loaded {} fossils", this.fossils.size)
this.observable.emit(this)
}
override fun sync(player: ServerPlayerEntity) {
FossilRegistrySyncPacket(this.all()).sendToPlayer(player)
}
/**
* Gets all loaded [Fossil]s.
*/
fun all() = this.fossils.values.toList()
/**
* Gets a [Fossil] by its [Identifier].
* @param identifier The identifier of the fossil.
* @return The [Fossil] if loaded, otherwise null.
*/
fun getByIdentifier(identifier: Identifier): Fossil? = this.fossils[identifier]
/**
* Looks for a [Fossil] that matches a [ItemStack].
* @param fossilStacks The fossil [ItemStack]'s.
* @return The [Fossil] if found, otherwise null.
*/
fun getFossilByItemStacks(fossilStacks: List<ItemStack>): Fossil? {
return this.all().firstOrNull { it.matchesIngredients(fossilStacks) }
}
/**
* Looks for a [Fossil] that is a superset of [ItemStack].
* @param fossilStacks The fossil [ItemStack]'s.
* @return The [Fossil] if found to be a superset, otherwise null.
*/
fun getSubFossilByItemStacks(fossilStacks: List<ItemStack>): Fossil? {
return this.all().firstOrNull { it.matchesIngredientsSubSet(fossilStacks) }
}
/**
* Checks if a [ItemStack] is a fossil ingredient.
* @param itemStack The ingredient [ItemStack].
* @return true if it's a fossil ingredient, otherwise false.
*/
fun isFossilIngredient(itemStack: ItemStack): Boolean {
return this.all().any { it.isIngredient(itemStack) }
}
}
@@ -0,0 +1,19 @@
/*
* 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.fossil
import com.cobblemon.mod.common.registry.ItemTagCondition
import net.minecraft.util.Identifier
data class NaturalMaterial(
val content: Int = 0,
val item: Identifier?,
val tag: ItemTagCondition? = null,
val returnItem: Identifier? = null
)
@@ -0,0 +1,90 @@
/*
* 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.fossil
import com.cobblemon.mod.common.api.data.JsonDataRegistry
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.net.messages.client.fossil.NaturalMaterialRegistrySyncPacket
import com.cobblemon.mod.common.registry.ItemTagCondition
import com.cobblemon.mod.common.util.adapters.IdentifierAdapter
import com.cobblemon.mod.common.util.adapters.ItemLikeConditionAdapter
import com.cobblemon.mod.common.util.cobblemonResource
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import net.minecraft.item.ItemStack
import net.minecraft.registry.Registries
import net.minecraft.resource.ResourceType
import net.minecraft.server.network.ServerPlayerEntity
import net.minecraft.util.Identifier
object NaturalMaterials : JsonDataRegistry<List<NaturalMaterial>>{
override val id = cobblemonResource("natural_materials")
override val type = ResourceType.SERVER_DATA
override val observable = SimpleObservable<NaturalMaterials>()
override val typeToken: TypeToken<List<NaturalMaterial>> =
TypeToken.getParameterized(List::class.java, NaturalMaterial::class.java) as TypeToken<List<NaturalMaterial>>
override val resourcePath = "natural_materials"
override val gson: Gson = GsonBuilder()
.setPrettyPrinting()
.registerTypeAdapter(Identifier::class.java, IdentifierAdapter)
.registerTypeAdapter(ItemTagCondition::class.java, ItemLikeConditionAdapter)
.create()
private val itemMap = mutableMapOf<Identifier, NaturalMaterial>()
private val tagMap = mutableMapOf<ItemTagCondition, NaturalMaterial>()
override fun sync(player: ServerPlayerEntity) {
NaturalMaterialRegistrySyncPacket(this.itemMap.values.toList() + this.tagMap.values.toList()).sendToPlayer(player)
}
override fun reload(data: Map<Identifier, List<NaturalMaterial>>) {
data.forEach { entry ->
entry.value.forEach {
itemMap.remove(it.item)
if (it.item != null) {
itemMap[it.item] = it
}
if (it.tag != null) {
tagMap[it.tag] = it
}
}
}
}
fun isNaturalMaterial(item: ItemStack): Boolean {
val itemId = Registries.ITEM.getId(item.item)
return itemId in itemMap.keys || tagMap.keys.any {
it.fits(item.item, Registries.ITEM)
}
}
fun getContent(item: ItemStack): Int? {
val itemId = Registries.ITEM.getId(item.item)
if (itemId in itemMap.keys) {
return itemMap[itemId]?.content
}
val tag = tagMap.keys.firstOrNull { it.fits(item.item, Registries.ITEM) }
if (tag != null) {
return tagMap[tag]?.content
}
return null
}
fun getReturnItem(item: ItemStack): Identifier? {
val itemId = Registries.ITEM.getId(item.item)
if (itemId in itemMap.keys) {
return itemMap[itemId]?.returnItem
}
val tag = tagMap.keys.firstOrNull { it.fits(item.item, Registries.ITEM) }
if (tag != null) {
return tagMap[tag]?.returnItem
}
return null
}
}
@@ -196,6 +196,8 @@ fun drawPortraitPokemon(
val context = RenderContext()
PokemonModelRepository.getTextureNoSubstitute(species.resourceIdentifier, aspects, 0f).let { it -> context.put(RenderContext.TEXTURE, it) }
context.put(RenderContext.SCALE, species.getForm(aspects).baseScale)
context.put(RenderContext.SPECIES, species.resourceIdentifier)
context.put(RenderContext.ASPECTS, aspects)
val renderType = model.getLayer(texture)
@@ -206,10 +208,12 @@ fun drawPortraitPokemon(
if (state == null) {
model.setupAnimStateless(setOf(PoseType.PORTRAIT, PoseType.PROFILE))
} else {
val originalPose = state.currentPose
model.getPose(PoseType.PORTRAIT)?.let { state.setPose(it.poseName) }
state.timeEnteredPose = 0F
state.updatePartialTicks(partialTicks)
model.setupAnimStateful(null, state, 0F, 0F, 0F, 0F, 0F)
originalPose?.let { state.setPose(it) }
}
matrixStack.push()
@@ -0,0 +1,31 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.molang
import com.bedrockk.molang.runtime.MoLangRuntime
import com.bedrockk.molang.runtime.value.MoValue
/**
* An object that can be given a [MoLangRuntime] to produce a single [MoValue]. This abstracts
* the use of simple and complex [Expression]s as MoLang can be a single line or multiple.
*
* @author Hiroku
* @since October 22nd, 2023
*/
interface ExpressionLike {
/** Produces a [MoValue] for a [MoLangRuntime] to supply an environment. */
fun resolve(runtime: MoLangRuntime): MoValue
fun resolveDouble(runtime: MoLangRuntime) = resolve(runtime).asDouble()
fun resolveFloat(runtime: MoLangRuntime) = resolveDouble(runtime).toFloat()
fun resolveString(runtime: MoLangRuntime) = resolve(runtime).asString()
fun resolveInt(runtime: MoLangRuntime) = resolveDouble(runtime).toInt()
fun resolveBoolean(runtime: MoLangRuntime) = resolveDouble(runtime) == 1.0
fun resolveObject(runtime: MoLangRuntime) = resolve(runtime) as ObjectValue<*>
}
@@ -0,0 +1,23 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.molang
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.MoLangRuntime
import com.cobblemon.mod.common.util.resolve
/**
* An [ExpressionLike] that produces MoValues by evaluating a series of [Expression]s.
*
* @author Hiroku
* @since October 22nd, 2023
*/
class ListExpression(val exprs: List<Expression>): ExpressionLike {
override fun resolve(runtime: MoLangRuntime) = exprs.resolve(runtime)
}
@@ -0,0 +1,196 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.molang
import com.bedrockk.molang.runtime.MoLangEnvironment
import com.bedrockk.molang.runtime.MoLangRuntime
import com.bedrockk.molang.runtime.MoParams
import com.bedrockk.molang.runtime.struct.ArrayStruct
import com.bedrockk.molang.runtime.struct.QueryStruct
import com.bedrockk.molang.runtime.struct.VariableStruct
import com.bedrockk.molang.runtime.value.DoubleValue
import com.bedrockk.molang.runtime.value.MoValue
import com.bedrockk.molang.runtime.value.StringValue
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.dialogue.PlayerDialogueFaceProvider
import com.cobblemon.mod.common.client.render.models.blockbench.wavefunction.WaveFunction
import com.cobblemon.mod.common.client.render.models.blockbench.wavefunction.WaveFunctions
import com.cobblemon.mod.common.util.isInt
import com.cobblemon.mod.common.util.itemRegistry
import net.minecraft.block.Block
import net.minecraft.nbt.NbtCompound
import net.minecraft.nbt.NbtDouble
import net.minecraft.nbt.NbtElement
import net.minecraft.nbt.NbtList
import net.minecraft.nbt.NbtString
import net.minecraft.registry.Registry
import net.minecraft.registry.RegistryKey
import net.minecraft.registry.RegistryKeys
import net.minecraft.registry.entry.RegistryEntry
import net.minecraft.registry.tag.TagKey
import net.minecraft.server.network.ServerPlayerEntity
import net.minecraft.util.Identifier
import net.minecraft.world.World
import net.minecraft.world.biome.Biome
import net.minecraft.world.dimension.DimensionType
/**
* Holds a bunch of useful MoLang trickery that can be used or extended in API
*
* @author Hiroku
* @since October 2nd, 2023
*/
object MoLangFunctions {
val generalFunctions = hashMapOf<String, java.util.function.Function<MoParams, Any>>(
"is_int" to java.util.function.Function { params -> DoubleValue(params.get<MoValue>(0).asString().isInt()) },
"is_number" to java.util.function.Function { params -> DoubleValue(params.get<MoValue>(0).asString().toDoubleOrNull() != null) },
"to_number" to java.util.function.Function { params -> DoubleValue(params.get<MoValue>(0).asString().toDoubleOrNull() ?: 0.0) },
"to_int" to java.util.function.Function { params -> DoubleValue(params.get<MoValue>(0).asString().toIntOrNull() ?: 0) },
"to_string" to java.util.function.Function { params -> StringValue(params.get<MoValue>(0).asString()) },
"do_effect_walks" to java.util.function.Function { _ ->
DoubleValue(Cobblemon.config.walkingInBattleAnimations)
},
"random" to java.util.function.Function { params ->
val options = mutableListOf<MoValue>()
var index = 0
while (params.contains(index)) {
options.add(params.get(index))
index++
}
return@Function options.random() // Can throw an exception if they specified no args. They'd be idiots though.
},
"curve" to java.util.function.Function { params ->
val curveName = params.getString(0)
val curve = WaveFunctions.functions[curveName] ?: throw IllegalArgumentException("Unknown curve: $curveName")
return@Function ObjectValue(curve)
},
"array" to java.util.function.Function { params ->
val values = params.params
val array = ArrayStruct(hashMapOf())
values.forEachIndexed { index, moValue -> array.setDirectly("$index", moValue) }
return@Function array
}
)
val biomeFunctions = hashMapOf<String, java.util.function.Function<MoParams, Any>>()
val worldFunctions = hashMapOf<String, java.util.function.Function<MoParams, Any>>()
val dimensionTypeFunctions = hashMapOf<String, java.util.function.Function<MoParams, Any>>()
val blockFunctions = hashMapOf<String, java.util.function.Function<MoParams, Any>>()
val playerFunctions = mutableListOf<(ServerPlayerEntity) -> HashMap<String, java.util.function.Function<MoParams, Any>>>(
{ player ->
hashMapOf(
"username" to java.util.function.Function { _ -> StringValue(player.gameProfile.name) },
"uuid" to java.util.function.Function { _ -> StringValue(player.gameProfile.id.toString()) },
"data" to java.util.function.Function { _ -> return@Function Cobblemon.molangData.load(player.uuid) },
"save_data" to java.util.function.Function { _ -> Cobblemon.molangData.save(player.uuid) },
"main_held_item" to java.util.function.Function { _ -> player.world.itemRegistry.getEntry(player.mainHandStack.item).asMoLangValue(RegistryKeys.ITEM) },
"off_held_item" to java.util.function.Function { _ -> player.world.itemRegistry.getEntry(player.offHandStack.item).asMoLangValue(RegistryKeys.ITEM) },
"face" to java.util.function.Function { _ -> ObjectValue(PlayerDialogueFaceProvider(player.uuid)) }
)
}
)
fun RegistryEntry<Biome>.asBiomeMoLangValue() = asMoLangValue(RegistryKeys.BIOME).addFunctions(biomeFunctions)
fun RegistryEntry<World>.asWorldMoLangValue() = asMoLangValue(RegistryKeys.WORLD).addFunctions(worldFunctions)
fun RegistryEntry<Block>.asBlockMoLangValue() = asMoLangValue(RegistryKeys.BLOCK).addFunctions(blockFunctions)
fun RegistryEntry<DimensionType>.asDimensionTypeMoLangValue() = asMoLangValue(RegistryKeys.DIMENSION_TYPE).addFunctions(dimensionTypeFunctions)
fun ServerPlayerEntity.asMoLangValue(): ObjectValue<ServerPlayerEntity> {
val value = ObjectValue(
obj = this,
stringify = { it.entityName }
)
value.addFunctions(playerFunctions.flatMap { it(this).entries.map { it.key to it.value } }.toMap())
return value
}
fun <T> RegistryEntry<T>.asMoLangValue(key: RegistryKey<Registry<T>>): ObjectValue<RegistryEntry<T>> {
val value = ObjectValue(
obj = this,
stringify = { it.key.get().value.toString() }
)
value.functions.put("is_in") {
val tag = TagKey.of(key, Identifier(it.getString(0).replace("#", "")))
return@put DoubleValue(if (value.obj.isIn(tag)) 1.0 else 0.0)
}
value.functions.put("is_of") {
val identifier = Identifier(it.getString(0))
return@put DoubleValue(if (value.obj.matchesId(identifier)) 1.0 else 0.0)
}
return value
}
fun QueryStruct.addStandardFunctions(): QueryStruct {
functions.putAll(generalFunctions)
return this
}
fun <T : QueryStruct> T.addFunctions(functions: Map<String, java.util.function.Function<MoParams, Any>>): T {
this.functions.putAll(functions)
return this
}
fun <T : QueryStruct> T.addFunction(name: String, function: java.util.function.Function<MoParams, Any>): T {
this.functions[name] = function
return this
}
fun MoLangEnvironment.getQueryStruct(name: String = "query") = structs.getOrPut(name) { QueryStruct(hashMapOf()) } as QueryStruct
fun MoLangRuntime.setup(): MoLangRuntime {
environment.getQueryStruct().addStandardFunctions()
return this
}
fun writeMoValueToNBT(value: MoValue): NbtElement? {
return when (value) {
is DoubleValue -> NbtDouble.of(value.value)
is StringValue -> NbtString.of(value.value)
is ArrayStruct -> {
val list = value.map.values
val nbtList = NbtList()
list.mapNotNull(::writeMoValueToNBT).forEach(nbtList::add)
nbtList
}
is VariableStruct -> {
val nbt = NbtCompound()
value.map.forEach { (key, value) ->
val element = writeMoValueToNBT(value) ?: return@forEach
nbt.put(key, element)
}
nbt
}
else -> null
}
}
fun readMoValueFromNBT(nbt: NbtElement): MoValue {
return when (nbt) {
is NbtDouble -> DoubleValue(nbt.doubleValue())
is NbtString -> StringValue(nbt.asString())
is NbtList -> {
val array = ArrayStruct(hashMapOf())
var index = 0
nbt.forEach { element ->
val value = readMoValueFromNBT(element)
array.setDirectly("$index", value)
index++
}
array
}
is NbtCompound -> {
val variable = VariableStruct(hashMapOf())
nbt.keys.toList().forEach { key ->
val value = readMoValueFromNBT(nbt[key]!!)
variable.map[key] = value
}
variable
}
else -> null
} ?: throw IllegalArgumentException("Invalid NBT element type: ${nbt.type}")
}
}
@@ -0,0 +1,28 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.molang
import com.bedrockk.molang.runtime.struct.QueryStruct
import com.bedrockk.molang.runtime.value.MoValue
/**
* A [MoValue] that just wraps around some other object value. It's for good and valid reasons.
*
* @author Hiroku
* @since October 2nd, 2023
*/
class ObjectValue<T>(
var obj: T,
val stringify: (T) -> String = { it.toString() },
val doublify: (T) -> Double = { throw NotImplementedError("Doublify not implemented for this object value, are you doing weird molang") }
) : QueryStruct(hashMapOf()) {
override fun value() = this
override fun asDouble() = doublify(obj)
override fun asString() = stringify(obj)
}
@@ -0,0 +1,24 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.molang
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.MoLangRuntime
import com.cobblemon.mod.common.util.resolve
/**
* A simple implementation of [ExpressionLike] that is just a single [Expression]. This
* is as opposed to [ListExpression]s.
*
* @author Hiroku
* @since October 22nd, 2023
*/
class SingleExpression(val expr: Expression) : ExpressionLike {
override fun resolve(runtime: MoLangRuntime) = runtime.resolve(expr)
}
@@ -8,6 +8,12 @@
package com.cobblemon.mod.common.api.moves
import com.bedrockk.molang.runtime.struct.MoStruct
import com.bedrockk.molang.runtime.struct.QueryStruct
import com.bedrockk.molang.runtime.value.DoubleValue
import com.bedrockk.molang.runtime.value.StringValue
import com.cobblemon.mod.common.api.molang.MoLangFunctions.addFunction
import com.cobblemon.mod.common.api.moves.animations.ActionEffectTimeline
import com.cobblemon.mod.common.api.moves.categories.DamageCategories
import com.cobblemon.mod.common.api.moves.categories.DamageCategory
import com.cobblemon.mod.common.api.types.ElementalType
@@ -45,8 +51,22 @@ open class MoveTemplate(
val pp: Int,
val priority: Int,
val critRatio: Double,
val effectChances: Array<Double>
val effectChances: Array<Double>,
val actionEffect: ActionEffectTimeline?
) {
val struct: MoStruct by lazy {
QueryStruct(hashMapOf())
.addFunction("name") { StringValue(name) }
.addFunction("type") { StringValue(elementalType.name) }
.addFunction("damage_category") { StringValue(damageCategory.name) }
.addFunction("power") { DoubleValue(power) }
.addFunction("target") { StringValue(target.name) }
.addFunction("accuracy") { DoubleValue(accuracy) }
.addFunction("pp") { DoubleValue(pp) }
.addFunction("priority") { DoubleValue(priority) }
.addFunction("crit_ratio") { DoubleValue(critRatio) }
}
val displayName: MutableText
get() = lang("move.$name")
@@ -65,7 +85,8 @@ open class MoveTemplate(
pp = 5,
priority = 0,
critRatio = 0.0,
effectChances = emptyArray()
effectChances = emptyArray(),
actionEffect = null
)
companion object {
@@ -10,12 +10,15 @@ package com.cobblemon.mod.common.api.moves
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.data.DataRegistry
import com.cobblemon.mod.common.api.moves.animations.ActionEffectTimeline
import com.cobblemon.mod.common.api.moves.animations.ActionEffects
import com.cobblemon.mod.common.api.moves.categories.DamageCategories
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.api.types.ElementalTypes
import com.cobblemon.mod.common.battles.MoveTarget
import com.cobblemon.mod.common.battles.runner.ShowdownService
import com.cobblemon.mod.common.net.messages.client.data.MovesRegistrySyncPacket
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import com.cobblemon.mod.common.util.cobblemonResource
import com.google.gson.JsonArray
import com.google.gson.JsonObject
@@ -72,7 +75,18 @@ object Moves : DataRegistry {
effectChances += secondaryMember.get("chance").asDouble
}
}
val move = MoveTemplate(id, num, elementalType, damageCategory, power, target, accuracy, pp, priority, critRatio, effectChances.toTypedArray())
val actionEffect = ActionEffects.actionEffects[id.asIdentifierDefaultingNamespace()]
?: run {
ActionEffects.actionEffects["generic_move".asIdentifierDefaultingNamespace()]
// if (damageCategory == DamageCategories.STATUS) {
// ActionEffects.actionEffects[cobblemonResource("status")]
// } else {
// val type = elementalType.name.lowercase()
// val category = damageCategory.name.lowercase()
// ActionEffects.actionEffects["${category}_$type".asIdentifierDefaultingNamespace()]
// }
}
val move = MoveTemplate(id, num, elementalType, damageCategory, power, target, accuracy, pp, priority, critRatio, effectChances.toTypedArray(), actionEffect)
this.register(move)
} catch (e: Exception) {
Cobblemon.LOGGER.error("Caught exception trying to resolve the move '{}'", id, e)
@@ -0,0 +1,94 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations
import com.bedrockk.molang.Expression
import com.bedrockk.molang.runtime.MoLangRuntime
import com.bedrockk.molang.runtime.struct.VariableStruct
import com.cobblemon.mod.common.api.moves.animations.keyframes.ActionEffectKeyframe
import com.cobblemon.mod.common.api.scheduling.ScheduledTask
import com.cobblemon.mod.common.util.asExpression
import com.cobblemon.mod.common.util.resolveBoolean
import java.util.concurrent.CompletableFuture
import net.minecraft.entity.Entity
/**
* An action effect will run and execute a series of 'keyframes', with each running once
* the previous has completed. The entire effect is considered complete for the given context
* once all the 'holds' provided in the context have been cleared or once every keyframe
* has finished.
*
* @author Hiroku
* @since October 20th, 2023
*/
class ActionEffectTimeline(
val timeline: List<ActionEffectKeyframe> = mutableListOf(),
val condition: Expression = "true".asExpression()
) {
companion object {
val NONE = ActionEffectTimeline()
}
fun run(context: ActionEffectContext): CompletableFuture<Unit> {
return if (timeline.isEmpty() || !context.runtime.resolveBoolean(condition)) {
CompletableFuture.completedFuture(Unit)
} else {
val finalFuture = CompletableFuture<Unit>()
// .toList copy because I'm paranoid about iterators being trying to share between identical effects playing
chainKeyframes(context, timeline.toList().iterator(), finalFuture)
finalFuture
}
}
fun chainKeyframes(context: ActionEffectContext, iterator: Iterator<ActionEffectKeyframe>, finalFuture: CompletableFuture<Unit>) {
if (!iterator.hasNext()) {
finalFuture.complete(Unit)
} else {
val keyframe = iterator.next()
context.currentKeyframes.add(keyframe)
keyframe.play(context)
.thenRun { context.currentKeyframes.remove(keyframe) }
.thenApply { chainKeyframes(context, iterator, finalFuture) }
}
}
}
class ActionEffectContext(
val actionEffect: ActionEffectTimeline,
val holds: MutableSet<String> = mutableSetOf(),
val providers: MutableList<Any> = mutableListOf(),
val runtime: MoLangRuntime,
var canBeInterrupted: Boolean = false,
var interrupted: Boolean = false,
var currentKeyframes: MutableList<ActionEffectKeyframe> = mutableListOf()
) {
inline fun <reified T> findOneProvider() = providers.filterIsInstance<T>().firstOrNull()
}
class UsersProvider(users: List<Entity>): EntityProvider {
override val entities = users
constructor(vararg users: Entity): this(users.toList())
}
class TargetsProvider(targets: List<Entity>): EntityProvider {
override val entities = targets
constructor(vararg targets: Entity): this(targets.toList())
}
interface EntityProvider {
val entities: List<Entity>
}
//class MoveAnimationKeyframe(
// val sound: Identifier? = null,
// val animation: List<AnimationWithMoments> = listOf(),
// val effects: List<ActionEffect> = listOf()
//)
@@ -0,0 +1,95 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations
import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.api.data.JsonDataRegistry
import com.cobblemon.mod.common.api.molang.ExpressionLike
import com.cobblemon.mod.common.api.moves.animations.keyframes.*
import com.cobblemon.mod.common.api.pokemon.stats.Stat
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.pokemon.adapters.CobblemonStatTypeAdapter
import com.cobblemon.mod.common.util.adapters.*
import com.cobblemon.mod.common.util.cobblemonResource
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import java.awt.Color
import net.minecraft.predicate.NumberRange
import net.minecraft.resource.ResourceType
import net.minecraft.server.network.ServerPlayerEntity
import net.minecraft.util.Identifier
import net.minecraft.util.math.Box
import net.minecraft.util.math.Vec3d
/**
* Data registry containing all of the [ActionEffectTimeline]s that can be triggered from various actions.
*
* @author Hiroku
* @since October 21st, 2023
*/
object ActionEffects : JsonDataRegistry<ActionEffectTimeline> {
override val id: Identifier = cobblemonResource("action_effects")
override val type: ResourceType = ResourceType.SERVER_DATA
override val observable = SimpleObservable<ActionEffects>()
init {
ActionEffectKeyframe.register<AnimationActionEffectKeyframe>("animation")
ActionEffectKeyframe.register<EntityMoLangActionEffectKeyframe>("entity_molang")
ActionEffectKeyframe.register<MoLangActionEffectKeyframe>("molang")
ActionEffectKeyframe.register<ParallelActionEffectKeyframe>("parallel")
ActionEffectKeyframe.register<CanInterruptActionEffectKeyframe>("can_interrupt")
ActionEffectKeyframe.register<CannotInterruptActionEffectKeyframe>("cannot_interrupt")
ActionEffectKeyframe.register<RemoveHoldsActionEffectKeyframe>("remove_holds")
ActionEffectKeyframe.register<AddHoldsActionEffectKeyframe>("add_holds")
ActionEffectKeyframe.register<MoveToTargetActionEffectKeyframe>("move_to_target")
ActionEffectKeyframe.register<ReturnToPositionActionEffectKeyframe>("return_to_position")
ActionEffectKeyframe.register<PauseActionEffectKeyframe>("pause")
ActionEffectKeyframe.register<SavePositionActionEffectKeyframe>("save_position")
ActionEffectKeyframe.register<ForkActionEffectKeyframe>("fork")
ActionEffectKeyframe.register<SequenceActionEffectKeyframe>("sequence")
ActionEffectKeyframe.register<RunActionEffectKeyframe>("run_action_effect")
ActionEffectKeyframe.register<EntityParticlesActionEffectKeyframe>("entity_particles")
ActionEffectKeyframe.register<EntitySoundActionEffectKeyframe>("entity_sound")
}
override val gson = GsonBuilder()
.disableHtmlEscaping()
.setPrettyPrinting()
.registerTypeAdapter(ActionEffectKeyframe::class.java, ActionEffectKeyframeAdapter)
.registerTypeAdapter(NumberRange.FloatRange::class.java, FloatNumberRangeAdapter)
.registerTypeAdapter(TypeToken.getParameterized(Collection::class.java, Box::class.java).type, BoxCollectionAdapter)
.registerTypeAdapter(Box::class.java, BoxAdapter)
.registerTypeAdapter(Vec3d::class.java, VerboseVec3dAdapter)
.registerTypeAdapter(Identifier::class.java, IdentifierAdapter)
.registerTypeAdapter(IntRange::class.java, VerboseIntRangeAdapter)
.registerTypeAdapter(Color::class.java, LiteralHexColorAdapter)
.registerTypeAdapter(Stat::class.java, CobblemonStatTypeAdapter)
.registerTypeAdapter(Expression::class.java, ExpressionAdapter)
.registerTypeAdapter(ExpressionLike::class.java, ExpressionLikeAdapter)
.registerTypeAdapter(
TypeToken.getParameterized(
TypeToken.get(List::class.java).type,
TypeToken.get(ActionEffectKeyframe::class.java).type
).type,
SingleToPluralAdapter(ActionEffectKeyframe::class.java) { it }
)
.create()
override val typeToken: TypeToken<ActionEffectTimeline> = TypeToken.get(ActionEffectTimeline::class.java)
override val resourcePath = "action_effects"
val actionEffects = mutableMapOf<Identifier, ActionEffectTimeline>()
override fun reload(data: Map<Identifier, ActionEffectTimeline>) {
actionEffects.clear()
actionEffects.putAll(data)
observable.emit(this)
}
override fun sync(player: ServerPlayerEntity) {}
}
@@ -0,0 +1,34 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations.keyframes
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import java.util.concurrent.CompletableFuture
/**
* A single component of an action effect. When played it must return a completable future that completes
* when the action this keyframe represents is finished. [interrupt] is provided for when something successfully
* interrupts the effect so that if any cancellation logic is necessary, it can be provided.
*
* @author Hiroku
* @since October 26th, 2023
*/
interface ActionEffectKeyframe {
companion object {
val types = mutableMapOf<String, Class<out ActionEffectKeyframe>>()
inline fun <reified T : ActionEffectKeyframe> register(type: String) {
types[type] = T::class.java
}
}
fun play(context: ActionEffectContext): CompletableFuture<Unit>
fun interrupt(context: ActionEffectContext) {}
fun skip(): CompletableFuture<Unit> = CompletableFuture.completedFuture(Unit)
}
@@ -0,0 +1,27 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations.keyframes
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import java.util.concurrent.CompletableFuture
/**
* An [ActionEffectKeyframe] that adds some holds from the context for future code to recognize as blocking some
* functionality from proceeding.
*
* @author Hiroku
* @since October 27th, 2023
*/
class AddHoldsActionEffectKeyframe : ActionEffectKeyframe {
val holds = mutableSetOf<String>()
override fun play(context: ActionEffectContext): CompletableFuture<Unit> {
context.holds.addAll(holds)
return CompletableFuture.completedFuture(Unit)
}
}
@@ -0,0 +1,54 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations.keyframes
import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.CobblemonNetwork.sendPacket
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import com.cobblemon.mod.common.api.moves.animations.EntityProvider
import com.cobblemon.mod.common.api.moves.animations.UsersProvider
import com.cobblemon.mod.common.api.scheduling.delayedFuture
import com.cobblemon.mod.common.net.messages.client.animation.PlayPoseableAnimationPacket
import com.cobblemon.mod.common.util.asExpressionLike
import java.util.concurrent.CompletableFuture
import net.minecraft.server.world.ServerWorld
class AnimationActionEffectKeyframe : ConditionalActionEffectKeyframe(), EntityConditionalActionEffectKeyframe {
var delay = "0".asExpressionLike()
var visibilityRange = 200
var animation: Set<String> = setOf("physical")
var variables: List<Expression> = listOf()
override val entityCondition = "q.entity.is_user".asExpressionLike()
override fun playWhenTrue(context: ActionEffectContext): CompletableFuture<Unit> {
val entities = context.providers
.filterIsInstance<EntityProvider>()
.flatMap { prov -> prov.entities.filter { test(context, it, isUser = prov is UsersProvider) } }
val expressions = variables.map { it.originalString }.toSet()
// Treat them as expressions if possible but otherwise yeah just send them as strings
val animation = animation.map {
try {
it.asExpressionLike().resolveString(context.runtime).takeIf { it != "0.0" } ?: it
} catch (e: Exception) {
it
}
}.toSet()
for (entity in entities) {
val world = entity.world as ServerWorld
val players = world.getPlayers { it.distanceTo(entity) <= visibilityRange }
val pkt = PlayPoseableAnimationPacket(entity.id, animation = animation, expressions = expressions)
players.forEach { it.sendPacket(pkt) }
}
return delayedFuture(seconds = delay.resolveFloat(context.runtime), serverThread = true)
}
}
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations.keyframes
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import java.util.concurrent.CompletableFuture
class CanInterruptActionEffectKeyframe : ConditionalActionEffectKeyframe() {
override fun playWhenTrue(context: ActionEffectContext): CompletableFuture<Unit> {
context.canBeInterrupted = true
return CompletableFuture.completedFuture(Unit)
}
}
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations.keyframes
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import java.util.concurrent.CompletableFuture
class CannotInterruptActionEffectKeyframe : ConditionalActionEffectKeyframe() {
override fun playWhenTrue(context: ActionEffectContext): CompletableFuture<Unit> {
context.canBeInterrupted = true
return CompletableFuture.completedFuture(Unit)
}
}
@@ -0,0 +1,27 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations.keyframes
import com.cobblemon.mod.common.api.molang.ExpressionLike
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import com.cobblemon.mod.common.util.asExpressionLike
import java.util.concurrent.CompletableFuture
abstract class ConditionalActionEffectKeyframe : ActionEffectKeyframe {
var condition: ExpressionLike = "true".asExpressionLike()
override fun play(context: ActionEffectContext): CompletableFuture<Unit> {
return if (condition.resolveBoolean(context.runtime)) {
playWhenTrue(context)
} else {
skip()
}
}
abstract fun playWhenTrue(context: ActionEffectContext): CompletableFuture<Unit>
}
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations.keyframes
import com.bedrockk.molang.runtime.struct.QueryStruct
import com.bedrockk.molang.runtime.value.DoubleValue
import com.bedrockk.molang.runtime.value.StringValue
import com.cobblemon.mod.common.api.molang.ExpressionLike
import com.cobblemon.mod.common.api.molang.MoLangFunctions.getQueryStruct
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import net.minecraft.entity.Entity
/**
* An action effect keyframe that plays for all entities for which the condition is true.
*
* @author Hiroku
* @since January 21st, 2024
*/
interface EntityConditionalActionEffectKeyframe {
val entityCondition: ExpressionLike
fun test(context: ActionEffectContext, entity: Entity, isUser: Boolean): Boolean {
// TODO this should use the entity's own query struct
context.runtime.environment.getQueryStruct().addFunction("entity") {
QueryStruct(hashMapOf())
.addFunction("uuid") { StringValue(entity.uuidAsString) }
.addFunction("is_user") { DoubleValue(isUser) }
}
return entityCondition.resolveBoolean(context.runtime)
}
}
@@ -0,0 +1,51 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations.keyframes
import com.cobblemon.mod.common.CobblemonNetwork.sendPacket
import com.cobblemon.mod.common.api.molang.ExpressionLike
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import com.cobblemon.mod.common.api.moves.animations.EntityProvider
import com.cobblemon.mod.common.api.moves.animations.UsersProvider
import com.cobblemon.mod.common.api.scheduling.delayedFuture
import com.cobblemon.mod.common.net.messages.client.effect.RunPosableMoLangPacket
import com.cobblemon.mod.common.util.asExpressionLike
import java.util.concurrent.CompletableFuture
import net.minecraft.server.world.ServerWorld
/**
* An action effect keyframe that will run client-side MoLang for all entities that fit the entity condition.
*
* This MoLang executes within that entity's runtime, meaning you can trigger animations or locational particles
* or sounds.
*
* @author Hiroku
* @since October 30th, 2023
*/
class EntityMoLangActionEffectKeyframe : ConditionalActionEffectKeyframe(), EntityConditionalActionEffectKeyframe {
var delay = "0".asExpressionLike()
val expressions = mutableSetOf<String>()
val visibilityRange = 200
override val entityCondition: ExpressionLike = "q.entity.is_user".asExpressionLike()
override fun playWhenTrue(context: ActionEffectContext): CompletableFuture<Unit> {
val entities = context.providers
.filterIsInstance<EntityProvider>()
.flatMap { prov -> prov.entities.filter { test(context, it, isUser = prov is UsersProvider) } }
for (entity in entities) {
val world = entity.world as ServerWorld
val players = world.getPlayers { it.distanceTo(entity) <= visibilityRange }
val pkt = RunPosableMoLangPacket(entityId = entity.id, expressions = expressions)
players.forEach { it.sendPacket(pkt) }
}
return delayedFuture(seconds = delay.resolveFloat(context.runtime), serverThread = true)
}
}
@@ -0,0 +1,56 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations.keyframes
import com.cobblemon.mod.common.CobblemonNetwork.sendPacket
import com.cobblemon.mod.common.api.molang.ExpressionLike
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import com.cobblemon.mod.common.api.moves.animations.EntityProvider
import com.cobblemon.mod.common.api.moves.animations.UsersProvider
import com.cobblemon.mod.common.api.scheduling.delayedFuture
import com.cobblemon.mod.common.entity.Poseable
import com.cobblemon.mod.common.net.messages.client.effect.SpawnSnowstormEntityParticlePacket
import com.cobblemon.mod.common.util.asExpressionLike
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import java.util.concurrent.CompletableFuture
import net.minecraft.server.world.ServerWorld
/**
* Spawns particles on the entity based on the given particle effect and locator.
*
* @author Hiroku
* @since January 21st, 2024
*/
class EntityParticlesActionEffectKeyframe : ConditionalActionEffectKeyframe(), EntityConditionalActionEffectKeyframe {
override val entityCondition = "q.entity.is_user".asExpressionLike()
var effect: String? = null
var locator: String = "root"
val delay: ExpressionLike = "0".asExpressionLike()
val visibilityRange = 200
override fun playWhenTrue(context: ActionEffectContext): CompletableFuture<Unit> {
val entities = context.providers
.filterIsInstance<EntityProvider>()
.flatMap { prov -> prov.entities.filter { test(context, it, isUser = prov is UsersProvider) } }
val effectIdentifier = try {
effect?.asExpressionLike()?.resolveString(context.runtime)
} catch (e: Exception) {
effect
}?.asIdentifierDefaultingNamespace() ?: return skip()
entities.filter { it is Poseable }.forEach { entity ->
val packet = SpawnSnowstormEntityParticlePacket(effectIdentifier, entity.id, locator)
val players = (entity.world as ServerWorld).getPlayers { it.distanceTo(entity) <= visibilityRange }
packet.sendToPlayers(players)
}
return delayedFuture(seconds = delay.resolveFloat(context.runtime), serverThread = true)
}
}
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations.keyframes
import com.cobblemon.mod.common.api.molang.ExpressionLike
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import com.cobblemon.mod.common.api.moves.animations.EntityProvider
import com.cobblemon.mod.common.api.moves.animations.UsersProvider
import com.cobblemon.mod.common.api.scheduling.delayedFuture
import com.cobblemon.mod.common.util.asExpressionLike
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import java.util.concurrent.CompletableFuture
import net.minecraft.registry.RegistryKeys
/**
* An action effect keyframe that plays a positioned sound for all matching entities.
*
* @author Hiroku
* @since January 21st, 2024
*/
class EntitySoundActionEffectKeyframe : ConditionalActionEffectKeyframe(), EntityConditionalActionEffectKeyframe {
override val entityCondition = "q.entity.is_user".asExpressionLike()
var sound: String? = null
val delay: ExpressionLike = "0".asExpressionLike()
override fun playWhenTrue(context: ActionEffectContext): CompletableFuture<Unit> {
val entities = context.providers
.filterIsInstance<EntityProvider>()
.flatMap { prov -> prov.entities.filter { test(context, it, isUser = prov is UsersProvider) } }
val soundIdentifier = try {
sound?.asExpressionLike()?.resolveString(context.runtime)?.takeIf { it != "0.0" } ?: sound
} catch (e: Exception) {
sound
}?.asIdentifierDefaultingNamespace() ?: return skip()
entities.forEach { entity ->
val soundEvent = entity.world.registryManager.get(RegistryKeys.SOUND_EVENT).get(soundIdentifier) ?: return skip()
entity.playSound(soundEvent, 1f, 1f)
}
return delayedFuture(seconds = delay.resolveFloat(context.runtime), serverThread = true)
}
}
@@ -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.api.moves.animations.keyframes
import com.cobblemon.mod.common.api.molang.ExpressionLike
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import com.cobblemon.mod.common.util.asExpressionLike
import java.util.concurrent.CompletableFuture
class ForkActionEffectKeyframe(
val condition: ExpressionLike = "true".asExpressionLike(),
val ifTrue: List<ActionEffectKeyframe> = listOf(),
val ifFalse: List<ActionEffectKeyframe> = listOf()
) : ActionEffectKeyframe {
override fun play(context: ActionEffectContext): CompletableFuture<Unit> {
val future = CompletableFuture<Unit>()
/*
* Using .toList() before running chainKeyframes because iterators can be weird about sharing,
* .toList() creates a copy of the list and then grabs its iterator so much safer (three parachutes)
*/
if (!condition.resolveBoolean(context.runtime)) {
context.actionEffect.chainKeyframes(context, ifFalse.toList().iterator(), future)
} else {
context.actionEffect.chainKeyframes(context, ifTrue.toList().iterator(), future)
}
return future
}
}
@@ -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.moves.animations.keyframes
import com.cobblemon.mod.common.api.molang.ExpressionLike
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import com.cobblemon.mod.common.api.scheduling.delayedFuture
import com.cobblemon.mod.common.util.asExpressionLike
import java.util.concurrent.CompletableFuture
/**
* An action effect keyframe that simply executes some MoLang on the effect context's runtime.
*
* @author Hiroku
* @since January 21st, 2024
*/
class MoLangActionEffectKeyframe : ActionEffectKeyframe {
val expressions: ExpressionLike = "0".asExpressionLike()
val delay: ExpressionLike = "0".asExpressionLike()
override fun play(context: ActionEffectContext): CompletableFuture<Unit> {
expressions.resolve(context.runtime)
return delayedFuture(seconds = delay.resolveFloat(context.runtime), serverThread = true)
}
}
@@ -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.api.moves.animations.keyframes
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import com.cobblemon.mod.common.api.moves.animations.ActionEffectTimeline
import com.cobblemon.mod.common.api.moves.animations.ActionEffects
import com.cobblemon.mod.common.api.moves.animations.TargetsProvider
import com.cobblemon.mod.common.api.moves.animations.UsersProvider
import com.cobblemon.mod.common.api.scheduling.afterOnServer
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.entity.pokemon.ai.PokemonNavigation
import com.cobblemon.mod.common.util.asExpressionLike
import java.util.concurrent.CompletableFuture
import kotlin.math.pow
import kotlin.math.sqrt
import net.minecraft.util.Identifier
class MoveToTargetActionEffectKeyframe : ActionEffectKeyframe {
val speed = 1F
val timeout = "4".asExpressionLike()
var proximity = -1F
val timeoutActionEffect: Identifier? = null
override fun play(context: ActionEffectContext): CompletableFuture<Unit> {
val user = context.findOneProvider<UsersProvider>()?.entities?.firstOrNull() as? PokemonEntity ?: return CompletableFuture.completedFuture(Unit)
val target = context.findOneProvider<TargetsProvider>()?.entities?.firstOrNull() ?: return CompletableFuture.completedFuture(Unit)
val future = CompletableFuture<Unit>()
var timedOut = false
val proximity = this.proximity.takeIf { it != -1F } ?: (sqrt(2 * user.boundingBox.xLength.pow(2)) + 1.5F + sqrt(2 * target.boundingBox.xLength.pow(2))).toFloat()
if (target.distanceTo(user) !in proximity..20F) {
future.complete(Unit)
return future
}
val timeoutEffect = timeoutActionEffect?.let { ActionEffects.actionEffects[it] } ?: ActionEffectTimeline.NONE
val nav = user.navigation
val navContext = PokemonNavigation.NavigationContext(
destinationProximity = proximity,
onArrival = {
if (!future.isDone && !timedOut) {
future.complete(Unit)
}
},
onCannotReach = {
if (!future.isDone && !timedOut) {
timedOut = true
timeoutEffect.run(context).thenApply { future.complete(Unit) }
}
}
)
afterOnServer(seconds = timeout.resolveFloat(context.runtime)) {
if (!future.isDone && !timedOut) {
timedOut = true
timeoutEffect.run(context).thenApply { future.complete(Unit) }
nav.stop()
}
}
nav.startMovingTo(target.x, target.y, target.z, speed.toDouble(), navContext)
return future
}
}
@@ -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.moves.animations.keyframes
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import java.util.concurrent.CompletableFuture
class ParallelActionEffectKeyframe : ConditionalActionEffectKeyframe() {
var keyframes: MutableList<ActionEffectKeyframe> = mutableListOf()
override fun playWhenTrue(context: ActionEffectContext): CompletableFuture<Unit> {
return CompletableFuture.allOf(
*keyframes.map {
context.currentKeyframes.add(it)
it.play(context).thenRun { context.currentKeyframes.remove(it) }
}.toTypedArray()
).thenApply {} // Map Void -> Unit at the end
}
}
@@ -0,0 +1,18 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations.keyframes
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import com.cobblemon.mod.common.api.scheduling.delayedFuture
import com.cobblemon.mod.common.util.asExpressionLike
class PauseActionEffectKeyframe : ConditionalActionEffectKeyframe() {
val pause = "1".asExpressionLike()
override fun playWhenTrue(context: ActionEffectContext) = delayedFuture(seconds = pause.resolveFloat(context.runtime), serverThread = true)
}
@@ -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.api.moves.animations.keyframes
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import com.cobblemon.mod.common.api.scheduling.delayedFuture
import java.util.concurrent.CompletableFuture
/**
* An [ActionEffectKeyframe] that clears some holds from the context, potentially marking the effect as
* complete as far as any blocked actions are concerned. If no holds are specified, then all holds are
* removed.
*
* @author Hiroku
* @since October 27th, 2023
*/
class RemoveHoldsActionEffectKeyframe : ActionEffectKeyframe {
val delay = 0F
val holds = mutableSetOf<String>()
override fun play(context: ActionEffectContext): CompletableFuture<Unit> {
return delayedFuture(seconds = delay, serverThread = true).thenApply {
if (holds.isEmpty()) {
context.holds.clear()
} else {
context.holds.removeAll(holds)
}
}
}
}
@@ -0,0 +1,70 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations.keyframes
import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import com.cobblemon.mod.common.api.moves.animations.ActionEffectTimeline
import com.cobblemon.mod.common.api.moves.animations.ActionEffects
import com.cobblemon.mod.common.api.moves.animations.UsersProvider
import com.cobblemon.mod.common.api.scheduling.after
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.entity.pokemon.ai.PokemonNavigation
import com.cobblemon.mod.common.util.asExpressionLike
import java.util.concurrent.CompletableFuture
import net.minecraft.util.Identifier
import net.minecraft.util.math.Vec3d
class ReturnToPositionActionEffectKeyframe : ActionEffectKeyframe {
val speed = 1F
val timeout = "4".asExpressionLike()
val timeoutActionEffect: Identifier? = null
override fun play(context: ActionEffectContext): CompletableFuture<Unit> {
val user = context.findOneProvider<UsersProvider>()?.entities?.firstOrNull() as? PokemonEntity ?: return skip()
val future = CompletableFuture<Unit>()
val pos = (context.runtime.environment.getValue(setOf("${user.uuidAsString}-pos").iterator())?.value() as? ObjectValue<*>)?.obj as? Vec3d ?: return skip()
var timedOut = false
if (pos.distanceTo(user.pos) > 20) {
future.complete(Unit)
return future
}
val timeoutEffect = timeoutActionEffect?.let { ActionEffects.actionEffects[it] } ?: ActionEffectTimeline.NONE
val nav = user.navigation
val navContext = PokemonNavigation.NavigationContext(
onArrival = {
if (!future.isDone && !timedOut) {
future.complete(Unit)
}
},
onCannotReach = {
if (!future.isDone && !timedOut) {
timedOut = true
timeoutEffect.run(context).thenApply { future.complete(Unit) }
}
}
)
after(seconds = timeout.resolveFloat(context.runtime), serverThread = true) {
if (!future.isDone && !timedOut) {
timedOut = true
timeoutEffect.run(context).thenApply { future.complete(Unit) }
nav.stop()
}
}
nav.startMovingTo(pos.x, pos.y, pos.z, speed.toDouble(), navContext)
return future
}
}
@@ -0,0 +1,34 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations.keyframes
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import com.cobblemon.mod.common.api.moves.animations.ActionEffects
import java.util.concurrent.CompletableFuture
import net.minecraft.util.Identifier
/**
* An action effect keyframe that simply runs another action effect based on an identifier. This action
* effect is marked complete only when the action effect it runs is complete unless [waitForActionEffect] is
* false.
*
* @author Hiroku
* @since January 21st, 2024
*/
class RunActionEffectKeyframe : ConditionalActionEffectKeyframe() {
val actionEffect: Identifier? = null
val waitForActionEffect = true
override fun playWhenTrue(context: ActionEffectContext): CompletableFuture<Unit> {
return if (actionEffect != null) {
ActionEffects.actionEffects[actionEffect]?.run(context)?.takeIf { waitForActionEffect } ?: skip()
} else {
skip()
}
}
}
@@ -0,0 +1,22 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations.keyframes
import com.cobblemon.mod.common.api.molang.ObjectValue
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import com.cobblemon.mod.common.api.moves.animations.UsersProvider
import java.util.concurrent.CompletableFuture
class SavePositionActionEffectKeyframe: ConditionalActionEffectKeyframe() {
override fun playWhenTrue(context: ActionEffectContext): CompletableFuture<Unit> {
val user = context.findOneProvider<UsersProvider>()?.entities?.firstOrNull() ?: return skip()
context.runtime.environment.setSimpleVariable("${user.uuidAsString}-pos", ObjectValue(user.pos))
return skip()
}
}
@@ -0,0 +1,26 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.animations.keyframes
import com.cobblemon.mod.common.api.moves.animations.ActionEffectContext
import java.util.concurrent.CompletableFuture
/**
* A sequence of action effects that are dependent on a condition.
*
* @author Hiroku
* @since October 29th, 2023
*/
class SequenceActionEffectKeyframe(val keyframes: List<ActionEffectKeyframe> = listOf()) : ConditionalActionEffectKeyframe() {
override fun playWhenTrue(context: ActionEffectContext): CompletableFuture<Unit> {
val future = CompletableFuture<Unit>()
context.actionEffect.chainKeyframes(context, keyframes.toList().iterator(), future)
return future
}
}
@@ -0,0 +1,82 @@
/*
* 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.multiblock
import com.cobblemon.mod.common.block.entity.FossilMultiblockEntity
import net.minecraft.block.*
import net.minecraft.block.entity.BlockEntity
import net.minecraft.entity.LivingEntity
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.item.ItemStack
import net.minecraft.server.world.ServerWorld
import net.minecraft.util.ActionResult
import net.minecraft.util.Hand
import net.minecraft.util.hit.BlockHitResult
import net.minecraft.util.math.BlockPos
import net.minecraft.world.World
/**
* A block that can be part of a [MultiblockStructure]
*/
abstract class MultiblockBlock(properties: Settings) : BlockWithEntity(properties) {
override fun onPlaced(
world: World,
pos: BlockPos,
state: BlockState,
placer: LivingEntity?,
itemStack: ItemStack?
) {
if (world is ServerWorld) {
val multiblockEntity = world.getBlockEntity(pos) as MultiblockEntity
multiblockEntity.multiblockBuilder?.validate(world)
}
super.onPlaced(world, pos, state, placer, itemStack)
}
override fun onUse(
state: BlockState,
world: World,
pos: BlockPos,
player: PlayerEntity,
hand: Hand,
hit: BlockHitResult
): ActionResult {
if(hand == Hand.OFF_HAND) {
return ActionResult.SUCCESS
}
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)
}
override fun onBreak(world: World, pos: BlockPos, state: BlockState, player: PlayerEntity?) {
super.onBreak(world, pos, state, player)
if (!world.isClient) {
val entity = world.getBlockEntity(pos)
if (entity is MultiblockEntity && entity.multiblockStructure != null) {
entity.multiblockStructure!!.onBreak(world, pos, state, player)
}
}
}
override fun createBlockEntity(pos: BlockPos, state: BlockState): BlockEntity? {
return createMultiBlockEntity(pos, state)
}
@Deprecated("Deprecated in Java")
override fun getRenderType(state: BlockState?): BlockRenderType {
return BlockRenderType.MODEL
}
abstract fun createMultiBlockEntity(pos: BlockPos, state: BlockState): FossilMultiblockEntity
}
@@ -0,0 +1,64 @@
/*
* 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.multiblock
import com.cobblemon.mod.common.api.multiblock.MultiblockStructure
import com.cobblemon.mod.common.api.multiblock.builder.MultiblockStructureBuilder
import com.cobblemon.mod.common.util.DataKeys
import net.minecraft.block.BlockState
import net.minecraft.block.entity.BlockEntity
import net.minecraft.block.entity.BlockEntityType
import net.minecraft.nbt.NbtCompound
import net.minecraft.nbt.NbtHelper
import net.minecraft.network.listener.ClientPlayPacketListener
import net.minecraft.network.packet.Packet
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket
import net.minecraft.util.math.BlockPos
/**
* Multiblock entities are kind of complicated. Basically every multiblock entity should have a MultiBlockStructureBuilder
* that is checked when this block entity is created. The multiblock entity also contains a reference to a MultiblockStructure
* which is shared between all MultiblockEntities in the structure. Finally, every Multiblock contains the location of the
* block that controls this blockentities associated structure
*/
abstract class MultiblockEntity(
type: BlockEntityType<*>,
pos: BlockPos,
state: BlockState,
var multiblockBuilder: MultiblockStructureBuilder?
) : BlockEntity(type, pos, state) {
abstract var multiblockStructure: MultiblockStructure?
abstract var masterBlockPos: BlockPos?
override fun toUpdatePacket(): Packet<ClientPlayPacketListener>? {
return BlockEntityUpdateS2CPacket.create(this)
}
override fun toInitialChunkDataNbt(): NbtCompound {
val result = NbtCompound()
writeNbt(result)
return result
}
override fun writeNbt(nbt: NbtCompound) {
super.writeNbt(nbt)
//Used for checking build conditions in multiblocks (Dont count a block if it has the FORMED flag)
nbt.putBoolean(DataKeys.FORMED, masterBlockPos != null)
if (multiblockStructure != null && multiblockStructure!!.controllerBlockPos == pos) {
nbt.put(DataKeys.MULTIBLOCK_STORAGE, multiblockStructure!!.writeToNbt())
}
else if (masterBlockPos != null) {
nbt.put(DataKeys.CONTROLLER_BLOCK, NbtHelper.fromBlockPos(masterBlockPos))
}
}
abstract override fun readNbt(nbt: NbtCompound)
}
@@ -0,0 +1,48 @@
/*
* 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.multiblock
import net.minecraft.block.BlockState
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.nbt.NbtCompound
import net.minecraft.server.world.ServerWorld
import net.minecraft.util.ActionResult
import net.minecraft.util.Hand
import net.minecraft.util.hit.BlockHitResult
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.random.Random
import net.minecraft.world.World
interface MultiblockStructure {
val controllerBlockPos: BlockPos
fun onUse(
blockState: BlockState,
world: World,
blockPos: BlockPos,
player: PlayerEntity,
interactionHand: Hand,
blockHitResult: BlockHitResult
): ActionResult
fun onBreak(world: World, pos: BlockPos, state: BlockState, player: PlayerEntity?)
fun tick(world: World)
fun syncToClient(world: World)
fun markDirty(world: World)
fun writeToNbt(): NbtCompound
fun getComparatorOutput(state: BlockState, world: World?, pos: BlockPos?): Int {
return 0
}
fun markRemoved(world: World):Unit
fun onTriggerEvent(state: BlockState?, world: ServerWorld?, pos: BlockPos?, random: Random?)
}
@@ -0,0 +1,39 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.multiblock.builder
import com.cobblemon.mod.common.api.multiblock.condition.MultiblockCondition
import net.minecraft.server.world.ServerWorld
import net.minecraft.util.math.Box
import net.minecraft.util.shape.VoxelShape
/**
* Represents an area that has a potential to form a MultiBlockStructure
* @property boundingBox The box that each condition checks in
* @property conditions The [MultiblockCondition]s that must be met for the multiblock to form. All must be true.
*
* @author Apion
* @since August 24, 2023
*/
interface MultiblockStructureBuilder {
val boundingBox: VoxelShape
val conditions: List<MultiblockCondition>
fun validate(world: ServerWorld): Boolean {
conditions.forEach {
if (!it.test(world, boundingBox)) {
return false
}
}
form(world)
return true
}
fun form(world: ServerWorld)
}
@@ -0,0 +1,21 @@
/*
* 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.multiblock.condition
import net.minecraft.server.world.ServerWorld
import net.minecraft.util.math.Box
import net.minecraft.util.shape.VoxelShape
class AndCondition(val conditionOne: MultiblockCondition, val conditionTwo: MultiblockCondition) :
MultiblockCondition {
override fun test(world: ServerWorld, box: VoxelShape): Boolean {
return conditionOne.test(world, box) and conditionTwo.test(world, box)
}
}
@@ -0,0 +1,46 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.multiblock.condition
import com.cobblemon.mod.common.util.blockPositionsAsList
import net.minecraft.predicate.BlockPredicate
import net.minecraft.server.world.ServerWorld
import net.minecraft.util.math.Direction
import net.minecraft.util.shape.VoxelShape
/**
* Checks that a block adjacent to another block matches a predicate. Basically we find a block that
* matched relToBlock, then we look in each direction to see if there is an adjacent block that matches
* target block.
*
* @param relToBlock The [BlockPredicate] for the main block. The block that matches this predicate is the block whose adjacent blocks we check
* @param targetBlock The [BlockPredicate] that is checked for blocks adjacent to relToBlock
* @param directionsToCheck The [Direction]s that we check from the target relToBlock
*
* @author Apion
* @since August 24th, 2023
*/
class BlockRelativeCondition(
val relToBlock: BlockPredicate,
val targetBlock: BlockPredicate,
val directionsToCheck: Array<Direction> = Direction.values()
) : MultiblockCondition {
override fun test(world: ServerWorld, box: VoxelShape): Boolean {
val relToBlockBlockPositions = box.blockPositionsAsList().filter { relToBlock.test(world, it) }
relToBlockBlockPositions.forEach { pos ->
directionsToCheck.forEach {
if (targetBlock.test(world, pos.offset(it))) {
return true
}
}
}
return false
}
}
@@ -0,0 +1,20 @@
/*
* 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.multiblock.condition
import net.minecraft.server.world.ServerWorld
import net.minecraft.util.math.Box
import net.minecraft.util.shape.VoxelShape
/**
*
*/
interface MultiblockCondition {
fun test(world: ServerWorld, box: VoxelShape): Boolean
}
@@ -0,0 +1,23 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.multiblock.condition
import net.minecraft.server.world.ServerWorld
import net.minecraft.util.math.Box
import net.minecraft.util.shape.VoxelShape
class OrCondition(
val conditionOne: MultiblockCondition,
val conditionTwo: MultiblockCondition
) : MultiblockCondition {
override fun test(world: ServerWorld, box: VoxelShape): Boolean {
return conditionOne.test(world, box) or conditionTwo.test(world, box)
}
}
@@ -0,0 +1,28 @@
/*
* 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.net.serializers
import net.minecraft.entity.data.TrackedDataHandler
import net.minecraft.network.PacketByteBuf
import net.minecraft.util.Identifier
/**
* Data serializer of [Identifier] for DataTracker things.
*
* @author Hiroku
* @since May 22nd, 2023
*/
object IdentifierDataSerializer : TrackedDataHandler<Identifier> {
override fun copy(value: Identifier) = Identifier(value.namespace, value.path)
override fun read(buf: PacketByteBuf) = Identifier(buf.readString(), buf.readString())
override fun write(buf: PacketByteBuf, value: Identifier) {
buf.writeString(value.namespace)
buf.writeString(value.path)
}
}
@@ -27,11 +27,14 @@ object CobblemonPermissions {
val HEAL_POKEMON_SELF = this.create("$HEAL_POKEMON_BASE.self", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
val HEAL_POKEMON_OTHER = this.create("$HEAL_POKEMON_BASE.other", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
private const val LEVEL_UP_BASE = "${COMMAND_PREFIX}levelup"
val LEVEL_UP_SELF = this.create("$LEVEL_UP_BASE.self", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
val LEVEL_UP_OTHER = this.create("$LEVEL_UP_BASE.other", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
val OPEN_STARTER_SCREEN = this.create("${COMMAND_PREFIX}openstarterscreen", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
val BEDROCK_PARTICLE = this.create("${COMMAND_PREFIX}bedrockparticle", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
val OPEN_DIALOGUE = this.create("${COMMAND_PREFIX}opendialogue", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
private const val POKEMON_EDIT_BASE = "${COMMAND_PREFIX}pokemonedit"
val POKEMON_EDIT_SELF = this.create("$POKEMON_EDIT_BASE.self", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)

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