mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-10-21 22:56:23 -04:00
Compare commits
209
Commits
1.8.0
...
audio-fixes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d29987f743 | ||
|
|
4a624b4a91 | ||
|
|
cdb8ee0d8e | ||
|
|
e7d86a382c | ||
|
|
eb911df830 | ||
|
|
1c30acc53c | ||
|
|
2a0e8f6d47 | ||
|
|
e6bd8ec529 | ||
|
|
911a95e873 | ||
|
|
447cfc2ae5 | ||
|
|
8dfeb0d260 | ||
|
|
caa7b19833 | ||
|
|
64dd8ae193 | ||
|
|
156ee6f290 | ||
|
|
fe433d1417 | ||
|
|
0dc662d295 | ||
|
|
081e370bfd | ||
|
|
3ef0567287 | ||
|
|
3cad9e5481 | ||
|
|
dc8b7908be | ||
|
|
85085a1eca | ||
|
|
bff59dee6e | ||
|
|
bb5828531a | ||
|
|
cd08e98c28 | ||
|
|
bf7d40c9b5 | ||
|
|
5abb3d7f97 | ||
|
|
975ad8186a | ||
|
|
26b6419f04 | ||
|
|
331f7ca425 | ||
|
|
71c9ac0ff0 | ||
|
|
1404cc0ab5 | ||
|
|
6ca908a91d | ||
|
|
0948b8da9a | ||
|
|
22e04a53b3 | ||
|
|
df3217b41b | ||
|
|
9ff15a1913 | ||
|
|
89e43945a3 | ||
|
|
bd8dcddf35 | ||
|
|
dd372f3160 | ||
|
|
c56aab28d4 | ||
|
|
ca58801794 | ||
|
|
38fa5e2628 | ||
|
|
fae1ae7124 | ||
|
|
3ec5f76c73 | ||
|
|
5bb8aaba55 | ||
|
|
23ba41e981 | ||
|
|
29b049452b | ||
|
|
0b0f665804 | ||
|
|
3cdf28ffdd | ||
|
|
5d53fba2ce | ||
|
|
c6fb18ea51 | ||
|
|
2d851cb134 | ||
|
|
f685be0aab | ||
|
|
14cc851562 | ||
|
|
7223d1fd68 | ||
|
|
6ab5ad52ec | ||
|
|
079b2ae766 | ||
|
|
34eea827e7 | ||
|
|
06c6ee5a9c | ||
|
|
54748c20ea | ||
|
|
75f52e4cf4 | ||
|
|
55446dd4b1 | ||
|
|
02e63b6fc8 | ||
|
|
3aebcf66ec | ||
|
|
49a5f716b7 | ||
|
|
8b825d558f | ||
|
|
9a7f97f11f | ||
|
|
95b8d62e4a | ||
|
|
0bd7b4dab3 | ||
|
|
8cbada0cf5 | ||
|
|
f0784fec2d | ||
|
|
cfe0c5e0a5 | ||
|
|
0bc5bb5caa | ||
|
|
3330941a2c | ||
|
|
79ea082d7e | ||
|
|
3d78929ff0 | ||
|
|
5d94b03f7a | ||
|
|
587305eb52 | ||
|
|
e363ce5e0e | ||
|
|
e49b704200 | ||
|
|
ec8b35860c | ||
|
|
74c49bf2da | ||
|
|
c03e7d9ed3 | ||
|
|
b54f2442c9 | ||
|
|
62c0545ea7 | ||
|
|
f25a676bd5 | ||
|
|
a9906762a0 | ||
|
|
7b5b88eca2 | ||
|
|
f821abd7e5 | ||
|
|
291682ba52 | ||
|
|
546d403b45 | ||
|
|
2652e53e0c | ||
|
|
08ac7d478d | ||
|
|
4f51016ca9 | ||
|
|
ef8b4fd3cd | ||
|
|
f55972c190 | ||
|
|
2dbf304ebe | ||
|
|
1c5feab9c9 | ||
|
|
1c720793c4 | ||
|
|
6a170f8ce8 | ||
|
|
b4aba94f89 | ||
|
|
9832730f5c | ||
|
|
ffdaec3e15 | ||
|
|
d481f887a8 | ||
|
|
df3aec6222 | ||
|
|
b423fb1c46 | ||
|
|
8ae26a268a | ||
|
|
39b522abcc | ||
|
|
9bcfcef4fd | ||
|
|
60ac2d8058 | ||
|
|
9366d28141 | ||
|
|
75b48196b7 | ||
|
|
5180e2b501 | ||
|
|
bb407b1d65 | ||
|
|
8b308e5595 | ||
|
|
148526e5e8 | ||
|
|
f319efcf12 | ||
|
|
c9f40e32a1 | ||
|
|
d642b8dd07 | ||
|
|
549a11116e | ||
|
|
b5468a4a4f | ||
|
|
5055e3926c | ||
|
|
3d92de18b8 | ||
|
|
c5d278ccb7 | ||
|
|
bf5e15de45 | ||
|
|
f4af417267 | ||
|
|
69c04acaeb | ||
|
|
83a6bb188f | ||
|
|
494a8b5e91 | ||
|
|
c8021f2f08 | ||
|
|
8cdf3af047 | ||
|
|
c90a24e1ab | ||
|
|
83e3cfc34e | ||
|
|
133dd4e5b7 | ||
|
|
a8cca14b86 | ||
|
|
9b0f356fa4 | ||
|
|
f2b0a102b6 | ||
|
|
ab9851fd12 | ||
|
|
a9df6bc709 | ||
|
|
a7d01b230a | ||
|
|
2a7db4b9b8 | ||
|
|
77e5f2501d | ||
|
|
3681813976 | ||
|
|
e6513717bd | ||
|
|
0e0c98f693 | ||
|
|
528bfa4e22 | ||
|
|
83c87779d7 | ||
|
|
dc33235144 | ||
|
|
333d234dbe | ||
|
|
935c658c5f | ||
|
|
ee42825dc3 | ||
|
|
0d9a4f9392 | ||
|
|
0426f4fbf9 | ||
|
|
5e90c05fdd | ||
|
|
75bc03fdcb | ||
|
|
9a0648d956 | ||
|
|
91187ce952 | ||
|
|
686bc62996 | ||
|
|
5925247ace | ||
|
|
c6a4bec3f3 | ||
|
|
7e582090f8 | ||
|
|
55eef6ea69 | ||
|
|
f65cb9538c | ||
|
|
8dbce8fefe | ||
|
|
46e771a062 | ||
|
|
4c0095844b | ||
|
|
4eb39566fa | ||
|
|
d034469ebb | ||
|
|
4f8a44c95b | ||
|
|
52b17ca39e | ||
|
|
10a2ef27d6 | ||
|
|
309ff3da13 | ||
|
|
3af91e2a74 | ||
|
|
2e027e3db7 | ||
|
|
fc40fb02c0 | ||
|
|
2c1c0299f9 | ||
|
|
3c7637515c | ||
|
|
08cbbaf68c | ||
|
|
6e911acf01 | ||
|
|
f6d82a1b28 | ||
|
|
702126aeab | ||
|
|
df566e8fcb | ||
|
|
c83e0f33b5 | ||
|
|
f279f936b6 | ||
|
|
f8e20bafd9 | ||
|
|
a5211ca7ff | ||
|
|
0a5abdb331 | ||
|
|
4ed7413dd2 | ||
|
|
40b66c24fc | ||
|
|
2f7bedf001 | ||
|
|
44c31a9ddb | ||
|
|
20a35de3d8 | ||
|
|
cfc8a15db1 | ||
|
|
d5ba22a86c | ||
|
|
a38505f1c5 | ||
|
|
3cf1ba1fb3 | ||
|
|
9f5d595827 | ||
|
|
75673f0204 | ||
|
|
b43a7571ff | ||
|
|
b071dc04d3 | ||
|
|
12f9ff1647 | ||
|
|
3256a302df | ||
|
|
edbe447477 | ||
|
|
2f43910368 | ||
|
|
c2e87e4cfa | ||
|
|
e40d2ee806 | ||
|
|
ba74e7603b | ||
|
|
19c3fe6dc4 | ||
|
|
d0778dd124 |
+66
-497
@@ -1,529 +1,98 @@
|
||||
# Changelog
|
||||
## [1.8.0 - Make Your Move Update (September 6th, 2026)](#1-8-0)
|
||||
#### I think the red eyes mean they're friendly!
|
||||
## [1.8.2 (MONTH xth, 2026)](#1-8-2)
|
||||
|
||||
### Additions
|
||||
- Added Alpha Pokémon
|
||||
- Alpha Pokémon are bigger, stronger, and more aggressive than regular Pokémon.
|
||||
- They are also scarier.
|
||||
- They always know a TM move and will adapt to be stronger than your party.
|
||||
- Alphas will always lead herds and spawn in herds.
|
||||
- Added alpha Pokémon attraction bait effect to Hopo Berries.
|
||||
- Added intrinsic scaling to all Pokémon (anywhere from 5% smaller to 5% bigger than normal). Some cases, such as shoulder mounting, will not scale so that the shoulder animations don't look silly.
|
||||
- Added scaling to "baby" Pokémon (10% smaller at level 1 → normally sized at level 10).
|
||||
- Added TMs.
|
||||
- Added TM Machine. TMs are made from elemental type gems, and their recipes are unlocked by having Pokémon that know the move.
|
||||
- Added config options for making TMs infinite-use and instant unlocking of all TM recipes.
|
||||
- Added Type Gem blocks as well as crystal clusters and deepslate core blocks that are used for growing elemental type gems.
|
||||
- Added a new Starter Selection menu that looks way better.
|
||||
- Added a "Move Dex" to the Pokédex to help identify what moves a Pokémon can learn and what Pokémon can get a move.
|
||||
- Added the Habitat Block, a spawner block for servers and adventure maps that controls spawning in an area.
|
||||
- Added 49 new habitat structures. In these habitats you will find rarer Pokémon and sometimes different Pokémon will appear on different days.
|
||||
- Added a toast to notify players of how they can scroll through their party. Did you know you can hold R and scroll instead of using arrow keys? It's true!!!
|
||||
- Added a way to obtain Porygon by inserting an Upgrade or Dubious Disc into a data monitor.
|
||||
- Added Disk Rack for storing disks and being an audio sequencer for Noteblocks. What does that have to do with Pokémon? How about you mind your own business!
|
||||
- Added missing crops to Botany Pots integration.
|
||||
- Added conditional seats for riding. Seats can be gated by Molang such as "is_alpha".
|
||||
- Added 10 new ruin structures.
|
||||
- Added a new shipwreck cove structure called the Magma Shipwreck Cove.
|
||||
- Added 7 new advancements.
|
||||
- Pokémon cries now play when clicking Pokémon in the summary screen.
|
||||
- Held item visibility can now be controlled by the `held_item_visible` command argument.
|
||||
- Added config option to disable Pokémon spawning on a per-world basis.
|
||||
- Added config options to award experience to fainted Pokémon for opponents they helped defeat (`awardExperienceToFaintedPokemon`) and to still award experience for defeated enemies even after battle loss/forfeit (`awardExperienceOnBattleLoss`).
|
||||
- Added `/givetm` command.
|
||||
- Added advancement triggers for learning TMs: `cobblemon:has_learn_specific_tm` (per-TM), `cobblemon:has_learn_all_tm` (all TMs learned), and `cobblemon:tms_learned` (count-based), backed by a new `totalTMLearnedCount` on player advancement data.
|
||||
- Added `cobblemon:catch_alpha_pokemon` advancement trigger and `totalAlphaCaptureCount` stat for captured Alpha Pokémon.
|
||||
|
||||
### New rideable Pokémon
|
||||
- Crobat
|
||||
- Skarmory
|
||||
- Milotic
|
||||
- Archeops
|
||||
- Goodra
|
||||
- Goodra (Hisuian Form)
|
||||
- Drampa
|
||||
- Duraludon
|
||||
- Archaludon
|
||||
- The following items can now be placed on the ground as blocks:
|
||||
- King's Rock, Galarica Cuff, Unremarkable Teacup, Masterpiece Teacup, Chipped Pot, Cracked Pot, Sachet, Metal Powder, Quick Powder, Bright Powder, Icy Rock, Heat Rock, Smooth Rock, Damp Rock, Destiny Knot, Luminous Moss, Never-Melt Ice, Wide Lens, Scope Lens, and Zoom Lens.
|
||||
- Iron Ball, Metal Coat, Throat Spray, HP Up, Protein, Iron, Carbos, Calcium, Zinc, PP Up, PP Max, Upgrade, Dubious Disc, and Loaded Dice.
|
||||
- The following items can now be placed on various surfaces:
|
||||
- Galarica Wreath, Magnet, Flame Orb, Life Orb, Toxic Orb, Light Ball, and Smoke Ball.
|
||||
- The following items can now be placed as blocks and have additional functionality:
|
||||
- Ring Target, Metronome, and Eject Button.
|
||||
- The following items can now be worn by Players and Pokémon:
|
||||
- Galarica Wreath, Cleanse Tag, Spell Tag, Sharp Beak, Covert Cloak, Shell Helmet, and Never-Melt Ice.
|
||||
- Wearable items can now be equipped by a player by holding it and right-clicking (or rebound use/interact)
|
||||
- Wearable items that can be placed down are exempt from this behaviour.
|
||||
|
||||
### Pokémon Added
|
||||
#### Generation 3
|
||||
- Wurmple
|
||||
- Silcoon
|
||||
- Beautifly
|
||||
- Cascoon
|
||||
- Dustox
|
||||
- Skitty
|
||||
- Delcatty
|
||||
- Seviper
|
||||
- Zangoose
|
||||
|
||||
#### Generation 4
|
||||
- Cherubi
|
||||
- Cherrim
|
||||
- Stunky
|
||||
- Skuntank
|
||||
- Snover
|
||||
- Abomasnow
|
||||
- Burmy
|
||||
- Wormadam
|
||||
- Mothim
|
||||
|
||||
#### Generation 5
|
||||
- Audino
|
||||
- Pawniard
|
||||
- Bisharp
|
||||
- Tympole
|
||||
- Palpitoad
|
||||
- Seismitoad
|
||||
|
||||
#### Generation 6
|
||||
- Pancham (+ Cosmetic with Black Glasses)
|
||||
- Pangoro (+ Cosmetic with Black Glasses)
|
||||
- Helioptile
|
||||
- Heliolisk
|
||||
|
||||
#### Generation 7
|
||||
- Rockruff
|
||||
- Lycanroc
|
||||
|
||||
#### Generation 8
|
||||
- Rolycoly
|
||||
- Carkol
|
||||
- Coalossal
|
||||
- Runerigus
|
||||
- Snom
|
||||
- Frosmoth
|
||||
- Indeedee
|
||||
- Duraludon
|
||||
- Applin
|
||||
- Flapple
|
||||
- Appletun
|
||||
- Grubbin
|
||||
- Charjabug
|
||||
- Vikavolt
|
||||
|
||||
#### Generation 9
|
||||
|
||||
- Nymble
|
||||
- Lokix
|
||||
- Kingambit
|
||||
- Dipplin
|
||||
- Archaludon
|
||||
- Hydrapple
|
||||
|
||||
#### Regional Forms
|
||||
- Sandshrew (Alolan Form)
|
||||
- Sandslash (Alolan Form)
|
||||
- Yamask (Galarian Form)
|
||||
- Avalugg (Hisuian Form)
|
||||
- Greavard
|
||||
- Houndstone
|
||||
|
||||
### Model updates for the following Pokémon
|
||||
|
||||
- Sandshrew
|
||||
- Sandslash
|
||||
- Nidoking
|
||||
- Zubat
|
||||
- Golbat
|
||||
- Crobat
|
||||
- Ditto
|
||||
- Porygon
|
||||
- Porygon2
|
||||
- Porygon-Z
|
||||
- Skarmory
|
||||
- Smoochum
|
||||
- Jynx
|
||||
- Popplio
|
||||
- Brionne
|
||||
- Primarina
|
||||
- Fletchling
|
||||
- Fletchinder
|
||||
- Talonflame
|
||||
- Sableye
|
||||
- Mawile
|
||||
- Goomy
|
||||
- Sliggoo
|
||||
- Goodra
|
||||
- Nacli
|
||||
- Naclstack
|
||||
- Garganacl
|
||||
- Bidoof
|
||||
- Cranidos
|
||||
- Chatot
|
||||
- Yamask
|
||||
- Cofagrigus
|
||||
- Tyranitar
|
||||
- Turtonator
|
||||
- Golett
|
||||
- Corsola
|
||||
- Arbok (New Patterns: Angry, Cartoon, Clown, Comedic, Crow, Grin, Ink, Modern, Rain, Scribble, Silence, Sloth, Suspicious, Will)
|
||||
- ... and Substitute
|
||||
|
||||
#### Model changes to the regional bias resource pack:
|
||||
- Added Mime Jr. (Galar Bias)
|
||||
- Added Bergmite (Hisui Bias)
|
||||
- Changed models for every existing regional bias
|
||||
- Cacnea
|
||||
- Cacturne
|
||||
- Binacle
|
||||
- Barbaracle
|
||||
- Glimmet
|
||||
- Glimmora
|
||||
- Deerling
|
||||
- Sawsbuck (All forms)
|
||||
- Absol
|
||||
|
||||
### Animation updates for the following Pokémon
|
||||
|
||||
- Kakuna
|
||||
- Grimer
|
||||
- Nidoran♀ (+ New shoulder mount)
|
||||
- Nidorina
|
||||
- Nidoran♂ (+ New shoulder mount)
|
||||
- Sandshrew
|
||||
- Diglett
|
||||
- Dugtrio
|
||||
- Graveler
|
||||
- Happiny
|
||||
- Chansey
|
||||
- Blissey
|
||||
- Poliwhirl
|
||||
- Poliwrath
|
||||
- Zubat
|
||||
- Vulpix
|
||||
- Drowzee
|
||||
- Hypno
|
||||
- Noctowl
|
||||
- Skarmory
|
||||
- Skitty
|
||||
- Flygon
|
||||
- Shellos
|
||||
- Riolu
|
||||
- Lucario
|
||||
- Purrloin
|
||||
- Liepard
|
||||
- Joltik
|
||||
- Galvantula
|
||||
- Nidoking
|
||||
- Fletchling
|
||||
- Fletchinder
|
||||
- Talonflame
|
||||
- Archeops
|
||||
- Drampa
|
||||
- Sewaddle
|
||||
- Swadloon
|
||||
- Leavanny
|
||||
- Goomy
|
||||
- Sliggoo
|
||||
- Goodra
|
||||
- Shedinja
|
||||
- Skwovet
|
||||
- Greedent
|
||||
- Bidoof
|
||||
- Cranidos
|
||||
- Chatot
|
||||
- Yamask
|
||||
- Cofagrigus
|
||||
- Luvdisc
|
||||
- Staryu
|
||||
- Starmie
|
||||
- Togetic
|
||||
- Rellor
|
||||
- Rabsca
|
||||
- Yungoos
|
||||
- Gumshoos
|
||||
- Cottonee
|
||||
- Whimsicott
|
||||
- Corsola
|
||||
|
||||
#### Added sounds to the following moves
|
||||
|
||||
- Absorb
|
||||
- Aurora Beam
|
||||
- Double Team
|
||||
- Draco Meteor
|
||||
- Fire Punch
|
||||
- Fire Spin
|
||||
- Flame Charge
|
||||
- Flame Wheel
|
||||
- Giga Drain
|
||||
- Ice Punch
|
||||
- Leech Life
|
||||
- Magical Leaf
|
||||
- Mega Drain
|
||||
- Minimize
|
||||
- Poison Gas
|
||||
- Rock Throw
|
||||
- Scary Face
|
||||
- Seed bomb
|
||||
- Smokescreen
|
||||
- String Shot
|
||||
- Tail Whip
|
||||
- Cacnea
|
||||
- Cacturne
|
||||
|
||||
### Changes
|
||||
- Removed the penalty for block destruction speed when on a hover mount, making them better for digging.
|
||||
- Golden Apples can now be crafted using the Applin Apples.
|
||||
- Prismarine Crystals and Amethyst Shards can now be used to craft Pokedexes.
|
||||
- Updated Pokédex Screens item tag to support tagged variants of Redstone and Glowstone Dust.
|
||||
- Sharp Beak can now be crafted using bones and Flying Gems.
|
||||
- Metal Alloy can now be crafted using iron and Thunder Stones.
|
||||
- Ability Capsules can now be brewed from Medicinal Brew and Dragon Breath.
|
||||
- Using an Ability Capsule will now return an Empty Bottle.
|
||||
- Decreased the default pastured wander radius to 32 blocks.
|
||||
- Added alternate versions of the basic PC Wallpapers based on the original design of Cobblemon's PC, before public release.
|
||||
- Rooted Arch Ruins, Crumbling Arch Ruins, and all fossil structures have been improved so that they generate more naturally in terrain.
|
||||
- Gimmighoul towers now generate at ground-level rather than sinking one block into the ground.
|
||||
- All ruin structures that did not generate with a gimmighoul/gilded chest before will now generate with one.
|
||||
- All ruin structures gilded chest loot tables have been updated to include a guaranteed TM not learned naturally by any Pokémon through their level-up moveset. Each ruin gets its own specific TM, so you can now go hunting ruins to complete your move dex!
|
||||
- The Prehistoric Underwater Fissure and Prehistoric Submerged Impact fossil structures now use the biome tag `#cobblemon:is_temperate_ocean`.
|
||||
- The lush shipwreck cove's phantom mob spawner has been replaced with breezes.
|
||||
- Shipwreck coves now generate slightly more frequently.
|
||||
- Added equipment loot tables for shipwreck cove enemies.
|
||||
- Maps from abandoned fishing boats leading to shipwreck coves now will skip explored chunks, allowing the player to find more shipwreck coves more easily.
|
||||
- All shipwreck coves' spawners have been adjusted to give compatible mobs enchanted iron or diamond armour and weapons while in its ominous state. The armour given to the mobs will also use the automaton trim. We upped the difficulty because it was too easy now that your Pokémon can fight for you.
|
||||
- One TM of the elemental hyper beams has been added as guaranteed loot to the main treasure chest in every shipwreck cove. (Magma Cove gets Blast Burn, Lush Cove gets Frenzy Plant, and Submerged Cove gets Hydro Cannon.)
|
||||
- The following items can now be obtained by brushing the following Pokémon:
|
||||
- Pink Wool - Wigglytuff
|
||||
- White Wool - Swablu, Altaria
|
||||
- Shed Shell - Ekans, Arbok, Dratini, Dragonair, Dunsparce, Treecko, Grovyle, Sceptile, Seviper, Scraggy, Scrafty, Helioptile, Heliolisk, Salandit, Salazzle, Sobble, Drizzile, Inteleon, Silicoblra, Sandaconda, Toxel, Toxtricity, Orthworm, Dudunsparce
|
||||
- Phantom Membrane - Dreepy, Drakloak, Dragapult
|
||||
- The following items can now be obtained by evolving the following Pokémon into any of their evolutions:
|
||||
- Turtle Scute - Squirtle, Wartortle, Turtwig, Grotle, Tirtouga, Chewtle
|
||||
- Shed Shell - Metapod, Kakuna, Ekans, Paras, Venonat, Krabby, Scyther, Kabuto, Dratini, Dragonair, Ledyba, Spinarak, Yanma, Pineco, Dunsparce, GLigar, Pupitar, Treecko, Grovyle, Silcoon, Cascoon, Surskit, Nincada, Trapinch, Vibrava, Corphish, Anorith, Bagon, Shelgon, Kricketot, Burmy, Combee, Skorupi, Swadloon, Whirlipede, Dwebble, Scraggy, Karrablast, Joltik, Larvesta, Spewpa, Clauncher, Helioptile, Charjabug, Crabrawler, Cutiefly, Dewpider, Salandit, Wimpod, Poipole, Sobble, Drizzile, Dottler, Silicobra, Toxel, Sizzlipede, Snom, Tarountula, Nymble, Rellor
|
||||
- Saccharine Leaves now drop Tart, Sweet, or Syrupy Apples, depending on their honey coating stage, instead of vanilla Apples.
|
||||
- Fixed the height of the Tumblestone Bud items when held in hand, placed on head, viewed in a GUI, and placed in an Item Frame.
|
||||
- Refactored all advancements, removing several deemed unnecessary. Due to this cleanup, all previously obtained advancements will be reset besides the root (for picking a starter Pokémon). This sucks, and we're sorry. We had to do this eventually so better now than later.
|
||||
- Forces between colliding hitboxes now factors in the weight of Pokémon.
|
||||
- Improved berry tree performance on singleplayer and servers.
|
||||
- Updated stat increase and decrease particle effects with the addition of alpha boost particles.
|
||||
- Improved the performance of pasture blocks on singleplayer and servers.
|
||||
- Changed the bait effects of the following items: (Vanilla) Sweet & Glow Berries, Golden & Enchanted Golden Apples (Cobblemon) Custap, Eggant, Hopo & Micle Berries, Sweet Hearts.
|
||||
- Wild Pokémon now reliably have at least one offensive move if they can have offensive moves at that level. No more free lunches with Pokémon that can't even hurt you.
|
||||
- Data Monitor can accept Disks (TMs, Music Disks, Upgrade, Dubious Disk, etc.) to change what's being displayed on the screen.
|
||||
- The party overlay's experience-gained animation now displays the amount of EXP the Pokémon gained.
|
||||
- Pressing the inventory key now closes the Pokémon interact wheel GUI.
|
||||
- Updated the sound for harvesting Apricorns.
|
||||
- Lowered the volume of harvesting berries.
|
||||
- Improved compatibility with various mods
|
||||
- Farmer's Delight's cutting board can now be used to strip Apricorn and Saccharine's logs, or salvage their planks from various blocks. It can also separate their boats from chests.
|
||||
- Farmer's Delight's cutting board can be used to get two white dye from Pep-Up Flowers and two magenta dye from Medicinal Leeks.
|
||||
- Farmer's Delight's cutting board can separate Tumblestone Blocks back into Tumblestones.
|
||||
- Farmer's Delight's cutting board can salvage Type Gems from their Gem Blocks.
|
||||
- Farmer's Delight's Onions, Tomatoes, and Cabbages can be used to cook Open-Faced Sandwiches. Nature's Spirit's Olives also can be used.
|
||||
- Farmer's Delight's cutting board can be used on Hearty Grains to obtain rice and straw, similarly to Farmer's Delight's Rice Panicles.
|
||||
- Farmer's Delight's Apple Pies and Apple Ciders can now be made using Applin Apples, alongside the Vanilla counterpart.
|
||||
- Amendments allows for cooking Leek and Potato Stew in a Cauldron.
|
||||
- Any mods that utilise Moonlight's Soft Fluid system can store Leek and Potato Stew, Medicinal Brew, Antidote, Awakening, Burn Heal, Ice Heal, Paralyze Heal, Full Heal, Potion, Super Potion, Hyper Potion, Max Potion, Full Restore, Ability Capsules, Moomoo Milk, and Berry Juice in liquid form (such as Suplementaries' Jar or Goblet, or Cauldrons while using Amendments).
|
||||
- Supplementaries' Hourglass can now use Bright Powder, Quick Powder, Metal Powder, Heal Powder, Silver Powder, and Remedy.
|
||||
- Berry Trees are now compatible with the Planter properly
|
||||
- Saccharine Way Signs (added by Supplementaries automagically) now use a premade texture to prevent odd visual issues.
|
||||
- Supplementaries' Jar can now store various Cobblemon cookies, candies, and similar items.
|
||||
- Some of Supplementaries' items have been added to the `#cobblemon:held/container_held_items` item tag, including sacks, safes, and lunch baskets.
|
||||
- Experience Nuggets can be used in place of Sculk for making the EXP Candies if using Create.
|
||||
- Rage Candy Bar has a Create Mixing recipe.
|
||||
- All Cobblemon ores can now be crushed in Create's Crushing Wheels. All Gem and Tumblestone Clusters can be crushed for automatic, low return, gems.
|
||||
- Hearty Grains can be milled like Farmer's Delight Rice Panicles if both Farmer's Delight and Create are installed.
|
||||
- Big Roots and Revival Herbs can be milled to their respective powders.
|
||||
- Pep-Up Flowers, Medicinal Leeks, and all 70 berries can be milled in Create's Millstone for additional dye drops.
|
||||
- Auspicious Armour and Upgrades can be Haunted using Create's crafting systems.
|
||||
- Applin Apples can be used to make Honeyed Apples in Create.
|
||||
- Sounds for interacting with various Cobblemon blocks now play from the centre of the block, rather than the corner. You probably didn't notice.
|
||||
- Dragonite's mailbag cosmetic can now also be obtained with a chest in the cosmetic slot.
|
||||
- Adjusted the walk speed for Croagunk and Aerodactyl.
|
||||
- The `/pc` command no longer plays PC activation sounds
|
||||
- Pressing the Summary key while either the starter selection or summary screen are open now closes those screens.
|
||||
- Ice type Pokémon are now immune to Packed Snow.
|
||||
- Added cobweb block slowness immunity for spider Pokémon
|
||||
- Updated various recipes to display in Recipe Groups within the Recipe Book
|
||||
- Updated most recipes to display more logically/consistently within the Recipe Book's categories
|
||||
- Make ride rotations less jittery in multiplayer.
|
||||
- Adjusted the timing and volume of sounds for Close Combat, Swords Dance and Aerial Ace
|
||||
|
||||
### Fixes
|
||||
- Fixed rare Pokémon being far too likely to spawn multiple times in a single spawn cycle. The dev told me that the exact bug is too complicated to explain.
|
||||
- Fixed Omanyte and Omastar incorrectly using water animations on land.
|
||||
- Fixed Pokédex layout for genderless variations.
|
||||
- Fixed odd stacking behaviour with Poké Baits.
|
||||
- Fixed a compatibility issue with World Game Rules which caused some log spam in specific cases.
|
||||
- Fixed improper validation of Pokémon when performing a trade.
|
||||
- Fixed an issue where particles like beams can disappear when you don't see the beginning of the beam, or you look away.
|
||||
- Fixed Bedrock particle materials sometimes being incorrectly invisible from some sides.
|
||||
- Fixed an occasional crash on retrieving revived fossils.
|
||||
- Fixed brushing not working on Neoforge. Again.
|
||||
- Fixed braking not working for submarine-style mounts (whoops).
|
||||
- Fixed strafing not having the same friction as forward movement (funny whoops).
|
||||
- Fixed submarine-style mounts' surface-water animations not playing when supposed to.
|
||||
- Fixed submarine-style mounts' camera freaking out when looking up or down on the surface.
|
||||
- Fixed pastured Pokémon despawning and running away.
|
||||
- Fixed Apricorn trees crashing when other mods bonemeal them.
|
||||
- Fixed the issue that caused hover-style mounts without a ground style to be rendered useless upon touching the ground on a server.
|
||||
- Fixed horizontal and vertical collisions with hover-style mounts so they no longer accumulate or retain momentum.
|
||||
- Fixed NeoForge brewing stand unexpectedly crashing users when shift clicking items within its menu. Well, I suppose all crashes are unexpected. You know what I mean.
|
||||
- Fixed NPCs switching Pokémon very often during battles.
|
||||
- Fixed Campfire Pot causing crashes under certain circumstances.
|
||||
- Fixed Type Gems not being consumed upon use in battles.
|
||||
- Fixed several Ancient Pokéball's not using the correct capture multiplier.
|
||||
- Fixed a server warning that could occur when recalling Pokémon.
|
||||
- Fixed sliding particles incorrectly handling block collision.
|
||||
- Fixed Full Heal not curing status conditions in battle. Literally it's one job.
|
||||
- Fixed a rare issue with battles locking up when you are forced to switch, with the switch menu appearing instantly.
|
||||
- Fixed the combined effects of Pledge moves having broken Showdown message handling and localisation.
|
||||
- Fixed a very niche issue where structures would spawn in an incorrect location, creating very funky world gen.
|
||||
- Fixed Galarian Ponyta missing its cry.
|
||||
- Fixed various log warnings caused by redundant files and sound events.
|
||||
- Traded Pokémon will now retain the original friendship level when traded back to its OT.
|
||||
- Tumblestone Clusters now display correctly on maps.
|
||||
- Fixed removing mulch from berry trees with a shovel not working. That was meant to be a thing.
|
||||
- Fixed collecting honey from Saccharine Leaf blocks deleting Honey Bottles when the inventory was full.
|
||||
- Fixed Stripped Saccharine Wood recipe being... not there.
|
||||
- Fixed some performance issues with a kind of sound event causing lag by attempting to create sounds every tick when out of range of hearing.
|
||||
- Fixed stat-reducing Aprijuice not being possible to apply on a maxed out Pokémon. Also fixed the possibility of going into negatives.
|
||||
- Fixed exploit where you could take out the bait or drop your Pokérod with bait to avoid consuming bait, now the bobber will just disappear if you do so.
|
||||
- Fixed Apricorn and Saccharine boats incorrectly using chest boat models.
|
||||
- Fixed wild and trainer battle AI refusing to select moves with the `adjacentAlly` target type, even when it's their only option.
|
||||
- Fixed gilded chests being more accessible than intended.
|
||||
- Fixed fished up Pokémon not being added as "seen" to the Pokédex.
|
||||
- Fixed surprised Gimmighoul encounters not being added as "seen" to the Pokédex.
|
||||
- Fixed a crash involving berry trees that have been world edited.
|
||||
- Fixed visual desync in multiplayer for players mounting Pokémon outside other players' loaded chunks.
|
||||
- Fixed Pokémon entities leveled by rare candy not getting stronger as Minecraft entities unless recalled.
|
||||
- Fixed a freeze during game load that occurred when multiple mods tried to load Cobblemon API classes at the same time.
|
||||
- Lowered the volume of Blitzle and Zebstrika's cry (shut up!).
|
||||
- Regional Foods will now prioritise being eaten instead of used for healing Pokémon - shift clicking will use it as healing.
|
||||
- Resolved z-fighting (texture flickering) on Pokédex Models.
|
||||
- Restored Ninjask's ability to do barrel rolls.
|
||||
- Fixed Raichu (male) and Alolan Raichu (both genders) not displaying the correct Partner Cap when Pewter Crunchies are in the cosmetic slot.
|
||||
- Fixed a crash caused by adding enchanted items to the Resurrection Machine.
|
||||
- Fixed a crash that could occur when starting a PvN battle with only fainted Pokémon.
|
||||
- Fixed the Remember Riding Camera config not being respected when dismounting and resolved the incompatibility with the Auto Third Person mod.
|
||||
- Fixed Full Heal block not dropping Full Heals. Lmao.
|
||||
- Fixed status cure items not returning an empty bottle when used.
|
||||
- Fixed Panpour consuming its held item when evolving with a Water Stone.
|
||||
- Fixed Smoked Tail Curry returning a Wooden Bowl when consumed despite it not being included in the recipe. Free bowls!
|
||||
- Fixed `/giveallpokemon` not respecting the min and max arguments.
|
||||
- Fixed the choose starter toast not disappearing when capturing a Pokémon instead of opening the starter selection screen.
|
||||
- Fixed an issue where certain Sinister Tea seasonings were only applying as instant effects and would not apply over time.
|
||||
- Long config option labels now scroll instead of overflowing in the configuration menu.
|
||||
- Fixed some z-fighting and clipping on Dewott and Hisui-Bias Dewott.
|
||||
- Eggant Berries can now be composted properly on NeoForge.
|
||||
- Composting chances are now the same on NeoForge as on Fabric.
|
||||
- Fixed problem where furnaces which had smelted Revival Herbs into Heal Powder in older versions would glitch out on trying to get the experience out of the block.
|
||||
- Fixed the Battle AI not recognizing Surging Strikes as a multistrike move.
|
||||
- Fixed Tentacool not using its swim animation when on water surface.
|
||||
- Fixed Eevee using its left shoulder pose when in battle.
|
||||
- Fixed Magikarp and Gyarados Jump Pattern resourcepacks replacing shiny textures of addons targeting Magikarp or Gyarados.
|
||||
- Fixed Combee's pollinated texture overwriting the shiny and female textures.
|
||||
- Fixed a colour mistake with Dracovish's shiny.
|
||||
- Fixed Togedemaru's back spikes z-fighting.
|
||||
- Fixed Sliggoo (+ Hisuian) evolving in the Nether and End where it can't actually rain.
|
||||
- Corrected the scales, hitbox sizes, and eye heights for Ariados, Cetoddle, Durant, Galvantula, Klink, Lanturn, Lumineon, Mantine, Mantyke, Mudbray, Numel, Staravia, and Torkoal.
|
||||
- Fixed Torkoal's walk speed not matching its animation. He will no longer move faster than Bunnelby and Buneary. This tortoise would've won.
|
||||
- Fixed Lanturn T-posing due to missing ground walk and sleep animations.
|
||||
- Fixed Oshawott and Dewott using their sleep animation in unintended scenarios.
|
||||
- Fixed Dudunsparce and Maushold always having the same form instead of having the 1 in 100 chance of being different.
|
||||
- Fixed bird mounts rapidly switching between their flying and gliding animations when flying at low speed.
|
||||
- Fixed some battles being startable with fainted Pokémon in the initial sendout.
|
||||
- Fixed random gender selection for forms with strict gender divides (such as Meowstic and Oinkologne) never choosing female (that's sexist).
|
||||
- Fixed the "Press R to battle" prompt not disappearing after you finish your first battle, at least until you relogged.
|
||||
- Fixed the composter block being listed as "composer" in the cosmetic items species feature
|
||||
- Fixed Castform's forms being tagged as introduced in generation 4 instead of 3.
|
||||
- Fixed Blitzle's base scale being `1` rather than the intended `0.8`.
|
||||
- Fixed Magnezone's emissive layer for the shiny having the wrong name, thus displaying wrongly.
|
||||
- Fixed Litleo not blinking.
|
||||
- Correctly grants "They're Minerals!" advancement when planting a type gem
|
||||
- Type Gem Blocks now have advancements to give you the recipe in the recipe book (the data for the advancements were inside the recipes somehow??)
|
||||
- Some other recipes without advancements have also been corrected
|
||||
- Corrected the TM Recipes for Charge Beam and Payday
|
||||
- Type Gem blocks now properly generate clusters off of the block.
|
||||
- Starter Screen Categories will no longer stop rendering if they are bigger than the viewport, and you are not viewing top or bottom edges
|
||||
- Random Starter option now properly handled in height calculation, so now it won't run off into other categories or be un-accessible due to scroll limits if it causes a new row
|
||||
- Mochi and Feathers no longer drop glass bottles on use
|
||||
- Fixed a rare set of concurrency bugs related to reloading packs on NeoForge; fixes a ModernFix issue
|
||||
- Removed unnecessary conditions for Mimikyu's standing pose. Hopefully fixes the rare instance of it using its shoulder animations during battle in multiplayer scenarios.
|
||||
- Fixed Rockruff line not blinking
|
||||
- Fixed Flygon sometimes using its running animation instead of walking
|
||||
- Fixed Bramblin always sleeping outside of battle
|
||||
- Fixed Dragonair using its battle idle as a normal idle
|
||||
- Fixed Lycanroc's head movement
|
||||
- Added head movement to Archaludon
|
||||
- Fixed Duraludon line not having any sleep animations
|
||||
- Fixed Diglett line not having their faint animations
|
||||
- Fixed Kingambit moving its legs while walking
|
||||
- Various Structure fixes
|
||||
- Tail Whip's sound now correctly plays on the Pokémon performing the move, rather than its target
|
||||
|
||||
### Developer
|
||||
- Added `PokeSnackSpawnerFactory` which allows influence registration on PokeSnack encounters.
|
||||
- Added `FishingSpawnerFactory` which allows influence registration on fishing encounters.
|
||||
- Added `BattleFleeAttemptEvent` fired from `PokemonBattle.checkFleeAttempt`, allowing developers to intercept and control flee attempts.
|
||||
- Tweaked the spawning selector interface to take a bucket function rather than a bucket directly.
|
||||
- Added a new `cobblemon:height_range` processor type to allow developers to restrict structure-spawning ranges.
|
||||
- Separated all the functions of MoLangFunctions.kt into their own files.
|
||||
- Spawn buckets and their base weights are now provided by the spawner, with different base weights for world, fishing, snack, and habitat spawn buckets.
|
||||
- Removed "SpawnBucket" class in favour of just storing maps of bucket names to weights.
|
||||
- Fixed nicknames not being applied to Pokémon spawned from `spawn_pool_world` files.
|
||||
- Added support for `profilePokedexScale`, `profilePokedexTranslation`, `profileSummaryScale`, and `profileSummaryTranslation` in poser files for finer control over profile displays.
|
||||
- Fixed riding camera offsets defined on Pokémon forms not being applied.
|
||||
- Marks can now provide aspects.
|
||||
|
||||
### Molang & Datapacks
|
||||
- Added `moveset_builders` datapack folder for different styles of movesets.
|
||||
- Added `party_pools` datapack folder for defining groups of Pokémon for complex NPC party definitions.
|
||||
- Added `party_compositions` datapack folder for arranging parties on NPCs that rely on party pools.
|
||||
- Added `composed_pool` NPC party provider type which combines a party pool with a party composition to create more complex NPC parties.
|
||||
- Added basic chatter NPC Behaviour.
|
||||
- Added `q.item.is_enchanted()`.
|
||||
- Added `q.item.has_enchantment(minecraft:sharpness, 3)`.
|
||||
- Added `has_chosen_starter` and `get_starter_uuid` as available Molang functions.
|
||||
- Added `has_tm_move_unlocked`, `unlock_tm_move`, and `lock_tm_move` as available Molang functions for Players.
|
||||
- Added `marks`, `has_mark`, and `remove_marks` as available Molang functions for Pokémon.
|
||||
- Added Data Component support for species drops, eg `"components": {"minecraft:custom_model_data": 123}`
|
||||
- Added the new `sortOrder` field to mark entries, (defaults to 0 if not specified) which controls the order in which marks are rendered on the HUD, with higher numbers being rendered on top of lower numbers.
|
||||
- Added optional `order` field to starter categories. It will allow explicitly sorting categories in the starter selection screen.
|
||||
- SpeciesAdditions append vs override now matches the wiki documentation.
|
||||
- Added `weighted_choice` as a new feature type. It requires setting weights for each choice and allows developers to simplify the process of assigning random aspect choice based on marble chance.
|
||||
- Added `q.world.spawn_loot_table_items(loot_table_id, x, y, z)` which spawns the items from the loot table at the position. Use type: `minecraft:chest` for the loot table.
|
||||
- Added `q.pokemon.entity` to access the entity of Pokémon.
|
||||
- Flamethrower and Seismic Toss had their action effect JSON cleaned up.
|
||||
- Ride sounds can now be set as exclusive to passengers.
|
||||
- Ride sounds no longer play when submerged unless specified with a new setting.
|
||||
- NPC Trainers can now call a `command` animation when issuing a command in battle.
|
||||
- Added a q.failed function to move action effects.
|
||||
- Herd spawned Pokémon have their levels controlled differently. The `levelRange` property now acts as a pre-offset clamp instead of a filter, with a new `herdLevelRange` property to do the filter behaviour.
|
||||
- `q.sound` now accepts three parameters (sound event, volume, and pitch) instead of just the sound event and pitch.
|
||||
- Added a new layer property that makes a layer scroll in a direction. "scrolling": {"speedU": 0.1, "speedV": 0.1}
|
||||
- Cleaned up seat data. Removed all now unused fields from seats in all species files. Also made locator seat names explicit in the species files (however, this doesn't break the legacy format)
|
||||
- A new `negate` variant for evolution requirements has been added, which will negate (invert) the provided inner condition.
|
||||
- Added Molang functions for individual Pokédex ids, wherein a subdex is passed in as a string to `dex_caught_count` etc.
|
||||
|
||||
### Particles
|
||||
|
||||
#### New Move Animations
|
||||
- Blizzard
|
||||
- Disarming Voice
|
||||
- Draco Meteor
|
||||
- Dragon Breath
|
||||
- Dragon Rage
|
||||
- Drain Punch
|
||||
- Fairy Wind
|
||||
- Fire Fang
|
||||
- Gust
|
||||
- Horn Drill
|
||||
- Hydro Pump
|
||||
- Ice Fang
|
||||
- Leafage
|
||||
- Leaf Storm
|
||||
- Light Screen
|
||||
- Night Shade
|
||||
- Play Rough
|
||||
- Pyro Ball
|
||||
- Reflect
|
||||
- Rock Slide
|
||||
- Sonic Boom
|
||||
- Sucker Punch
|
||||
- Supersonic
|
||||
- Thunder Fang
|
||||
|
||||
#### Tweaks and Fixes (Moves)
|
||||
|
||||
- Confusion
|
||||
- Dragon Claw
|
||||
- Eruption
|
||||
- Fire Punch
|
||||
- Flame Burst
|
||||
- Flame Charge
|
||||
- Flamethrower
|
||||
- Frost Breath
|
||||
- Hypnosis
|
||||
- Ice Punch
|
||||
- Icy Wind
|
||||
- Mud Sport
|
||||
- Poison Fang
|
||||
- Protect
|
||||
- Psychic
|
||||
- Quick Attack
|
||||
- Rage Powder
|
||||
- Razor Leaf
|
||||
- Sand Attack
|
||||
- Scratch
|
||||
- Shadow Claw
|
||||
- Sing
|
||||
- Spore
|
||||
- String Shot
|
||||
- Tackle
|
||||
- Tail Whip
|
||||
- Thunder
|
||||
- Thunder Punch
|
||||
- Thunder Wave
|
||||
- Water Gun
|
||||
- Water Pulse
|
||||
- Water Sport
|
||||
|
||||
#### Miscellaneous Particles
|
||||
|
||||
- Added Wild Might particles for Alpha Pokémon.
|
||||
- Updated stat increase and decrease particles.
|
||||
|
||||
### Localization
|
||||
- Updated translations for:
|
||||
- Japanese
|
||||
- German
|
||||
- Spanish
|
||||
- Ecuadorian Spanish
|
||||
- Portuguese
|
||||
- Brazilian Portuguese
|
||||
- Simplified Chinese
|
||||
- Traditional Chinese
|
||||
- Korean
|
||||
- Russian
|
||||
- Updated translations for:
|
||||
@@ -1,9 +0,0 @@
|
||||
- Some kind of particle effect for them? they're meant to have glowing eyes, so maybe some red particles on the eye locator
|
||||
--- global posers? stacked posers?
|
||||
--- red texture seems to be what some people wanted.
|
||||
|
||||
/- shoulder mounts part of it
|
||||
- omni boost
|
||||
- roar when player comes within reach, adjust levels
|
||||
|
||||
- Riding settings to control what the min scale is for a pokemon to be ridable.
|
||||
@@ -0,0 +1,529 @@
|
||||
# Changelog
|
||||
## [1.8.0 - Make Your Move Update (September 6th, 2026)](#1-8-0)
|
||||
#### I think the red eyes mean they're friendly!
|
||||
|
||||
### Additions
|
||||
- Added Alpha Pokémon
|
||||
- Alpha Pokémon are bigger, stronger, and more aggressive than regular Pokémon.
|
||||
- They are also scarier.
|
||||
- They always know a TM move and will adapt to be stronger than your party.
|
||||
- Alphas will always lead herds and spawn in herds.
|
||||
- Added alpha Pokémon attraction bait effect to Hopo Berries.
|
||||
- Added intrinsic scaling to all Pokémon (anywhere from 5% smaller to 5% bigger than normal). Some cases, such as shoulder mounting, will not scale so that the shoulder animations don't look silly.
|
||||
- Added scaling to "baby" Pokémon (10% smaller at level 1 → normally sized at level 10).
|
||||
- Added TMs.
|
||||
- Added TM Machine. TMs are made from elemental type gems, and their recipes are unlocked by having Pokémon that know the move.
|
||||
- Added config options for making TMs infinite-use and instant unlocking of all TM recipes.
|
||||
- Added Type Gem blocks as well as crystal clusters and deepslate core blocks that are used for growing elemental type gems.
|
||||
- Added a new Starter Selection menu that looks way better.
|
||||
- Added a "Move Dex" to the Pokédex to help identify what moves a Pokémon can learn and what Pokémon can get a move.
|
||||
- Added the Habitat Block, a spawner block for servers and adventure maps that controls spawning in an area.
|
||||
- Added 49 new habitat structures. In these habitats you will find rarer Pokémon and sometimes different Pokémon will appear on different days.
|
||||
- Added a toast to notify players of how they can scroll through their party. Did you know you can hold R and scroll instead of using arrow keys? It's true!!!
|
||||
- Added a way to obtain Porygon by inserting an Upgrade or Dubious Disc into a data monitor.
|
||||
- Added Disk Rack for storing disks and being an audio sequencer for Noteblocks. What does that have to do with Pokémon? How about you mind your own business!
|
||||
- Added missing crops to Botany Pots integration.
|
||||
- Added conditional seats for riding. Seats can be gated by Molang such as "is_alpha".
|
||||
- Added 10 new ruin structures.
|
||||
- Added a new shipwreck cove structure called the Magma Shipwreck Cove.
|
||||
- Added 7 new advancements.
|
||||
- Pokémon cries now play when clicking Pokémon in the summary screen.
|
||||
- Held item visibility can now be controlled by the `held_item_visible` command argument.
|
||||
- Added config option to disable Pokémon spawning on a per-world basis.
|
||||
- Added config options to award experience to fainted Pokémon for opponents they helped defeat (`awardExperienceToFaintedPokemon`) and to still award experience for defeated enemies even after battle loss/forfeit (`awardExperienceOnBattleLoss`).
|
||||
- Added `/givetm` command.
|
||||
- Added advancement triggers for learning TMs: `cobblemon:has_learn_specific_tm` (per-TM), `cobblemon:has_learn_all_tm` (all TMs learned), and `cobblemon:tms_learned` (count-based), backed by a new `totalTMLearnedCount` on player advancement data.
|
||||
- Added `cobblemon:catch_alpha_pokemon` advancement trigger and `totalAlphaCaptureCount` stat for captured Alpha Pokémon.
|
||||
|
||||
### New rideable Pokémon
|
||||
- Crobat
|
||||
- Skarmory
|
||||
- Milotic
|
||||
- Archeops
|
||||
- Goodra
|
||||
- Goodra (Hisuian Form)
|
||||
- Drampa
|
||||
- Duraludon
|
||||
- Archaludon
|
||||
|
||||
### Pokémon Added
|
||||
#### Generation 3
|
||||
- Wurmple
|
||||
- Silcoon
|
||||
- Beautifly
|
||||
- Cascoon
|
||||
- Dustox
|
||||
- Skitty
|
||||
- Delcatty
|
||||
- Seviper
|
||||
- Zangoose
|
||||
|
||||
#### Generation 4
|
||||
- Cherubi
|
||||
- Cherrim
|
||||
- Stunky
|
||||
- Skuntank
|
||||
|
||||
#### Generation 5
|
||||
- Audino
|
||||
- Pawniard
|
||||
- Bisharp
|
||||
|
||||
#### Generation 6
|
||||
- Pancham (+ Cosmetic with Black Glasses)
|
||||
- Pangoro (+ Cosmetic with Black Glasses)
|
||||
|
||||
#### Generation 7
|
||||
- Rockruff
|
||||
- Lycanroc
|
||||
|
||||
#### Generation 8
|
||||
- Rolycoly
|
||||
- Carkol
|
||||
- Coalossal
|
||||
- Runerigus
|
||||
- Snom
|
||||
- Frosmoth
|
||||
- Indeedee
|
||||
- Duraludon
|
||||
- Applin
|
||||
- Flapple
|
||||
- Appletun
|
||||
|
||||
#### Generation 9
|
||||
|
||||
- Nymble
|
||||
- Lokix
|
||||
- Kingambit
|
||||
- Dipplin
|
||||
- Archaludon
|
||||
- Hydrapple
|
||||
|
||||
#### Regional Forms
|
||||
- Sandshrew (Alolan Form)
|
||||
- Sandslash (Alolan Form)
|
||||
- Yamask (Galarian Form)
|
||||
- Avalugg (Hisuian Form)
|
||||
|
||||
### Model updates for the following Pokémon
|
||||
|
||||
- Sandshrew
|
||||
- Sandslash
|
||||
- Nidoking
|
||||
- Zubat
|
||||
- Golbat
|
||||
- Crobat
|
||||
- Ditto
|
||||
- Porygon
|
||||
- Porygon2
|
||||
- Porygon-Z
|
||||
- Skarmory
|
||||
- Smoochum
|
||||
- Jynx
|
||||
- Popplio
|
||||
- Brionne
|
||||
- Primarina
|
||||
- Fletchling
|
||||
- Fletchinder
|
||||
- Talonflame
|
||||
- Sableye
|
||||
- Mawile
|
||||
- Goomy
|
||||
- Sliggoo
|
||||
- Goodra
|
||||
- Nacli
|
||||
- Naclstack
|
||||
- Garganacl
|
||||
- Bidoof
|
||||
- Cranidos
|
||||
- Chatot
|
||||
- Yamask
|
||||
- Cofagrigus
|
||||
- Tyranitar
|
||||
- Turtonator
|
||||
- Golett
|
||||
- Corsola
|
||||
- Arbok (New Patterns: Angry, Cartoon, Clown, Comedic, Crow, Grin, Ink, Modern, Rain, Scribble, Silence, Sloth, Suspicious, Will)
|
||||
- ... and Substitute
|
||||
|
||||
#### Model changes to the regional bias resource pack:
|
||||
- Added Mime Jr. (Galar Bias)
|
||||
- Added Bergmite (Hisui Bias)
|
||||
- Changed models for every existing regional bias
|
||||
|
||||
### Animation updates for the following Pokémon
|
||||
|
||||
- Kakuna
|
||||
- Grimer
|
||||
- Nidoran♀ (+ New shoulder mount)
|
||||
- Nidorina
|
||||
- Nidoran♂ (+ New shoulder mount)
|
||||
- Sandshrew
|
||||
- Diglett
|
||||
- Dugtrio
|
||||
- Graveler
|
||||
- Happiny
|
||||
- Chansey
|
||||
- Blissey
|
||||
- Poliwhirl
|
||||
- Poliwrath
|
||||
- Zubat
|
||||
- Vulpix
|
||||
- Drowzee
|
||||
- Hypno
|
||||
- Noctowl
|
||||
- Skarmory
|
||||
- Skitty
|
||||
- Flygon
|
||||
- Shellos
|
||||
- Riolu
|
||||
- Lucario
|
||||
- Purrloin
|
||||
- Liepard
|
||||
- Joltik
|
||||
- Galvantula
|
||||
- Nidoking
|
||||
- Fletchling
|
||||
- Fletchinder
|
||||
- Talonflame
|
||||
- Archeops
|
||||
- Drampa
|
||||
- Sewaddle
|
||||
- Swadloon
|
||||
- Leavanny
|
||||
- Goomy
|
||||
- Sliggoo
|
||||
- Goodra
|
||||
- Shedinja
|
||||
- Skwovet
|
||||
- Greedent
|
||||
- Bidoof
|
||||
- Cranidos
|
||||
- Chatot
|
||||
- Yamask
|
||||
- Cofagrigus
|
||||
- Luvdisc
|
||||
- Staryu
|
||||
- Starmie
|
||||
- Togetic
|
||||
- Rellor
|
||||
- Rabsca
|
||||
- Yungoos
|
||||
- Gumshoos
|
||||
- Cottonee
|
||||
- Whimsicott
|
||||
- Corsola
|
||||
|
||||
#### Added sounds to the following moves
|
||||
|
||||
- Absorb
|
||||
- Aurora Beam
|
||||
- Double Team
|
||||
- Draco Meteor
|
||||
- Fire Punch
|
||||
- Fire Spin
|
||||
- Flame Charge
|
||||
- Flame Wheel
|
||||
- Giga Drain
|
||||
- Ice Punch
|
||||
- Leech Life
|
||||
- Magical Leaf
|
||||
- Mega Drain
|
||||
- Minimize
|
||||
- Poison Gas
|
||||
- Rock Throw
|
||||
- Scary Face
|
||||
- Seed bomb
|
||||
- Smokescreen
|
||||
- String Shot
|
||||
- Tail Whip
|
||||
|
||||
### Changes
|
||||
- Removed the penalty for block destruction speed when on a hover mount, making them better for digging.
|
||||
- Golden Apples can now be crafted using the Applin Apples.
|
||||
- Prismarine Crystals and Amethyst Shards can now be used to craft Pokedexes.
|
||||
- Updated Pokédex Screens item tag to support tagged variants of Redstone and Glowstone Dust.
|
||||
- Sharp Beak can now be crafted using bones and Flying Gems.
|
||||
- Metal Alloy can now be crafted using iron and Thunder Stones.
|
||||
- Ability Capsules can now be brewed from Medicinal Brew and Dragon Breath.
|
||||
- Using an Ability Capsule will now return an Empty Bottle.
|
||||
- Decreased the default pastured wander radius to 32 blocks.
|
||||
- Added alternate versions of the basic PC Wallpapers based on the original design of Cobblemon's PC, before public release.
|
||||
- Rooted Arch Ruins, Crumbling Arch Ruins, and all fossil structures have been improved so that they generate more naturally in terrain.
|
||||
- Gimmighoul towers now generate at ground-level rather than sinking one block into the ground.
|
||||
- All ruin structures that did not generate with a gimmighoul/gilded chest before will now generate with one.
|
||||
- All ruin structures gilded chest loot tables have been updated to include a guaranteed TM not learned naturally by any Pokémon through their level-up moveset. Each ruin gets its own specific TM, so you can now go hunting ruins to complete your move dex!
|
||||
- The Prehistoric Underwater Fissure and Prehistoric Submerged Impact fossil structures now use the biome tag `#cobblemon:is_temperate_ocean`.
|
||||
- The lush shipwreck cove's phantom mob spawner has been replaced with breezes.
|
||||
- Shipwreck coves now generate slightly more frequently.
|
||||
- Added equipment loot tables for shipwreck cove enemies.
|
||||
- Maps from abandoned fishing boats leading to shipwreck coves now will skip explored chunks, allowing the player to find more shipwreck coves more easily.
|
||||
- All shipwreck coves' spawners have been adjusted to give compatible mobs enchanted iron or diamond armour and weapons while in its ominous state. The armour given to the mobs will also use the automaton trim. We upped the difficulty because it was too easy now that your Pokémon can fight for you.
|
||||
- One TM of the elemental hyper beams has been added as guaranteed loot to the main treasure chest in every shipwreck cove. (Magma Cove gets Blast Burn, Lush Cove gets Frenzy Plant, and Submerged Cove gets Hydro Cannon.)
|
||||
- The following items can now be obtained by brushing the following Pokémon:
|
||||
- Pink Wool - Wigglytuff
|
||||
- White Wool - Swablu, Altaria
|
||||
- Shed Shell - Ekans, Arbok, Dratini, Dragonair, Dunsparce, Treecko, Grovyle, Sceptile, Seviper, Scraggy, Scrafty, Helioptile, Heliolisk, Salandit, Salazzle, Sobble, Drizzile, Inteleon, Silicoblra, Sandaconda, Toxel, Toxtricity, Orthworm, Dudunsparce
|
||||
- Phantom Membrane - Dreepy, Drakloak, Dragapult
|
||||
- The following items can now be obtained by evolving the following Pokémon into any of their evolutions:
|
||||
- Turtle Scute - Squirtle, Wartortle, Turtwig, Grotle, Tirtouga, Chewtle
|
||||
- Shed Shell - Metapod, Kakuna, Ekans, Paras, Venonat, Krabby, Scyther, Kabuto, Dratini, Dragonair, Ledyba, Spinarak, Yanma, Pineco, Dunsparce, GLigar, Pupitar, Treecko, Grovyle, Silcoon, Cascoon, Surskit, Nincada, Trapinch, Vibrava, Corphish, Anorith, Bagon, Shelgon, Kricketot, Burmy, Combee, Skorupi, Swadloon, Whirlipede, Dwebble, Scraggy, Karrablast, Joltik, Larvesta, Spewpa, Clauncher, Helioptile, Charjabug, Crabrawler, Cutiefly, Dewpider, Salandit, Wimpod, Poipole, Sobble, Drizzile, Dottler, Silicobra, Toxel, Sizzlipede, Snom, Tarountula, Nymble, Rellor
|
||||
- Saccharine Leaves now drop Tart, Sweet, or Syrupy Apples, depending on their honey coating stage, instead of vanilla Apples.
|
||||
- Fixed the height of the Tumblestone Bud items when held in hand, placed on head, viewed in a GUI, and placed in an Item Frame.
|
||||
- Refactored all advancements, removing several deemed unnecessary. Due to this cleanup, all previously obtained advancements will be reset besides the root (for picking a starter Pokémon). This sucks, and we're sorry. We had to do this eventually so better now than later.
|
||||
- Forces between colliding hitboxes now factors in the weight of Pokémon.
|
||||
- Improved berry tree performance on singleplayer and servers.
|
||||
- Updated stat increase and decrease particle effects with the addition of alpha boost particles.
|
||||
- Improved the performance of pasture blocks on singleplayer and servers.
|
||||
- Changed the bait effects of the following items: (Vanilla) Sweet & Glow Berries, Golden & Enchanted Golden Apples (Cobblemon) Custap, Eggant, Hopo & Micle Berries, Sweet Hearts.
|
||||
- Wild Pokémon now reliably have at least one offensive move if they can have offensive moves at that level. No more free lunches with Pokémon that can't even hurt you.
|
||||
- Data Monitor can accept Disks (TMs, Music Disks, Upgrade, Dubious Disk, etc.) to change what's being displayed on the screen.
|
||||
- The party overlay's experience-gained animation now displays the amount of EXP the Pokémon gained.
|
||||
- Pressing the inventory key now closes the Pokémon interact wheel GUI.
|
||||
- Updated the sound for harvesting Apricorns.
|
||||
- Lowered the volume of harvesting berries.
|
||||
- Improved compatibility with various mods
|
||||
- Farmer's Delight's cutting board can now be used to strip Apricorn and Saccharine's logs, or salvage their planks from various blocks. It can also separate their boats from chests.
|
||||
- Farmer's Delight's cutting board can be used to get two white dye from Pep-Up Flowers and two magenta dye from Medicinal Leeks.
|
||||
- Farmer's Delight's cutting board can separate Tumblestone Blocks back into Tumblestones.
|
||||
- Farmer's Delight's cutting board can salvage Type Gems from their Gem Blocks.
|
||||
- Farmer's Delight's Onions, Tomatoes, and Cabbages can be used to cook Open-Faced Sandwiches. Nature's Spirit's Olives also can be used.
|
||||
- Farmer's Delight's cutting board can be used on Hearty Grains to obtain rice and straw, similarly to Farmer's Delight's Rice Panicles.
|
||||
- Farmer's Delight's Apple Pies and Apple Ciders can now be made using Applin Apples, alongside the Vanilla counterpart.
|
||||
- Amendments allows for cooking Leek and Potato Stew in a Cauldron.
|
||||
- Any mods that utilise Moonlight's Soft Fluid system can store Leek and Potato Stew, Medicinal Brew, Antidote, Awakening, Burn Heal, Ice Heal, Paralyze Heal, Full Heal, Potion, Super Potion, Hyper Potion, Max Potion, Full Restore, Ability Capsules, Moomoo Milk, and Berry Juice in liquid form (such as Suplementaries' Jar or Goblet, or Cauldrons while using Amendments).
|
||||
- Supplementaries' Hourglass can now use Bright Powder, Quick Powder, Metal Powder, Heal Powder, Silver Powder, and Remedy.
|
||||
- Berry Trees are now compatible with the Planter properly
|
||||
- Saccharine Way Signs (added by Supplementaries automagically) now use a premade texture to prevent odd visual issues.
|
||||
- Supplementaries' Jar can now store various Cobblemon cookies, candies, and similar items.
|
||||
- Some of Supplementaries' items have been added to the `#cobblemon:held/container_held_items` item tag, including sacks, safes, and lunch baskets.
|
||||
- Experience Nuggets can be used in place of Sculk for making the EXP Candies if using Create.
|
||||
- Rage Candy Bar has a Create Mixing recipe.
|
||||
- All Cobblemon ores can now be crushed in Create's Crushing Wheels. All Gem and Tumblestone Clusters can be crushed for automatic, low return, gems.
|
||||
- Hearty Grains can be milled like Farmer's Delight Rice Panicles if both Farmer's Delight and Create are installed.
|
||||
- Big Roots and Revival Herbs can be milled to their respective powders.
|
||||
- Pep-Up Flowers, Medicinal Leeks, and all 70 berries can be milled in Create's Millstone for additional dye drops.
|
||||
- Auspicious Armour and Upgrades can be Haunted using Create's crafting systems.
|
||||
- Applin Apples can be used to make Honeyed Apples in Create.
|
||||
- Sounds for interacting with various Cobblemon blocks now play from the centre of the block, rather than the corner. You probably didn't notice.
|
||||
- Dragonite's mailbag cosmetic can now also be obtained with a chest in the cosmetic slot.
|
||||
- Adjusted the walk speed for Croagunk and Aerodactyl.
|
||||
- The `/pc` command no longer plays PC activation sounds
|
||||
- Pressing the Summary key while either the starter selection or summary screen are open now closes those screens.
|
||||
- Ice type Pokémon are now immune to Packed Snow.
|
||||
- Added cobweb block slowness immunity for spider Pokémon
|
||||
|
||||
### Fixes
|
||||
- Fixed rare Pokémon being far too likely to spawn multiple times in a single spawn cycle. The dev told me that the exact bug is too complicated to explain.
|
||||
- Fixed Omanyte and Omastar incorrectly using water animations on land.
|
||||
- Fixed Pokédex layout for genderless variations.
|
||||
- Fixed odd stacking behaviour with Poké Baits.
|
||||
- Fixed a compatibility issue with World Game Rules which caused some log spam in specific cases.
|
||||
- Fixed improper validation of Pokémon when performing a trade.
|
||||
- Fixed an issue where particles like beams can disappear when you don't see the beginning of the beam, or you look away.
|
||||
- Fixed Bedrock particle materials sometimes being incorrectly invisible from some sides.
|
||||
- Fixed an occasional crash on retrieving revived fossils.
|
||||
- Fixed brushing not working on Neoforge. Again.
|
||||
- Fixed braking not working for submarine-style mounts (whoops).
|
||||
- Fixed strafing not having the same friction as forward movement (funny whoops).
|
||||
- Fixed submarine-style mounts' surface-water animations not playing when supposed to.
|
||||
- Fixed submarine-style mounts' camera freaking out when looking up or down on the surface.
|
||||
- Fixed pastured Pokémon despawning and running away.
|
||||
- Fixed Apricorn trees crashing when other mods bonemeal them.
|
||||
- Fixed the issue that caused hover-style mounts without a ground style to be rendered useless upon touching the ground on a server.
|
||||
- Fixed horizontal and vertical collisions with hover-style mounts so they no longer accumulate or retain momentum.
|
||||
- Fixed NeoForge brewing stand unexpectedly crashing users when shift clicking items within its menu. Well, I suppose all crashes are unexpected. You know what I mean.
|
||||
- Fixed NPCs switching Pokémon very often during battles.
|
||||
- Fixed Campfire Pot causing crashes under certain circumstances.
|
||||
- Fixed Type Gems not being consumed upon use in battles.
|
||||
- Fixed several Ancient Pokéball's not using the correct capture multiplier.
|
||||
- Fixed a server warning that could occur when recalling Pokémon.
|
||||
- Fixed sliding particles incorrectly handling block collision.
|
||||
- Fixed Full Heal not curing status conditions in battle. Literally it's one job.
|
||||
- Fixed a rare issue with battles locking up when you are forced to switch, with the switch menu appearing instantly.
|
||||
- Fixed the combined effects of Pledge moves having broken Showdown message handling and localisation.
|
||||
- Fixed a very niche issue where structures would spawn in an incorrect location, creating very funky world gen.
|
||||
- Fixed Galarian Ponyta missing its cry.
|
||||
- Fixed various log warnings caused by redundant files and sound events.
|
||||
- Traded Pokémon will now retain the original friendship level when traded back to its OT.
|
||||
- Tumblestone Clusters now display correctly on maps.
|
||||
- Fixed removing mulch from berry trees with a shovel not working. That was meant to be a thing.
|
||||
- Fixed collecting honey from Saccharine Leaf blocks deleting Honey Bottles when the inventory was full.
|
||||
- Fixed Stripped Saccharine Wood recipe being... not there.
|
||||
- Fixed some performance issues with a kind of sound event causing lag by attempting to create sounds every tick when out of range of hearing.
|
||||
- Fixed stat-reducing Aprijuice not being possible to apply on a maxed out Pokémon. Also fixed the possibility of going into negatives.
|
||||
- Fixed exploit where you could take out the bait or drop your Pokérod with bait to avoid consuming bait, now the bobber will just disappear if you do so.
|
||||
- Fixed Apricorn and Saccharine boats incorrectly using chest boat models.
|
||||
- Fixed wild and trainer battle AI refusing to select moves with the `adjacentAlly` target type, even when it's their only option.
|
||||
- Fixed gilded chests being more accessible than intended.
|
||||
- Fixed fished up Pokémon not being added as "seen" to the Pokédex.
|
||||
- Fixed surprised Gimmighoul encounters not being added as "seen" to the Pokédex.
|
||||
- Fixed a crash involving berry trees that have been world edited.
|
||||
- Fixed visual desync in multiplayer for players mounting Pokémon outside other players' loaded chunks.
|
||||
- Fixed Pokémon entities leveled by rare candy not getting stronger as Minecraft entities unless recalled.
|
||||
- Fixed a freeze during game load that occurred when multiple mods tried to load Cobblemon API classes at the same time.
|
||||
- Lowered the volume of Blitzle and Zebstrika's cry (shut up!).
|
||||
- Regional Foods will now prioritise being eaten instead of used for healing Pokémon - shift clicking will use it as healing.
|
||||
- Resolved z-fighting (texture flickering) on Pokédex Models.
|
||||
- Restored Ninjask's ability to do barrel rolls.
|
||||
- Fixed Raichu (male) and Alolan Raichu (both genders) not displaying the correct Partner Cap when Pewter Crunchies are in the cosmetic slot.
|
||||
- Fixed a crash caused by adding enchanted items to the Resurrection Machine.
|
||||
- Fixed a crash that could occur when starting a PvN battle with only fainted Pokémon.
|
||||
- Fixed the Remember Riding Camera config not being respected when dismounting and resolved the incompatibility with the Auto Third Person mod.
|
||||
- Fixed Full Heal block not dropping Full Heals. Lmao.
|
||||
- Fixed status cure items not returning an empty bottle when used.
|
||||
- Fixed Panpour consuming its held item when evolving with a Water Stone.
|
||||
- Fixed Smoked Tail Curry returning a Wooden Bowl when consumed despite it not being included in the recipe. Free bowls!
|
||||
- Fixed `/giveallpokemon` not respecting the min and max arguments.
|
||||
- Fixed the choose starter toast not disappearing when capturing a Pokémon instead of opening the starter selection screen.
|
||||
- Fixed an issue where certain Sinister Tea seasonings were only applying as instant effects and would not apply over time.
|
||||
- Long config option labels now scroll instead of overflowing in the configuration menu.
|
||||
- Fixed some z-fighting and clipping on Dewott and Hisui-Bias Dewott.
|
||||
- Eggant Berries can now be composted properly on NeoForge.
|
||||
- Composting chances are now the same on NeoForge as on Fabric.
|
||||
- Fixed problem where furnaces which had smelted Revival Herbs into Heal Powder in older versions would glitch out on trying to get the experience out of the block.
|
||||
- Fixed the Battle AI not recognizing Surging Strikes as a multistrike move.
|
||||
- Fixed Tentacool not using its swim animation when on water surface.
|
||||
- Fixed Eevee using its left shoulder pose when in battle.
|
||||
- Fixed Magikarp and Gyarados Jump Pattern resourcepacks replacing shiny textures of addons targeting Magikarp or Gyarados.
|
||||
- Fixed Combee's pollinated texture overwriting the shiny and female textures.
|
||||
- Fixed a colour mistake with Dracovish's shiny.
|
||||
- Fixed Togedemaru's back spikes z-fighting.
|
||||
- Fixed Sliggoo (+ Hisuian) evolving in the Nether and End where it can't actually rain.
|
||||
- Corrected the scales, hitbox sizes, and eye heights for Ariados, Cetoddle, Durant, Galvantula, Klink, Lanturn, Lumineon, Mantine, Mantyke, Mudbray, Numel, Staravia, and Torkoal.
|
||||
- Fixed Torkoal's walk speed not matching its animation. He will no longer move faster than Bunnelby and Buneary. This tortoise would've won.
|
||||
- Fixed Lanturn T-posing due to missing ground walk and sleep animations.
|
||||
- Fixed Oshawott and Dewott using their sleep animation in unintended scenarios.
|
||||
- Fixed Dudunsparce and Maushold always having the same form instead of having the 1 in 100 chance of being different.
|
||||
- Fixed bird mounts rapidly switching between their flying and gliding animations when flying at low speed.
|
||||
- Fixed some battles being startable with fainted Pokémon in the initial sendout.
|
||||
- Fixed random gender selection for forms with strict gender divides (such as Meowstic and Oinkologne) never choosing female (that's sexist).
|
||||
- Fixed the "Press R to battle" prompt not disappearing after you finish your first battle, at least until you relogged.
|
||||
- Fixed the composter block being listed as "composer" in the cosmetic items species feature
|
||||
- Fixed Castform's forms being tagged as introduced in generation 4 instead of 3.
|
||||
- Fixed Blitzle's base scale being `1` rather than the intended `0.8`.
|
||||
- Fixed Magnezone's emissive layer for the shiny having the wrong name, thus displaying wrongly.
|
||||
- Fixed Litleo not blinking.
|
||||
|
||||
### Developer
|
||||
- Added `PokeSnackSpawnerFactory` which allows influence registration on PokeSnack encounters.
|
||||
- Added `FishingSpawnerFactory` which allows influence registration on fishing encounters.
|
||||
- Added `BattleFleeAttemptEvent` fired from `PokemonBattle.checkFleeAttempt`, allowing developers to intercept and control flee attempts.
|
||||
- Tweaked the spawning selector interface to take a bucket function rather than a bucket directly.
|
||||
- Added a new `cobblemon:height_range` processor type to allow developers to restrict structure-spawning ranges.
|
||||
- Separated all the functions of MoLangFunctions.kt into their own files.
|
||||
- Spawn buckets and their base weights are now provided by the spawner, with different base weights for world, fishing, snack, and habitat spawn buckets.
|
||||
- Removed "SpawnBucket" class in favour of just storing maps of bucket names to weights.
|
||||
- Fixed nicknames not being applied to Pokémon spawned from `spawn_pool_world` files.
|
||||
- Added support for `profilePokedexScale`, `profilePokedexTranslation`, `profileSummaryScale`, and `profileSummaryTranslation` in poser files for finer control over profile displays.
|
||||
- Fixed riding camera offsets defined on Pokémon forms not being applied.
|
||||
- Marks can now provide aspects.
|
||||
|
||||
### Molang & Datapacks
|
||||
- Added `moveset_builders` datapack folder for different styles of movesets.
|
||||
- Added `party_pools` datapack folder for defining groups of Pokémon for complex NPC party definitions.
|
||||
- Added `party_compositions` datapack folder for arranging parties on NPCs that rely on party pools.
|
||||
- Added `composed_pool` NPC party provider type which combines a party pool with a party composition to create more complex NPC parties.
|
||||
- Added basic chatter NPC Behaviour.
|
||||
- Added `q.item.is_enchanted()`.
|
||||
- Added `q.item.has_enchantment(minecraft:sharpness, 3)`.
|
||||
- Added `has_chosen_starter` and `get_starter_uuid` as available Molang functions.
|
||||
- Added `has_tm_move_unlocked`, `unlock_tm_move`, and `lock_tm_move` as available Molang functions for Players.
|
||||
- Added `marks`, `has_mark`, and `remove_marks` as available Molang functions for Pokémon.
|
||||
- Added Data Component support for species drops, eg `"components": {"minecraft:custom_model_data": 123}`
|
||||
- Added the new `sortOrder` field to mark entries, (defaults to 0 if not specified) which controls the order in which marks are rendered on the HUD, with higher numbers being rendered on top of lower numbers.
|
||||
- Added optional `order` field to starter categories. It will allow explicitly sorting categories in the starter selection screen.
|
||||
- SpeciesAdditions append vs override now matches the wiki documentation.
|
||||
- Added `weighted_choice` as a new feature type. It requires setting weights for each choice and allows developers to simplify the process of assigning random aspect choice based on marble chance.
|
||||
- Added `q.world.spawn_loot_table_items(loot_table_id, x, y, z)` which spawns the items from the loot table at the position. Use type: `minecraft:chest` for the loot table.
|
||||
- Added `q.pokemon.entity` to access the entity of Pokémon.
|
||||
- Flamethrower and Seismic Toss had their action effect JSON cleaned up.
|
||||
- Ride sounds can now be set as exclusive to passengers.
|
||||
- Ride sounds no longer play when submerged unless specified with a new setting.
|
||||
- NPC Trainers can now call a `command` animation when issuing a command in battle.
|
||||
- Added a q.failed function to move action effects.
|
||||
- Herd spawned Pokémon have their levels controlled differently. The `levelRange` property now acts as a pre-offset clamp instead of a filter, with a new `herdLevelRange` property to do the filter behaviour.
|
||||
- `q.sound` now accepts three parameters (sound event, volume, and pitch) instead of just the sound event and pitch.
|
||||
- Added a new layer property that makes a layer scroll in a direction. "scrolling": {"speedU": 0.1, "speedV": 0.1}
|
||||
- Cleaned up seat data. Removed all now unused fields from seats in all species files. Also made locator seat names explicit in the species files (however, this doesn't break the legacy format)
|
||||
|
||||
### Particles
|
||||
|
||||
#### New Move Animations
|
||||
- Blizzard
|
||||
- Disarming Voice
|
||||
- Draco Meteor
|
||||
- Dragon Breath
|
||||
- Dragon Rage
|
||||
- Drain Punch
|
||||
- Fairy Wind
|
||||
- Fire Fang
|
||||
- Gust
|
||||
- Horn Drill
|
||||
- Hydro Pump
|
||||
- Ice Fang
|
||||
- Leafage
|
||||
- Leaf Storm
|
||||
- Light Screen
|
||||
- Night Shade
|
||||
- Play Rough
|
||||
- Pyro Ball
|
||||
- Reflect
|
||||
- Rock Slide
|
||||
- Sonic Boom
|
||||
- Sucker Punch
|
||||
- Supersonic
|
||||
- Thunder Fang
|
||||
|
||||
#### Tweaks and Fixes (Moves)
|
||||
|
||||
- Confusion
|
||||
- Dragon Claw
|
||||
- Eruption
|
||||
- Fire Punch
|
||||
- Flame Burst
|
||||
- Flame Charge
|
||||
- Flamethrower
|
||||
- Frost Breath
|
||||
- Hypnosis
|
||||
- Ice Punch
|
||||
- Icy Wind
|
||||
- Mud Sport
|
||||
- Poison Fang
|
||||
- Protect
|
||||
- Psychic
|
||||
- Quick Attack
|
||||
- Rage Powder
|
||||
- Razor Leaf
|
||||
- Sand Attack
|
||||
- Scratch
|
||||
- Shadow Claw
|
||||
- Sing
|
||||
- Spore
|
||||
- String Shot
|
||||
- Tackle
|
||||
- Tail Whip
|
||||
- Thunder
|
||||
- Thunder Punch
|
||||
- Thunder Wave
|
||||
- Water Gun
|
||||
- Water Pulse
|
||||
- Water Sport
|
||||
|
||||
#### Miscellaneous Particles
|
||||
|
||||
- Added Wild Might particles for Alpha Pokémon.
|
||||
- Updated stat increase and decrease particles.
|
||||
|
||||
### Localization
|
||||
- Updated translations for:
|
||||
- Japanese
|
||||
- German
|
||||
- Spanish
|
||||
- Ecuadorian Spanish
|
||||
- Portuguese
|
||||
- Brazilian Portuguese
|
||||
- Simplified Chinese
|
||||
- Traditional Chinese
|
||||
- Korean
|
||||
- Russian
|
||||
@@ -0,0 +1,41 @@
|
||||
# Changelog
|
||||
## [1.8.1 (September 13th, 2026)](#1-8-1)
|
||||
|
||||
### Animation updates for the following Pokémon
|
||||
- Flapple, Appletun, Dipplin, Hydrapple (placeholder animations only).
|
||||
|
||||
### Fixes
|
||||
- Fixed a potential world generation stall caused by Type Gem clusters.
|
||||
- Fixed Pokémon on shoulders not animating if they are visibly holding a held item.
|
||||
- Fixed NPCs getting their own TM progress file.
|
||||
- Fixed odd NeoForge crash due to a dependency being outdated. It will now correctly flag the dependency for being outdated.
|
||||
- Fixed the TM Machine refusing move selections that the `unlockAllMoveDexMovesByDefault` config had made visible, leaving the move slot blank and the craft button unresponsive.
|
||||
- Fixed the Beast Ball not applying its 0.1× penalty to Pokémon that are not Ultra Beasts.
|
||||
- Fixed the Moon Ball reading the world's total elapsed time instead of the time of day, so its bonus applied during the day instead.
|
||||
- Fixed the Love Ball never awarding its 2.5× opposite gender bonus, and matching species by display name instead of identifier.
|
||||
- Fixed the Timer Ball being weaker than a regular Poké Ball on early turns and only reaching 4× on turn 14 instead of turn 10.
|
||||
- Fixed the Luxury Ball only doubling Friendship gains of 1, leaving level up and berry gains unaffected.
|
||||
- Fixed Rufflet, Braviary, and Hisuian Braviary flooding logs with errors about missing sound events.
|
||||
- Fixed Pokémon property typos in Pangoro and Dedenne herd spawn files.
|
||||
- Fixed unintentional watermelon cosmetic for Hisuian Electrode.
|
||||
- Fixed Blastoise having an unintentional passenger seat.
|
||||
- Fixed form typo in Rockruff-Dusk spawn, preventing it from being able to spawn.
|
||||
- Fixed the `stat_compare` and `stat_equal` evolution requirements crashing the game when given `special_attack` or `special_defence`, and made them treat any non-permanent stat as a failed requirement instead of crashing.
|
||||
- Fixed Rowap and Jacoba berries not correctly altering Pokémon sizes when used as bait.
|
||||
- Fixed Ampharos' eyes not emitting particles.
|
||||
- Fixed Alolan Raticate's cry not playing.
|
||||
- Fixed several incorrect light-based spawning conditions for ghosts and bugs.
|
||||
- Removed unused, placeholder habitat pools.
|
||||
- Fixed Mantyke, Mantine, and Quaxly getting stuck in a recoil 'expression' during battles due to having an expression assigned as a recoil animation.
|
||||
- Fixed Lucario's aura particles not emitting.
|
||||
- Fixed Lycanroc's head movement.
|
||||
- Added head movement to Archaludon.
|
||||
- Fixed Duraludon line not having their sleep animations.
|
||||
- Fixed Diglett line not having their faint animations.
|
||||
- Fixed Kingambit moving its legs while walking.
|
||||
|
||||
### Localization
|
||||
- Updated translations for:
|
||||
- Brazilian Portuguese
|
||||
- Simplified Chinese
|
||||
- Japanese
|
||||
@@ -16,6 +16,8 @@ import com.cobblemon.mod.common.block.MintBlock.MintType
|
||||
import com.cobblemon.mod.common.block.campfirepot.CampfireBlock
|
||||
import com.cobblemon.mod.common.block.campfirepot.CampfirePotBlock
|
||||
import com.cobblemon.mod.common.block.chest.GildedChestBlock
|
||||
import com.cobblemon.mod.common.block.decor.ActivatableDecorationBlock
|
||||
import com.cobblemon.mod.common.block.decor.RingTargetBlock
|
||||
import com.cobblemon.mod.common.block.general.BaleBlock
|
||||
import com.cobblemon.mod.common.block.general.HorizontalRotationCarpetBlock
|
||||
import com.cobblemon.mod.common.block.general.HorizontalRotationalBlock
|
||||
@@ -620,6 +622,88 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
|
||||
@JvmField
|
||||
val WEAKNESS_POLICY = create("weakness_policy", WallAttachedDirectionalShapeBlock(BlockBehaviour.Properties.of().sound(CobblemonSounds.ITEM_BLOCK_PAPER_LARGE_SOUNDS).mapColor(MapColor.NONE).noOcclusion().noCollission(), 14, 12, 1))
|
||||
|
||||
@JvmField
|
||||
val RING_TARGET = create("ring_target", RingTargetBlock(BlockBehaviour.Properties.of().sound(SoundType.WOOD).mapColor(MapColor.NONE).noOcclusion().strength(0.125f)))
|
||||
@JvmField
|
||||
val MAGNET = create("magnet", MagnetBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.NONE).noOcclusion().strength(0.075f)))
|
||||
@JvmField
|
||||
val GALARICA_WREATH = create("galarica_wreath", GalaricaWreathBlock(BlockBehaviour.Properties.of().sound(SoundType.AZALEA_LEAVES).mapColor(MapColor.NONE).noOcclusion().noCollission()))
|
||||
|
||||
@JvmField
|
||||
val FLAME_ORB = create("flame_orb", OrbBlock(BlockBehaviour.Properties.of().sound(SoundType.GLASS).mapColor(MapColor.NONE).noOcclusion().lightLevel{15}))
|
||||
@JvmField
|
||||
val TOXIC_ORB = create("toxic_orb", OrbBlock(BlockBehaviour.Properties.of().sound(SoundType.GLASS).mapColor(MapColor.NONE).noOcclusion()))
|
||||
@JvmField
|
||||
val LIFE_ORB = create("life_orb", OrbBlock(BlockBehaviour.Properties.of().sound(SoundType.GLASS).mapColor(MapColor.NONE).noOcclusion().lightLevel{7}))
|
||||
@JvmField
|
||||
val LIGHT_BALL = create("light_ball", OrbBlock(BlockBehaviour.Properties.of().sound(SoundType.GLASS).mapColor(MapColor.NONE).noOcclusion().lightLevel{13}))
|
||||
@JvmField
|
||||
val SMOKE_BALL = create("smoke_ball", OrbBlock(BlockBehaviour.Properties.of().sound(SoundType.GLASS).mapColor(MapColor.NONE).noOcclusion()))
|
||||
|
||||
@JvmField
|
||||
val KINGS_ROCK = create("kings_rock", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(CobblemonSounds.TUMBLESTONE_BLOCK_SOUNDS).mapColor(MapColor.NONE).noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.CENTERED_6x))
|
||||
|
||||
@JvmField
|
||||
val GALARICA_CUFF = create("galarica_cuff", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.AZALEA_LEAVES).mapColor(MapColor.NONE).noCollission().noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.FLATTENED_10x4))
|
||||
@JvmField
|
||||
val UNREMARKABLE_TEACUP = create("unremarkable_teacup", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.DECORATED_POT).mapColor(MapColor.NONE).noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.TEACUP))
|
||||
@JvmField
|
||||
val MASTERPIECE_TEACUP = create("masterpiece_teacup", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.DECORATED_POT).mapColor(MapColor.NONE).noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.TEACUP))
|
||||
@JvmField
|
||||
val CHIPPED_POT = create("chipped_pot", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.DECORATED_POT).mapColor(MapColor.NONE).noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.TEAPOT))
|
||||
@JvmField
|
||||
val CRACKED_POT = create("cracked_pot", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.DECORATED_POT).mapColor(MapColor.NONE).noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.TEAPOT))
|
||||
|
||||
@JvmField
|
||||
val SACHET = create("sachet", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.WOOL).mapColor(MapColor.NONE).noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.POUCH))
|
||||
@JvmField
|
||||
val METAL_POWDER = create("metal_powder", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.WOOL).mapColor(MapColor.NONE).noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.POUCH))
|
||||
@JvmField
|
||||
val QUICK_POWDER = create("quick_powder", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.WOOL).mapColor(MapColor.NONE).noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.POUCH))
|
||||
@JvmField
|
||||
val BRIGHT_POWDER = create("bright_powder", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.WOOL).mapColor(MapColor.NONE).noOcclusion().lightLevel{3}, DecorativeItemBlock.DecorativeItemBlockType.POUCH))
|
||||
|
||||
@JvmField
|
||||
val NEVER_MELT_ICE = create("never_melt_ice", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.GLASS).mapColor(MapColor.NONE).noOcclusion().friction(0.989F), DecorativeItemBlock.DecorativeItemBlockType.NEVERMELT))
|
||||
@JvmField
|
||||
val SCOPE_LENS = create("scope_lens", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.COPPER).mapColor(MapColor.NONE).noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.SCOPE))
|
||||
@JvmField
|
||||
val WIDE_LENS = create("wide_lens", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.COPPER).mapColor(MapColor.NONE).noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.WIDE))
|
||||
@JvmField
|
||||
val ZOOM_LENS = create("zoom_lens", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.COPPER).mapColor(MapColor.NONE).noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.ZOOM))
|
||||
|
||||
@JvmField
|
||||
val ICY_ROCK = create("icy_rock", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.DEEPSLATE).mapColor(MapColor.NONE).noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.FLATTENED_8x4))
|
||||
@JvmField
|
||||
val HEAT_ROCK = create("heat_rock", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.DEEPSLATE).mapColor(MapColor.NONE).noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.FLATTENED_8x4))
|
||||
@JvmField
|
||||
val SMOOTH_ROCK = create("smooth_rock", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.DEEPSLATE).mapColor(MapColor.NONE).noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.FLATTENED_8x4))
|
||||
@JvmField
|
||||
val DAMP_ROCK = create("damp_rock", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.DEEPSLATE).mapColor(MapColor.NONE).noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.FLATTENED_8x6))
|
||||
@JvmField
|
||||
val DESTINY_KNOT = create("destiny_knot", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.WOOL).mapColor(MapColor.NONE).noOcclusion(), DecorativeItemBlock.DecorativeItemBlockType.KNOT))
|
||||
@JvmField
|
||||
val LUMINOUS_MOSS = create("luminous_moss", DecorativeItemBlock(BlockBehaviour.Properties.of().sound(SoundType.MOSS).mapColor(MapColor.NONE).noOcclusion().lightLevel{5}, DecorativeItemBlock.DecorativeItemBlockType.CENTERED_8x))
|
||||
|
||||
@JvmField
|
||||
val METRONOME = create("metronome", ActivatableDecorationBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.NONE).pushReaction(PushReaction.DESTROY).noOcclusion(), ActivatableDecorationBlock.ActivatableDecorationBlockType.METRONOME))
|
||||
@JvmField
|
||||
val EJECT_BUTTON = create("eject_button", EjectButtonBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.NONE).pushReaction(PushReaction.DESTROY).noOcclusion().strength(0.125f), 40))
|
||||
|
||||
@JvmField
|
||||
val LOADED_DICE = create("loaded_dice", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.DICE))
|
||||
@JvmField
|
||||
val IRON_BALL = create("iron_ball", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.IRON_BALL))
|
||||
@JvmField
|
||||
val METAL_COAT = create("metal_coat", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.METAL).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.METAL_COAT))
|
||||
@JvmField
|
||||
val UPGRADE = create("upgrade", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.UPGRADE))
|
||||
@JvmField
|
||||
val DUBIOUS_DISC = create("dubious_disc", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.UPGRADE))
|
||||
|
||||
@JvmField
|
||||
val THROAT_SPRAY = create("throat_spray", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.THROAT_SPRAY))
|
||||
|
||||
@JvmField
|
||||
val FULL_HEAL = create("full_heal", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.STATUS_RESTORE))
|
||||
@JvmField
|
||||
@@ -670,6 +754,23 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
|
||||
@JvmField
|
||||
val X_SPEED = create("x_${Stats.SPEED.identifier.path}", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.BATTLE_ITEM))
|
||||
|
||||
@JvmField
|
||||
val HP_UP = create("hp_up", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.VITAMIN))
|
||||
@JvmField
|
||||
val PROTEIN = create("protein", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.VITAMIN))
|
||||
@JvmField
|
||||
val IRON = create("iron", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.VITAMIN))
|
||||
@JvmField
|
||||
val CARBOS = create("carbos", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.VITAMIN))
|
||||
@JvmField
|
||||
val CALCIUM = create("calcium", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.VITAMIN))
|
||||
@JvmField
|
||||
val ZINC = create("zinc", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.VITAMIN))
|
||||
@JvmField
|
||||
val PP_UP = create("pp_up", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.VITAMIN))
|
||||
@JvmField
|
||||
val PP_MAX = create("pp_max", StackableItemBlock(BlockBehaviour.Properties.of().sound(SoundType.CANDLE).mapColor(MapColor.NONE).noOcclusion(), StackableItemBlock.StackableItemBlockType.VITAMIN))
|
||||
|
||||
@JvmField
|
||||
val MONITOR = create("monitor", MonitorBlock(BlockBehaviour.Properties.of().mapColor(MapColor.METAL).sound(SoundType.METAL).pushReaction(PushReaction.BLOCK).requiresCorrectToolForDrops().strength(5.0F, 6.0F).lightLevel { if (it.getValue(MonitorBlock.SCREEN) != MonitorBlock.MonitorScreen.OFF) 13 else 0 }))
|
||||
@JvmField
|
||||
@@ -685,6 +786,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
|
||||
@JvmField
|
||||
val PC = create("pc", PCBlock(BlockBehaviour.Properties.of().mapColor(MapColor.METAL).sound(SoundType.METAL).pushReaction(PushReaction.BLOCK).strength(2F).noOcclusion().lightLevel { if ((it.getValue(PCBlock.ON) as Boolean) && (it.getValue(PCBlock.PART) == PCBlock.PCPart.TOP)) 13 else 0 }))
|
||||
|
||||
@JvmField
|
||||
val TM_MACHINE = create(
|
||||
"tm_machine",
|
||||
TMMachineBlock(
|
||||
@@ -713,7 +815,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
|
||||
|
||||
@JvmField
|
||||
val PASTURE = create("pasture", PastureBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN).sound(SoundType.WOOD).strength(2F).noOcclusion().pushReaction(PushReaction.BLOCK).lightLevel { if ((it.getValue(PastureBlock.ON) as Boolean) && (it.getValue(PastureBlock.PART) == PastureBlock.PasturePart.TOP)) 13 else 0 }))
|
||||
|
||||
@JvmField
|
||||
val RED_MINT = create("red_mint", MintBlock(MintType.RED, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_RED).noCollission().randomTicks().instabreak().sound(CobblemonSounds.MINT_SOUNDS).pushReaction(PushReaction.DESTROY)))
|
||||
@JvmField
|
||||
val BLUE_MINT = create("blue_mint", MintBlock(MintType.BLUE, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLUE).noCollission().randomTicks().instabreak().sound(CobblemonSounds.MINT_SOUNDS).pushReaction(PushReaction.DESTROY)))
|
||||
|
||||
@@ -472,9 +472,9 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
// Evolution items
|
||||
@JvmField val LINK_CABLE = create("link_cable", LinkCableItem())
|
||||
@JvmField val DRAGON_SCALE = noSettingsItem("dragon_scale")
|
||||
@JvmField val METAL_COAT = noSettingsItem("metal_coat")
|
||||
@JvmField val UPGRADE = noSettingsItem("upgrade")
|
||||
@JvmField val DUBIOUS_DISC = noSettingsItem("dubious_disc")
|
||||
@JvmField val METAL_COAT = itemNameBlockItem("metal_coat", CobblemonBlocks.METAL_COAT)
|
||||
@JvmField val UPGRADE = itemNameBlockItem("upgrade", CobblemonBlocks.UPGRADE)
|
||||
@JvmField val DUBIOUS_DISC = itemNameBlockItem("dubious_disc", CobblemonBlocks.DUBIOUS_DISC)
|
||||
@JvmField val DEEP_SEA_SCALE = noSettingsItem("deep_sea_scale")
|
||||
@JvmField val DEEP_SEA_TOOTH = noSettingsItem("deep_sea_tooth")
|
||||
@JvmField val ELECTIRIZER = noSettingsItem("electirizer")
|
||||
@@ -483,7 +483,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField val PROTECTOR = noSettingsItem("protector")
|
||||
@JvmField val REAPER_CLOTH = noSettingsItem("reaper_cloth")
|
||||
@JvmField val PRISM_SCALE = noSettingsItem("prism_scale")
|
||||
@JvmField val SACHET = noSettingsItem("sachet")
|
||||
@JvmField val SACHET = itemNameBlockItem("sachet", CobblemonBlocks.SACHET)
|
||||
@JvmField val WHIPPED_DREAM = create("whipped_dream", foodItem(8, 0.3f))
|
||||
@JvmField val STRAWBERRY_SWEET = create("strawberry_sweet", foodItem(6, 0.125f))
|
||||
@JvmField val LOVE_SWEET = create("love_sweet", foodItem(6, 0.125f))
|
||||
@@ -492,22 +492,20 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField val FLOWER_SWEET = create("flower_sweet", foodItem(6, 0.125f))
|
||||
@JvmField val STAR_SWEET = create("star_sweet", foodItem(6, 0.125f))
|
||||
@JvmField val RIBBON_SWEET = create("ribbon_sweet", foodItem(6, 0.125f))
|
||||
@JvmField val CHIPPED_POT = noSettingsItem("chipped_pot")
|
||||
@JvmField val CRACKED_POT = noSettingsItem("cracked_pot")
|
||||
@JvmField val MASTERPIECE_TEACUP = noSettingsItem("masterpiece_teacup")
|
||||
@JvmField val UNREMARKABLE_TEACUP = noSettingsItem("unremarkable_teacup")
|
||||
@JvmField val CHIPPED_POT = itemNameBlockItem("chipped_pot", CobblemonBlocks.CHIPPED_POT)
|
||||
@JvmField val CRACKED_POT = itemNameBlockItem("cracked_pot", CobblemonBlocks.CRACKED_POT)
|
||||
@JvmField val MASTERPIECE_TEACUP = itemNameBlockItem("masterpiece_teacup", CobblemonBlocks.MASTERPIECE_TEACUP)
|
||||
@JvmField val UNREMARKABLE_TEACUP = itemNameBlockItem("unremarkable_teacup", CobblemonBlocks.UNREMARKABLE_TEACUP)
|
||||
@JvmField val SWEET_APPLE = compostableItem("sweet_apple", foodItem(4, 0.3f), 0.65f)
|
||||
@JvmField val TART_APPLE = compostableItem("tart_apple", foodItem(4, 0.3f), 0.65f)
|
||||
@JvmField val SYRUPY_APPLE = compostableItem("syrupy_apple", foodItem(4, 0.3f), 0.65f)
|
||||
@JvmField val GALARICA_CUFF = noSettingsItem("galarica_cuff")
|
||||
@JvmField val GALARICA_WREATH = noSettingsItem("galarica_wreath")
|
||||
@JvmField val GALARICA_CUFF = itemNameBlockItem("galarica_cuff", CobblemonBlocks.GALARICA_CUFF)
|
||||
@JvmField val BLACK_AUGURITE = noSettingsItem("black_augurite")
|
||||
@JvmField val PEAT_BLOCK = noSettingsItem("peat_block")
|
||||
@JvmField val RAZOR_CLAW = noSettingsItem("razor_claw")
|
||||
@JvmField val RAZOR_FANG = noSettingsItem("razor_fang")
|
||||
@JvmField val AUSPICIOUS_ARMOR = heldItem("auspicious_armor")
|
||||
@JvmField val MALICIOUS_ARMOR = heldItem("malicious_armor")
|
||||
@JvmField val SHELL_HELMET = heldItem("shell_helmet")
|
||||
@JvmField val METAL_ALLOY = noSettingsItem("metal_alloy")
|
||||
@JvmField val SCROLL_OF_DARKNESS = noSettingsItem("scroll_of_darkness")
|
||||
@JvmField val SCROLL_OF_WATERS = noSettingsItem("scroll_of_waters")
|
||||
@@ -651,17 +649,17 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField
|
||||
val EXPERIENCE_CANDY_XL = candyItem("exp_candy_xl") { _, _ -> CandyItem.DEFAULT_XL_CANDY_YIELD }
|
||||
@JvmField
|
||||
val CALCIUM = create("calcium", VitaminItem(Stats.SPECIAL_ATTACK))
|
||||
val CALCIUM = create("calcium", VitaminItem(Stats.SPECIAL_ATTACK, CobblemonBlocks.CALCIUM))
|
||||
@JvmField
|
||||
val CARBOS = create("carbos", VitaminItem(Stats.SPEED))
|
||||
val CARBOS = create("carbos", VitaminItem(Stats.SPEED, CobblemonBlocks.CARBOS))
|
||||
@JvmField
|
||||
val HP_UP = create("hp_up", VitaminItem(Stats.HP))
|
||||
val HP_UP = create("hp_up", VitaminItem(Stats.HP, CobblemonBlocks.HP_UP))
|
||||
@JvmField
|
||||
val IRON = create("iron", VitaminItem(Stats.DEFENCE))
|
||||
val IRON = create("iron", VitaminItem(Stats.DEFENCE, CobblemonBlocks.IRON))
|
||||
@JvmField
|
||||
val PROTEIN = create("protein", VitaminItem(Stats.ATTACK))
|
||||
val PROTEIN = create("protein", VitaminItem(Stats.ATTACK, CobblemonBlocks.PROTEIN))
|
||||
@JvmField
|
||||
val ZINC = create("zinc", VitaminItem(Stats.SPECIAL_DEFENCE))
|
||||
val ZINC = create("zinc", VitaminItem(Stats.SPECIAL_DEFENCE, CobblemonBlocks.ZINC))
|
||||
@JvmField
|
||||
val HEALTH_MOCHI = create("health_mochi", MochiItem(Stats.HP))
|
||||
@JvmField
|
||||
@@ -743,9 +741,9 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField
|
||||
val MAX_REVIVE = create("max_revive", ReviveItem(max = true))
|
||||
@JvmField
|
||||
val PP_UP = create("pp_up", PPUpItem(1))
|
||||
val PP_UP = create("pp_up", PPUpItem(1, CobblemonBlocks.PP_UP))
|
||||
@JvmField
|
||||
val PP_MAX = create("pp_max", PPUpItem(3))
|
||||
val PP_MAX = create("pp_max", PPUpItem(3, CobblemonBlocks.PP_MAX))
|
||||
|
||||
@JvmField
|
||||
val RED_MINT_SEEDS = mintSeed("red", MintType.RED.getCropBlock())
|
||||
@@ -922,11 +920,18 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField val CHOICE_SPECS = wearableItem("choice_specs")
|
||||
@JvmField val EXP_SHARE = wearableItem("exp_share")
|
||||
@JvmField val FOCUS_BAND = wearableItem("focus_band")
|
||||
@JvmField val KINGS_ROCK = wearableItem("kings_rock")
|
||||
@JvmField val KINGS_ROCK = wearableBlockItem("kings_rock", CobblemonBlocks.KINGS_ROCK)
|
||||
@JvmField val NEVER_MELT_ICE = wearableBlockItem("never_melt_ice", CobblemonBlocks.NEVER_MELT_ICE)
|
||||
@JvmField val MUSCLE_BAND = wearableItem("muscle_band")
|
||||
@JvmField val ROCKY_HELMET = wearableItem("rocky_helmet")
|
||||
@JvmField val SAFETY_GOGGLES = wearableItem("safety_goggles")
|
||||
@JvmField val WISE_GLASSES = wearableItem("wise_glasses")
|
||||
@JvmField val SHARP_BEAK = wearableItem("sharp_beak")
|
||||
@JvmField val COVERT_CLOAK = wearableItem("covert_cloak")
|
||||
@JvmField val SHELL_HELMET = wearableItem("shell_helmet")
|
||||
@JvmField val GALARICA_WREATH = wearableBlockItem("galarica_wreath", CobblemonBlocks.GALARICA_WREATH)
|
||||
@JvmField val CLEANSE_TAG = wearableBlockItem("cleanse_tag", CobblemonBlocks.CLEANSE_TAG)
|
||||
@JvmField val SPELL_TAG = wearableBlockItem("spell_tag", CobblemonBlocks.SPELL_TAG)
|
||||
|
||||
// Held Items
|
||||
@JvmField
|
||||
@@ -954,17 +959,13 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField
|
||||
val CHOICE_SCARF = heldItem("choice_scarf")
|
||||
@JvmField
|
||||
val CLEANSE_TAG = itemNameBlockItem("cleanse_tag", CobblemonBlocks.CLEANSE_TAG)
|
||||
@JvmField
|
||||
val CLEAR_AMULET = heldItem("clear_amulet")
|
||||
@JvmField
|
||||
val COVERT_CLOAK = heldItem("covert_cloak")
|
||||
@JvmField
|
||||
val DESTINY_KNOT = heldItem("destiny_knot")
|
||||
val DESTINY_KNOT = itemNameBlockItem("destiny_knot", CobblemonBlocks.DESTINY_KNOT)
|
||||
@JvmField
|
||||
val DRAGON_FANG = heldItem("dragon_fang")
|
||||
@JvmField
|
||||
val EJECT_BUTTON = heldItem("eject_button")
|
||||
val EJECT_BUTTON = itemNameBlockItem("eject_button", CobblemonBlocks.EJECT_BUTTON)
|
||||
@JvmField
|
||||
val EJECT_PACK = heldItem("eject_pack")
|
||||
@JvmField
|
||||
@@ -978,7 +979,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField
|
||||
val FAIRY_FEATHER = heldItem("fairy_feather")
|
||||
@JvmField
|
||||
val FLAME_ORB = heldItem("flame_orb")
|
||||
val FLAME_ORB = itemNameBlockItem("flame_orb", CobblemonBlocks.FLAME_ORB)
|
||||
@JvmField
|
||||
val FLOAT_STONE = heldItem("float_stone")
|
||||
@JvmField
|
||||
@@ -992,34 +993,32 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField
|
||||
val HEAVY_DUTY_BOOTS = heldItem("heavy_duty_boots")
|
||||
@JvmField
|
||||
val IRON_BALL = heldItem("iron_ball")
|
||||
val IRON_BALL = itemNameBlockItem("iron_ball", CobblemonBlocks.IRON_BALL)
|
||||
@JvmField
|
||||
val LAGGING_TAIL = heldItem("lagging_tail")
|
||||
@JvmField
|
||||
val LEFTOVERS = compostableHeldItem("leftovers", null, 0.50f)
|
||||
@JvmField
|
||||
val LIFE_ORB = heldItem("life_orb")
|
||||
val LIFE_ORB = itemNameBlockItem("life_orb", CobblemonBlocks.LIFE_ORB)
|
||||
@JvmField
|
||||
val LIGHT_BALL = heldItem("light_ball")
|
||||
val LIGHT_BALL = itemNameBlockItem("light_ball", CobblemonBlocks.LIGHT_BALL)
|
||||
@JvmField
|
||||
val LIGHT_CLAY = heldItem("light_clay")
|
||||
@JvmField
|
||||
val LOADED_DICE = heldItem("loaded_dice")
|
||||
val LOADED_DICE = itemNameBlockItem("loaded_dice", CobblemonBlocks.LOADED_DICE)
|
||||
@JvmField
|
||||
val LUCKY_EGG = heldItem("lucky_egg")
|
||||
@JvmField
|
||||
val LUMINOUS_MOSS = heldItem("luminous_moss")
|
||||
val LUMINOUS_MOSS = itemNameBlockItem("luminous_moss", CobblemonBlocks.LUMINOUS_MOSS)
|
||||
@JvmField
|
||||
val MAGNET = heldItem("magnet")
|
||||
val MAGNET = itemNameBlockItem("magnet", CobblemonBlocks.MAGNET)
|
||||
@JvmField
|
||||
val METRONOME = heldItem("metronome")
|
||||
val METRONOME = itemNameBlockItem("metronome", CobblemonBlocks.METRONOME)
|
||||
@JvmField
|
||||
val MIRACLE_SEED = heldItem("miracle_seed")
|
||||
@JvmField
|
||||
val MYSTIC_WATER = heldItem("mystic_water")
|
||||
@JvmField
|
||||
val NEVER_MELT_ICE = heldItem("never_melt_ice")
|
||||
@JvmField
|
||||
val POISON_BARB = heldItem("poison_barb")
|
||||
@JvmField
|
||||
val POWER_ANKLET = heldItem("power_anklet")
|
||||
@@ -1044,13 +1043,11 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField
|
||||
val RED_CARD = heldItem("red_card")
|
||||
@JvmField
|
||||
val RING_TARGET = heldItem("ring_target")
|
||||
val RING_TARGET = itemNameBlockItem("ring_target", CobblemonBlocks.RING_TARGET)
|
||||
@JvmField
|
||||
val ROOM_SERVICE = heldItem("room_service")
|
||||
@JvmField
|
||||
val SCOPE_LENS = heldItem("scope_lens")
|
||||
@JvmField
|
||||
val SHARP_BEAK = heldItem("sharp_beak")
|
||||
val SCOPE_LENS = itemNameBlockItem("scope_lens", CobblemonBlocks.SCOPE_LENS)
|
||||
@JvmField
|
||||
val SHED_SHELL = heldItem("shed_shell")
|
||||
@JvmField
|
||||
@@ -1062,9 +1059,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField
|
||||
val SOFT_SAND = heldItem("soft_sand")
|
||||
@JvmField
|
||||
val SPELL_TAG = itemNameBlockItem("spell_tag", CobblemonBlocks.SPELL_TAG)
|
||||
@JvmField
|
||||
val SMOKE_BALL = heldItem("smoke_ball")
|
||||
val SMOKE_BALL = itemNameBlockItem("smoke_ball", CobblemonBlocks.SMOKE_BALL)
|
||||
@JvmField
|
||||
val SOOTHE_BELL = heldItem("soothe_bell")
|
||||
@JvmField
|
||||
@@ -1072,9 +1067,9 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField
|
||||
val TERRAIN_EXTENDER = heldItem("terrain_extender")
|
||||
@JvmField
|
||||
val THROAT_SPRAY = heldItem("throat_spray")
|
||||
val THROAT_SPRAY = itemNameBlockItem("throat_spray", CobblemonBlocks.THROAT_SPRAY)
|
||||
@JvmField
|
||||
val TOXIC_ORB = heldItem("toxic_orb")
|
||||
val TOXIC_ORB = itemNameBlockItem("toxic_orb", CobblemonBlocks.TOXIC_ORB)
|
||||
@JvmField
|
||||
val TWISTED_SPOON = heldItem("twisted_spoon")
|
||||
@JvmField
|
||||
@@ -1082,9 +1077,9 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField
|
||||
val WEAKNESS_POLICY = itemNameBlockItem("weakness_policy", CobblemonBlocks.WEAKNESS_POLICY)
|
||||
@JvmField
|
||||
val WIDE_LENS = heldItem("wide_lens")
|
||||
val WIDE_LENS = itemNameBlockItem("wide_lens", CobblemonBlocks.WIDE_LENS)
|
||||
@JvmField
|
||||
val ZOOM_LENS = heldItem("zoom_lens")
|
||||
val ZOOM_LENS = itemNameBlockItem("zoom_lens", CobblemonBlocks.ZOOM_LENS)
|
||||
@JvmField
|
||||
val MENTAL_HERB = compostableHeldItem("mental_herb", null, 0.85F)
|
||||
@JvmField
|
||||
@@ -1096,19 +1091,19 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField
|
||||
val WHITE_HERB = compostableHeldItem("white_herb", null, 0.85F)
|
||||
@JvmField
|
||||
val BRIGHT_POWDER = heldItem("bright_powder")
|
||||
val BRIGHT_POWDER = itemNameBlockItem("bright_powder", CobblemonBlocks.BRIGHT_POWDER)
|
||||
@JvmField
|
||||
val METAL_POWDER = heldItem("metal_powder")
|
||||
val METAL_POWDER = itemNameBlockItem("metal_powder", CobblemonBlocks.METAL_POWDER)
|
||||
@JvmField
|
||||
val QUICK_POWDER = heldItem("quick_powder")
|
||||
val QUICK_POWDER = itemNameBlockItem("quick_powder", CobblemonBlocks.QUICK_POWDER)
|
||||
@JvmField
|
||||
val DAMP_ROCK = heldItem("damp_rock")
|
||||
val DAMP_ROCK = itemNameBlockItem("damp_rock", CobblemonBlocks.DAMP_ROCK)
|
||||
@JvmField
|
||||
val HEAT_ROCK = heldItem("heat_rock")
|
||||
val HEAT_ROCK = itemNameBlockItem("heat_rock", CobblemonBlocks.HEAT_ROCK)
|
||||
@JvmField
|
||||
val SMOOTH_ROCK = heldItem("smooth_rock")
|
||||
val SMOOTH_ROCK = itemNameBlockItem("smooth_rock", CobblemonBlocks.SMOOTH_ROCK)
|
||||
@JvmField
|
||||
val ICY_ROCK = heldItem("icy_rock")
|
||||
val ICY_ROCK = itemNameBlockItem("icy_rock", CobblemonBlocks.ICY_ROCK)
|
||||
|
||||
// Mulch
|
||||
@JvmField
|
||||
@@ -1599,7 +1594,16 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
|
||||
private fun wearableItem(name: String, heldItemRemappedName: String? = null): CobblemonItem = create(
|
||||
name,
|
||||
WearableItem(name).also {
|
||||
WearableHatItem(name).also {
|
||||
wearables.add(it)
|
||||
if (heldItemRemappedName != null) {
|
||||
CobblemonHeldItemManager.registerRemap(it, heldItemRemappedName)
|
||||
}
|
||||
}
|
||||
)
|
||||
private fun wearableBlockItem(name: String, block: Block, heldItemRemappedName: String? = null): WearableBlockItem = create(
|
||||
name,
|
||||
WearableBlockItem(name, block).also {
|
||||
wearables.add(it)
|
||||
if (heldItemRemappedName != null) {
|
||||
CobblemonHeldItemManager.registerRemap(it, heldItemRemappedName)
|
||||
|
||||
+2
-1
@@ -21,7 +21,8 @@ import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
*/
|
||||
data class FriendshipUpdatedEvent(
|
||||
val pokemon: Pokemon,
|
||||
val newFriendshipInitial: Int
|
||||
val newFriendshipInitial: Int,
|
||||
val earned: Boolean = false
|
||||
) {
|
||||
var newFriendship: Int = newFriendshipInitial
|
||||
set(value) {
|
||||
|
||||
@@ -83,12 +83,6 @@ import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.biome.Biome
|
||||
import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.level.dimension.DimensionType
|
||||
import net.minecraft.world.level.levelgen.Heightmap
|
||||
import net.minecraft.world.level.pathfinder.PathType
|
||||
import net.minecraft.world.level.storage.loot.LootParams
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams
|
||||
import net.minecraft.world.phys.AABB
|
||||
import net.minecraft.world.phys.Vec3
|
||||
import java.util.function.Function
|
||||
|
||||
@@ -99,25 +93,31 @@ import java.util.function.Function
|
||||
* @since October 2nd, 2023
|
||||
*/
|
||||
object MoLangFunctions {
|
||||
fun ItemStack.asMoLangValue(registryAccess: RegistryAccess) = ObjectValue(this)
|
||||
.addStandardFunctions()
|
||||
.addFunctions(ItemStackMoLangFunctions.attach(Pair(this, registryAccess)))
|
||||
fun ItemStack.asMoLangValue(registryAccess: RegistryAccess) =
|
||||
ObjectValue(this)
|
||||
.addStandardFunctions()
|
||||
.addFunctions(ItemStackMoLangFunctions.attach(Pair(this, registryAccess)))
|
||||
|
||||
fun Holder<Biome>.asBiomeMoLangValue() = asMoLangValue(Registries.BIOME)
|
||||
.addFunctions(BiomeMoLangFunctions.attach(this))
|
||||
fun Holder<Biome>.asBiomeMoLangValue() =
|
||||
asMoLangValue(Registries.BIOME)
|
||||
.addFunctions(BiomeMoLangFunctions.attach(this))
|
||||
|
||||
fun Holder<Level>.asWorldMoLangValue() = asMoLangValue(Registries.DIMENSION)
|
||||
.addFunctions(WorldMoLangFunctions.attach(this))
|
||||
fun Holder<Level>.asWorldMoLangValue() =
|
||||
asMoLangValue(Registries.DIMENSION)
|
||||
.addFunctions(WorldMoLangFunctions.attach(this))
|
||||
|
||||
fun Holder<Block>.asBlockMoLangValue() = asMoLangValue(Registries.BLOCK)
|
||||
.addFunctions(BlockMoLangFunctions.attach(this))
|
||||
fun Holder<Block>.asBlockMoLangValue() =
|
||||
asMoLangValue(Registries.BLOCK)
|
||||
.addFunctions(BlockMoLangFunctions.attach(this))
|
||||
|
||||
fun MinecraftServer.asMoLangValue() = ObjectValue(this)
|
||||
.addStandardFunctions()
|
||||
.addFunctions(ServerMoLangFunctions.attach(this))
|
||||
fun MinecraftServer.asMoLangValue() =
|
||||
ObjectValue(this)
|
||||
.addStandardFunctions()
|
||||
.addFunctions(ServerMoLangFunctions.attach(this))
|
||||
|
||||
fun Holder<DimensionType>.asDimensionTypeMoLangValue() = asMoLangValue(Registries.DIMENSION_TYPE)
|
||||
.addFunctions(DimensionTypeMoLangFunctions.attach(this))
|
||||
fun Holder<DimensionType>.asDimensionTypeMoLangValue() =
|
||||
asMoLangValue(Registries.DIMENSION_TYPE)
|
||||
.addFunctions(DimensionTypeMoLangFunctions.attach(this))
|
||||
|
||||
fun Player.asMoLangValue(): ObjectValue<Player> {
|
||||
if (this is ServerPlayer && uuid in Cobblemon.serverPlayerStructs) {
|
||||
@@ -129,10 +129,11 @@ object MoLangFunctions {
|
||||
}
|
||||
}
|
||||
|
||||
val value = ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.effectiveName().string }
|
||||
)
|
||||
val value =
|
||||
ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.effectiveName().string },
|
||||
)
|
||||
|
||||
value.addFunctions(EntityMoLangFunctions.attach(this))
|
||||
value.addFunctions(LivingEntityMoLangFunctions.attach(this))
|
||||
@@ -153,57 +154,63 @@ object MoLangFunctions {
|
||||
}
|
||||
|
||||
fun PartyStore.asMoLangValue(): ObjectValue<PartyStore> {
|
||||
val value = ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.toString() }
|
||||
)
|
||||
val value =
|
||||
ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.toString() },
|
||||
)
|
||||
value.addFunctions(PokemonStoreMoLangFunctions.attach(this))
|
||||
value.addFunctions(PartyMoLangFunctions.attach(this))
|
||||
return value
|
||||
}
|
||||
|
||||
fun DropEntry.asMoLangValue(): ObjectValue<DropEntry> {
|
||||
val value = ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.toString() }
|
||||
)
|
||||
val value =
|
||||
ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.toString() },
|
||||
)
|
||||
value.addFunctions(DropEntryMoLangFunctions.attach(this))
|
||||
return value
|
||||
}
|
||||
|
||||
fun PokemonProperties.asMoLangValue(): ObjectValue<PokemonProperties> {
|
||||
val value = ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.asString() }
|
||||
)
|
||||
val value =
|
||||
ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.asString() },
|
||||
)
|
||||
value.addFunctions(PokemonPropertiesMoLangFunctions.attach(this))
|
||||
return value
|
||||
}
|
||||
|
||||
fun Evolution.asMoLangValue(): ObjectValue<Evolution> {
|
||||
val value = ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.toString() }
|
||||
)
|
||||
val value =
|
||||
ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.toString() },
|
||||
)
|
||||
value.addFunctions(EvolutionMoLangFunctions.attach(this))
|
||||
return value
|
||||
}
|
||||
|
||||
fun PCStore.asMoLangValue(): ObjectValue<PCStore> {
|
||||
val value = ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.toString() }
|
||||
)
|
||||
val value =
|
||||
ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.toString() },
|
||||
)
|
||||
value.addFunctions(PokemonStoreMoLangFunctions.attach(this))
|
||||
value.addFunctions(PCMoLangFunctions.attach(this))
|
||||
return value
|
||||
}
|
||||
|
||||
fun NPCEntity.asMoLangValue(): ObjectValue<NPCEntity> {
|
||||
val value = ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.name.string }
|
||||
)
|
||||
val value =
|
||||
ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.name.string },
|
||||
)
|
||||
value.addFunctions(EntityMoLangFunctions.attach(this))
|
||||
value.addFunctions(LivingEntityMoLangFunctions.attach(this))
|
||||
value.addFunctions(NPCMoLangFunctions.attach(this))
|
||||
@@ -211,10 +218,11 @@ object MoLangFunctions {
|
||||
}
|
||||
|
||||
fun PokemonEntity.asMoLangValue(): ObjectValue<PokemonEntity> {
|
||||
val value = ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.pokemon.uuid.toString() }
|
||||
)
|
||||
val value =
|
||||
ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.pokemon.uuid.toString() },
|
||||
)
|
||||
|
||||
value.addFunctions(EntityMoLangFunctions.attach(this))
|
||||
value.addFunctions(LivingEntityMoLangFunctions.attach(this))
|
||||
@@ -225,36 +233,40 @@ object MoLangFunctions {
|
||||
}
|
||||
|
||||
fun PokemonBattle.asMoLangValue(): ObjectValue<PokemonBattle> {
|
||||
val value = ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.battleId.toString() }
|
||||
)
|
||||
val value =
|
||||
ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.battleId.toString() },
|
||||
)
|
||||
value.addFunctions(BattleMoLangFunctions.attach(this))
|
||||
return value
|
||||
}
|
||||
|
||||
fun BattleActor.asMoLangValue(): ObjectValue<BattleActor> {
|
||||
val value = ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.toString() }
|
||||
)
|
||||
val value =
|
||||
ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.toString() },
|
||||
)
|
||||
value.addFunctions(BattleActorMoLangFunctions.attach(this))
|
||||
return value
|
||||
}
|
||||
|
||||
fun SpawnablePosition.asMoLangValue(): ObjectValue<SpawnablePosition> {
|
||||
val value = ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.toString() }
|
||||
)
|
||||
val value =
|
||||
ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.toString() },
|
||||
)
|
||||
value.addFunctions(SpawnablePositionMoLangFunctions.attach(this))
|
||||
return value
|
||||
}
|
||||
|
||||
fun Vec3.asMoLangValue(): ObjectValue<Vec3> {
|
||||
val value = ObjectValue(
|
||||
obj = this
|
||||
)
|
||||
val value =
|
||||
ObjectValue(
|
||||
obj = this,
|
||||
)
|
||||
value.addFunction("x") { this.x }
|
||||
value.addFunction("y") { this.y }
|
||||
value.addFunction("z") { this.z }
|
||||
@@ -265,45 +277,66 @@ object MoLangFunctions {
|
||||
/**
|
||||
* Different functions exist depending on the entity type, this tries to make the struct that's most specific to the type.
|
||||
*/
|
||||
fun Entity.asMostSpecificMoLangValue(): ObjectValue<out Entity> {
|
||||
return when (this) {
|
||||
is Player -> asMoLangValue()
|
||||
is PokemonEntity -> struct
|
||||
is NPCEntity -> struct
|
||||
is ItemEntity -> ObjectValue(this).also { item ->
|
||||
item.addStandardFunctions()
|
||||
item.addFunctions(EntityMoLangFunctions.attach(this))
|
||||
item.addFunctions(ItemStackMoLangFunctions.attach(Pair(this.item, this.registryAccess())))
|
||||
fun Entity.asMostSpecificMoLangValue(): ObjectValue<out Entity> =
|
||||
when (this) {
|
||||
is Player -> {
|
||||
asMoLangValue()
|
||||
}
|
||||
|
||||
else -> ObjectValue(this).also { objectValue ->
|
||||
objectValue.addStandardFunctions()
|
||||
objectValue.addFunctions(EntityMoLangFunctions.attach(this))
|
||||
if (this is LivingEntity) {
|
||||
objectValue.addFunctions(LivingEntityMoLangFunctions.attach(this))
|
||||
is PokemonEntity -> {
|
||||
struct
|
||||
}
|
||||
|
||||
is NPCEntity -> {
|
||||
struct
|
||||
}
|
||||
|
||||
is ItemEntity -> {
|
||||
ObjectValue(this).also { item ->
|
||||
item.addStandardFunctions()
|
||||
item.addFunctions(EntityMoLangFunctions.attach(this))
|
||||
item.addFunctions(ItemStackMoLangFunctions.attach(Pair(this.item, this.registryAccess())))
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
ObjectValue(this).also { objectValue ->
|
||||
objectValue.addStandardFunctions()
|
||||
objectValue.addFunctions(EntityMoLangFunctions.attach(this))
|
||||
if (this is LivingEntity) {
|
||||
objectValue.addFunctions(LivingEntityMoLangFunctions.attach(this))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> Holder<T>.asMoLangValue(key: ResourceKey<Registry<T>>): ObjectValue<Holder<T>> {
|
||||
val value = ObjectValue(
|
||||
obj = this,
|
||||
stringify = { it.unwrapKey().get().location().toString() }
|
||||
)
|
||||
value.functions["is_in"] = Function put@{ params: MoParams ->
|
||||
val tag = TagKey.create(key, ResourceLocation.parse(params.getString(0).replace("#", "")))
|
||||
return@put DoubleValue(if (value.obj.`is`(tag)) 1.0 else 0.0)
|
||||
}
|
||||
value.functions["is_of"] = Function put@{ params: MoParams ->
|
||||
val identifier = ResourceLocation.parse(params.getString(0))
|
||||
return@put DoubleValue(if (value.obj.`is`(identifier)) 1.0 else 0.0)
|
||||
}
|
||||
val value =
|
||||
ObjectValue(
|
||||
obj = this,
|
||||
stringify = {
|
||||
it
|
||||
.unwrapKey()
|
||||
.get()
|
||||
.location()
|
||||
.toString()
|
||||
},
|
||||
)
|
||||
value.functions["is_in"] =
|
||||
Function put@{ params: MoParams ->
|
||||
val tag = TagKey.create(key, ResourceLocation.parse(params.getString(0).replace("#", "")))
|
||||
return@put DoubleValue(if (value.obj.`is`(tag)) 1.0 else 0.0)
|
||||
}
|
||||
value.functions["is_of"] =
|
||||
Function put@{ params: MoParams ->
|
||||
val identifier = ResourceLocation.parse(params.getString(0))
|
||||
return@put DoubleValue(if (value.obj.`is`(identifier)) 1.0 else 0.0)
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
fun QueryStruct.addStandardFunctions(): QueryStruct {
|
||||
addFunctions(GeneralMoLangFunctions.holder)
|
||||
addFunctions(GeneralMoLangFunctions.functions)
|
||||
return this
|
||||
}
|
||||
|
||||
@@ -370,23 +403,17 @@ object MoLangFunctions {
|
||||
return this
|
||||
}
|
||||
|
||||
fun moLangFunctionMap(
|
||||
vararg functions: Pair<String, (MoParams) -> MoValue>
|
||||
): Map<String, (MoParams) -> MoValue> {
|
||||
return functions.toMap()
|
||||
}
|
||||
fun moLangFunctionMap(vararg functions: Pair<String, (MoParams) -> MoValue>): Map<String, (MoParams) -> MoValue> = functions.toMap()
|
||||
|
||||
fun queryStructOf(
|
||||
vararg functions: Pair<String, (MoParams) -> MoValue>
|
||||
): QueryStruct {
|
||||
return QueryStruct(
|
||||
fun queryStructOf(vararg functions: Pair<String, (MoParams) -> MoValue>): QueryStruct =
|
||||
QueryStruct(
|
||||
hashMapOf<String, Function<MoParams, Any>>(
|
||||
*functions.map { (name, func) ->
|
||||
name to Function<MoParams, Any> { params -> func(params) }
|
||||
}.toTypedArray()
|
||||
)
|
||||
*functions
|
||||
.map { (name, func) ->
|
||||
name to Function<MoParams, Any> { params -> func(params) }
|
||||
}.toTypedArray(),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fun MoLangRuntime.setup(): MoLangRuntime {
|
||||
environment.query.addStandardFunctions()
|
||||
@@ -395,8 +422,14 @@ object MoLangFunctions {
|
||||
|
||||
fun writeMoValueToNBT(value: MoValue): Tag? {
|
||||
return when (value) {
|
||||
is DoubleValue -> DoubleTag.valueOf(value.value)
|
||||
is StringValue -> StringTag.valueOf(value.value)
|
||||
is DoubleValue -> {
|
||||
DoubleTag.valueOf(value.value)
|
||||
}
|
||||
|
||||
is StringValue -> {
|
||||
StringTag.valueOf(value.value)
|
||||
}
|
||||
|
||||
is ArrayStruct -> {
|
||||
val list = value.map.values
|
||||
val nbtList = ListTag()
|
||||
@@ -413,14 +446,22 @@ object MoLangFunctions {
|
||||
nbt
|
||||
}
|
||||
|
||||
else -> null
|
||||
else -> {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun readMoValueFromNBT(nbt: Tag): MoValue {
|
||||
return when (nbt) {
|
||||
is DoubleTag -> DoubleValue(nbt.asDouble)
|
||||
is StringTag -> StringValue(nbt.asString)
|
||||
fun readMoValueFromNBT(nbt: Tag): MoValue =
|
||||
when (nbt) {
|
||||
is DoubleTag -> {
|
||||
DoubleValue(nbt.asDouble)
|
||||
}
|
||||
|
||||
is StringTag -> {
|
||||
StringValue(nbt.asString)
|
||||
}
|
||||
|
||||
is ListTag -> {
|
||||
val array = ArrayStruct(hashMapOf())
|
||||
var index = 0
|
||||
@@ -441,11 +482,12 @@ object MoLangFunctions {
|
||||
variable
|
||||
}
|
||||
|
||||
else -> VariableStruct()
|
||||
else -> {
|
||||
VariableStruct()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: this one is unused. Should we move it to [MoLangFunctions] object?
|
||||
fun Either<ResourceLocation, ExpressionLike>.runScript(runtime: MoLangRuntime) =
|
||||
map({ CobblemonScripts.run(it, runtime) }, { it.resolve(runtime) })
|
||||
map({ CobblemonScripts.run(it, runtime) }, { it.resolve(runtime) })
|
||||
|
||||
+9
-10
@@ -17,30 +17,29 @@ import com.cobblemon.mod.common.battles.actor.PlayerBattleActor
|
||||
import com.cobblemon.mod.common.battles.actor.PokemonBattleActor
|
||||
import com.cobblemon.mod.common.entity.npc.NPCBattleActor
|
||||
|
||||
|
||||
object BattleActorMoLangFunctions : AbstractMoLangFunctionHolder<BattleActor>() {
|
||||
override fun BattleActor.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val actor = this
|
||||
val map = mutableMapOf<String, (MoParams) -> Any>(
|
||||
"is_npc" to { DoubleValue(actor.type == ActorType.NPC) },
|
||||
"is_player" to { DoubleValue(actor.type == ActorType.PLAYER) },
|
||||
"is_wild" to { DoubleValue(actor.type == ActorType.WILD) }
|
||||
)
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
functions["is_npc"] = { DoubleValue(actor.type == ActorType.NPC) }
|
||||
functions["is_player"] = { DoubleValue(actor.type == ActorType.PLAYER) }
|
||||
functions["is_wild"] = { DoubleValue(actor.type == ActorType.WILD) }
|
||||
|
||||
when (actor) {
|
||||
is NPCBattleActor -> {
|
||||
map["npc"] = { actor.entity.struct }
|
||||
functions["npc"] = { actor.entity.struct }
|
||||
}
|
||||
|
||||
is PlayerBattleActor -> {
|
||||
map["player"] = { actor.entity?.asMoLangValue() ?: DoubleValue.ZERO }
|
||||
functions["player"] = { actor.entity?.asMoLangValue() ?: DoubleValue.ZERO }
|
||||
}
|
||||
|
||||
is PokemonBattleActor -> {
|
||||
map["pokemon"] = { actor.entity?.asMoLangValue() ?: DoubleValue.ZERO }
|
||||
functions["pokemon"] = { actor.entity?.asMoLangValue() ?: DoubleValue.ZERO }
|
||||
}
|
||||
}
|
||||
|
||||
return map
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+14
-12
@@ -16,17 +16,19 @@ import com.cobblemon.mod.common.util.getStringOrNull
|
||||
object BattleMessageMoLangFunctions : AbstractMoLangFunctionHolder<BattleMessage>() {
|
||||
override fun BattleMessage.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val battleMessage = this
|
||||
return mutableMapOf(
|
||||
"has_argument_at" to { params ->
|
||||
val index = params.getInt(0)
|
||||
val value = params.getStringOrNull(1) ?: ""
|
||||
DoubleValue(value == battleMessage.argumentAt(index))
|
||||
},
|
||||
"has_argument" to { params ->
|
||||
val argumentName = params.getString(0)
|
||||
val value = params.getStringOrNull(1) ?: ""
|
||||
DoubleValue(value == battleMessage.optionalArgument(argumentName))
|
||||
}
|
||||
)
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
functions["has_argument_at"] = { params ->
|
||||
val index = params.getInt(0)
|
||||
val value = params.getStringOrNull(1) ?: ""
|
||||
DoubleValue(value == battleMessage.argumentAt(index))
|
||||
}
|
||||
functions["has_argument"] = { params ->
|
||||
val argumentName = params.getString(0)
|
||||
val value = params.getStringOrNull(1) ?: ""
|
||||
DoubleValue(value == battleMessage.optionalArgument(argumentName))
|
||||
}
|
||||
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+17
-15
@@ -18,20 +18,22 @@ import java.util.*
|
||||
object BattleMoLangFunctions : AbstractMoLangFunctionHolder<PokemonBattle>() {
|
||||
override fun PokemonBattle.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val battle = this
|
||||
return mutableMapOf(
|
||||
"environment" to { battle.runtime.environment },
|
||||
"battle_id" to { StringValue(battle.battleId.toString()) },
|
||||
"battle_type" to { StringValue(battle.format.toString()) },
|
||||
"is_pvn" to { DoubleValue(battle.isPvN) },
|
||||
"is_pvp" to { DoubleValue(battle.isPvP) },
|
||||
"is_pvw" to { DoubleValue(battle.isPvW) },
|
||||
"stop" to { battle.stop() },
|
||||
"actors" to { battle.actors.toList().asArrayValue { it.struct } },
|
||||
"get_actor" to getActor@{ params ->
|
||||
val uuid = UUID.fromString(params.getString(0))
|
||||
val actor = battle.actors.find { it.uuid == uuid } ?: return@getActor DoubleValue.ZERO
|
||||
actor.struct
|
||||
}
|
||||
)
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
functions["environment"] = { battle.runtime.environment }
|
||||
functions["battle_id"] = { StringValue(battle.battleId.toString()) }
|
||||
functions["battle_type"] = { StringValue(battle.format.toString()) }
|
||||
functions["is_pvn"] = { DoubleValue(battle.isPvN) }
|
||||
functions["is_pvp"] = { DoubleValue(battle.isPvP) }
|
||||
functions["is_pvw"] = { DoubleValue(battle.isPvW) }
|
||||
functions["stop"] = { battle.stop() }
|
||||
functions["actors"] = { battle.actors.toList().asArrayValue { it.struct } }
|
||||
functions["get_actor"] = getActor@{ params ->
|
||||
val uuid = UUID.fromString(params.getString(0))
|
||||
val actor = battle.actors.find { it.uuid == uuid } ?: return@getActor DoubleValue.ZERO
|
||||
actor.struct
|
||||
}
|
||||
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -12,8 +12,11 @@ import com.bedrockk.molang.runtime.MoParams
|
||||
import net.minecraft.core.Holder
|
||||
import net.minecraft.world.level.biome.Biome
|
||||
|
||||
object BiomeMoLangFunctions: AbstractMoLangFunctionHolder<Holder<Biome>>() {
|
||||
object BiomeMoLangFunctions : AbstractMoLangFunctionHolder<Holder<Biome>>() {
|
||||
override fun Holder<Biome>.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
return mutableMapOf()
|
||||
val biome = this
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -12,8 +12,11 @@ import com.bedrockk.molang.runtime.MoParams
|
||||
import net.minecraft.core.Holder
|
||||
import net.minecraft.world.level.block.Block
|
||||
|
||||
object BlockMoLangFunctions: AbstractMoLangFunctionHolder<Holder<Block>>() {
|
||||
object BlockMoLangFunctions : AbstractMoLangFunctionHolder<Holder<Block>>() {
|
||||
override fun Holder<Block>.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
return mutableMapOf()
|
||||
val block = this
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -14,6 +14,9 @@ import net.minecraft.world.level.dimension.DimensionType
|
||||
|
||||
object DimensionTypeMoLangFunctions : AbstractMoLangFunctionHolder<Holder<DimensionType>>() {
|
||||
override fun Holder<DimensionType>.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
return mutableMapOf()
|
||||
val dimension = this
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+7
-6
@@ -18,15 +18,16 @@ import com.cobblemon.mod.common.util.getOrNull
|
||||
object DropEntryMoLangFunctions : AbstractMoLangFunctionHolder<DropEntry>() {
|
||||
override fun DropEntry.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val drop = this
|
||||
val map = mutableMapOf<String, (MoParams) -> Any>()
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
map["percentage"] = { DoubleValue(drop.percentage.toDouble()) }
|
||||
map["quantity"] = { DoubleValue(drop.quantity.toDouble()) }
|
||||
map["max_selectable_times"] = { DoubleValue(drop.maxSelectableTimes.toDouble()) }
|
||||
map["can_drop"] = { params ->
|
||||
functions["percentage"] = { DoubleValue(drop.percentage.toDouble()) }
|
||||
functions["quantity"] = { DoubleValue(drop.quantity.toDouble()) }
|
||||
functions["max_selectable_times"] = { DoubleValue(drop.maxSelectableTimes.toDouble()) }
|
||||
functions["can_drop"] = { params ->
|
||||
val pokemon = params.getOrNull<ObjectValue<Pokemon>>(0)?.obj
|
||||
DoubleValue(if (drop.canDrop(pokemon)) 1.0 else 0.0)
|
||||
}
|
||||
return map
|
||||
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+265
-223
@@ -56,258 +56,300 @@ import kotlin.math.sqrt
|
||||
|
||||
object EntityMoLangFunctions : AbstractMoLangFunctionHolder<Entity>() {
|
||||
override fun Entity.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val thisEntity = this
|
||||
val map = mutableMapOf<String, (MoParams) -> Any>(
|
||||
"uuid" to { StringValue(thisEntity.uuid.toString()) },
|
||||
"name" to { _ -> StringValue(thisEntity.effectiveName().string) },
|
||||
"yaw" to { _ -> DoubleValue(thisEntity.yRot.toDouble()) },
|
||||
"pitch" to { _ -> DoubleValue(thisEntity.xRot.toDouble()) },
|
||||
"x" to { _ -> DoubleValue(thisEntity.x) },
|
||||
"y" to { _ -> DoubleValue(thisEntity.y) },
|
||||
"z" to { _ -> DoubleValue(thisEntity.z) },
|
||||
"velocity_x" to { _ -> DoubleValue(thisEntity.deltaMovement.x) },
|
||||
"velocity_y" to { _ -> DoubleValue(thisEntity.deltaMovement.y) },
|
||||
"velocity_z" to { _ -> DoubleValue(thisEntity.deltaMovement.z) },
|
||||
"width" to { DoubleValue(thisEntity.boundingBox.xsize) },
|
||||
"height" to { DoubleValue(thisEntity.boundingBox.ysize) },
|
||||
"this_size" to { DoubleValue(thisEntity.boundingBox.run { if (xsize > ysize) xsize else ysize }) },
|
||||
"this_width" to { DoubleValue(thisEntity.boundingBox.xsize) },
|
||||
"this_height" to { DoubleValue(thisEntity.boundingBox.ysize) },
|
||||
"id_modulo" to { params -> DoubleValue(thisEntity.uuid.hashCode() % params.getDouble(0)) },
|
||||
"horizontal_velocity" to { _ -> DoubleValue(thisEntity.deltaMovement.horizontalDistance()) },
|
||||
"vertical_velocity" to { DoubleValue(thisEntity.deltaMovement.y) },
|
||||
"is_on_ground" to { _ -> DoubleValue(thisEntity.onGround()) },
|
||||
"world" to { _ -> thisEntity.level().worldRegistry.wrapAsHolder(thisEntity.level()).asWorldMoLangValue() },
|
||||
"biome" to { _ -> thisEntity.level().getBiome(thisEntity.blockPosition()).asBiomeMoLangValue() },
|
||||
"is_passenger" to { DoubleValue(thisEntity.isPassenger) },
|
||||
"discard" to { thisEntity.discard() },
|
||||
"is_sneaking" to { _ -> DoubleValue(thisEntity.isShiftKeyDown) },
|
||||
"is_sprinting" to { _ -> DoubleValue(thisEntity.isSprinting) },
|
||||
"is_in_water" to { _ -> DoubleValue(thisEntity.isUnderWater) },
|
||||
"is_in_rain" to { _ -> DoubleValue(thisEntity.isInWaterOrRain && !thisEntity.isInWater) },
|
||||
"is_touching_water_or_rain" to { _ -> DoubleValue(thisEntity.isInWaterRainOrBubble) },
|
||||
"is_touching_water" to { _ -> DoubleValue(thisEntity.isInWater) },
|
||||
"is_underwater" to { DoubleValue(thisEntity.getIsSubmerged()) },
|
||||
"is_in_lava" to { _ -> DoubleValue(thisEntity.isInLava) },
|
||||
"is_on_fire" to { _ -> DoubleValue(thisEntity.isOnFire) },
|
||||
"is_invisible" to { _ -> DoubleValue(thisEntity.isInvisible) },
|
||||
"is_riding" to { _ -> DoubleValue(thisEntity.isPassenger) },
|
||||
"set_name" to { params ->
|
||||
val name = params.getString(0)
|
||||
thisEntity.customName = name.text()
|
||||
DoubleValue.ONE
|
||||
},
|
||||
"damage" to { params ->
|
||||
val amount = params.getDouble(0)
|
||||
val source = DamageSource(
|
||||
thisEntity.level().registryAccess().registryOrThrow(Registries.DAMAGE_TYPE)
|
||||
.getHolder(DamageTypes.GENERIC).get()
|
||||
val entity = this
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
functions["uuid"] = { StringValue(entity.uuid.toString()) }
|
||||
functions["name"] = { StringValue(entity.effectiveName().string) }
|
||||
functions["yaw"] = { DoubleValue(entity.yRot.toDouble()) }
|
||||
functions["pitch"] = { DoubleValue(entity.xRot.toDouble()) }
|
||||
functions["x"] = { DoubleValue(entity.x) }
|
||||
functions["y"] = { DoubleValue(entity.y) }
|
||||
functions["z"] = { DoubleValue(entity.z) }
|
||||
functions["velocity_x"] = { DoubleValue(entity.deltaMovement.x) }
|
||||
functions["velocity_y"] = { DoubleValue(entity.deltaMovement.y) }
|
||||
functions["velocity_z"] = { DoubleValue(entity.deltaMovement.z) }
|
||||
functions["width"] = { DoubleValue(entity.boundingBox.xsize) }
|
||||
functions["height"] = { DoubleValue(entity.boundingBox.ysize) }
|
||||
functions["this_size"] = { DoubleValue(entity.boundingBox.run { if (xsize > ysize) xsize else ysize }) }
|
||||
functions["this_width"] = { DoubleValue(entity.boundingBox.xsize) }
|
||||
functions["this_height"] = { DoubleValue(entity.boundingBox.ysize) }
|
||||
functions["id_modulo"] = { params -> DoubleValue(entity.uuid.hashCode() % params.getDouble(0)) }
|
||||
functions["horizontal_velocity"] = { DoubleValue(entity.deltaMovement.horizontalDistance()) }
|
||||
functions["vertical_velocity"] = { DoubleValue(entity.deltaMovement.y) }
|
||||
functions["is_on_ground"] = { DoubleValue(entity.onGround()) }
|
||||
functions["world"] = {
|
||||
entity
|
||||
.level()
|
||||
.worldRegistry
|
||||
.wrapAsHolder(entity.level())
|
||||
.asWorldMoLangValue()
|
||||
}
|
||||
functions["biome"] = { entity.level().getBiome(entity.blockPosition()).asBiomeMoLangValue() }
|
||||
functions["is_passenger"] = { DoubleValue(entity.isPassenger) }
|
||||
functions["discard"] = { entity.discard() }
|
||||
functions["is_sneaking"] = { DoubleValue(entity.isShiftKeyDown) }
|
||||
functions["is_sprinting"] = { DoubleValue(entity.isSprinting) }
|
||||
functions["is_in_water"] = { DoubleValue(entity.isUnderWater) }
|
||||
functions["is_in_rain"] = { DoubleValue(entity.isInWaterOrRain && !entity.isInWater) }
|
||||
functions["is_touching_water_or_rain"] = { DoubleValue(entity.isInWaterRainOrBubble) }
|
||||
functions["is_touching_water"] = { DoubleValue(entity.isInWater) }
|
||||
functions["is_underwater"] = { DoubleValue(entity.getIsSubmerged()) }
|
||||
functions["is_in_lava"] = { DoubleValue(entity.isInLava) }
|
||||
functions["is_on_fire"] = { DoubleValue(entity.isOnFire) }
|
||||
functions["is_invisible"] = { DoubleValue(entity.isInvisible) }
|
||||
functions["is_riding"] = { DoubleValue(entity.isPassenger) }
|
||||
functions["set_name"] = { params ->
|
||||
val name = params.getString(0)
|
||||
entity.customName = name.text()
|
||||
DoubleValue.ONE
|
||||
}
|
||||
functions["damage"] = { params ->
|
||||
val amount = params.getDouble(0)
|
||||
val source =
|
||||
DamageSource(
|
||||
entity
|
||||
.level()
|
||||
.registryAccess()
|
||||
.registryOrThrow(Registries.DAMAGE_TYPE)
|
||||
.getHolder(DamageTypes.GENERIC)
|
||||
.get(),
|
||||
)
|
||||
thisEntity.hurt(source, amount.toFloat())
|
||||
},
|
||||
"distance_to_owner" to distanceToOwner@{
|
||||
if (thisEntity !is TamableAnimal) {
|
||||
return@distanceToOwner DoubleValue.ZERO
|
||||
}
|
||||
val owner = thisEntity.owner ?: return@distanceToOwner DoubleValue.ZERO
|
||||
DoubleValue(thisEntity.distanceTo(owner))
|
||||
},
|
||||
"owner" to owner@{
|
||||
if (thisEntity !is TamableAnimal) return@owner DoubleValue.ZERO
|
||||
val owner = thisEntity.owner
|
||||
owner?.asMostSpecificMoLangValue() ?: DoubleValue.ZERO
|
||||
},
|
||||
"delta_movement" to {
|
||||
listOf(thisEntity.deltaMovement.x, thisEntity.deltaMovement.y, thisEntity.deltaMovement.z)
|
||||
.asArrayValue(::DoubleValue)
|
||||
},
|
||||
"tags" to {
|
||||
val tags = thisEntity.tags
|
||||
val array = ArrayStruct(hashMapOf())
|
||||
tags.forEachIndexed { index, tag -> array.setDirectly("$index", StringValue(tag)) }
|
||||
array
|
||||
},
|
||||
"add_tag" to { params ->
|
||||
val tag = params.getString(0)
|
||||
thisEntity.addTag(tag)
|
||||
DoubleValue.ONE
|
||||
},
|
||||
"remove_tag" to { params ->
|
||||
val tag = params.getString(0)
|
||||
thisEntity.removeTag(tag)
|
||||
DoubleValue.ONE
|
||||
},
|
||||
"has_tag" to { params ->
|
||||
val tag = params.getString(0)
|
||||
DoubleValue(thisEntity.tags.contains(tag))
|
||||
},
|
||||
"distance_to_pos" to { params ->
|
||||
val x = params.getDouble(0)
|
||||
val y = params.getDouble(1)
|
||||
val z = params.getDouble(2)
|
||||
DoubleValue(sqrt(thisEntity.distanceToSqr(Vec3(x, y, z))))
|
||||
},
|
||||
"type" to { _ ->
|
||||
thisEntity.registryAccess().registry(Registries.ENTITY_TYPE).get().getKey(thisEntity.type)?.toString()?.let {
|
||||
entity.hurt(source, amount.toFloat())
|
||||
}
|
||||
functions["distance_to_owner"] = distanceToOwner@{
|
||||
if (entity !is TamableAnimal) {
|
||||
return@distanceToOwner DoubleValue.ZERO
|
||||
}
|
||||
val owner = entity.owner ?: return@distanceToOwner DoubleValue.ZERO
|
||||
DoubleValue(entity.distanceTo(owner))
|
||||
}
|
||||
functions["owner"] = owner@{
|
||||
if (entity !is TamableAnimal) return@owner DoubleValue.ZERO
|
||||
val owner = entity.owner
|
||||
owner?.asMostSpecificMoLangValue() ?: DoubleValue.ZERO
|
||||
}
|
||||
functions["delta_movement"] = {
|
||||
listOf(entity.deltaMovement.x, entity.deltaMovement.y, entity.deltaMovement.z)
|
||||
.asArrayValue(::DoubleValue)
|
||||
}
|
||||
functions["tags"] = {
|
||||
val tags = entity.tags
|
||||
val array = ArrayStruct(hashMapOf())
|
||||
tags.forEachIndexed { index, tag -> array.setDirectly("$index", StringValue(tag)) }
|
||||
array
|
||||
}
|
||||
functions["add_tag"] = { params ->
|
||||
val tag = params.getString(0)
|
||||
entity.addTag(tag)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
functions["remove_tag"] = { params ->
|
||||
val tag = params.getString(0)
|
||||
entity.removeTag(tag)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
functions["has_tag"] = { params ->
|
||||
val tag = params.getString(0)
|
||||
DoubleValue(entity.tags.contains(tag))
|
||||
}
|
||||
functions["distance_to_pos"] = { params ->
|
||||
val x = params.getDouble(0)
|
||||
val y = params.getDouble(1)
|
||||
val z = params.getDouble(2)
|
||||
DoubleValue(sqrt(entity.distanceToSqr(Vec3(x, y, z))))
|
||||
}
|
||||
functions["type"] = {
|
||||
entity
|
||||
.registryAccess()
|
||||
.registry(Registries.ENTITY_TYPE)
|
||||
.get()
|
||||
.getKey(entity.type)
|
||||
?.toString()
|
||||
?.let {
|
||||
StringValue(it)
|
||||
} ?: DoubleValue.ZERO
|
||||
},
|
||||
"find_nearby_block" to findNearbyBlock@{ params ->
|
||||
val input = params.getString(0)
|
||||
val isTag = input.contains("#")
|
||||
val type = input.replace("#", "").asIdentifierDefaultingNamespace(namespace = "minecraft")
|
||||
val range = params.getDoubleOrNull(1) ?: 10
|
||||
val blockPos = thisEntity.level().getBlockStatesWithPos(
|
||||
AABB.ofSize(
|
||||
thisEntity.position(),
|
||||
range.toDouble(),
|
||||
range.toDouble(),
|
||||
range.toDouble()
|
||||
)
|
||||
)
|
||||
.filter { blockPosPair ->
|
||||
}
|
||||
functions["find_nearby_block"] = findNearbyBlock@{ params ->
|
||||
val input = params.getString(0)
|
||||
val isTag = input.contains("#")
|
||||
val type = input.replace("#", "").asIdentifierDefaultingNamespace(namespace = "minecraft")
|
||||
val range = params.getDoubleOrNull(1) ?: 10
|
||||
val blockPos =
|
||||
entity
|
||||
.level()
|
||||
.getBlockStatesWithPos(
|
||||
AABB.ofSize(
|
||||
entity.position(),
|
||||
range.toDouble(),
|
||||
range.toDouble(),
|
||||
range.toDouble(),
|
||||
),
|
||||
).filter { blockPosPair ->
|
||||
blockPosPair.first.blockHolder.let {
|
||||
if (isTag) it.`is`(
|
||||
TagKey.create(
|
||||
Registries.BLOCK,
|
||||
type
|
||||
if (isTag) {
|
||||
it.`is`(
|
||||
TagKey.create(
|
||||
Registries.BLOCK,
|
||||
type,
|
||||
),
|
||||
)
|
||||
) else it.`is`(type)
|
||||
} else {
|
||||
it.`is`(type)
|
||||
}
|
||||
}
|
||||
}
|
||||
.minByOrNull { it.second.distSqr(thisEntity.blockPosition()) }
|
||||
}.minByOrNull { it.second.distSqr(entity.blockPosition()) }
|
||||
?.second
|
||||
if (blockPos != null) {
|
||||
return@findNearbyBlock ArrayStruct(
|
||||
mapOf(
|
||||
"0" to DoubleValue(blockPos.x),
|
||||
"1" to DoubleValue(blockPos.y),
|
||||
"2" to DoubleValue(blockPos.z)
|
||||
)
|
||||
)
|
||||
}
|
||||
return@findNearbyBlock DoubleValue.ZERO
|
||||
},
|
||||
"get_nearby_entities" to { params ->
|
||||
val distance = params.getDouble(0)
|
||||
val entities =
|
||||
thisEntity.level().getEntities(thisEntity, AABB.ofSize(thisEntity.position(), distance, distance, distance))
|
||||
if (blockPos != null) {
|
||||
return@findNearbyBlock ArrayStruct(
|
||||
mapOf(
|
||||
"0" to DoubleValue(blockPos.x),
|
||||
"1" to DoubleValue(blockPos.y),
|
||||
"2" to DoubleValue(blockPos.z),
|
||||
),
|
||||
)
|
||||
}
|
||||
return@findNearbyBlock DoubleValue.ZERO
|
||||
}
|
||||
functions["get_nearby_entities"] = { params ->
|
||||
val distance = params.getDouble(0)
|
||||
val entities =
|
||||
entity
|
||||
.level()
|
||||
.getEntities(entity, AABB.ofSize(entity.position(), distance, distance, distance))
|
||||
|
||||
entities
|
||||
.filterIsInstance<Entity>()
|
||||
.map { it.asMostSpecificMoLangValue() }
|
||||
.asArrayValue()
|
||||
},
|
||||
"is_standing_on_blocks" to { params ->
|
||||
val depth = params.getDouble(0).toInt()
|
||||
val blockStrings: MutableSet<String> = mutableSetOf()
|
||||
for (blockIndex in 1..<params.params.size) {
|
||||
blockStrings.add(params.getString(blockIndex))
|
||||
}
|
||||
entities
|
||||
.filterIsInstance<Entity>()
|
||||
.map { it.asMostSpecificMoLangValue() }
|
||||
.asArrayValue()
|
||||
}
|
||||
functions["is_standing_on_blocks"] = { params ->
|
||||
val depth = params.getDouble(0).toInt()
|
||||
val blockStrings: MutableSet<String> = mutableSetOf()
|
||||
for (blockIndex in 1..<params.params.size) {
|
||||
blockStrings.add(params.getString(blockIndex))
|
||||
}
|
||||
|
||||
if (thisEntity.isStandingOn(blockStrings, depth)) DoubleValue.ONE else DoubleValue.ZERO
|
||||
},
|
||||
if (entity.isStandingOn(blockStrings, depth)) DoubleValue.ONE else DoubleValue.ZERO
|
||||
}
|
||||
|
||||
// q.entity.spawn_bedrock_particles(effect, locator, [player])
|
||||
// sends to everyone nearby or just to the player if they're set.
|
||||
// Locator is necessary even if unused on non-posables.
|
||||
"spawn_bedrock_particles" to { params ->
|
||||
val particle = params.getString(0).asResource()
|
||||
val locator = params.getString(1)
|
||||
val player = params.getOrNull<MoValue>(2)?.let {
|
||||
// q.entity.spawn_bedrock_particles(effect, locator, [player])
|
||||
// sends to everyone nearby or just to the player if they're set.
|
||||
// Locator is necessary even if unused on non-posables.
|
||||
functions["spawn_bedrock_particles"] = { params ->
|
||||
val particle = params.getString(0).asResource()
|
||||
val locator = params.getString(1)
|
||||
val player =
|
||||
params.getOrNull<MoValue>(2)?.let {
|
||||
when (it) {
|
||||
is StringValue -> thisEntity.level().getPlayerByUUID(UUID.fromString(it.value))
|
||||
is StringValue -> entity.level().getPlayerByUUID(UUID.fromString(it.value))
|
||||
is ObjectValue<*> -> it.obj
|
||||
else -> null
|
||||
}
|
||||
} as? ServerPlayer
|
||||
|
||||
val packet = SpawnSnowstormEntityParticlePacket(particle, thisEntity.id, listOf(locator))
|
||||
if (player == null) {
|
||||
packet.sendToPlayersAround(thisEntity.x, thisEntity.y, thisEntity.z, 64.0, thisEntity.level().dimension())
|
||||
} else {
|
||||
packet.sendToPlayer(player)
|
||||
}
|
||||
},
|
||||
"make_intangible" to { params ->
|
||||
val intangible = params.getBooleanOrNull(0) ?: true
|
||||
thisEntity.noPhysics = intangible
|
||||
DoubleValue.ONE
|
||||
val packet = SpawnSnowstormEntityParticlePacket(particle, entity.id, listOf(locator))
|
||||
if (player == null) {
|
||||
packet.sendToPlayersAround(
|
||||
entity.x,
|
||||
entity.y,
|
||||
entity.z,
|
||||
64.0,
|
||||
entity.level().dimension(),
|
||||
)
|
||||
} else {
|
||||
packet.sendToPlayer(player)
|
||||
}
|
||||
)
|
||||
}
|
||||
functions["make_intangible"] = { params ->
|
||||
val intangible = params.getBooleanOrNull(0) ?: true
|
||||
entity.noPhysics = intangible
|
||||
DoubleValue.ONE
|
||||
}
|
||||
|
||||
|
||||
if (thisEntity is PosableEntity) {
|
||||
map["play_animation"] = playAnimation@{ params ->
|
||||
val animation = params.getString(0)
|
||||
val packet = PlayPosableAnimationPacket(thisEntity.id, setOf(animation), emptyList())
|
||||
val target = params.getStringOrNull(1)
|
||||
if (target != null) {
|
||||
val targetPlayer = if (target.asUUID != null) {
|
||||
thisEntity.level().getPlayerByUUID(target.asUUID!!) as ServerPlayer
|
||||
} else if (thisEntity.level() is ServerLevel) {
|
||||
thisEntity.level().server!!.playerList.getPlayerByName(target)
|
||||
when (entity) {
|
||||
is PosableEntity -> {
|
||||
functions["play_animation"] = playAnimation@{ params ->
|
||||
val animation = params.getString(0)
|
||||
val packet = PlayPosableAnimationPacket(entity.id, setOf(animation), emptyList())
|
||||
val target = params.getStringOrNull(1)
|
||||
if (target != null) {
|
||||
val targetPlayer =
|
||||
if (target.asUUID != null) {
|
||||
entity.level().getPlayerByUUID(target.asUUID!!) as ServerPlayer
|
||||
} else if (entity.level() is ServerLevel) {
|
||||
entity
|
||||
.level()
|
||||
.server!!
|
||||
.playerList
|
||||
.getPlayerByName(target)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
if (targetPlayer != null) {
|
||||
packet.sendToPlayer(targetPlayer)
|
||||
return@playAnimation DoubleValue.ONE
|
||||
} else {
|
||||
return@playAnimation DoubleValue.ZERO
|
||||
}
|
||||
} else {
|
||||
null
|
||||
}
|
||||
if (targetPlayer != null) {
|
||||
packet.sendToPlayer(targetPlayer)
|
||||
packet.sendToPlayersAround(
|
||||
entity.x,
|
||||
entity.y,
|
||||
entity.z,
|
||||
64.0,
|
||||
entity.level().dimension(),
|
||||
)
|
||||
return@playAnimation DoubleValue.ONE
|
||||
} else {
|
||||
return@playAnimation DoubleValue.ZERO
|
||||
}
|
||||
} else {
|
||||
packet.sendToPlayersAround(thisEntity.x, thisEntity.y, thisEntity.z, 64.0, thisEntity.level().dimension())
|
||||
return@playAnimation DoubleValue.ONE
|
||||
}
|
||||
|
||||
functions["face"] = { params ->
|
||||
ObjectValue(ReferenceDialogueFaceProvider(entity.id, params.getBooleanOrNull(0) != false))
|
||||
}
|
||||
}
|
||||
|
||||
map["face"] = { params ->
|
||||
ObjectValue(ReferenceDialogueFaceProvider(thisEntity.id, params.getBooleanOrNull(0) != false))
|
||||
|
||||
is Schedulable -> {
|
||||
functions["run_molang_after"] = { params ->
|
||||
val expression = params.getString(0).asExpressionLike()
|
||||
val delayInSeconds = params.getDouble(1).toFloat()
|
||||
val runtime = MoLangRuntime()
|
||||
runtime.environment.cloneFrom(params.environment)
|
||||
entity.after(delayInSeconds) {
|
||||
runtime.resolve(expression)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (thisEntity is Schedulable) {
|
||||
map["run_molang_after"] = { params ->
|
||||
val expression = params.getString(0).asExpressionLike()
|
||||
val delayInSeconds = params.getDouble(1).toFloat()
|
||||
val runtime = MoLangRuntime()
|
||||
runtime.environment.cloneFrom(params.environment)
|
||||
thisEntity.after(delayInSeconds) {
|
||||
runtime.resolve(expression)
|
||||
is MoLangScriptingEntity -> {
|
||||
functions["add_callback"] = { params ->
|
||||
val type = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val callback = params.getString(1).asIdentifierDefaultingNamespace()
|
||||
val allowDuplicates = params.getBooleanOrNull(2) ?: false
|
||||
entity.callbacks.addCallback(type, callback, allowDuplicates)
|
||||
}
|
||||
functions["remove_callback"] = { params ->
|
||||
val type = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val callback = params.getString(1).asIdentifierDefaultingNamespace()
|
||||
entity.callbacks.removeCallback(type, callback)
|
||||
}
|
||||
functions["has_callback"] = { params ->
|
||||
val type = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val callback = params.getString(1).asIdentifierDefaultingNamespace()
|
||||
DoubleValue(callback in (entity.callbacks[type] ?: emptySet()))
|
||||
}
|
||||
functions["clear_callbacks"] = { params ->
|
||||
val type = params.getStringOrNull(0)?.asIdentifierDefaultingNamespace()
|
||||
if (type != null) {
|
||||
entity.callbacks[type]?.clear()
|
||||
} else {
|
||||
entity.callbacks.clear()
|
||||
}
|
||||
DoubleValue.ONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (thisEntity is MoLangScriptingEntity) {
|
||||
map["add_callback"] = { params ->
|
||||
val type = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val callback = params.getString(1).asIdentifierDefaultingNamespace()
|
||||
val allowDuplicates = params.getBooleanOrNull(2) ?: false
|
||||
thisEntity.callbacks.addCallback(type, callback, allowDuplicates)
|
||||
}
|
||||
map["remove_callback"] = { params ->
|
||||
val type = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val callback = params.getString(1).asIdentifierDefaultingNamespace()
|
||||
thisEntity.callbacks.removeCallback(type, callback)
|
||||
}
|
||||
map["has_callback"] = { params ->
|
||||
val type = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val callback = params.getString(1).asIdentifierDefaultingNamespace()
|
||||
DoubleValue(callback in (thisEntity.callbacks[type] ?: emptySet()))
|
||||
}
|
||||
map["clear_callbacks"] = { params ->
|
||||
val type = params.getStringOrNull(0)?.asIdentifierDefaultingNamespace()
|
||||
if (type != null) {
|
||||
thisEntity.callbacks[type]?.clear()
|
||||
} else {
|
||||
thisEntity.callbacks.clear()
|
||||
}
|
||||
DoubleValue.ONE
|
||||
}
|
||||
}
|
||||
|
||||
return map
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -19,26 +19,26 @@ import com.cobblemon.mod.common.pokemon.evolution.variants.TradeEvolution
|
||||
object EvolutionMoLangFunctions : AbstractMoLangFunctionHolder<Evolution>() {
|
||||
override fun Evolution.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val evolution = this
|
||||
val map = hashMapOf<String, (MoParams) -> Any>()
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
map["result"] = { evolution.result.asMoLangValue() }
|
||||
map["is_optional"] = { DoubleValue(evolution.optional) }
|
||||
map["consumes_held_item"] = { DoubleValue(evolution.consumeHeldItem) }
|
||||
functions["result"] = { evolution.result.asMoLangValue() }
|
||||
functions["is_optional"] = { DoubleValue(evolution.optional) }
|
||||
functions["consumes_held_item"] = { DoubleValue(evolution.consumeHeldItem) }
|
||||
|
||||
when (evolution) {
|
||||
is LevelUpEvolution -> {
|
||||
map["is_level_up"] = { DoubleValue.ONE }
|
||||
functions["is_level_up"] = { DoubleValue.ONE }
|
||||
}
|
||||
|
||||
is TradeEvolution -> {
|
||||
map["is_trade"] = { DoubleValue.ONE }
|
||||
functions["is_trade"] = { DoubleValue.ONE }
|
||||
}
|
||||
|
||||
is ItemInteractionEvolution -> {
|
||||
map["is_item"] = { DoubleValue.ONE }
|
||||
functions["is_item"] = { DoubleValue.ONE }
|
||||
}
|
||||
}
|
||||
|
||||
return map
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+107
-101
@@ -42,101 +42,104 @@ import net.minecraft.world.item.ItemStack
|
||||
import java.text.ParseException
|
||||
|
||||
object GeneralMoLangFunctions {
|
||||
val holder: HashMap<String, (MoParams) -> Any> = hashMapOf(
|
||||
"print" to { params ->
|
||||
val functions: MutableMap<String, (MoParams) -> Any> = mutableMapOf()
|
||||
|
||||
init {
|
||||
functions["print"] = { params ->
|
||||
val message = params.get<MoValue>(0).asString()
|
||||
LOGGER.info(message)
|
||||
},
|
||||
"delete_variable" to deleteVar@{ params ->
|
||||
}
|
||||
functions["delete_variable"] = { params ->
|
||||
val struct = params.get<VariableStruct>(0)
|
||||
val variable = params.getString(1)
|
||||
struct.map.remove(variable)
|
||||
return@deleteVar DoubleValue.ONE
|
||||
},
|
||||
"delete_variables" to { params ->
|
||||
DoubleValue.ONE
|
||||
}
|
||||
functions["delete_variables"] = { params ->
|
||||
val struct = params.get<VariableStruct>(0)
|
||||
struct.map.clear()
|
||||
DoubleValue.ONE
|
||||
},
|
||||
"get_variable" to { params ->
|
||||
}
|
||||
functions["get_variable"] = { params ->
|
||||
val struct = params.get<VariableStruct>(0)
|
||||
val variable = params.getString(1)
|
||||
struct.map[variable] ?: DoubleValue.ZERO
|
||||
},
|
||||
"set_variable" to { params ->
|
||||
}
|
||||
functions["set_variable"] = { params ->
|
||||
val struct = params.get<VariableStruct>(0)
|
||||
val variable = params.getString(1)
|
||||
val value = params.get<MoValue>(2)
|
||||
struct.map[variable] = value
|
||||
value
|
||||
},
|
||||
"set_query" to { params ->
|
||||
}
|
||||
functions["set_query"] = { params ->
|
||||
val variable = params.getString(0)
|
||||
val value = params.get<MoValue>(1)
|
||||
params.environment.query.addFunction(variable) { value }
|
||||
value
|
||||
},
|
||||
"replace" to { params ->
|
||||
}
|
||||
functions["replace"] = { params ->
|
||||
val text = params.getString(0)
|
||||
val search = params.getString(1)
|
||||
val replace = params.getString(2)
|
||||
StringValue(text.replace(search, replace))
|
||||
},
|
||||
"is_included" to { params ->
|
||||
}
|
||||
functions["is_included"] = { params ->
|
||||
val text = params.getString(0)
|
||||
val search = params.getString(1)
|
||||
DoubleValue(text.contains(search))
|
||||
},
|
||||
"to_lower" to { params ->
|
||||
}
|
||||
functions["to_lower"] = { params ->
|
||||
StringValue(params.getString(0).lowercase())
|
||||
},
|
||||
"to_upper" to { params ->
|
||||
}
|
||||
functions["to_upper"] = { params ->
|
||||
StringValue(params.getString(0).uppercase())
|
||||
},
|
||||
"string_length" to { params ->
|
||||
}
|
||||
functions["string_length"] = { params ->
|
||||
DoubleValue(params.getString(0).length)
|
||||
},
|
||||
"split_string" to { params ->
|
||||
}
|
||||
functions["split_string"] = { params ->
|
||||
val text = params.getString(0)
|
||||
val delimiter = params.getString(1)
|
||||
val parts = text.split(delimiter).map { StringValue(it) }
|
||||
val struct = ArrayStruct(hashMapOf())
|
||||
parts.forEachIndexed { index, moValue -> struct.setDirectly("$index", moValue) }
|
||||
struct
|
||||
},
|
||||
"is_blank" to { params ->
|
||||
}
|
||||
functions["is_blank"] = { params ->
|
||||
val arg = params.get<MoValue>(0)
|
||||
DoubleValue((arg is StringValue && (arg.value.isBlank() || arg.value.toDoubleOrNull() == 0.0)) || (arg is DoubleValue && arg.value == 0.0))
|
||||
},
|
||||
"run_command" to { params ->
|
||||
DoubleValue(
|
||||
(arg is StringValue && (arg.value.isBlank() || arg.value.toDoubleOrNull() == 0.0)) ||
|
||||
(arg is DoubleValue && arg.value == 0.0),
|
||||
)
|
||||
}
|
||||
functions["run_command"] = { params ->
|
||||
val command = params.getString(0)
|
||||
try {
|
||||
server()!!.commands.performPrefixedCommand(server()!!.createCommandSourceStack(), command)
|
||||
} catch (_: NullPointerException) {
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
},
|
||||
"is_int" to { params -> DoubleValue(params.get<MoValue>(0).asString().isInt()) },
|
||||
"is_number" to { params ->
|
||||
}
|
||||
functions["is_int"] = { params -> DoubleValue(params.get<MoValue>(0).asString().isInt()) }
|
||||
functions["is_number"] = { params ->
|
||||
DoubleValue(
|
||||
params.get<MoValue>(0).asString().toDoubleOrNull() != null
|
||||
params.get<MoValue>(0).asString().toDoubleOrNull() != null,
|
||||
)
|
||||
},
|
||||
"to_number" to { params ->
|
||||
}
|
||||
functions["to_number"] = { params ->
|
||||
DoubleValue(
|
||||
params.get<MoValue>(0).asString().toDoubleOrNull() ?: 0.0
|
||||
params.get<MoValue>(0).asString().toDoubleOrNull() ?: 0.0,
|
||||
)
|
||||
},
|
||||
"to_int" to { params ->
|
||||
}
|
||||
functions["to_int"] = { params ->
|
||||
DoubleValue(
|
||||
params.get<MoValue>(0).asString().toIntOrNull() ?: 0
|
||||
params.get<MoValue>(0).asString().toIntOrNull() ?: 0,
|
||||
)
|
||||
},
|
||||
"to_string" to { params -> StringValue(params.get<MoValue>(0).asString()) },
|
||||
"do_effect_walks" to { _ ->
|
||||
DoubleValue(Cobblemon.config.walkingInBattleAnimations)
|
||||
},
|
||||
"random" to { params ->
|
||||
}
|
||||
functions["to_string"] = { params -> StringValue(params.get<MoValue>(0).asString()) }
|
||||
functions["do_effect_walks"] = { DoubleValue(Cobblemon.config.walkingInBattleAnimations) }
|
||||
functions["random"] = { params ->
|
||||
val options = mutableListOf<MoValue>()
|
||||
var index = 0
|
||||
while (params.contains(index)) {
|
||||
@@ -144,35 +147,35 @@ object GeneralMoLangFunctions {
|
||||
index++
|
||||
}
|
||||
options.random() // Can throw an exception if they specified no args. They'd be idiots though.
|
||||
},
|
||||
"curve" to { params ->
|
||||
}
|
||||
functions["curve"] = { params ->
|
||||
val curveName = params.getString(0)
|
||||
val curve =
|
||||
WaveFunctions.functions[curveName] ?: throw IllegalArgumentException("Unknown curve: $curveName")
|
||||
ObjectValue(curve)
|
||||
},
|
||||
"array" to { params ->
|
||||
}
|
||||
functions["array"] = { params ->
|
||||
val values = params.params
|
||||
val array = ArrayStruct(hashMapOf())
|
||||
values.forEachIndexed { index, moValue -> array.setDirectly("$index", moValue) }
|
||||
array
|
||||
},
|
||||
"length" to { params ->
|
||||
}
|
||||
functions["length"] = { params ->
|
||||
val array = (params.getOrNull<MoValue>(0) as? VariableStruct)
|
||||
if (array == null) {
|
||||
DoubleValue.ZERO
|
||||
} else {
|
||||
DoubleValue(array.map.size.toDouble())
|
||||
}
|
||||
},
|
||||
"append" to { params ->
|
||||
}
|
||||
functions["append"] = { params ->
|
||||
val array = params.get<ArrayStruct>(0)
|
||||
val value = params.get<MoValue>(1)
|
||||
val nextIndex = array.map.size
|
||||
array.setDirectly("$nextIndex", value)
|
||||
array
|
||||
},
|
||||
"insert" to { params ->
|
||||
}
|
||||
functions["insert"] = { params ->
|
||||
val array = params.get<ArrayStruct>(0)
|
||||
val index = params.getInt(1)
|
||||
val value = params.get<MoValue>(2)
|
||||
@@ -187,36 +190,40 @@ object GeneralMoLangFunctions {
|
||||
}
|
||||
array.map[index.toString()] = value
|
||||
array
|
||||
},
|
||||
"delete" to { params ->
|
||||
}
|
||||
functions["delete"] = { params ->
|
||||
val array = params.get<ArrayStruct>(0)
|
||||
val index = params.getInt(1)
|
||||
if (index in 0 until array.map.size) {
|
||||
array.map.remove(index.toString())
|
||||
// Re-index the array to keep keys sequential in numerical order
|
||||
val newMap = hashMapOf<String, MoValue>()
|
||||
array.map.keys.mapNotNull { it.toIntOrNull() }
|
||||
array.map.keys
|
||||
.mapNotNull { it.toIntOrNull() }
|
||||
.sorted()
|
||||
.forEachIndexed { i, k -> newMap[i.toString()] = array.map[k.toString()]!! }
|
||||
array.map.clear()
|
||||
array.map.putAll(newMap)
|
||||
}
|
||||
array
|
||||
},
|
||||
"run_script" to { params ->
|
||||
}
|
||||
functions["run_script"] = { params ->
|
||||
val runtime = MoLangRuntime()
|
||||
runtime.environment.query = params.environment.query
|
||||
runtime.environment.variable = params.environment.variable
|
||||
val args = params.params.subList(1, params.params.size)
|
||||
runtime.environment.context = ContextStruct(
|
||||
(params.environment.context?.map
|
||||
?: emptyMap()) + args.mapIndexed { index, value -> "arg_${index + 1}" to value }.toMap()
|
||||
)
|
||||
runtime.environment.context =
|
||||
ContextStruct(
|
||||
(
|
||||
params.environment.context?.map
|
||||
?: emptyMap()
|
||||
) + args.mapIndexed { index, value -> "arg_${index + 1}" to value }.toMap(),
|
||||
)
|
||||
val script = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
// store the args in the
|
||||
CobblemonScripts.run(script, runtime) ?: DoubleValue.ZERO
|
||||
},
|
||||
"run_molang" to { params ->
|
||||
}
|
||||
functions["run_molang"] = { params ->
|
||||
val runtime = MoLangRuntime()
|
||||
runtime.environment.query = params.environment.query
|
||||
runtime.environment.variable = params.environment.variable
|
||||
@@ -224,17 +231,16 @@ object GeneralMoLangFunctions {
|
||||
val expression = params.getString(0).asExpressionLike()
|
||||
val delayInSeconds = params.getDoubleOrNull(1)?.toFloat() ?: 0.0f
|
||||
|
||||
fun evaluate(): MoValue {
|
||||
return try {
|
||||
fun evaluate(): MoValue =
|
||||
try {
|
||||
runtime.resolve(expression)
|
||||
} catch (ex: Exception) {
|
||||
LOGGER.warn(
|
||||
"Failed to evaluate MoLang expression${if (delayInSeconds > 0.0f) " (delayed)" else ""}: $expression",
|
||||
ex
|
||||
ex,
|
||||
)
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
|
||||
if (delayInSeconds > 0.0f) {
|
||||
val tracker =
|
||||
@@ -246,55 +252,55 @@ object GeneralMoLangFunctions {
|
||||
} else {
|
||||
evaluate()
|
||||
}
|
||||
},
|
||||
"system_time_millis" to { _ ->
|
||||
DoubleValue(System.currentTimeMillis())
|
||||
},
|
||||
}
|
||||
functions["system_time_millis"] = { DoubleValue(System.currentTimeMillis()) }
|
||||
// the rest of the world use dd/MM/yyyy grow up america (this comment was generated by copilot)
|
||||
"date_local_time" to { _ ->
|
||||
functions["date_local_time"] = {
|
||||
val time = System.currentTimeMillis()
|
||||
val date = java.util.Date(time)
|
||||
val formatted = java.text.SimpleDateFormat("dd/MM/yyyy").format(date)
|
||||
StringValue(formatted)
|
||||
},
|
||||
"date_of" to { params ->
|
||||
}
|
||||
functions["date_of"] = { params ->
|
||||
val time = params.getDouble(0).toLong()
|
||||
val date = java.util.Date(time)
|
||||
val formatted = java.text.SimpleDateFormat("dd/MM/yyyy").format(date)
|
||||
StringValue(formatted)
|
||||
},
|
||||
"date_is_after" to { params ->
|
||||
}
|
||||
functions["date_is_after"] = { params ->
|
||||
val dateA = params.getString(0)
|
||||
val dateB = params.getString(1)
|
||||
val format = java.text.SimpleDateFormat("dd/MM/yyyy")
|
||||
val a = try {
|
||||
format.parse(dateA)
|
||||
} catch (_: ParseException) {
|
||||
throw RuntimeException("Cannot parse date ${dateA}, expected it to be in dd/MM/yyyy format, other provided")
|
||||
}
|
||||
val b = try {
|
||||
format.parse(dateB)
|
||||
} catch (_: ParseException) {
|
||||
throw RuntimeException("Cannot parse date ${dateB}, expected it to be in dd/MM/yyyy format, other provided")
|
||||
}
|
||||
val a =
|
||||
try {
|
||||
format.parse(dateA)
|
||||
} catch (_: ParseException) {
|
||||
throw RuntimeException("Cannot parse date $dateA, expected it to be in dd/MM/yyyy format, other provided")
|
||||
}
|
||||
val b =
|
||||
try {
|
||||
format.parse(dateB)
|
||||
} catch (_: ParseException) {
|
||||
throw RuntimeException("Cannot parse date $dateB, expected it to be in dd/MM/yyyy format, other provided")
|
||||
}
|
||||
DoubleValue(a.after(b))
|
||||
},
|
||||
"get_move_from_id" to { params ->
|
||||
}
|
||||
functions["get_move_from_id"] = { params ->
|
||||
val moveId = params.getString(0)
|
||||
val moveTemplate = Moves.getByName(moveId)
|
||||
moveTemplate?.struct ?: DoubleValue.ZERO
|
||||
},
|
||||
"create_simple_party_provider" to { _ ->
|
||||
}
|
||||
functions["create_simple_party_provider"] = {
|
||||
val partyProvider = SimplePartyProvider()
|
||||
partyProvider.struct
|
||||
},
|
||||
"create_pickup_item" to { params ->
|
||||
}
|
||||
functions["create_pickup_item"] = { params ->
|
||||
val item = params.getOrNull<MoValue>(0)?.asString()?.let(ObtainableItemCondition::parseFromString)
|
||||
val pickupPriority = params.getIntOrNull(1) ?: 0
|
||||
val pickupItem = ObtainableItem(item = item, pickupPriority = pickupPriority)
|
||||
pickupItem.struct
|
||||
},
|
||||
"create_itemstack" to { params ->
|
||||
}
|
||||
functions["create_itemstack"] = { params ->
|
||||
val itemId = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
try {
|
||||
val item = BuiltInRegistries.ITEM.get(itemId)
|
||||
@@ -305,7 +311,7 @@ object GeneralMoLangFunctions {
|
||||
LOGGER.error("Cannot create item stack from identifier: $itemId, item with that ID does not exist. Possible typo?")
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
},
|
||||
"file" to { MoLangLoadedFilesCache.struct }
|
||||
)
|
||||
}
|
||||
functions["file"] = { MoLangLoadedFilesCache.struct }
|
||||
}
|
||||
}
|
||||
|
||||
+22
-21
@@ -26,43 +26,44 @@ object ItemStackMoLangFunctions : AbstractMoLangFunctionHolder<Pair<ItemStack, R
|
||||
val registryAccess = this.second
|
||||
val itemRegistry = registryAccess.registryOrThrow(Registries.ITEM)
|
||||
val holder = itemRegistry.wrapAsHolder(stack.item)
|
||||
val functions = mutableMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
val map = hashMapOf<String, (MoParams) -> Any>()
|
||||
map["item"] = { _ -> holder.asMoLangValue(Registries.ITEM) }
|
||||
map["count"] = { _ -> DoubleValue(stack.count.toDouble()) }
|
||||
map["damage_value"] = { _ -> DoubleValue(stack.damageValue) }
|
||||
map["max_damage"] = { _ -> DoubleValue(stack.maxDamage) }
|
||||
map["is_empty"] = { _ -> DoubleValue(stack.isEmpty) }
|
||||
map["shrink"] = { params -> stack.shrink(params.getInt(0)) }
|
||||
map["grow"] = { params -> stack.grow(params.getInt(0)) }
|
||||
map["is_of"] = { params ->
|
||||
functions["item"] = { holder.asMoLangValue(Registries.ITEM) }
|
||||
functions["count"] = { DoubleValue(stack.count.toDouble()) }
|
||||
functions["damage_value"] = { DoubleValue(stack.damageValue) }
|
||||
functions["max_damage"] = { DoubleValue(stack.maxDamage) }
|
||||
functions["is_empty"] = { DoubleValue(stack.isEmpty) }
|
||||
functions["shrink"] = { params -> stack.shrink(params.getInt(0)) }
|
||||
functions["grow"] = { params -> stack.grow(params.getInt(0)) }
|
||||
functions["is_of"] = { params ->
|
||||
DoubleValue(
|
||||
holder.`is`(
|
||||
params.getString(0).asIdentifierDefaultingNamespace()
|
||||
)
|
||||
params.getString(0).asIdentifierDefaultingNamespace(),
|
||||
),
|
||||
)
|
||||
}
|
||||
map["is_in"] = { params ->
|
||||
functions["is_in"] = { params ->
|
||||
DoubleValue(
|
||||
holder.`is`(
|
||||
TagKey.create(
|
||||
Registries.ITEM,
|
||||
params.getString(0).replace("#", "").asIdentifierDefaultingNamespace()
|
||||
)
|
||||
)
|
||||
params.getString(0).replace("#", "").asIdentifierDefaultingNamespace(),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
map["is_food"] = { _ -> DoubleValue(stack.has(DataComponents.FOOD)) }
|
||||
map["is_enchanted"] = { _ -> DoubleValue(stack.hasFoil()) }
|
||||
map["has_enchantment"] = put@{ params ->
|
||||
functions["is_food"] = { DoubleValue(stack.has(DataComponents.FOOD)) }
|
||||
functions["is_enchanted"] = { DoubleValue(stack.hasFoil()) }
|
||||
functions["has_enchantment"] = hasEnchantment@{ params ->
|
||||
val enchantmentId = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val minLevel = params.getIntOrNull(1) ?: 1
|
||||
val enchantmentRegistry = registryAccess.registryOrThrow(Registries.ENCHANTMENT)
|
||||
val holder =
|
||||
enchantmentRegistry.getHolder(enchantmentId).orElse(null) ?: return@put DoubleValue.ZERO
|
||||
enchantmentRegistry.getHolder(enchantmentId).orElse(null) ?: return@hasEnchantment DoubleValue.ZERO
|
||||
val level = EnchantmentHelper.getItemEnchantmentLevel(holder, stack)
|
||||
return@put DoubleValue(level >= minLevel)
|
||||
DoubleValue(level >= minLevel)
|
||||
}
|
||||
return map
|
||||
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+154
-137
@@ -53,26 +53,27 @@ import java.util.*
|
||||
object LivingEntityMoLangFunctions : AbstractMoLangFunctionHolder<LivingEntity>() {
|
||||
override fun LivingEntity.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val entity = this
|
||||
val map = mutableMapOf<String, (MoParams) -> Any>()
|
||||
map["is_player"] = { _ -> DoubleValue(entity is Player) }
|
||||
map["is_npc"] = { _ -> DoubleValue(entity is NPCEntity) }
|
||||
map["is_mob"] = { _ -> DoubleValue(entity is Mob) }
|
||||
map["is_pokemon"] = { _ -> DoubleValue(entity is PokemonEntity) }
|
||||
map["is_animal"] = { _ -> DoubleValue(entity is Animal) }
|
||||
map["is_tamable"] = { _ -> DoubleValue(entity is TamableAnimal) }
|
||||
map["is_tamed"] = { _ -> DoubleValue(entity is TamableAnimal && entity.isTame) }
|
||||
map["is_hostile"] = { _ -> DoubleValue(entity is Monster) }
|
||||
map["is_baby"] = { _ -> DoubleValue(entity.isBaby) }
|
||||
map["is_adult"] = { _ -> DoubleValue(!entity.isBaby) }
|
||||
map["remove_effect"] = put@{ params ->
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
functions["is_player"] = { DoubleValue(entity is Player) }
|
||||
functions["is_npc"] = { DoubleValue(entity is NPCEntity) }
|
||||
functions["is_mob"] = { DoubleValue(entity is Mob) }
|
||||
functions["is_pokemon"] = { DoubleValue(entity is PokemonEntity) }
|
||||
functions["is_animal"] = { DoubleValue(entity is Animal) }
|
||||
functions["is_tamable"] = { DoubleValue(entity is TamableAnimal) }
|
||||
functions["is_tamed"] = { DoubleValue(entity is TamableAnimal && entity.isTame) }
|
||||
functions["is_hostile"] = { DoubleValue(entity is Monster) }
|
||||
functions["is_baby"] = { DoubleValue(entity.isBaby) }
|
||||
functions["is_adult"] = { DoubleValue(!entity.isBaby) }
|
||||
functions["remove_effect"] = removeEffect@{ params ->
|
||||
val effectId = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val effectHolder = BuiltInRegistries.MOB_EFFECT.getHolder(effectId).orElse(null)
|
||||
if (effectHolder != null) {
|
||||
entity.removeEffect(effectHolder)
|
||||
return@put DoubleValue.ONE
|
||||
return@removeEffect DoubleValue.ONE
|
||||
}
|
||||
}
|
||||
map["add_effect"] = put@{ params ->
|
||||
functions["add_effect"] = addEffect@{ params ->
|
||||
val effectId = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val duration = params.getInt(1)
|
||||
val amplifier = params.getIntOrNull(2) ?: 0
|
||||
@@ -81,36 +82,37 @@ object LivingEntityMoLangFunctions : AbstractMoLangFunctionHolder<LivingEntity>(
|
||||
val effectHolder = BuiltInRegistries.MOB_EFFECT.getHolder(effectId).orElse(null)
|
||||
if (effectHolder != null) {
|
||||
entity.addEffect(MobEffectInstance(effectHolder, duration, amplifier, ambient, visible))
|
||||
return@put DoubleValue.ONE
|
||||
return@addEffect DoubleValue.ONE
|
||||
}
|
||||
}
|
||||
map["has_effect"] = put@{ params ->
|
||||
functions["has_effect"] = { params ->
|
||||
val effectId = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val effectHolder = BuiltInRegistries.MOB_EFFECT.getHolder(effectId).orElse(null)
|
||||
return@put DoubleValue(if (effectHolder != null) entity.hasEffect(effectHolder) else false)
|
||||
DoubleValue(effectHolder != null && entity.hasEffect(effectHolder))
|
||||
}
|
||||
map["heal"] = { params ->
|
||||
functions["heal"] = { params ->
|
||||
val amount = params.getDouble(0)
|
||||
entity.heal(amount.toFloat())
|
||||
}
|
||||
map["is_looking_at"] = put@{ params ->
|
||||
functions["is_looking_at"] = isLookingAt@{ params ->
|
||||
val targetEntity = params.get<MoValue>(0)
|
||||
val maxDistance = params.getDoubleOrNull(1)?.toFloat() ?: 2.0F
|
||||
|
||||
val entity = if (targetEntity is ObjectValue<*> && targetEntity.obj is Entity) {
|
||||
targetEntity.obj as Entity
|
||||
} else {
|
||||
return@put DoubleValue.ZERO
|
||||
}
|
||||
val entity =
|
||||
if (targetEntity is ObjectValue<*> && targetEntity.obj is Entity) {
|
||||
targetEntity.obj as Entity
|
||||
} else {
|
||||
return@isLookingAt DoubleValue.ZERO
|
||||
}
|
||||
|
||||
return@put DoubleValue(entity.isLookingAt(entity, maxDistance))
|
||||
DoubleValue(entity.isLookingAt(entity, maxDistance))
|
||||
}
|
||||
map["is_living_entity"] = { DoubleValue.ONE }
|
||||
map["is_flying"] = { _ -> DoubleValue(entity.isFallFlying) }
|
||||
map["is_sleeping"] = { _ -> DoubleValue(entity.isSleeping) }
|
||||
map["health"] = { _ -> DoubleValue(entity.health) }
|
||||
map["max_health"] = { _ -> DoubleValue(entity.maxHealth) }
|
||||
map["look_at_position"] = { params ->
|
||||
functions["is_living_entity"] = { DoubleValue.ONE }
|
||||
functions["is_flying"] = { DoubleValue(entity.isFallFlying) }
|
||||
functions["is_sleeping"] = { DoubleValue(entity.isSleeping) }
|
||||
functions["health"] = { DoubleValue(entity.health) }
|
||||
functions["max_health"] = { DoubleValue(entity.maxHealth) }
|
||||
functions["look_at_position"] = { params ->
|
||||
val x = params.getDouble(0)
|
||||
val y = params.getDouble(1)
|
||||
val z = params.getDouble(2)
|
||||
@@ -120,159 +122,174 @@ object LivingEntityMoLangFunctions : AbstractMoLangFunctionHolder<LivingEntity>(
|
||||
brain.setMemoryWithExpiry(
|
||||
MemoryModuleType.LOOK_TARGET,
|
||||
CobblemonBlockPosTracker(Vec3(x, y, z), flags.toSet()),
|
||||
duration.toLong()
|
||||
duration.toLong(),
|
||||
)
|
||||
}
|
||||
map["get_wander_control_memory"] = put@{
|
||||
val value = entity.brain.getMemorySafely(CobblemonMemories.WANDER_CONTROL).orElse(null)
|
||||
?: CobblemonWanderControl()
|
||||
functions["get_wander_control_memory"] = {
|
||||
val value =
|
||||
entity.brain.getMemorySafely(CobblemonMemories.WANDER_CONTROL).orElse(null)
|
||||
?: CobblemonWanderControl()
|
||||
if (
|
||||
!entity.brain.checkMemory(CobblemonMemories.WANDER_CONTROL, MemoryStatus.VALUE_PRESENT)
|
||||
&& entity.brain.checkMemory(CobblemonMemories.WANDER_CONTROL, MemoryStatus.REGISTERED)
|
||||
!entity.brain.checkMemory(CobblemonMemories.WANDER_CONTROL, MemoryStatus.VALUE_PRESENT) &&
|
||||
entity.brain.checkMemory(CobblemonMemories.WANDER_CONTROL, MemoryStatus.REGISTERED)
|
||||
) {
|
||||
entity.brain.setMemory(CobblemonMemories.WANDER_CONTROL, value)
|
||||
}
|
||||
return@put value.struct
|
||||
value.struct
|
||||
}
|
||||
map["get_position_memory"] = put@{ params ->
|
||||
functions["get_position_memory"] = getPosMemory@{ params ->
|
||||
val id = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val memoryType = BuiltInRegistries.MEMORY_MODULE_TYPE.get(id)
|
||||
if (entity.brain.checkMemory(memoryType, MemoryStatus.VALUE_PRESENT)) {
|
||||
return@put when (val memory = entity.brain.getMemory(memoryType).get()) {
|
||||
is Vec3i -> VariableStruct(
|
||||
mapOf(
|
||||
"x" to DoubleValue(memory.x),
|
||||
"y" to DoubleValue(memory.y),
|
||||
"z" to DoubleValue(memory.z)
|
||||
return@getPosMemory when (val memory = entity.brain.getMemory(memoryType).get()) {
|
||||
is Vec3i -> {
|
||||
VariableStruct(
|
||||
mapOf(
|
||||
"x" to DoubleValue(memory.x),
|
||||
"y" to DoubleValue(memory.y),
|
||||
"z" to DoubleValue(memory.z),
|
||||
),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
is Position -> VariableStruct(
|
||||
mapOf(
|
||||
"x" to DoubleValue(memory.x()),
|
||||
"y" to DoubleValue(memory.y()),
|
||||
"z" to DoubleValue(memory.z())
|
||||
is Position -> {
|
||||
VariableStruct(
|
||||
mapOf(
|
||||
"x" to DoubleValue(memory.x()),
|
||||
"y" to DoubleValue(memory.y()),
|
||||
"z" to DoubleValue(memory.z()),
|
||||
),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
else -> DoubleValue.ZERO
|
||||
else -> {
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return@put DoubleValue.ZERO
|
||||
}
|
||||
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
map["set_uuid_memory"] = put@{ params ->
|
||||
val memory = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
.let(BuiltInRegistries.MEMORY_MODULE_TYPE::get) as MemoryModuleType<UUID>
|
||||
val uuid = params.getString(1).asUUID ?: return@put DoubleValue.ZERO
|
||||
functions["set_uuid_memory"] = setUuidMemory@{ params ->
|
||||
val memory =
|
||||
params
|
||||
.getString(0)
|
||||
.asIdentifierDefaultingNamespace()
|
||||
.let(BuiltInRegistries.MEMORY_MODULE_TYPE::get) as MemoryModuleType<UUID>
|
||||
val uuid = params.getString(1).asUUID ?: return@setUuidMemory DoubleValue.ZERO
|
||||
val expiry = params.getIntOrNull(2) ?: -1
|
||||
if (expiry != -1) {
|
||||
entity.brain.setMemoryWithExpiry(memory, uuid, expiry.toLong())
|
||||
} else {
|
||||
entity.brain.setMemory(memory, uuid)
|
||||
}
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["erase_memory"] = put@{ params ->
|
||||
val memories = params.params.map { it.asString().asIdentifierDefaultingNamespace() }
|
||||
.map(BuiltInRegistries.MEMORY_MODULE_TYPE::get)
|
||||
functions["erase_memory"] = { params ->
|
||||
val memories =
|
||||
params.params
|
||||
.map { it.asString().asIdentifierDefaultingNamespace() }
|
||||
.map(BuiltInRegistries.MEMORY_MODULE_TYPE::get)
|
||||
memories.forEach { entity.brain.eraseMemory(it) }
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["has_memory_value"] = put@{ params ->
|
||||
functions["has_memory_value"] = hasMemoryValue@{ params ->
|
||||
for (param in params.params) {
|
||||
if (!entity.hasMemoryFromString(param.asString())) {
|
||||
return@put DoubleValue.ZERO
|
||||
return@hasMemoryValue DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["lacks_memory_value"] = put@{ params ->
|
||||
functions["lacks_memory_value"] = lacksMemoryValue@{ params ->
|
||||
for (param in params.params) {
|
||||
if (entity.hasMemoryFromString(param.asString())) {
|
||||
return@put DoubleValue.ZERO
|
||||
return@lacksMemoryValue DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["is_doing_activity"] = put@{ params ->
|
||||
functions["is_doing_activity"] = isDoingActivity@{ params ->
|
||||
for (param in params.params) {
|
||||
if (entity.isDoingActivityFromString(param.asString())) {
|
||||
return@put DoubleValue.ONE
|
||||
return@isDoingActivity DoubleValue.ONE
|
||||
}
|
||||
}
|
||||
return@put DoubleValue.ZERO
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
map["can_see"] = put@{ params ->
|
||||
functions["can_see"] = canSee@{ params ->
|
||||
val target = params.get<MoValue>(0)
|
||||
val range = params.getDoubleOrNull(1) ?: 32.0
|
||||
if (target is ObjectValue<*>) {
|
||||
val targetEntity = target.obj as? LivingEntity ?: return@put DoubleValue.ZERO
|
||||
val targetEntity = target.obj as? LivingEntity ?: return@canSee DoubleValue.ZERO
|
||||
val vector = targetEntity.eyePosition.subtract(entity.eyePosition).normalize()
|
||||
val trace = entity.traceEntityCollision(
|
||||
maxDistance = range.toFloat(),
|
||||
stepDistance = 0.1F,
|
||||
direction = vector,
|
||||
entityClass = targetEntity.javaClass,
|
||||
collideBlock = ClipContext.Fluid.NONE
|
||||
)
|
||||
return@put DoubleValue(targetEntity in (trace?.entities ?: emptyList()))
|
||||
} else {
|
||||
return@put DoubleValue.ZERO
|
||||
val trace =
|
||||
entity.traceEntityCollision(
|
||||
maxDistance = range.toFloat(),
|
||||
stepDistance = 0.1F,
|
||||
direction = vector,
|
||||
entityClass = targetEntity.javaClass,
|
||||
collideBlock = ClipContext.Fluid.NONE,
|
||||
)
|
||||
return@canSee DoubleValue(targetEntity in (trace?.entities ?: emptyList()))
|
||||
}
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
|
||||
when (entity) {
|
||||
is PathfinderMob -> {
|
||||
functions["walk_to"] = { params ->
|
||||
val x = params.getDouble(0)
|
||||
val y = params.getDouble(1)
|
||||
val z = params.getDouble(2)
|
||||
val speedMultiplier = params.getDoubleOrNull(3) ?: 0.35
|
||||
|
||||
if (entity.brain.checkMemory(MemoryModuleType.WALK_TARGET, MemoryStatus.REGISTERED)) {
|
||||
entity.brain.setMemory(
|
||||
MemoryModuleType.WALK_TARGET,
|
||||
WalkTarget(Vec3(x, y, z), speedMultiplier.toFloat(), 1),
|
||||
)
|
||||
entity.brain.setMemory(
|
||||
MemoryModuleType.LOOK_TARGET,
|
||||
BlockPosTracker(Vec3(x, y + entity.eyeHeight, z)),
|
||||
)
|
||||
} else {
|
||||
entity.navigation.moveTo(x, y, z, speedMultiplier)
|
||||
entity.lookControl.setLookAt(Vec3(x, y + entity.eyeHeight, z))
|
||||
}
|
||||
}
|
||||
|
||||
functions["has_walk_target"] = {
|
||||
DoubleValue(entity.brain.getMemorySafely(MemoryModuleType.WALK_TARGET).isPresent || entity.isPathFinding)
|
||||
}
|
||||
|
||||
functions["set_can_float"] = { params ->
|
||||
val canFloat = params.getBooleanOrNull(0) != false
|
||||
entity.navigation.setCanFloat(canFloat)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
|
||||
functions["get_pathfinding_malus"] = getPfMalus@{ params ->
|
||||
val type = PathType.entries.find { it.name == params.getString(0).uppercase() }
|
||||
if (type != null) {
|
||||
return@getPfMalus DoubleValue(entity.getPathfindingMalus(type))
|
||||
}
|
||||
Cobblemon.LOGGER.error("Cannot get pathfinding type, unknown value: ${params.getString(0)}")
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
functions["set_pathfinding_malus"] = setPfMalus@{ params ->
|
||||
val type = PathType.entries.find { it.name == params.getString(0).uppercase() }
|
||||
val malus = params.getDouble(1).toFloat()
|
||||
if (type != null) {
|
||||
entity.setPathfindingMalus(type, malus)
|
||||
return@setPfMalus DoubleValue.ONE
|
||||
}
|
||||
Cobblemon.LOGGER.error("Cannot set pathfinding type, unknown value: ${params.getString(0)}")
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity is PathfinderMob) {
|
||||
map["walk_to"] = { params ->
|
||||
val x = params.getDouble(0)
|
||||
val y = params.getDouble(1)
|
||||
val z = params.getDouble(2)
|
||||
val speedMultiplier = params.getDoubleOrNull(3) ?: 0.35
|
||||
|
||||
if (entity.brain.checkMemory(MemoryModuleType.WALK_TARGET, MemoryStatus.REGISTERED)) {
|
||||
entity.brain.setMemory(
|
||||
MemoryModuleType.WALK_TARGET,
|
||||
WalkTarget(Vec3(x, y, z), speedMultiplier.toFloat(), 1)
|
||||
)
|
||||
entity.brain.setMemory(
|
||||
MemoryModuleType.LOOK_TARGET,
|
||||
BlockPosTracker(Vec3(x, y + entity.eyeHeight, z))
|
||||
)
|
||||
} else {
|
||||
entity.navigation.moveTo(x, y, z, speedMultiplier)
|
||||
entity.lookControl.setLookAt(Vec3(x, y + entity.eyeHeight, z))
|
||||
}
|
||||
}
|
||||
|
||||
map["has_walk_target"] = { _ ->
|
||||
DoubleValue(entity.brain.getMemorySafely(MemoryModuleType.WALK_TARGET).isPresent || entity.isPathFinding)
|
||||
}
|
||||
|
||||
map["set_can_float"] = { params ->
|
||||
val canFloat = params.getBooleanOrNull(0) != false
|
||||
entity.navigation.setCanFloat(canFloat)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
|
||||
map["get_pathfinding_malus"] = put@{ params ->
|
||||
val type = PathType.entries.find { it.name == params.getString(0).uppercase() }
|
||||
if (type != null) {
|
||||
return@put DoubleValue(entity.getPathfindingMalus(type))
|
||||
}
|
||||
Cobblemon.LOGGER.error("Unknown pathfinding type: ${params.getString(0)}")
|
||||
return@put DoubleValue.ZERO
|
||||
}
|
||||
map["set_pathfinding_malus"] = put@{ params ->
|
||||
val type = PathType.entries.find { it.name == params.getString(0).uppercase() }
|
||||
val malus = params.getDouble(1).toFloat()
|
||||
if (type != null) {
|
||||
entity.setPathfindingMalus(type, malus)
|
||||
return@put DoubleValue.ONE
|
||||
}
|
||||
Cobblemon.LOGGER.error("Unknown pathfinding type: ${params.getString(0)}")
|
||||
return@put DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
return map
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+108
-98
@@ -50,18 +50,23 @@ import kotlin.collections.any
|
||||
object NPCMoLangFunctions : AbstractMoLangFunctionHolder<NPCEntity>() {
|
||||
override fun NPCEntity.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val npc = this
|
||||
val map = hashMapOf<String, (MoParams) -> Any>()
|
||||
map["class"] = { StringValue(npc.npc.id.toString()) }
|
||||
map["name"] = { StringValue(npc.name.string) }
|
||||
map["level"] = { DoubleValue(npc.level) }
|
||||
map["has_aspect"] = { params -> DoubleValue(npc.aspects.contains(params.getString(0))) }
|
||||
map["in_battle"] = { DoubleValue(npc.isInBattle()) }
|
||||
map["battles"] = {
|
||||
ArrayStruct(npc.battleIds.mapNotNull { BattleRegistry.getBattle(it)?.struct }
|
||||
.mapIndexed { index, value -> "$index" to value }.toMap())
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
functions["class"] = { StringValue(npc.npc.id.toString()) }
|
||||
functions["name"] = { StringValue(npc.name.string) }
|
||||
functions["level"] = { DoubleValue(npc.level) }
|
||||
functions["has_aspect"] = { params -> DoubleValue(npc.aspects.contains(params.getString(0))) }
|
||||
functions["in_battle"] = { DoubleValue(npc.isInBattle()) }
|
||||
functions["battles"] = {
|
||||
ArrayStruct(
|
||||
npc.battleIds
|
||||
.mapNotNull { BattleRegistry.getBattle(it)?.struct }
|
||||
.mapIndexed { index, value -> "$index" to value }
|
||||
.toMap(),
|
||||
)
|
||||
}
|
||||
map["stop_battles"] = { _ -> npc.battleIds.forEach { BattleRegistry.getBattle(it)?.stop() } }
|
||||
map["run_script_on_client"] = { params ->
|
||||
functions["stop_battles"] = { npc.battleIds.forEach { BattleRegistry.getBattle(it)?.stop() } }
|
||||
functions["run_script_on_client"] = { params ->
|
||||
val world = npc.level()
|
||||
if (world is ServerLevel) {
|
||||
val script = params.getString(0)
|
||||
@@ -70,141 +75,142 @@ object NPCMoLangFunctions : AbstractMoLangFunctionHolder<NPCEntity>() {
|
||||
}
|
||||
Unit
|
||||
}
|
||||
map["run_script"] = { params ->
|
||||
functions["run_script"] = { params ->
|
||||
val script = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val runtime = MoLangRuntime()
|
||||
runtime.environment.cloneFrom(params.environment)
|
||||
CobblemonScripts.run(script, runtime) ?: DoubleValue(0)
|
||||
}
|
||||
map["set_movable"] = put@{ params ->
|
||||
functions["set_movable"] = { params ->
|
||||
val movable = params.getBooleanOrNull(0) != false
|
||||
npc.isMovable = movable
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["set_invulnerable"] = put@{ params ->
|
||||
functions["set_invulnerable"] = { params ->
|
||||
val invulnerable = params.getBooleanOrNull(0) != false
|
||||
npc.isInvulnerable = invulnerable
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["set_leashable"] = put@{ params ->
|
||||
functions["set_leashable"] = { params ->
|
||||
val leashable = params.getBooleanOrNull(0) != false
|
||||
npc.isLeashable = leashable
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["set_allow_projectile_hits"] = put@{ params ->
|
||||
functions["set_allow_projectile_hits"] = { params ->
|
||||
val allowProjectileHits = params.getBooleanOrNull(0) != false
|
||||
npc.allowProjectileHits = allowProjectileHits
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["set_name_tag_visible"] = put@{ params ->
|
||||
functions["set_name_tag_visible"] = { params ->
|
||||
val nameTagVisible = params.getBooleanOrNull(0) != false
|
||||
npc.hideNameTag = !nameTagVisible
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["unset_interaction"] = put@{
|
||||
functions["unset_interaction"] = {
|
||||
npc.interaction = null
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["set_dialogue_interaction"] = put@{ params ->
|
||||
functions["set_dialogue_interaction"] = { params ->
|
||||
val dialogue = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
npc.interaction = DialogueNPCInteractionConfiguration().also {
|
||||
it.dialogue = dialogue
|
||||
}
|
||||
return@put DoubleValue.ONE
|
||||
npc.interaction =
|
||||
DialogueNPCInteractionConfiguration().also {
|
||||
it.dialogue = dialogue
|
||||
}
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["set_script_interaction"] = put@{ params ->
|
||||
functions["set_script_interaction"] = { params ->
|
||||
val script = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
npc.interaction = ScriptNPCInteractionConfiguration().also {
|
||||
it.script = script
|
||||
}
|
||||
return@put DoubleValue.ONE
|
||||
npc.interaction =
|
||||
ScriptNPCInteractionConfiguration().also {
|
||||
it.script = script
|
||||
}
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["set_player_texture"] = put@{ params ->
|
||||
functions["set_player_texture"] = setPlayerTexture@{ params ->
|
||||
val username = params.getString(0)
|
||||
// Re-applying it would be unnecessarily laggy.
|
||||
if (username == npc.data.map["player_texture_username"]?.asString()) {
|
||||
return@put DoubleValue.ZERO
|
||||
return@setPlayerTexture DoubleValue.ZERO
|
||||
}
|
||||
npc.loadTextureFromGameProfileName(username)
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["unset_player_texture"] = put@{
|
||||
functions["unset_player_texture"] = {
|
||||
npc.unloadTexture()
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["set_resource_identifier"] = put@{ params ->
|
||||
functions["set_resource_identifier"] = { params ->
|
||||
val identifier = params.getStringOrNull(0)?.asIdentifierDefaultingNamespace()
|
||||
npc.forcedResourceIdentifier = identifier
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["unset_resource_identifier"] = put@{
|
||||
functions["unset_resource_identifier"] = {
|
||||
npc.forcedResourceIdentifier = null
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["set_class"] = put@{ params ->
|
||||
functions["set_class"] = setClass@{ params ->
|
||||
val identifier = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val npcClass = NPCClasses.getByIdentifier(identifier)
|
||||
if (npcClass != null) {
|
||||
npc.npc = npcClass
|
||||
return@put DoubleValue.ONE
|
||||
} else {
|
||||
Cobblemon.LOGGER.error("Unknown NPC class: $identifier")
|
||||
return@put DoubleValue.ZERO
|
||||
return@setClass DoubleValue.ONE
|
||||
}
|
||||
Cobblemon.LOGGER.error("Unknown NPC class: $identifier")
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
map["set_render_scale"] = put@{ params ->
|
||||
functions["set_render_scale"] = { params ->
|
||||
val scale = params.getDouble(0)
|
||||
npc.renderScale = scale.toFloat()
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["render_scale"] = { _ -> DoubleValue(npc.renderScale) }
|
||||
map["set_hitbox_scale"] = put@{ params ->
|
||||
functions["render_scale"] = { DoubleValue(npc.renderScale) }
|
||||
functions["set_hitbox_scale"] = { params ->
|
||||
val scale = params.getDouble(0).toFloat()
|
||||
npc.hitboxScale = scale
|
||||
npc.refreshDimensions()
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["hitbox_scale"] = { _ -> DoubleValue(npc.hitboxScale) }
|
||||
map["set_hitbox"] = put@{ params ->
|
||||
functions["hitbox_scale"] = { DoubleValue(npc.hitboxScale) }
|
||||
functions["set_hitbox"] = setHitbox@{ params ->
|
||||
if (params.params.isEmpty()) {
|
||||
npc.hitbox = null
|
||||
return@put DoubleValue.ONE
|
||||
return@setHitbox DoubleValue.ONE
|
||||
}
|
||||
val width = params.getDouble(0).toFloat()
|
||||
val height = params.getDouble(1).toFloat()
|
||||
val eyeHeight = params.getDoubleOrNull(2)?.toFloat() ?: (height * 0.85F)
|
||||
npc.hitbox = EntityDimensions.scalable(width, height).withEyeHeight(eyeHeight)
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["unset_hitbox"] = put@{
|
||||
functions["unset_hitbox"] = {
|
||||
npc.hitbox = null
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["aspects"] = put@{
|
||||
functions["aspects"] = {
|
||||
val aspects = npc.aspects
|
||||
return@put aspects.asArrayValue { StringValue(it) }
|
||||
aspects.asArrayValue { StringValue(it) }
|
||||
}
|
||||
map["add_aspect"] = put@{ params ->
|
||||
functions["add_aspect"] = { params ->
|
||||
val aspects = params.params.map { it.asString() }
|
||||
npc.appliedAspects.addAll(aspects)
|
||||
npc.updateAspects()
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["remove_aspect"] = put@{ params ->
|
||||
functions["remove_aspect"] = { params ->
|
||||
val aspects = params.params.map { it.asString() }
|
||||
npc.appliedAspects.removeAll(aspects.toSet())
|
||||
npc.updateAspects()
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["party"] = put@{
|
||||
val party = npc.party ?: return@put DoubleValue.ZERO
|
||||
return@put party.asMoLangValue()
|
||||
functions["party"] = party@{
|
||||
val party = npc.party ?: return@party DoubleValue.ZERO
|
||||
party.asMoLangValue()
|
||||
}
|
||||
map["create_npc_party"] = put@{
|
||||
functions["create_npc_party"] = {
|
||||
val party = NPCPartyStore(npc)
|
||||
return@put party.asMoLangValue()
|
||||
party.asMoLangValue()
|
||||
}
|
||||
map["set_npc_party"] = { params ->
|
||||
functions["set_npc_party"] = { params ->
|
||||
val party = params.get<MoValue>(0)
|
||||
if (party is ObjectValue<*>) {
|
||||
npc.party = party.obj as NPCPartyStore
|
||||
@@ -213,18 +219,19 @@ object NPCMoLangFunctions : AbstractMoLangFunctionHolder<NPCEntity>() {
|
||||
}
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["run_action_effect"] = put@{ params ->
|
||||
functions["run_action_effect"] = runActionEffect@{ params ->
|
||||
val runtime = MoLangRuntime().setup()
|
||||
runtime.environment.cloneFrom(params.environment)
|
||||
runtime.withNPCValue(value = npc)
|
||||
val actionEffect = ActionEffects.actionEffects[params.getString(0).asIdentifierDefaultingNamespace()]
|
||||
if (actionEffect != null) {
|
||||
val context = ActionEffectContext(
|
||||
actionEffect = actionEffect,
|
||||
providers = mutableListOf(NPCProvider(npc)),
|
||||
runtime = runtime,
|
||||
level = npc.level()
|
||||
)
|
||||
val context =
|
||||
ActionEffectContext(
|
||||
actionEffect = actionEffect,
|
||||
providers = mutableListOf(NPCProvider(npc)),
|
||||
runtime = runtime,
|
||||
level = npc.level(),
|
||||
)
|
||||
npc.actionEffect = context
|
||||
npc.brain.setMemory(CobblemonMemories.ACTIVE_ACTION_EFFECT, context)
|
||||
npc.brain.setActiveActivityIfPossible(CobblemonActivities.ACTION_EFFECT)
|
||||
@@ -236,37 +243,40 @@ object NPCMoLangFunctions : AbstractMoLangFunctionHolder<NPCEntity>() {
|
||||
}
|
||||
}
|
||||
|
||||
return@put DoubleValue.ONE
|
||||
return@runActionEffect DoubleValue.ONE
|
||||
}
|
||||
return@put DoubleValue.ZERO
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
map["put_pokemon_in_healer"] = put@{ params ->
|
||||
val healer = npc.level()
|
||||
.getBlockEntity(params.get<ArrayStruct>(0).asBlockPos(), CobblemonBlockEntities.HEALING_MACHINE)
|
||||
.orElse(null) ?: return@put DoubleValue.ZERO
|
||||
val party = npc.party ?: return@put DoubleValue.ZERO
|
||||
functions["put_pokemon_in_healer"] = putPokeInHealer@{ params ->
|
||||
val healer =
|
||||
npc
|
||||
.level()
|
||||
.getBlockEntity(params.get<ArrayStruct>(0).asBlockPos(), CobblemonBlockEntities.HEALING_MACHINE)
|
||||
.orElse(null) ?: return@putPokeInHealer DoubleValue.ZERO
|
||||
val party = npc.party ?: return@putPokeInHealer DoubleValue.ZERO
|
||||
if (healer.canHeal(party)) {
|
||||
healer.activate(npc.uuid, party)
|
||||
return@put DoubleValue.ONE
|
||||
} else {
|
||||
return@put DoubleValue.ZERO
|
||||
return@putPokeInHealer DoubleValue.ONE
|
||||
}
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
map["look_at_position"] = { params ->
|
||||
functions["look_at_position"] = { params ->
|
||||
val pos = Vec3(params.getDouble(0), params.getDouble(1), params.getDouble(2))
|
||||
npc.lookAt(EntityAnchorArgument.Anchor.EYES, pos)
|
||||
}
|
||||
map["environment"] = { _ -> npc.runtime.environment }
|
||||
map["party"] = { npc.party?.struct ?: DoubleValue.ZERO }
|
||||
map["has_party"] = { DoubleValue(npc.party != null) }
|
||||
map["is_npc"] = { DoubleValue.ONE }
|
||||
map["can_battle"] =
|
||||
{ DoubleValue(npc.party?.any { it.currentHealth > 0 } == true || npc.npc.party?.isStatic == false) }
|
||||
map["set_battle_theme"] = put@{ params ->
|
||||
functions["environment"] = { npc.runtime.environment }
|
||||
functions["party"] = { npc.party?.struct ?: DoubleValue.ZERO }
|
||||
functions["has_party"] = { DoubleValue(npc.party != null) }
|
||||
functions["is_npc"] = { DoubleValue.ONE }
|
||||
functions["can_battle"] = {
|
||||
DoubleValue(npc.party?.any { it.currentHealth > 0 } == true || npc.npc.party?.isStatic == false)
|
||||
}
|
||||
functions["set_battle_theme"] = { params ->
|
||||
val soundId = params.getString(0).asResource()
|
||||
npc.npc.battleTheme = soundId
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
return map
|
||||
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+11
-11
@@ -23,40 +23,40 @@ import com.cobblemon.mod.common.util.getBooleanOrNull
|
||||
object PCMoLangFunctions : AbstractMoLangFunctionHolder<PCStore>() {
|
||||
override fun PCStore.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val pc = this
|
||||
val map = mutableMapOf<String, (MoParams) -> Any>()
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
map["get_pokemon"] = getPokemon@{ params ->
|
||||
functions["get_pokemon"] = getPokemon@{ params ->
|
||||
val box = params.getInt(0)
|
||||
val slot = params.getInt(1)
|
||||
val pokemon = pc[PCPosition(box, slot)] ?: return@getPokemon DoubleValue.ZERO
|
||||
return@getPokemon pokemon.struct
|
||||
pokemon.struct
|
||||
}
|
||||
map["set_pokemon"] = { params ->
|
||||
functions["set_pokemon"] = { params ->
|
||||
val box = params.getInt(0)
|
||||
val slot = params.getInt(1)
|
||||
val pokemon = params.get<ObjectValue<Pokemon>>(2).obj
|
||||
pc[PCPosition(box, slot)] = pokemon
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["resize"] = { params ->
|
||||
functions["resize"] = { params ->
|
||||
val newSize = params.getInt(0)
|
||||
val lockNewSize = params.getBooleanOrNull(1) == true
|
||||
pc.resize(newSize, lockNewSize)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["get_box_count"] = { DoubleValue(pc.boxes.size.toDouble()) }
|
||||
map["has_unlocked_wallpaper"] = { params ->
|
||||
functions["get_box_count"] = { DoubleValue(pc.boxes.size.toDouble()) }
|
||||
functions["has_unlocked_wallpaper"] = { params ->
|
||||
val wallpaper = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
DoubleValue(pc.unlockedWallpapers.contains(wallpaper))
|
||||
}
|
||||
map["get_unlocked_wallpapers"] = { pc.unlockedWallpapers.asArrayValue { StringValue(it.toString()) } }
|
||||
map["unlock_wallpaper"] = unlockWallpaper@{
|
||||
functions["get_unlocked_wallpapers"] = { pc.unlockedWallpapers.asArrayValue { StringValue(it.toString()) } }
|
||||
functions["unlock_wallpaper"] = unlockWallpaper@{
|
||||
val wallpaper = it.getString(0).asIdentifierDefaultingNamespace()
|
||||
val playSound = it.getBooleanOrNull(1) != false
|
||||
CobblemonUnlockableWallpapers.unlockableWallpapers[wallpaper] ?: return@unlockWallpaper DoubleValue.ZERO
|
||||
return@unlockWallpaper DoubleValue(pc.unlockWallpaper(wallpaper, playSound))
|
||||
DoubleValue(pc.unlockWallpaper(wallpaper, playSound))
|
||||
}
|
||||
|
||||
return map
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+7
-5
@@ -14,21 +14,23 @@ import com.cobblemon.mod.common.api.molang.ObjectValue
|
||||
import com.cobblemon.mod.common.api.storage.party.PartyStore
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
|
||||
object PartyMoLangFunctions: AbstractMoLangFunctionHolder<PartyStore>() {
|
||||
object PartyMoLangFunctions : AbstractMoLangFunctionHolder<PartyStore>() {
|
||||
override fun PartyStore.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val party = this
|
||||
val map = hashMapOf<String, (MoParams) -> Any>()
|
||||
map["get_pokemon"] = getPokemon@{ params ->
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
functions["get_pokemon"] = getPokemon@{ params ->
|
||||
val index = params.getInt(0)
|
||||
val pokemon = party.get(index) ?: return@getPokemon DoubleValue.ZERO
|
||||
pokemon.struct
|
||||
}
|
||||
map["set_pokemon"] = { params ->
|
||||
functions["set_pokemon"] = { params ->
|
||||
val index = params.getInt(0)
|
||||
val pokemon = params.get<ObjectValue<Pokemon>>(1).obj
|
||||
party.set(index, pokemon)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
return map
|
||||
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+300
-266
@@ -17,12 +17,12 @@ 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.CobblemonBlockEntities
|
||||
import com.cobblemon.mod.common.api.moves.Moves
|
||||
import com.cobblemon.mod.common.api.tms.TechnicalMachines
|
||||
import com.cobblemon.mod.common.api.dialogue.PlayerDialogueFaceProvider
|
||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMoLangValue
|
||||
import com.cobblemon.mod.common.api.molang.ObjectValue
|
||||
import com.cobblemon.mod.common.api.moves.Moves
|
||||
import com.cobblemon.mod.common.api.text.text
|
||||
import com.cobblemon.mod.common.api.tms.TechnicalMachines
|
||||
import com.cobblemon.mod.common.battles.BattleBuilder
|
||||
import com.cobblemon.mod.common.battles.BattleFormat
|
||||
import com.cobblemon.mod.common.entity.npc.NPCEntity
|
||||
@@ -52,355 +52,389 @@ import net.minecraft.core.registries.Registries
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.sounds.SoundSource
|
||||
import net.minecraft.stats.Stats
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.level.GameType
|
||||
import kotlin.collections.iterator
|
||||
|
||||
object PlayerMoLangFunctions : AbstractMoLangFunctionHolder<Player>() {
|
||||
override fun Player.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val player = this
|
||||
val map = mutableMapOf<String, (MoParams) -> Any>()
|
||||
map["username"] = { _ -> StringValue(player.gameProfile.name) }
|
||||
map["uuid"] = { _ -> StringValue(player.gameProfile.id.toString()) }
|
||||
map["main_held_item"] = { _ -> player.mainHandItem.asMoLangValue(player.registryAccess()) }
|
||||
map["off_held_item"] = { _ -> player.offhandItem.asMoLangValue(player.registryAccess()) }
|
||||
map["inventory"] = put@{ _ ->
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
functions["username"] = { StringValue(player.gameProfile.name) }
|
||||
functions["uuid"] = { StringValue(player.gameProfile.id.toString()) }
|
||||
functions["main_held_item"] = { player.mainHandItem.asMoLangValue(player.registryAccess()) }
|
||||
functions["off_held_item"] = { player.offhandItem.asMoLangValue(player.registryAccess()) }
|
||||
functions["inventory"] = {
|
||||
val inventory = player.inventory
|
||||
val items = ArrayStruct(hashMapOf())
|
||||
for (i in 0 until inventory.containerSize) {
|
||||
items.setDirectly("$i", inventory.getItem(i).asMoLangValue(player.registryAccess()))
|
||||
}
|
||||
return@put items
|
||||
items
|
||||
}
|
||||
map["has_inventory_space"] = put@{ _ ->
|
||||
functions["has_inventory_space"] = {
|
||||
val inventory = player.inventory
|
||||
return@put if (inventory.getFreeSlot() != -1) DoubleValue.ONE else DoubleValue.ZERO
|
||||
if (inventory.freeSlot != -1) DoubleValue.ONE else DoubleValue.ZERO
|
||||
}
|
||||
map["set_inventory_slot"] = put@{ params ->
|
||||
functions["set_inventory_slot"] = setInvSlot@{ params ->
|
||||
val slot = params.getInt(0)
|
||||
val inventory = player.inventory
|
||||
if (slot !in 0 until inventory.containerSize) return@put DoubleValue.ZERO
|
||||
if (slot !in 0 until inventory.containerSize) return@setInvSlot DoubleValue.ZERO
|
||||
|
||||
val value = params.getOrNull<MoValue>(1) ?: return@put DoubleValue.ZERO
|
||||
val value = params.getOrNull<MoValue>(1) ?: return@setInvSlot DoubleValue.ZERO
|
||||
|
||||
val stack: ItemStack? = when (value) {
|
||||
is ObjectValue<*> -> value.obj as? ItemStack
|
||||
is StringValue -> {
|
||||
val id = ResourceLocation.parse(value.value)
|
||||
val item = player.registryAccess().registryOrThrow(Registries.ITEM).get(id)
|
||||
?: return@put DoubleValue.ZERO
|
||||
ItemStack(item)
|
||||
val stack: ItemStack? =
|
||||
when (value) {
|
||||
is ObjectValue<*> -> {
|
||||
value.obj as? ItemStack
|
||||
}
|
||||
|
||||
is StringValue -> {
|
||||
val id = ResourceLocation.parse(value.value)
|
||||
val item =
|
||||
player.registryAccess().registryOrThrow(Registries.ITEM).get(id)
|
||||
?: return@setInvSlot DoubleValue.ZERO
|
||||
ItemStack(item)
|
||||
}
|
||||
|
||||
else -> {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
else -> null
|
||||
}
|
||||
|
||||
if (stack == null) return@put DoubleValue.ZERO
|
||||
if (stack == null) return@setInvSlot DoubleValue.ZERO
|
||||
|
||||
inventory.setItem(slot, stack)
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["give_item"] = put@{ params ->
|
||||
functions["give_item"] = giveItem@{ params ->
|
||||
val inventory = player.inventory
|
||||
val freeSlot = inventory.getFreeSlot()
|
||||
val value = params.getOrNull<MoValue>(0) ?: return@put DoubleValue.ZERO
|
||||
val freeSlot = inventory.freeSlot
|
||||
val value = params.getOrNull<MoValue>(0) ?: return@giveItem DoubleValue.ZERO
|
||||
val dropIfFull = params.getBooleanOrNull(1) ?: false
|
||||
|
||||
val stack: ItemStack? = when (value) {
|
||||
is ObjectValue<*> -> value.obj as? ItemStack
|
||||
is StringValue -> {
|
||||
val id = ResourceLocation.parse(value.value)
|
||||
val item = player.registryAccess().registryOrThrow(Registries.ITEM).get(id)
|
||||
?: return@put DoubleValue.ZERO
|
||||
ItemStack(item)
|
||||
val stack: ItemStack? =
|
||||
when (value) {
|
||||
is ObjectValue<*> -> {
|
||||
value.obj as? ItemStack
|
||||
}
|
||||
|
||||
is StringValue -> {
|
||||
val id = ResourceLocation.parse(value.value)
|
||||
val item =
|
||||
player.registryAccess().registryOrThrow(Registries.ITEM).get(id)
|
||||
?: return@giveItem DoubleValue.ZERO
|
||||
ItemStack(item)
|
||||
}
|
||||
|
||||
else -> {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
else -> null
|
||||
}
|
||||
|
||||
if (stack == null) return@put DoubleValue.ZERO
|
||||
if (stack == null) return@giveItem DoubleValue.ZERO
|
||||
|
||||
if (freeSlot == -1) {
|
||||
if (dropIfFull) {
|
||||
player.drop(stack, false)
|
||||
return@put DoubleValue.ONE
|
||||
return@giveItem DoubleValue.ONE
|
||||
} else {
|
||||
return@put DoubleValue.ZERO
|
||||
return@giveItem DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
|
||||
inventory.setItem(freeSlot, stack)
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["face"] = { params ->
|
||||
functions["face"] = { params ->
|
||||
ObjectValue(
|
||||
PlayerDialogueFaceProvider(
|
||||
player.uuid,
|
||||
params.getBooleanOrNull(0) != false
|
||||
)
|
||||
params.getBooleanOrNull(0) != false,
|
||||
),
|
||||
)
|
||||
}
|
||||
map["swing_hand"] = { _ -> player.swing(player.usedItemHand) }
|
||||
map["food_level"] = { _ -> DoubleValue(player.foodData.foodLevel) }
|
||||
map["saturation_level"] = { _ -> DoubleValue(player.foodData.saturationLevel) }
|
||||
map["tell"] = { params ->
|
||||
functions["swing_hand"] = { player.swing(player.usedItemHand) }
|
||||
functions["food_level"] = { DoubleValue(player.foodData.foodLevel) }
|
||||
functions["saturation_level"] = { DoubleValue(player.foodData.saturationLevel) }
|
||||
functions["tell"] = { params ->
|
||||
val message = params.getString(0).text()
|
||||
val overlay = params.getBooleanOrNull(1) == true
|
||||
player.displayClientMessage(message, overlay)
|
||||
}
|
||||
map["teleport"] = { params ->
|
||||
functions["teleport"] = { params ->
|
||||
val x = params.getDouble(0)
|
||||
val y = params.getDouble(1)
|
||||
val z = params.getDouble(2)
|
||||
val playParticleOptionss = params.getBooleanOrNull(3) ?: false
|
||||
player.randomTeleport(x, y, z, playParticleOptionss)
|
||||
val playParticleOptions = params.getBooleanOrNull(3) ?: false
|
||||
player.randomTeleport(x, y, z, playParticleOptions)
|
||||
}
|
||||
map["heal"] = { params ->
|
||||
functions["heal"] = { params ->
|
||||
val amount = params.getDoubleOrNull(0) ?: player.maxHealth
|
||||
player.heal(amount.toFloat())
|
||||
}
|
||||
map["environment"] = {
|
||||
functions["environment"] = {
|
||||
val environment = MoLangEnvironment()
|
||||
environment.query = player.asMoLangValue()
|
||||
environment
|
||||
}
|
||||
map["is_player"] = { DoubleValue.ONE }
|
||||
map["riding_pokemon"] = put@{
|
||||
functions["is_player"] = { DoubleValue.ONE }
|
||||
functions["riding_pokemon"] = ridingPokemon@{
|
||||
val vehicle = player.vehicle
|
||||
if (vehicle is PokemonEntity) {
|
||||
return@put vehicle.struct
|
||||
} else {
|
||||
return@put DoubleValue.ZERO
|
||||
return@ridingPokemon vehicle.struct
|
||||
}
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
if (player is ServerPlayer) {
|
||||
map["seen_credits"] = { _ ->
|
||||
DoubleValue(player.seenCredits)
|
||||
}
|
||||
map["is_in_dialogue"] = { _ ->
|
||||
DoubleValue(player.isInDialogue)
|
||||
}
|
||||
map["active_dialogue"] = put@{ _ ->
|
||||
if (player.isInDialogue) {
|
||||
return@put player.activeDialogue?.toMoLangStruct() ?: DoubleValue.ZERO
|
||||
} else {
|
||||
|
||||
when (player) {
|
||||
is ServerPlayer -> {
|
||||
functions["seen_credits"] = { DoubleValue(player.seenCredits) }
|
||||
functions["is_in_dialogue"] = { DoubleValue(player.isInDialogue) }
|
||||
functions["active_dialogue"] = activeDialogue@{
|
||||
if (player.isInDialogue) {
|
||||
return@activeDialogue player.activeDialogue?.toMoLangStruct() ?: DoubleValue.ZERO
|
||||
}
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
map["is_spectator"] = { DoubleValue(player.isSpectator) }
|
||||
map["is_creative"] = { DoubleValue(player.isCreative) }
|
||||
map["is_survival"] = { DoubleValue(player.gameMode.isSurvival) }
|
||||
map["is_adventure"] = { DoubleValue(player.gameMode.gameModeForPlayer == GameType.ADVENTURE) }
|
||||
map["run_command"] = { params ->
|
||||
val command = params.getString(0)
|
||||
player.server.commands.performPrefixedCommand(player.createCommandSourceStack(), command)
|
||||
}
|
||||
map["set_battle_theme"] = put@{ params ->
|
||||
val soundId = params.getString(0).asResource()
|
||||
Cobblemon.playerDataManager.getGenericData(player).battleTheme = soundId
|
||||
return@put DoubleValue.ONE
|
||||
}
|
||||
map["battle_music"] = put@{ params ->
|
||||
val soundId = params.getString(0).asResource()
|
||||
val volume = params.getDoubleOrNull(1)?.toFloat() ?: 1.0f
|
||||
val pitch = params.getDoubleOrNull(2)?.toFloat() ?: 1.0f
|
||||
val restart = params.getBooleanOrNull(3) ?: true
|
||||
functions["is_spectator"] = { DoubleValue(player.isSpectator) }
|
||||
functions["is_creative"] = { DoubleValue(player.isCreative) }
|
||||
functions["is_survival"] = { DoubleValue(player.gameMode.isSurvival) }
|
||||
functions["is_adventure"] = { DoubleValue(player.gameMode.gameModeForPlayer == GameType.ADVENTURE) }
|
||||
functions["run_command"] = { params ->
|
||||
val command = params.getString(0)
|
||||
player.server.commands.performPrefixedCommand(player.createCommandSourceStack(), command)
|
||||
}
|
||||
functions["set_battle_theme"] = { params ->
|
||||
val soundId = params.getString(0).asResource()
|
||||
Cobblemon.playerDataManager.getGenericData(player).battleTheme = soundId
|
||||
DoubleValue.ONE
|
||||
}
|
||||
functions["battle_music"] = battleMusic@{ params ->
|
||||
val soundId = params.getString(0).asResource()
|
||||
val volume = params.getDoubleOrNull(1)?.toFloat() ?: 1.0f
|
||||
val pitch = params.getDoubleOrNull(2)?.toFloat() ?: 1.0f
|
||||
val restart = params.getBooleanOrNull(3) ?: true
|
||||
|
||||
if (soundId != null) {
|
||||
val packet = BattleMusicPacket(soundId, volume, pitch, restart)
|
||||
if (soundId != null) {
|
||||
val packet = BattleMusicPacket(soundId, volume, pitch, restart)
|
||||
packet.sendToPlayer(player)
|
||||
return@battleMusic DoubleValue.ONE
|
||||
}
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
functions["stop_battle_music"] = {
|
||||
val packet = BattleMusicPacket(null)
|
||||
packet.sendToPlayer(player)
|
||||
return@put DoubleValue.ONE
|
||||
} else {
|
||||
return@put DoubleValue.ZERO
|
||||
DoubleValue.ONE
|
||||
}
|
||||
}
|
||||
map["stop_battle_music"] = put@{ _ ->
|
||||
val packet = BattleMusicPacket(null)
|
||||
packet.sendToPlayer(player)
|
||||
return@put DoubleValue.ONE
|
||||
}
|
||||
map["play_sound_on_server"] = { params ->
|
||||
val sound = params.getString(0).asResource()
|
||||
val soundSource = SoundSource.valueOf(params.getString(1).uppercase())
|
||||
val volume = params.getDoubleOrNull(2)?.toFloat() ?: 1.0f
|
||||
val pitch = params.getDoubleOrNull(3)?.toFloat() ?: 1.0f
|
||||
functions["play_sound_on_server"] = { params ->
|
||||
val sound = params.getString(0).asResource()
|
||||
val soundSource = SoundSource.valueOf(params.getString(1).uppercase())
|
||||
val volume = params.getDoubleOrNull(2)?.toFloat() ?: 1.0f
|
||||
val pitch = params.getDoubleOrNull(3)?.toFloat() ?: 1.0f
|
||||
|
||||
val packet =
|
||||
UnvalidatedPlaySoundS2CPacket(sound, soundSource, player.x, player.y, player.z, volume, pitch)
|
||||
packet.sendToPlayer(player)
|
||||
}
|
||||
map["is_party_at_full_health"] = { _ ->
|
||||
DoubleValue(player.party().none(Pokemon::canBeHealed))
|
||||
}
|
||||
map["can_heal_at_healer"] = put@{ params ->
|
||||
val pos = params.get<ArrayStruct>(0).asBlockPos()
|
||||
val healer = player.level().getBlockEntity(pos, CobblemonBlockEntities.HEALING_MACHINE).orElse(null)
|
||||
?: return@put DoubleValue.ZERO
|
||||
val party = player.party()
|
||||
return@put DoubleValue(healer.canHeal(party))
|
||||
}
|
||||
map["put_pokemon_in_healer"] = put@{ params ->
|
||||
val healer = player.level()
|
||||
.getBlockEntity(params.get<ArrayStruct>(0).asBlockPos(), CobblemonBlockEntities.HEALING_MACHINE)
|
||||
.orElse(null) ?: return@put DoubleValue.ZERO
|
||||
val party = player.party()
|
||||
if (healer.canHeal(party)) {
|
||||
healer.activate(player.uuid, party)
|
||||
return@put DoubleValue.ONE
|
||||
} else {
|
||||
return@put DoubleValue.ZERO
|
||||
val packet =
|
||||
UnvalidatedPlaySoundS2CPacket(
|
||||
sound,
|
||||
soundSource,
|
||||
player.x,
|
||||
player.y,
|
||||
player.z,
|
||||
volume,
|
||||
pitch,
|
||||
)
|
||||
|
||||
packet.sendToPlayer(player)
|
||||
}
|
||||
}
|
||||
map["party"] = { player.party().struct }
|
||||
map["pc"] = { player.pc().struct }
|
||||
map["has_permission"] = { params ->
|
||||
DoubleValue(
|
||||
Cobblemon.permissionValidator.hasPermission(
|
||||
player,
|
||||
params.getString(0),
|
||||
params.getIntOrNull(1) ?: 4
|
||||
functions["is_party_at_full_health"] = { DoubleValue(player.party().none(Pokemon::canBeHealed)) }
|
||||
functions["can_heal_at_healer"] = canHealAtHealer@{ params ->
|
||||
val pos = params.get<ArrayStruct>(0).asBlockPos()
|
||||
val healer =
|
||||
player.level().getBlockEntity(pos, CobblemonBlockEntities.HEALING_MACHINE).orElse(null)
|
||||
?: return@canHealAtHealer DoubleValue.ZERO
|
||||
val party = player.party()
|
||||
DoubleValue(healer.canHeal(party))
|
||||
}
|
||||
functions["put_pokemon_in_healer"] = putPokemonAtHealer@{ params ->
|
||||
val healer =
|
||||
player
|
||||
.level()
|
||||
.getBlockEntity(
|
||||
params.get<ArrayStruct>(0).asBlockPos(),
|
||||
CobblemonBlockEntities.HEALING_MACHINE,
|
||||
).orElse(null) ?: return@putPokemonAtHealer DoubleValue.ZERO
|
||||
val party = player.party()
|
||||
if (healer.canHeal(party)) {
|
||||
healer.activate(player.uuid, party)
|
||||
return@putPokemonAtHealer DoubleValue.ONE
|
||||
}
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
functions["party"] = { player.party().struct }
|
||||
functions["pc"] = { player.pc().struct }
|
||||
functions["has_permission"] = { params ->
|
||||
DoubleValue(
|
||||
Cobblemon.permissionValidator.hasPermission(
|
||||
player,
|
||||
params.getString(0),
|
||||
params.getIntOrNull(1) ?: 4,
|
||||
),
|
||||
)
|
||||
)
|
||||
}
|
||||
map["data"] = { params -> Cobblemon.molangData.load(player.uuid, params.getStringOrNull(0)) }
|
||||
map["save_data"] = { params -> Cobblemon.molangData.save(player.uuid, params.getStringOrNull(0)) }
|
||||
map["in_battle"] = { DoubleValue(player.isInBattle()) }
|
||||
map["battle"] = { player.getBattleState()?.first?.struct ?: DoubleValue.ZERO }
|
||||
map["get_npc_data"] = put@{ params ->
|
||||
val npcId = ((params.get<MoValue>(0) as? ObjectValue<*>)?.obj as? NPCEntity)?.stringUUID
|
||||
?: params.getString(0)
|
||||
val data = Cobblemon.molangData.load(player.uuid, params.getStringOrNull(1))
|
||||
if (data.map.containsKey(npcId)) {
|
||||
return@put data.map[npcId]!!
|
||||
} else {
|
||||
}
|
||||
functions["data"] = { params -> Cobblemon.molangData.load(player.uuid, params.getStringOrNull(0)) }
|
||||
functions["save_data"] = { params -> Cobblemon.molangData.save(player.uuid, params.getStringOrNull(0)) }
|
||||
functions["in_battle"] = { DoubleValue(player.isInBattle()) }
|
||||
functions["battle"] = { player.getBattleState()?.first?.struct ?: DoubleValue.ZERO }
|
||||
functions["get_npc_data"] = getNpcData@{ params ->
|
||||
val npcId =
|
||||
((params.get<MoValue>(0) as? ObjectValue<*>)?.obj as? NPCEntity)?.stringUUID
|
||||
?: params.getString(0)
|
||||
val data = Cobblemon.molangData.load(player.uuid, params.getStringOrNull(1))
|
||||
if (data.map.containsKey(npcId)) {
|
||||
return@getNpcData data.map[npcId]!!
|
||||
}
|
||||
|
||||
val vars = VariableStruct()
|
||||
data.map[npcId] = vars
|
||||
return@put vars
|
||||
vars
|
||||
}
|
||||
}
|
||||
map["get_npc_variable"] = put@{ params ->
|
||||
val npcId = ((params.get<MoValue>(0) as? ObjectValue<*>)?.obj as? NPCEntity)?.stringUUID
|
||||
?: params.getString(0)
|
||||
val variable = params.getString(1)
|
||||
val data = Cobblemon.molangData.load(player.uuid, params.getStringOrNull(2))
|
||||
if (data.map.containsKey(npcId)) {
|
||||
return@put (data.map[npcId] as VariableStruct).map[variable] ?: DoubleValue.ZERO
|
||||
} else {
|
||||
return@put DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
map["set_npc_variable"] = put@{ params ->
|
||||
val npcId = ((params.get<MoValue>(0) as? ObjectValue<*>)?.obj as? NPCEntity)?.stringUUID
|
||||
?: params.getString(0)
|
||||
val variable = params.getString(1)
|
||||
val value = params.get<MoValue>(2)
|
||||
val saveAfterwards = params.getBooleanOrNull(3) != false
|
||||
val path = params.getStringOrNull(4)
|
||||
val data = Cobblemon.molangData.load(player.uuid, path)
|
||||
val npcData = data.map.getOrPut(npcId) { VariableStruct() } as VariableStruct
|
||||
npcData.map[variable] = value
|
||||
if (saveAfterwards) {
|
||||
Cobblemon.molangData.save(player.uuid, path)
|
||||
}
|
||||
return@put DoubleValue.ONE
|
||||
}
|
||||
map["pokedex"] = { player.pokedex().struct }
|
||||
map["has_advancement"] = put@{ params ->
|
||||
val requiredAdvancement = ResourceLocation.parse(params.getString(0))
|
||||
for (entry in player.advancements.progress) {
|
||||
if (entry.key.id == requiredAdvancement && entry.value.isDone) {
|
||||
return@put DoubleValue.ONE
|
||||
functions["get_npc_variable"] = getNpcVariable@{ params ->
|
||||
val npcId =
|
||||
((params.get<MoValue>(0) as? ObjectValue<*>)?.obj as? NPCEntity)?.stringUUID
|
||||
?: params.getString(0)
|
||||
val variable = params.getString(1)
|
||||
val data = Cobblemon.molangData.load(player.uuid, params.getStringOrNull(2))
|
||||
if (data.map.containsKey(npcId)) {
|
||||
return@getNpcVariable (data.map[npcId] as VariableStruct).map[variable] ?: DoubleValue.ZERO
|
||||
}
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
return@put DoubleValue.ZERO
|
||||
}
|
||||
map["has_tm_move_unlocked"] = put@{ params ->
|
||||
val move = Moves.getByName(params.getString(0)) ?: return@put DoubleValue.ZERO
|
||||
val tm = TechnicalMachines.moveToTM[move] ?: return@put DoubleValue.ZERO
|
||||
DoubleValue(if (player.tmList().learnedTMs.contains(tm.id)) 1.0 else 0.0)
|
||||
}
|
||||
map["unlock_tm_move"] = put@{ params ->
|
||||
val move = Moves.getByName(params.getString(0)) ?: return@put DoubleValue.ZERO
|
||||
val tm = TechnicalMachines.moveToTM[move] ?: return@put DoubleValue.ZERO
|
||||
player.tmList().syncTMFromMove(move)
|
||||
DoubleValue(if (player.tmList().learnedTMs.contains(tm.id)) 1.0 else 0.0)
|
||||
}
|
||||
map["lock_tm_move"] = put@{ params ->
|
||||
val move = Moves.getByName(params.getString(0)) ?: return@put DoubleValue.ZERO
|
||||
val tm = TechnicalMachines.moveToTM[move] ?: return@put DoubleValue.ZERO
|
||||
player.tmList().syncTMLockFromMove(move)
|
||||
DoubleValue(if (player.tmList().learnedTMs.contains(tm.id)) 0.0 else 1.0)
|
||||
}
|
||||
map["start_battle"] = put@{ params ->
|
||||
val opponentValue = params.get<MoValue>(0)
|
||||
val opponent = if (opponentValue is ObjectValue<*>) {
|
||||
opponentValue.obj as ServerPlayer
|
||||
} else {
|
||||
val paramString = opponentValue.asString()
|
||||
val playerUUID = paramString.asUUID
|
||||
if (playerUUID != null) {
|
||||
server()?.playerList?.getPlayer(playerUUID) ?: return@put DoubleValue.ZERO
|
||||
} else {
|
||||
server()?.playerList?.getPlayerByName(paramString) ?: return@put DoubleValue.ZERO
|
||||
functions["set_npc_variable"] = { params ->
|
||||
val npcId =
|
||||
((params.get<MoValue>(0) as? ObjectValue<*>)?.obj as? NPCEntity)?.stringUUID
|
||||
?: params.getString(0)
|
||||
val variable = params.getString(1)
|
||||
val value = params.get<MoValue>(2)
|
||||
val saveAfterwards = params.getBooleanOrNull(3) != false
|
||||
val path = params.getStringOrNull(4)
|
||||
val data = Cobblemon.molangData.load(player.uuid, path)
|
||||
val npcData = data.map.getOrPut(npcId) { VariableStruct() } as VariableStruct
|
||||
npcData.map[variable] = value
|
||||
if (saveAfterwards) {
|
||||
Cobblemon.molangData.save(player.uuid, path)
|
||||
}
|
||||
DoubleValue.ONE
|
||||
}
|
||||
val format = params.getStringOrNull(1)
|
||||
?.let(BattleFormat::fromFormatIdentifier)
|
||||
?: BattleFormat.GEN_9_SINGLES
|
||||
functions["pokedex"] = { player.pokedex().struct }
|
||||
functions["has_advancement"] = hasAdvancement@{ params ->
|
||||
val requiredAdvancement = ResourceLocation.parse(params.getString(0))
|
||||
player.advancements.progress.forEach { (holder, progress) ->
|
||||
if (holder.id == requiredAdvancement && progress.isDone) {
|
||||
return@hasAdvancement DoubleValue.ONE
|
||||
}
|
||||
}
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
functions["has_tm_move_unlocked"] = hasTmMoveUnlocked@{ params ->
|
||||
val move = Moves.getByName(params.getString(0)) ?: return@hasTmMoveUnlocked DoubleValue.ZERO
|
||||
val tm = TechnicalMachines.moveToTM[move] ?: return@hasTmMoveUnlocked DoubleValue.ZERO
|
||||
DoubleValue(if (player.tmList().learnedTMs.contains(tm.id)) 1.0 else 0.0)
|
||||
}
|
||||
functions["unlock_tm_move"] = unlockTmMove@{ params ->
|
||||
val move = Moves.getByName(params.getString(0)) ?: return@unlockTmMove DoubleValue.ZERO
|
||||
val tm = TechnicalMachines.moveToTM[move] ?: return@unlockTmMove DoubleValue.ZERO
|
||||
player.tmList().syncTMFromMove(move)
|
||||
DoubleValue(if (player.tmList().learnedTMs.contains(tm.id)) 1.0 else 0.0)
|
||||
}
|
||||
functions["lock_tm_move"] = lockTmMove@{ params ->
|
||||
val move = Moves.getByName(params.getString(0)) ?: return@lockTmMove DoubleValue.ZERO
|
||||
val tm = TechnicalMachines.moveToTM[move] ?: return@lockTmMove DoubleValue.ZERO
|
||||
player.tmList().syncTMLockFromMove(move)
|
||||
DoubleValue(if (player.tmList().learnedTMs.contains(tm.id)) 0.0 else 1.0)
|
||||
}
|
||||
functions["start_battle"] = startBattle@{ params ->
|
||||
val opponentValue = params.get<MoValue>(0)
|
||||
val opponent =
|
||||
if (opponentValue is ObjectValue<*>) {
|
||||
opponentValue.obj as ServerPlayer
|
||||
} else {
|
||||
val paramString = opponentValue.asString()
|
||||
val playerUUID = paramString.asUUID
|
||||
if (playerUUID != null) {
|
||||
server()?.playerList?.getPlayer(playerUUID) ?: return@startBattle DoubleValue.ZERO
|
||||
} else {
|
||||
server()?.playerList?.getPlayerByName(paramString)
|
||||
?: return@startBattle DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
val format =
|
||||
params
|
||||
.getStringOrNull(1)
|
||||
?.let(BattleFormat::fromFormatIdentifier)
|
||||
?: BattleFormat.GEN_9_SINGLES
|
||||
|
||||
val setLevel = params.getIntOrNull(2) ?: -1
|
||||
format.adjustLevel = setLevel
|
||||
val setLevel = params.getIntOrNull(2) ?: -1
|
||||
format.adjustLevel = setLevel
|
||||
|
||||
val rules = params.getStringOrNull(5)
|
||||
?.split(",")
|
||||
?.toSet()
|
||||
?: emptySet()
|
||||
val rules =
|
||||
params
|
||||
.getStringOrNull(5)
|
||||
?.split(",")
|
||||
?.toSet()
|
||||
?: emptySet()
|
||||
|
||||
val modifiedBattleFormat = BattleFormat.setBattleRules(
|
||||
battleFormat = format,
|
||||
rules = rules
|
||||
)
|
||||
val modifiedBattleFormat =
|
||||
BattleFormat.setBattleRules(
|
||||
battleFormat = format,
|
||||
rules = rules,
|
||||
)
|
||||
|
||||
val cloneParties = (setLevel != -1) || (params.getBooleanOrNull(3) ?: false)
|
||||
val healFirst = params.getBooleanOrNull(4) ?: false
|
||||
val cloneParties = (setLevel != -1) || (params.getBooleanOrNull(3) ?: false)
|
||||
val healFirst = params.getBooleanOrNull(4) ?: false
|
||||
|
||||
val battleStartResult = BattleBuilder.pvp1v1(
|
||||
player1 = player,
|
||||
player2 = opponent,
|
||||
battleFormat = modifiedBattleFormat,
|
||||
cloneParties = cloneParties,
|
||||
healFirst = healFirst
|
||||
)
|
||||
var returnValue: MoValue = DoubleValue.ZERO
|
||||
battleStartResult.ifSuccessful { returnValue = it.struct }
|
||||
return@put returnValue
|
||||
val battleStartResult =
|
||||
BattleBuilder.pvp1v1(
|
||||
player1 = player,
|
||||
player2 = opponent,
|
||||
battleFormat = modifiedBattleFormat,
|
||||
cloneParties = cloneParties,
|
||||
healFirst = healFirst,
|
||||
)
|
||||
var returnValue: MoValue = DoubleValue.ZERO
|
||||
battleStartResult.ifSuccessful { returnValue = it.struct }
|
||||
returnValue
|
||||
}
|
||||
functions["get_custom_stat"] = getCustomStat@{ params ->
|
||||
val statName = params.getString(0)
|
||||
|
||||
val resourceLocation = ResourceLocation.tryParse(statName) ?: return@getCustomStat DoubleValue.ZERO
|
||||
val statResourceLocation =
|
||||
BuiltInRegistries.CUSTOM_STAT.get(resourceLocation) ?: return@getCustomStat DoubleValue.ZERO
|
||||
|
||||
val exists = Stats.CUSTOM.contains(statResourceLocation)
|
||||
if (!exists) return@getCustomStat DoubleValue.ZERO
|
||||
|
||||
val stat = Stats.CUSTOM.get(statResourceLocation)
|
||||
val value = player.stats.getValue(stat)
|
||||
|
||||
DoubleValue(value)
|
||||
}
|
||||
functions["get_starter_uuid"] = {
|
||||
Cobblemon.playerDataManager.getGenericData(player).starterUUID?.let {
|
||||
StringValue(
|
||||
it.toString(),
|
||||
)
|
||||
} ?: DoubleValue.ZERO
|
||||
}
|
||||
functions["has_chosen_starter"] = {
|
||||
DoubleValue(Cobblemon.playerDataManager.getGenericData(player).starterSelected)
|
||||
}
|
||||
}
|
||||
map["get_custom_stat"] = put@{ params ->
|
||||
val statName = params.getString(0)
|
||||
|
||||
val resourceLocation = ResourceLocation.tryParse(statName) ?: return@put DoubleValue.ZERO
|
||||
val statResourceLocation =
|
||||
BuiltInRegistries.CUSTOM_STAT.get(resourceLocation) ?: return@put DoubleValue.ZERO
|
||||
|
||||
val exists = net.minecraft.stats.Stats.CUSTOM.contains(statResourceLocation)
|
||||
if (!exists) return@put DoubleValue.ZERO
|
||||
|
||||
val stat = net.minecraft.stats.Stats.CUSTOM.get(statResourceLocation)
|
||||
val value = player.stats.getValue(stat)
|
||||
|
||||
DoubleValue(value)
|
||||
}
|
||||
map["get_starter_uuid"] = { _ ->
|
||||
Cobblemon.playerDataManager.getGenericData(player).starterUUID?.let {
|
||||
StringValue(
|
||||
it.toString()
|
||||
)
|
||||
} ?: DoubleValue.ZERO
|
||||
}
|
||||
map["has_chosen_starter"] = { _ -> DoubleValue(Cobblemon.playerDataManager.getGenericData(player).starterSelected) }
|
||||
}
|
||||
|
||||
return map
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+71
-37
@@ -16,6 +16,7 @@ import com.cobblemon.mod.common.api.molang.ObjectValue
|
||||
import com.cobblemon.mod.common.api.pokedex.AbstractPokedexManager
|
||||
import com.cobblemon.mod.common.api.pokedex.CaughtCount
|
||||
import com.cobblemon.mod.common.api.pokedex.CaughtPercent
|
||||
import com.cobblemon.mod.common.api.pokedex.Dexes
|
||||
import com.cobblemon.mod.common.api.pokedex.PokedexEntryProgress
|
||||
import com.cobblemon.mod.common.api.pokedex.PokedexManager
|
||||
import com.cobblemon.mod.common.api.pokedex.SeenCount
|
||||
@@ -27,57 +28,90 @@ import com.cobblemon.mod.common.util.getStringOrNull
|
||||
object PokedexMoLangFunctions : AbstractMoLangFunctionHolder<AbstractPokedexManager>() {
|
||||
override fun AbstractPokedexManager.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val pokedex = this
|
||||
val map = mutableMapOf<String, (MoParams) -> Any>()
|
||||
map["get_species_record"] = { params ->
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
functions["get_species_record"] = { params ->
|
||||
val speciesId = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
pokedex.speciesRecords[speciesId]?.struct ?: QueryStruct(hashMapOf())
|
||||
}
|
||||
|
||||
map["has_seen"] = put@{ params ->
|
||||
functions["has_seen"] = hasSeen@{ params ->
|
||||
val speciesId = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val formName = params.getStringOrNull(1)
|
||||
val formName =
|
||||
params.getStringOrNull(1)
|
||||
?: return@hasSeen DoubleValue(
|
||||
pokedex.getHighestKnowledgeForSpecies(speciesId).ordinal >= PokedexEntryProgress.SEEN.ordinal,
|
||||
)
|
||||
|
||||
if (formName == null) {
|
||||
return@put DoubleValue(pokedex.getHighestKnowledgeForSpecies(speciesId).ordinal >= PokedexEntryProgress.SEEN.ordinal)
|
||||
} else {
|
||||
return@put DoubleValue(
|
||||
(pokedex.getSpeciesRecord(speciesId)?.getFormRecord(formName)?.knowledge?.ordinal
|
||||
?: 0) >= PokedexEntryProgress.SEEN.ordinal
|
||||
)
|
||||
}
|
||||
DoubleValue(
|
||||
(
|
||||
pokedex
|
||||
.getSpeciesRecord(speciesId)
|
||||
?.getFormRecord(formName)
|
||||
?.knowledge
|
||||
?.ordinal
|
||||
?: 0
|
||||
) >= PokedexEntryProgress.SEEN.ordinal,
|
||||
)
|
||||
}
|
||||
|
||||
map["has_caught"] = put@{ params ->
|
||||
functions["has_caught"] = hasCaught@{ params ->
|
||||
val speciesId = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val formName = params.getStringOrNull(1)
|
||||
if (formName == null) {
|
||||
return@put DoubleValue(pokedex.getHighestKnowledgeForSpecies(speciesId) == PokedexEntryProgress.OWNED)
|
||||
} else {
|
||||
return@put DoubleValue(
|
||||
pokedex.getSpeciesRecord(speciesId)
|
||||
?.getFormRecord(formName)?.knowledge == PokedexEntryProgress.OWNED
|
||||
val formName =
|
||||
params.getStringOrNull(1) ?: return@hasCaught DoubleValue(
|
||||
pokedex.getHighestKnowledgeForSpecies(
|
||||
speciesId,
|
||||
) == PokedexEntryProgress.OWNED,
|
||||
)
|
||||
}
|
||||
DoubleValue(
|
||||
pokedex
|
||||
.getSpeciesRecord(speciesId)
|
||||
?.getFormRecord(formName)
|
||||
?.knowledge == PokedexEntryProgress.OWNED,
|
||||
)
|
||||
}
|
||||
map["caught_count"] = { DoubleValue(pokedex.getGlobalCalculatedValue(CaughtCount)) }
|
||||
map["seen_count"] = { DoubleValue(pokedex.getGlobalCalculatedValue(SeenCount)) }
|
||||
map["caught_percent"] = { DoubleValue(pokedex.getGlobalCalculatedValue(CaughtPercent)) }
|
||||
map["seen_percent"] = { DoubleValue(pokedex.getGlobalCalculatedValue(SeenPercent)) }
|
||||
functions["caught_count"] = { DoubleValue(pokedex.getGlobalCalculatedValue(CaughtCount)) }
|
||||
functions["seen_count"] = { DoubleValue(pokedex.getGlobalCalculatedValue(SeenCount)) }
|
||||
functions["caught_percent"] = { DoubleValue(pokedex.getGlobalCalculatedValue(CaughtPercent)) }
|
||||
functions["seen_percent"] = { DoubleValue(pokedex.getGlobalCalculatedValue(SeenPercent)) }
|
||||
|
||||
if (pokedex is PokedexManager) {
|
||||
map["player_id"] = { StringValue(pokedex.uuid.toString()) }
|
||||
map["see"] = put@{ params ->
|
||||
val pokemon = params.get<ObjectValue<Pokemon>>(0).obj
|
||||
pokedex.encounter(pokemon)
|
||||
return@put DoubleValue.ONE
|
||||
}
|
||||
map["catch"] = put@{ params ->
|
||||
val pokemon = params.get<ObjectValue<Pokemon>>(0).obj
|
||||
pokedex.obtain(pokemon)
|
||||
return@put DoubleValue.ONE
|
||||
functions["dex_caught_count"] = { params ->
|
||||
val dexId = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
if (Dexes.dexEntryMap.containsKey(dexId)) DoubleValue(pokedex.getDexCalculatedValue(dexId, CaughtCount))
|
||||
else DoubleValue.ZERO
|
||||
}
|
||||
functions["dex_seen_count"] = { params ->
|
||||
val dexId = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
if (Dexes.dexEntryMap.containsKey(dexId)) DoubleValue(pokedex.getDexCalculatedValue(dexId, SeenCount))
|
||||
else DoubleValue.ZERO
|
||||
}
|
||||
functions["dex_caught_percent"] = { params ->
|
||||
val dexId = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
if (Dexes.dexEntryMap.containsKey(dexId)) DoubleValue(pokedex.getDexCalculatedValue(dexId, CaughtPercent).toDouble())
|
||||
else DoubleValue.ZERO
|
||||
}
|
||||
functions["dex_seen_percent"] = { params ->
|
||||
val dexId = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
if (Dexes.dexEntryMap.containsKey(dexId)) DoubleValue(pokedex.getDexCalculatedValue(dexId, SeenPercent).toDouble())
|
||||
else DoubleValue.ZERO
|
||||
}
|
||||
|
||||
when (pokedex) {
|
||||
is PokedexManager -> {
|
||||
functions["player_id"] = { StringValue(pokedex.uuid.toString()) }
|
||||
functions["see"] = { params ->
|
||||
val pokemon = params.get<ObjectValue<Pokemon>>(0).obj
|
||||
pokedex.encounter(pokemon)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
functions["catch"] = { params ->
|
||||
val pokemon = params.get<ObjectValue<Pokemon>>(0).obj
|
||||
pokedex.obtain(pokemon)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return map
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+55
-40
@@ -32,100 +32,113 @@ import com.cobblemon.mod.common.util.withQueryValue
|
||||
object PokemonEntityMoLangFunctions : AbstractMoLangFunctionHolder<PokemonEntity>() {
|
||||
override fun PokemonEntity.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val pokemonEntity = this
|
||||
val map = mutableMapOf<String, (MoParams) -> Any>()
|
||||
map["is_busy"] = { DoubleValue(pokemonEntity.isBusy) }
|
||||
map["in_battle"] = { DoubleValue(pokemonEntity.isBattling) }
|
||||
map["is_moving"] = { DoubleValue((pokemonEntity.moveControl as? PokemonMoveControl)?.hasWanted() == true) }
|
||||
map["is_flying"] = { DoubleValue(pokemonEntity.getBehaviourFlag(PokemonBehaviourFlag.FLYING)) }
|
||||
map["get_riding_state"] = { params ->
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
functions["is_busy"] = { DoubleValue(pokemonEntity.isBusy) }
|
||||
functions["in_battle"] = { DoubleValue(pokemonEntity.isBattling) }
|
||||
functions["is_moving"] =
|
||||
{ DoubleValue((pokemonEntity.moveControl as? PokemonMoveControl)?.hasWanted() == true) }
|
||||
functions["is_flying"] = { DoubleValue(pokemonEntity.getBehaviourFlag(PokemonBehaviourFlag.FLYING)) }
|
||||
functions["get_riding_state"] = { params ->
|
||||
val name = params.getStringOrNull(0)
|
||||
pokemonEntity.ifRidingAvailableSupply(DoubleValue.ZERO) { behaviour, settings, state ->
|
||||
val moValue = behaviour.asMoLangValue(settings, state, pokemonEntity)
|
||||
return@ifRidingAvailableSupply moValue.functions[name]?.apply(MoParams.EMPTY) as? MoValue ?: moValue
|
||||
}
|
||||
}
|
||||
map["is_gliding"] = {
|
||||
functions["is_gliding"] = {
|
||||
pokemonEntity.ifRidingAvailableSupply(DoubleValue.ZERO) { behaviour, settings, state ->
|
||||
val moValue = behaviour.asMoLangValue(settings, state, pokemonEntity)
|
||||
return@ifRidingAvailableSupply moValue.functions["gliding"]?.apply(MoParams.EMPTY) as? MoValue
|
||||
?: DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
map["is_sprinting"] = {
|
||||
functions["is_sprinting"] = {
|
||||
pokemonEntity.ifRidingAvailableSupply(DoubleValue.ZERO) { behaviour, settings, state ->
|
||||
val moValue = behaviour.asMoLangValue(settings, state, pokemonEntity)
|
||||
return@ifRidingAvailableSupply moValue.functions["sprinting"]?.apply(MoParams.EMPTY) as? MoValue
|
||||
?: DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
map["is_drifting"] = {
|
||||
functions["is_drifting"] = {
|
||||
pokemonEntity.ifRidingAvailableSupply(DoubleValue.ZERO) { behaviour, settings, state ->
|
||||
val moValue = behaviour.asMoLangValue(settings, state, pokemonEntity)
|
||||
return@ifRidingAvailableSupply moValue.functions["drifting"]?.apply(MoParams.EMPTY) as? MoValue
|
||||
?: DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
map["is_powered_drifting"] = {
|
||||
functions["is_powered_drifting"] = {
|
||||
pokemonEntity.ifRidingAvailableSupply(DoubleValue.ZERO) { behaviour, settings, state ->
|
||||
val moValue = behaviour.asMoLangValue(settings, state, pokemonEntity)
|
||||
return@ifRidingAvailableSupply moValue.functions["powered_drifting"]?.apply(MoParams.EMPTY) as? MoValue
|
||||
?: DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
map["in_air"] = {
|
||||
functions["in_air"] = {
|
||||
pokemonEntity.ifRidingAvailableSupply(DoubleValue.ZERO) { behaviour, settings, state ->
|
||||
val moValue = behaviour.asMoLangValue(settings, state, pokemonEntity)
|
||||
return@ifRidingAvailableSupply moValue.functions["in_air"]?.apply(MoParams.EMPTY) as? MoValue
|
||||
?: DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
map["is_wild"] = { DoubleValue(pokemonEntity.ownerUUID == null) }
|
||||
map["is_in_party"] = { DoubleValue(pokemonEntity.pokemon.storeCoordinates.get()?.store is PartyStore) }
|
||||
map["is_ridden"] = { DoubleValue(pokemonEntity.hasControllingPassenger()) }
|
||||
map["has_aspect"] = { DoubleValue(it.getString(0) in pokemonEntity.aspects) }
|
||||
map["is_pokemon"] = { DoubleValue.ONE }
|
||||
map["is_holding_item"] = {
|
||||
DoubleValue(!pokemonEntity.entityData.get(PokemonEntity.SHOWN_HELD_ITEM).let {
|
||||
it.isEmpty || it.`is`(CobblemonItemTags.WEARABLE_HAT_ITEMS) || it.`is`(CobblemonItemTags.WEARABLE_FACE_ITEMS)
|
||||
})
|
||||
functions["is_wild"] = { DoubleValue(pokemonEntity.ownerUUID == null) }
|
||||
functions["is_in_party"] = {
|
||||
DoubleValue(
|
||||
pokemonEntity.pokemon.storeCoordinates
|
||||
.get()
|
||||
?.store is PartyStore,
|
||||
)
|
||||
}
|
||||
map["riding_style"] = {
|
||||
StringValue(pokemonEntity.ifRidingAvailableSupply("") { behaviour, settings, state ->
|
||||
behaviour.getRidingStyle(settings, state).name
|
||||
})
|
||||
functions["is_ridden"] = { DoubleValue(pokemonEntity.hasControllingPassenger()) }
|
||||
functions["has_aspect"] = { DoubleValue(it.getString(0) in pokemonEntity.aspects) }
|
||||
functions["is_pokemon"] = { DoubleValue.ONE }
|
||||
functions["is_holding_item"] = {
|
||||
DoubleValue(
|
||||
!pokemonEntity.entityData.get(PokemonEntity.SHOWN_HELD_ITEM).let {
|
||||
it.isEmpty || it.`is`(CobblemonItemTags.WEARABLE_HAT_ITEMS) || it.`is`(CobblemonItemTags.WEARABLE_FACE_ITEMS)
|
||||
},
|
||||
)
|
||||
}
|
||||
map["is_wearing_hat"] = {
|
||||
functions["riding_style"] = {
|
||||
StringValue(
|
||||
pokemonEntity.ifRidingAvailableSupply("") { behaviour, settings, state ->
|
||||
behaviour.getRidingStyle(settings, state).name
|
||||
},
|
||||
)
|
||||
}
|
||||
functions["is_wearing_hat"] = {
|
||||
DoubleValue(
|
||||
pokemonEntity.entityData
|
||||
.get(PokemonEntity.SHOWN_HELD_ITEM)
|
||||
.`is`(CobblemonItemTags.WEARABLE_HAT_ITEMS)
|
||||
.`is`(CobblemonItemTags.WEARABLE_HAT_ITEMS),
|
||||
)
|
||||
}
|
||||
map["is_wearing_face"] = {
|
||||
functions["is_wearing_face"] = {
|
||||
DoubleValue(
|
||||
pokemonEntity.entityData
|
||||
.get(PokemonEntity.SHOWN_HELD_ITEM)
|
||||
.`is`(CobblemonItemTags.WEARABLE_FACE_ITEMS)
|
||||
.`is`(CobblemonItemTags.WEARABLE_FACE_ITEMS),
|
||||
)
|
||||
}
|
||||
map["is_pastured"] = {
|
||||
functions["is_pastured"] = {
|
||||
DoubleValue((pokemonEntity.tethering != null))
|
||||
}
|
||||
map["pasture_conflict_enabled"] = {
|
||||
functions["pasture_conflict_enabled"] = {
|
||||
DoubleValue(pokemonEntity.getBehaviourFlag(PokemonBehaviourFlag.PASTURE_CONFLICT))
|
||||
}
|
||||
map["run_action_effect"] = runActionEffect@{ params ->
|
||||
functions["run_action_effect"] = runActionEffect@{ params ->
|
||||
val runtime = MoLangRuntime().setup()
|
||||
runtime.environment.cloneFrom(params.environment)
|
||||
runtime.withQueryValue("entity", pokemonEntity.struct)
|
||||
val actionEffect = ActionEffects.actionEffects[params.getString(0).asIdentifierDefaultingNamespace()]
|
||||
if (actionEffect != null) {
|
||||
val context = ActionEffectContext(
|
||||
actionEffect = actionEffect,
|
||||
providers = mutableListOf(TargetsProvider(pokemonEntity)),
|
||||
runtime = runtime,
|
||||
level = pokemonEntity.level()
|
||||
)
|
||||
val context =
|
||||
ActionEffectContext(
|
||||
actionEffect = actionEffect,
|
||||
providers = mutableListOf(TargetsProvider(pokemonEntity)),
|
||||
runtime = runtime,
|
||||
level = pokemonEntity.level(),
|
||||
)
|
||||
// This was taken from NPC run_action_effect but this variable isn't used, so I just commented it out.
|
||||
// pokemonEntity.actionEffect = context
|
||||
pokemonEntity.brain.setMemory(CobblemonMemories.ACTIVE_ACTION_EFFECT, context)
|
||||
@@ -135,14 +148,16 @@ object PokemonEntityMoLangFunctions : AbstractMoLangFunctionHolder<PokemonEntity
|
||||
pokemonEntity.brain.getMemory(CobblemonMemories.ACTIVE_ACTION_EFFECT).orElse(null)
|
||||
if (pokemonActionEffect == context && pokemonEntity.brain.isActive(CobblemonActivities.ACTION_EFFECT)) {
|
||||
pokemonEntity.brain.eraseMemory(CobblemonMemories.ACTIVE_ACTION_EFFECT)
|
||||
//pokemonEntity.actionEffect = null
|
||||
// pokemonEntity.actionEffect = null
|
||||
}
|
||||
}
|
||||
|
||||
return@runActionEffect DoubleValue.ONE
|
||||
}
|
||||
return@runActionEffect DoubleValue.ZERO
|
||||
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
return map
|
||||
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+128
-127
@@ -33,218 +33,214 @@ import com.cobblemon.mod.common.util.getDoubleOrNull
|
||||
import com.cobblemon.mod.common.util.getIntOrNull
|
||||
import com.cobblemon.mod.common.util.server
|
||||
import com.cobblemon.mod.common.util.toProperties
|
||||
import kotlin.random.Random
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import kotlin.random.Random
|
||||
|
||||
object PokemonMoLangFunctions : AbstractMoLangFunctionHolder<Pokemon>() {
|
||||
override fun Pokemon.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val pokemon = this
|
||||
val map = mutableMapOf<String, (MoParams) -> Any>()
|
||||
map["id"] = { StringValue(pokemon.uuid.toString()) }
|
||||
map["nickname"] = { StringValue(pokemon.nickname.toString()) }
|
||||
map["level"] = { DoubleValue(pokemon.level.toDouble()) }
|
||||
map["max_hp"] = { DoubleValue(pokemon.maxHealth.toDouble()) }
|
||||
map["current_hp"] = { DoubleValue(pokemon.currentHealth.toDouble()) }
|
||||
map["friendship"] = { DoubleValue(pokemon.friendship.toDouble()) }
|
||||
map["max_fullness"] = { DoubleValue(pokemon.getMaxFullness().toDouble()) }
|
||||
map["fullness"] = { DoubleValue(pokemon.currentFullness.toDouble()) }
|
||||
map["lose_fullness"] = { params ->
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
functions["id"] = { StringValue(pokemon.uuid.toString()) }
|
||||
functions["nickname"] = { StringValue(pokemon.nickname.toString()) }
|
||||
functions["level"] = { DoubleValue(pokemon.level.toDouble()) }
|
||||
functions["max_hp"] = { DoubleValue(pokemon.maxHealth.toDouble()) }
|
||||
functions["current_hp"] = { DoubleValue(pokemon.currentHealth.toDouble()) }
|
||||
functions["friendship"] = { DoubleValue(pokemon.friendship.toDouble()) }
|
||||
functions["max_fullness"] = { DoubleValue(pokemon.getMaxFullness().toDouble()) }
|
||||
functions["fullness"] = { DoubleValue(pokemon.currentFullness.toDouble()) }
|
||||
functions["lose_fullness"] = { params ->
|
||||
val amount = params.getDouble(0)
|
||||
pokemon.loseFullness(amount.toInt())
|
||||
}
|
||||
map["feed_pokemon"] = { params ->
|
||||
functions["feed_pokemon"] = { params ->
|
||||
val amount = params.getDouble(0)
|
||||
val playSound = params.getBooleanOrNull(1) ?: true
|
||||
pokemon.feedPokemon(amount.toInt(), playSound)
|
||||
}
|
||||
map["behaviour"] = { pokemon.form.behaviour.struct }
|
||||
map["behavior"] = { pokemon.form.behaviour.struct } // Inferior
|
||||
map["pokeball"] = { StringValue(pokemon.caughtBall.toString()) }
|
||||
map["ability"] = { StringValue(pokemon.ability.name) }
|
||||
map["has_learned"] = put@{ params ->
|
||||
functions["behaviour"] = { pokemon.form.behaviour.struct }
|
||||
functions["behavior"] = { pokemon.form.behaviour.struct } // Inferior
|
||||
functions["pokeball"] = { StringValue(pokemon.caughtBall.toString()) }
|
||||
functions["ability"] = { StringValue(pokemon.ability.name) }
|
||||
functions["has_learned"] = hasLearned@{ params ->
|
||||
val moveName = params.getString(0)
|
||||
val move = pokemon.allAccessibleMoves.find { it.name == moveName }
|
||||
if (move != null) {
|
||||
return@put DoubleValue.ONE
|
||||
} else {
|
||||
return@put DoubleValue.ZERO
|
||||
}
|
||||
if (move != null) return@hasLearned DoubleValue.ONE
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
map["moveset"] = {
|
||||
functions["moveset"] = {
|
||||
val struct = QueryStruct(hashMapOf())
|
||||
for ((index, move) in pokemon.moveSet.withIndex()) {
|
||||
struct.addFunction(index.toString()) { move.struct }
|
||||
}
|
||||
struct
|
||||
}
|
||||
map["evs"] = {
|
||||
functions["evs"] = {
|
||||
val struct = QueryStruct(hashMapOf())
|
||||
for (stat in Stats.PERMANENT) {
|
||||
struct.addFunction(stat.showdownId) { DoubleValue(pokemon.evs.getOrDefault(stat).toDouble()) }
|
||||
}
|
||||
struct
|
||||
}
|
||||
map["ivs"] = {
|
||||
functions["ivs"] = {
|
||||
val struct = QueryStruct(hashMapOf())
|
||||
for (stat in Stats.PERMANENT) {
|
||||
struct.addFunction(stat.showdownId) { DoubleValue(pokemon.ivs.getOrDefault(stat).toDouble()) }
|
||||
}
|
||||
struct
|
||||
}
|
||||
map["hyper_trained_ivs"] = {
|
||||
functions["hyper_trained_ivs"] = {
|
||||
val struct = QueryStruct(hashMapOf())
|
||||
for (stat in Stats.PERMANENT) {
|
||||
struct.addFunction(stat.showdownId) { DoubleValue(pokemon.ivs.hyperTrainedIVs[stat] ?: -1.0) }
|
||||
}
|
||||
struct
|
||||
}
|
||||
map["ride_boosts"] = {
|
||||
functions["ride_boosts"] = {
|
||||
val struct = QueryStruct(hashMapOf())
|
||||
for (stat in RidingStat.entries) {
|
||||
struct.addFunction(stat.name.lowercase()) { DoubleValue(pokemon.getRideBoost(stat)) }
|
||||
}
|
||||
struct
|
||||
}
|
||||
map["natdex_number"] = {
|
||||
functions["natdex_number"] = {
|
||||
DoubleValue(pokemon.species.nationalPokedexNumber.toDouble())
|
||||
}
|
||||
map["types"] = {
|
||||
pokemon.form.types.map { it.showdownId }.asArrayValue(::StringValue)
|
||||
functions["types"] = {
|
||||
pokemon.form.types
|
||||
.map { it.showdownId }
|
||||
.asArrayValue(::StringValue)
|
||||
}
|
||||
map["gender_ratio"] = {
|
||||
functions["gender_ratio"] = {
|
||||
DoubleValue(pokemon.form.maleRatio.toDouble())
|
||||
}
|
||||
map["ev_yield"] = {
|
||||
functions["ev_yield"] = {
|
||||
val struct = QueryStruct(hashMapOf())
|
||||
for (stat in Stats.PERMANENT) {
|
||||
struct.addFunction(stat.showdownId) { DoubleValue(pokemon.form.evYield[stat]?.toDouble()) }
|
||||
}
|
||||
struct
|
||||
}
|
||||
map["base_stats"] = {
|
||||
functions["base_stats"] = {
|
||||
val struct = QueryStruct(hashMapOf())
|
||||
for (stat in Stats.PERMANENT) {
|
||||
struct.addFunction(stat.showdownId) { DoubleValue(pokemon.form.baseStats[stat]?.toDouble()) }
|
||||
}
|
||||
struct
|
||||
}
|
||||
map["catch_rate"] = {
|
||||
functions["catch_rate"] = {
|
||||
DoubleValue(pokemon.form.catchRate.toDouble())
|
||||
}
|
||||
map["base_experience_yield"] = {
|
||||
functions["base_experience_yield"] = {
|
||||
DoubleValue(pokemon.form.baseExperienceYield.toDouble())
|
||||
}
|
||||
map["drops"] = {
|
||||
functions["drops"] = {
|
||||
val struct = QueryStruct(hashMapOf())
|
||||
for ((index, drop) in pokemon.form.drops.entries.withIndex()) {
|
||||
for ((index, drop) in pokemon.form.drops.entries
|
||||
.withIndex()) {
|
||||
struct.addFunction(index.toString()) { drop }
|
||||
}
|
||||
struct
|
||||
}
|
||||
map["tm_learnset"] = {
|
||||
functions["tm_learnset"] = {
|
||||
val struct = QueryStruct(hashMapOf())
|
||||
for ((index, move) in pokemon.form.moves.tmMoves.withIndex()) {
|
||||
for ((index, move) in pokemon.form.moves.tmMoves
|
||||
.withIndex()) {
|
||||
struct.addFunction(index.toString()) { move.struct }
|
||||
}
|
||||
struct
|
||||
}
|
||||
map["egg_learnset"] = {
|
||||
functions["egg_learnset"] = {
|
||||
val struct = QueryStruct(hashMapOf())
|
||||
for ((index, move) in pokemon.form.moves.eggMoves.withIndex()) {
|
||||
for ((index, move) in pokemon.form.moves.eggMoves
|
||||
.withIndex()) {
|
||||
struct.addFunction(index.toString()) { move.struct }
|
||||
}
|
||||
struct
|
||||
}
|
||||
map["tutor_learnset"] = {
|
||||
functions["tutor_learnset"] = {
|
||||
val struct = QueryStruct(hashMapOf())
|
||||
for ((index, move) in pokemon.form.moves.tutorMoves.withIndex()) {
|
||||
for ((index, move) in pokemon.form.moves.tutorMoves
|
||||
.withIndex()) {
|
||||
struct.addFunction(index.toString()) { move.struct }
|
||||
}
|
||||
struct
|
||||
}
|
||||
map["level_learnset"] = {
|
||||
functions["level_learnset"] = {
|
||||
val struct = QueryStruct(hashMapOf())
|
||||
for ((index, move) in pokemon.form.moves.levelUpMoves) {
|
||||
struct.addFunction(index.toString()) { move }
|
||||
}
|
||||
struct
|
||||
}
|
||||
map["ability_pool"] = {
|
||||
functions["ability_pool"] = {
|
||||
val struct = QueryStruct(hashMapOf())
|
||||
for ((index, ability) in pokemon.form.abilities.withIndex()) {
|
||||
struct.addFunction(index.toString()) { StringValue(ability.toString()) }
|
||||
}
|
||||
struct
|
||||
}
|
||||
map["egg_groups"] = {
|
||||
functions["egg_groups"] = {
|
||||
val struct = QueryStruct(hashMapOf())
|
||||
for ((index, group) in pokemon.form.eggGroups.withIndex()) {
|
||||
struct.addFunction(index.toString()) { StringValue(group.toString()) }
|
||||
}
|
||||
struct
|
||||
}
|
||||
map["egg_cycles"] = {
|
||||
functions["egg_cycles"] = {
|
||||
DoubleValue(pokemon.species.eggCycles.toDouble())
|
||||
}
|
||||
map["labels"] = {
|
||||
functions["labels"] = {
|
||||
val struct = QueryStruct(hashMapOf())
|
||||
for ((index, label) in pokemon.form.labels.withIndex()) {
|
||||
struct.addFunction(index.toString()) { StringValue(label) }
|
||||
}
|
||||
struct
|
||||
}
|
||||
map["aspects"] = {
|
||||
functions["aspects"] = {
|
||||
val aspects = pokemon.aspects
|
||||
aspects.asArrayValue { StringValue(it) }
|
||||
}
|
||||
map["form_aspects"] = {
|
||||
functions["form_aspects"] = {
|
||||
val aspects = pokemon.form.aspects
|
||||
aspects.asArrayValue { StringValue(it) }
|
||||
}
|
||||
map["form_name"] = {
|
||||
functions["form_name"] = {
|
||||
StringValue(pokemon.form.name)
|
||||
}
|
||||
// Yes, this is the lazy call for a single hardcoded pre-evolution.
|
||||
// Lol. Lmao, even.
|
||||
// TO-DO: Subscribe to [PokemonSpecies.observable].
|
||||
// Gito: surely this is just a typo, right? not touching the function name just in case
|
||||
map["prevolution"] = preEvolution@{
|
||||
val preEvolution = pokemon.species.preEvolution ?: return@preEvolution DoubleValue.ZERO
|
||||
return@preEvolution preEvolution
|
||||
}
|
||||
map["nature"] = { StringValue(pokemon.nature.toString()) }
|
||||
map["is_wild"] = { DoubleValue(pokemon.entity?.let { it.ownerUUID == null } == true) }
|
||||
map["is_shiny"] = { DoubleValue(pokemon.shiny) }
|
||||
map["is_in_party"] = { DoubleValue(pokemon.storeCoordinates.get()?.store is PartyStore) }
|
||||
map["species"] = { pokemon.species.struct }
|
||||
map["form"] = { StringValue(pokemon.form.name) }
|
||||
map["weight"] = { DoubleValue(pokemon.species.weight.toDouble()) }
|
||||
map["matches"] = { params -> DoubleValue(params.getString(0).toProperties().matches(pokemon)) }
|
||||
map["apply"] = { params ->
|
||||
functions["pre_evolution"] = { pokemon.species.preEvolution ?: DoubleValue.ZERO }
|
||||
functions["nature"] = { StringValue(pokemon.nature.toString()) }
|
||||
functions["is_wild"] = { DoubleValue(pokemon.entity?.let { it.ownerUUID == null } == true) }
|
||||
functions["is_shiny"] = { DoubleValue(pokemon.shiny) }
|
||||
functions["is_in_party"] = { DoubleValue(pokemon.storeCoordinates.get()?.store is PartyStore) }
|
||||
functions["species"] = { pokemon.species.struct }
|
||||
functions["form"] = { StringValue(pokemon.form.name) }
|
||||
functions["weight"] = { DoubleValue(pokemon.species.weight.toDouble()) }
|
||||
functions["matches"] = { params -> DoubleValue(params.getString(0).toProperties().matches(pokemon)) }
|
||||
functions["apply"] = { params ->
|
||||
params.getString(0).toProperties().apply(pokemon)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["owner"] = { pokemon.getOwnerPlayer()?.asMoLangValue() ?: DoubleValue.ZERO }
|
||||
map["held_item"] = { pokemon.heldItem().asMoLangValue(server()!!.registryAccess()) }
|
||||
map["remove_held_item"] = { _ ->
|
||||
pokemon.removeHeldItem()
|
||||
}
|
||||
map["add_aspects"] = { params ->
|
||||
functions["owner"] = { pokemon.getOwnerPlayer()?.asMoLangValue() ?: DoubleValue.ZERO }
|
||||
functions["held_item"] = { pokemon.heldItem().asMoLangValue(server()!!.registryAccess()) }
|
||||
functions["remove_held_item"] = { pokemon.removeHeldItem() }
|
||||
functions["add_aspects"] = { params ->
|
||||
for (aspect in params.params) pokemon.forcedAspects += aspect.asString()
|
||||
pokemon.updateAspects()
|
||||
}
|
||||
map["remove_aspects"] = { params ->
|
||||
functions["remove_aspects"] = { params ->
|
||||
for (aspect in params.params) pokemon.forcedAspects -= aspect.asString()
|
||||
pokemon.updateAspects()
|
||||
}
|
||||
map["cosmetic_item"] = {
|
||||
functions["cosmetic_item"] = {
|
||||
pokemon.cosmeticItem().asMoLangValue(server()!!.registryAccess())
|
||||
}
|
||||
map["remove_cosmetic_item"] = { _ ->
|
||||
pokemon.removeCosmeticItem()
|
||||
}
|
||||
map["marks"] = { _ -> pokemon.marks.asArrayValue { StringValue(it.identifier.toString()) } }
|
||||
map["has_mark"] = { params ->
|
||||
functions["remove_cosmetic_item"] = { pokemon.removeCosmeticItem() }
|
||||
functions["marks"] = { pokemon.marks.asArrayValue { StringValue(it.identifier.toString()) } }
|
||||
functions["has_mark"] = { params ->
|
||||
var hasMark = false
|
||||
val identifier = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val mark = Marks.getByIdentifier(identifier)
|
||||
@@ -254,7 +250,7 @@ object PokemonMoLangFunctions : AbstractMoLangFunctionHolder<Pokemon>() {
|
||||
|
||||
DoubleValue(hasMark)
|
||||
}
|
||||
map["remove_marks"] = { params ->
|
||||
functions["remove_marks"] = { params ->
|
||||
var removedMark = false
|
||||
for (param in params.params) {
|
||||
val identifier = param.asString().asIdentifierDefaultingNamespace()
|
||||
@@ -267,7 +263,7 @@ object PokemonMoLangFunctions : AbstractMoLangFunctionHolder<Pokemon>() {
|
||||
|
||||
DoubleValue(removedMark)
|
||||
}
|
||||
map["add_marks"] = { params ->
|
||||
functions["add_marks"] = { params ->
|
||||
var appliedMark = false
|
||||
for (param in params.params) {
|
||||
val identifier = param.asString().asIdentifierDefaultingNamespace()
|
||||
@@ -280,7 +276,7 @@ object PokemonMoLangFunctions : AbstractMoLangFunctionHolder<Pokemon>() {
|
||||
|
||||
DoubleValue(appliedMark)
|
||||
}
|
||||
map["add_marks_with_chance"] = { params ->
|
||||
functions["add_marks_with_chance"] = { params ->
|
||||
var appliedMark = false
|
||||
for (param in params.params) {
|
||||
val identifier = param.asString().asIdentifierDefaultingNamespace()
|
||||
@@ -298,17 +294,15 @@ object PokemonMoLangFunctions : AbstractMoLangFunctionHolder<Pokemon>() {
|
||||
|
||||
DoubleValue(appliedMark)
|
||||
}
|
||||
map["add_potential_marks"] = { params ->
|
||||
functions["add_potential_marks"] = { params ->
|
||||
for (param in params.params) {
|
||||
val identifier = param.asString().asIdentifierDefaultingNamespace()
|
||||
val mark = Marks.getByIdentifier(identifier)
|
||||
if (mark != null) pokemon.addPotentialMark(mark)
|
||||
}
|
||||
}
|
||||
map["apply_potential_marks"] = put@{
|
||||
return@put DoubleValue(pokemon.applyPotentialMarks())
|
||||
}
|
||||
map["hyper_train_iv"] = hyperTrainIv@{ params ->
|
||||
functions["apply_potential_marks"] = { DoubleValue(pokemon.applyPotentialMarks()) }
|
||||
functions["hyper_train_iv"] = hyperTrainIv@{ params ->
|
||||
val statId = params.getString(0)
|
||||
val stat = Stats.getStat(statId)
|
||||
val value = params.getIntOrNull(1) ?: IVs.MAX_VALUE
|
||||
@@ -321,12 +315,12 @@ object PokemonMoLangFunctions : AbstractMoLangFunctionHolder<Pokemon>() {
|
||||
return@hyperTrainIv DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
map["add_exp"] = { params ->
|
||||
functions["add_exp"] = { params ->
|
||||
val exp = params.getDouble(0).toInt()
|
||||
pokemon.addExperience(SidemodExperienceSource("molang"), exp)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["set_iv"] = setIv@{ params ->
|
||||
functions["set_iv"] = setIv@{ params ->
|
||||
val statId = params.getString(0)
|
||||
val stat = Stats.getStat(statId)
|
||||
val value = params.getIntOrNull(1)?.coerceIn(0, IVs.MAX_VALUE) ?: IVs.MAX_VALUE
|
||||
@@ -338,7 +332,7 @@ object PokemonMoLangFunctions : AbstractMoLangFunctionHolder<Pokemon>() {
|
||||
return@setIv DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
map["set_ev"] = setEv@{ params ->
|
||||
functions["set_ev"] = setEv@{ params ->
|
||||
val statId = params.getString(0)
|
||||
val stat = Stats.getStat(statId)
|
||||
val value = (params.getIntOrNull(1) ?: 0).coerceIn(0, 255)
|
||||
@@ -350,49 +344,54 @@ object PokemonMoLangFunctions : AbstractMoLangFunctionHolder<Pokemon>() {
|
||||
return@setEv DoubleValue.ZERO
|
||||
}
|
||||
}
|
||||
map["set_ride_boost"] = setRideBoost@{ params ->
|
||||
functions["set_ride_boost"] = setRideBoost@{ params ->
|
||||
val statName = params.getString(0).uppercase()
|
||||
val stat = RidingStat.entries.find { it.name.equals(statName, ignoreCase = true) }
|
||||
?: return@setRideBoost DoubleValue.ZERO
|
||||
val stat =
|
||||
RidingStat.entries.find { it.name.equals(statName, ignoreCase = true) }
|
||||
?: return@setRideBoost DoubleValue.ZERO
|
||||
val value = params.getDoubleOrNull(1)?.toFloat() ?: return@setRideBoost DoubleValue.ZERO
|
||||
|
||||
pokemon.setRideBoost(stat, value)
|
||||
return@setRideBoost DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["add_ride_boost"] = addRideBoost@{ params ->
|
||||
functions["add_ride_boost"] = addRideBoost@{ params ->
|
||||
val statName = params.getString(0).uppercase()
|
||||
val stat = RidingStat.entries.find { it.name.equals(statName, ignoreCase = true) }
|
||||
?: return@addRideBoost DoubleValue.ZERO
|
||||
val stat =
|
||||
RidingStat.entries.find { it.name.equals(statName, ignoreCase = true) }
|
||||
?: return@addRideBoost DoubleValue.ZERO
|
||||
val value = params.getDoubleOrNull(1)?.toFloat() ?: return@addRideBoost DoubleValue.ZERO
|
||||
|
||||
return@addRideBoost DoubleValue(if (pokemon.addRideBoost(stat, value)) 1.0 else 0.0)
|
||||
DoubleValue(if (pokemon.addRideBoost(stat, value)) 1.0 else 0.0)
|
||||
}
|
||||
map["initialize_moveset"] = put@{ params ->
|
||||
functions["initialize_moveset"] = initializeMoveset@{ params ->
|
||||
val param = params.get<MoValue>(0) ?: StringValue(pokemon.form.defaultWildMovesetBuilder.toString())
|
||||
if (param is DoubleValue) {
|
||||
pokemon.initializeMoveset(param == DoubleValue.ONE)
|
||||
} else {
|
||||
val movesetBuilderId = ResourceLocation.parse(param.asString())
|
||||
val movesetBuilder = CobblemonMovesetBuilders.movesetBuilders[movesetBuilderId]
|
||||
?: run {
|
||||
Cobblemon.LOGGER.error("Tried initializing moveset from moveset builder ${param.asString()} but it does not exist.")
|
||||
return@put DoubleValue.ZERO
|
||||
}
|
||||
val movesetBuilder =
|
||||
CobblemonMovesetBuilders.movesetBuilders[movesetBuilderId]
|
||||
?: run {
|
||||
Cobblemon.LOGGER.error(
|
||||
"Tried initializing moveset from moveset builder ${param.asString()} but it does not exist.",
|
||||
)
|
||||
return@initializeMoveset DoubleValue.ZERO
|
||||
}
|
||||
pokemon.initializeMovesetFrom(movesetBuilder)
|
||||
}
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["validate_moveset"] = { params ->
|
||||
functions["validate_moveset"] = { params ->
|
||||
val includeLegacy = params.getBooleanOrNull(0) ?: true
|
||||
pokemon.validateMoveset(includeLegacy)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["teach_learnable_moves"] = { params ->
|
||||
functions["teach_learnable_moves"] = { params ->
|
||||
val includeLegacy = params.getBooleanOrNull(0) ?: true
|
||||
pokemon.teachLearnableMoves(includeLegacy)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["teach_move"] = teachMove@{ params ->
|
||||
functions["teach_move"] = teachMove@{ params ->
|
||||
val moveName = params.getString(0)
|
||||
val moveTemplate = Moves.getByName(moveName) ?: return@teachMove DoubleValue.ZERO
|
||||
val bypass = params.getBooleanOrNull(1) ?: false
|
||||
@@ -402,8 +401,9 @@ object PokemonMoLangFunctions : AbstractMoLangFunctionHolder<Pokemon>() {
|
||||
return@teachMove DoubleValue.ZERO
|
||||
}
|
||||
|
||||
val alreadyKnows = pokemon.moveSet.getMoves().any { it.template == moveTemplate } ||
|
||||
pokemon.benchedMoves.any { it.moveTemplate == moveTemplate }
|
||||
val alreadyKnows =
|
||||
pokemon.moveSet.getMoves().any { it.template == moveTemplate } ||
|
||||
pokemon.benchedMoves.any { it.moveTemplate == moveTemplate }
|
||||
if (alreadyKnows) {
|
||||
return@teachMove DoubleValue.ZERO
|
||||
}
|
||||
@@ -416,42 +416,43 @@ object PokemonMoLangFunctions : AbstractMoLangFunctionHolder<Pokemon>() {
|
||||
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["can_learn_move"] = canLearnMove@{ params ->
|
||||
functions["can_learn_move"] = canLearnMove@{ params ->
|
||||
val moveName = params.getString(0)
|
||||
val moveTemplate = Moves.getByName(moveName) ?: return@canLearnMove DoubleValue.ZERO
|
||||
val includeLegacy = params.getBooleanOrNull(1) ?: true
|
||||
|
||||
val canLearn = if (includeLegacy) {
|
||||
LearnsetQuery.ANY.canLearn(moveTemplate, pokemon.form.moves)
|
||||
} else {
|
||||
LearnsetQuery.LEGAL.canLearn(moveTemplate, pokemon.form.moves)
|
||||
}
|
||||
return@canLearnMove DoubleValue(if (canLearn) 1.0 else 0.0)
|
||||
val canLearn =
|
||||
if (includeLegacy) {
|
||||
LearnsetQuery.ANY.canLearn(moveTemplate, pokemon.form.moves)
|
||||
} else {
|
||||
LearnsetQuery.LEGAL.canLearn(moveTemplate, pokemon.form.moves)
|
||||
}
|
||||
|
||||
DoubleValue(if (canLearn) 1.0 else 0.0)
|
||||
}
|
||||
map["unlearn_move"] = unlearnMove@{ params ->
|
||||
functions["unlearn_move"] = unlearnMove@{ params ->
|
||||
val moveName = params.getString(0)
|
||||
val moveTemplate = Moves.getByName(moveName)
|
||||
if (moveTemplate != null) {
|
||||
pokemon.unlearnMove(moveTemplate)
|
||||
return@unlearnMove DoubleValue.ONE
|
||||
} else {
|
||||
return@unlearnMove DoubleValue.ZERO
|
||||
}
|
||||
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
map["can_evolve"] = { _ ->
|
||||
DoubleValue(pokemon.evolutions.any())
|
||||
}
|
||||
map["force_evolve"] = forceEvolve@{ params ->
|
||||
functions["can_evolve"] = { DoubleValue(pokemon.evolutions.any()) }
|
||||
functions["force_evolve"] = forceEvolve@{ params ->
|
||||
val idx = params.getInt(0)
|
||||
val evolution = if (idx >= 0) pokemon.evolutions.elementAtOrNull(idx) else return@forceEvolve DoubleValue.ZERO
|
||||
val evolution =
|
||||
if (idx >= 0) pokemon.evolutions.elementAtOrNull(idx) else return@forceEvolve DoubleValue.ZERO
|
||||
evolution?.forceEvolve(pokemon)
|
||||
StringValue(evolution.toString())
|
||||
}
|
||||
|
||||
map["entity"] = { pokemon.entity?.asMoLangValue() ?: DoubleValue.ZERO }
|
||||
map["is_alpha"] = { DoubleValue(pokemon.isAlpha) }
|
||||
map["size_category"] = { _ -> StringValue(pokemon.getSizeCategory().name) }
|
||||
functions["entity"] = { pokemon.entity?.asMoLangValue() ?: DoubleValue.ZERO }
|
||||
functions["is_alpha"] = { DoubleValue(pokemon.isAlpha) }
|
||||
functions["size_category"] = { StringValue(pokemon.getSizeCategory().name) }
|
||||
|
||||
return map
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+20
-22
@@ -20,52 +20,50 @@ import com.cobblemon.mod.common.util.getStringOrNull
|
||||
object PokemonPropertiesMoLangFunctions : AbstractMoLangFunctionHolder<PokemonProperties>() {
|
||||
override fun PokemonProperties.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val props = this
|
||||
val map = mutableMapOf<String, (MoParams) -> Any>()
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
map["level"] = { DoubleValue(props.level?.toDouble() ?: 0) }
|
||||
map["set_level"] = { params ->
|
||||
functions["level"] = { DoubleValue(props.level?.toDouble() ?: 0) }
|
||||
functions["set_level"] = { params ->
|
||||
props.level = params.getIntOrNull(0)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["shiny"] = { DoubleValue(props.shiny) }
|
||||
map["set_shiny"] = { params ->
|
||||
functions["shiny"] = { DoubleValue(props.shiny) }
|
||||
functions["set_shiny"] = { params ->
|
||||
props.shiny = params.getBooleanOrNull(0)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["species"] = { props.species?.let { StringValue(it) } ?: DoubleValue.ZERO }
|
||||
map["set_species"] = { params ->
|
||||
functions["species"] = { props.species?.let { StringValue(it) } ?: DoubleValue.ZERO }
|
||||
functions["set_species"] = { params ->
|
||||
props.species = params.getStringOrNull(0)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["gender"] = { props.gender?.let { StringValue(it.name) } ?: DoubleValue.ZERO }
|
||||
map["set_gender"] = { params ->
|
||||
functions["gender"] = { props.gender?.let { StringValue(it.name) } ?: DoubleValue.ZERO }
|
||||
functions["set_gender"] = { params ->
|
||||
props.gender = params.getStringOrNull(0)?.let { Gender.valueOf(it) }
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["form"] = { props.form?.let { StringValue(it) } ?: DoubleValue.ZERO }
|
||||
map["ivs"] = ivs@{
|
||||
functions["form"] = { props.form?.let { StringValue(it) } ?: DoubleValue.ZERO }
|
||||
functions["ivs"] = ivs@{
|
||||
val ivs = props.ivs ?: return@ivs DoubleValue.ZERO
|
||||
|
||||
return@ivs ivs.struct
|
||||
ivs.struct
|
||||
}
|
||||
map["evs"] = evs@{
|
||||
functions["evs"] = evs@{
|
||||
val evs = props.evs ?: return@evs DoubleValue.ZERO
|
||||
|
||||
return@evs evs.struct
|
||||
evs.struct
|
||||
}
|
||||
map["friendship"] = { DoubleValue(props.friendship?.toDouble() ?: DoubleValue.ZERO) }
|
||||
map["set_friendship"] = { params ->
|
||||
functions["friendship"] = { DoubleValue(props.friendship?.toDouble() ?: DoubleValue.ZERO) }
|
||||
functions["set_friendship"] = { params ->
|
||||
props.friendship = params.getIntOrNull(0)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["create"] = {
|
||||
val pokemon = props.create()
|
||||
pokemon.struct
|
||||
}
|
||||
map["to_string"] = { params ->
|
||||
functions["create"] = { (props.create()).struct }
|
||||
functions["to_string"] = { params ->
|
||||
val separator = params.getStringOrNull(0) ?: " "
|
||||
StringValue(props.asString(separator = separator))
|
||||
}
|
||||
return map
|
||||
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+28
-27
@@ -22,83 +22,84 @@ import com.cobblemon.mod.common.util.asUUID
|
||||
import com.cobblemon.mod.common.util.getPlayer
|
||||
import com.cobblemon.mod.common.util.toProperties
|
||||
|
||||
object PokemonStoreMoLangFunctions: AbstractMoLangFunctionHolder<PokemonStore<*>>() {
|
||||
object PokemonStoreMoLangFunctions : AbstractMoLangFunctionHolder<PokemonStore<*>>() {
|
||||
override fun PokemonStore<*>.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val store = this
|
||||
val map = mutableMapOf<String, (MoParams) -> Any>()
|
||||
map["uuid"] = { StringValue(store.uuid.toString()) }
|
||||
map["add"] = { params ->
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
functions["uuid"] = { StringValue(store.uuid.toString()) }
|
||||
functions["add"] = { params ->
|
||||
val pokemon = params.get<ObjectValue<Pokemon>>(0)
|
||||
DoubleValue(store.add(pokemon.obj))
|
||||
}
|
||||
map["add_by_properties"] = { params ->
|
||||
functions["add_by_properties"] = { params ->
|
||||
val props = params.getString(0).toProperties()
|
||||
val player = (store as? PlayerPartyStore)?.playerUUID?.getPlayer() // Only really know for sure when it's a player party store
|
||||
val player =
|
||||
(store as? PlayerPartyStore)?.playerUUID?.getPlayer() // Only really know for sure when it's a player party store
|
||||
val pokemon = props.create(player = player)
|
||||
DoubleValue(store.add(pokemon))
|
||||
}
|
||||
map["find_by_properties"] = { params ->
|
||||
functions["find_by_properties"] = { params ->
|
||||
val props = params.getString(0).toProperties()
|
||||
val pokemon = store.find { props.matches(it) }
|
||||
pokemon?.asStruct() ?: DoubleValue.ZERO
|
||||
}
|
||||
map["find_all_by_properties"] = { params ->
|
||||
functions["find_all_by_properties"] = { params ->
|
||||
val props = params.getString(0).toProperties()
|
||||
val pokemon = store.filter { props.matches(it) }
|
||||
ArrayStruct(pokemon.mapIndexed { index, value -> "$index" to value.asStruct() }.toMap())
|
||||
}
|
||||
map["find_by_id"] = { params ->
|
||||
functions["find_by_id"] = { params ->
|
||||
val id = params.getString(0).asUUID
|
||||
val pokemon = store.find { it.uuid == id }
|
||||
pokemon?.asStruct() ?: DoubleValue.ZERO
|
||||
}
|
||||
map["remove_by_id"] = removeById@{ params ->
|
||||
functions["remove_by_id"] = removeById@{ params ->
|
||||
val id = params.getString(0).asUUID
|
||||
val pokemon = store.find { it.uuid == id } ?: return@removeById DoubleValue.ZERO
|
||||
return@removeById DoubleValue(store.remove(pokemon))
|
||||
DoubleValue(store.remove(pokemon))
|
||||
}
|
||||
map["average_level"] = averageLevel@{ _ ->
|
||||
functions["average_level"] = averageLevel@{
|
||||
var numberOfPokemon = 0
|
||||
var totalLevel = 0
|
||||
for (pokemon in store) {
|
||||
totalLevel += pokemon.level
|
||||
numberOfPokemon++
|
||||
}
|
||||
if (numberOfPokemon == 0) {
|
||||
return@averageLevel DoubleValue.ZERO
|
||||
}
|
||||
return@averageLevel DoubleValue(totalLevel.toDouble() / numberOfPokemon)
|
||||
|
||||
if (numberOfPokemon == 0) return@averageLevel DoubleValue.ZERO
|
||||
|
||||
DoubleValue(totalLevel.toDouble() / numberOfPokemon)
|
||||
}
|
||||
map["count"] = { _ -> DoubleValue(store.count()) }
|
||||
map["count_by_properties"] = { params ->
|
||||
functions["count"] = { DoubleValue(store.count()) }
|
||||
functions["count_by_properties"] = { params ->
|
||||
val props = params.getString(0).toProperties()
|
||||
DoubleValue(store.count { props.matches(it) })
|
||||
}
|
||||
map["highest_level"] = {
|
||||
functions["highest_level"] = {
|
||||
val highest = store.maxOfOrNull { it.level } ?: 0
|
||||
DoubleValue(highest)
|
||||
}
|
||||
map["lowest_level"] = {
|
||||
functions["lowest_level"] = {
|
||||
val lowest = store.minOfOrNull { it.level } ?: 0
|
||||
DoubleValue(lowest)
|
||||
}
|
||||
map["heal"] = {
|
||||
functions["heal"] = {
|
||||
for (pokemon in store) {
|
||||
pokemon.heal()
|
||||
}
|
||||
DoubleValue.ONE
|
||||
}
|
||||
map["healing_remainder_percent"] = { _ ->
|
||||
functions["healing_remainder_percent"] = {
|
||||
var totalPercent = 0.0f
|
||||
for (pokemon in store) {
|
||||
totalPercent += (1.0f - (pokemon.currentHealth.toFloat() / pokemon.maxHealth))
|
||||
}
|
||||
DoubleValue(totalPercent)
|
||||
}
|
||||
map["has_usable_pokemon"] = { _ -> DoubleValue(store.any { !it.isFainted() }) }
|
||||
map["pokemon"] = {
|
||||
store.map { it.asStruct() }.asArrayValue()
|
||||
}
|
||||
return map
|
||||
functions["has_usable_pokemon"] = { DoubleValue(store.any { !it.isFainted() }) }
|
||||
functions["pokemon"] = { store.map { it.asStruct() }.asArrayValue() }
|
||||
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+21
-20
@@ -25,62 +25,63 @@ import java.util.*
|
||||
object ServerMoLangFunctions : AbstractMoLangFunctionHolder<MinecraftServer>() {
|
||||
override fun MinecraftServer.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val server = this
|
||||
val map = mutableMapOf<String, (MoParams) -> Any>()
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
map["get_world"] = getWorld@{ params ->
|
||||
val world = server.getLevel(
|
||||
ResourceKey.create(
|
||||
Registries.DIMENSION,
|
||||
params.getString(0).asIdentifierDefaultingNamespace(namespace = "minecraft")
|
||||
)
|
||||
) ?: return@getWorld DoubleValue.ZERO
|
||||
functions["get_world"] = getWorld@{ params ->
|
||||
val world =
|
||||
server.getLevel(
|
||||
ResourceKey.create(
|
||||
Registries.DIMENSION,
|
||||
params.getString(0).asIdentifierDefaultingNamespace(namespace = "minecraft"),
|
||||
),
|
||||
) ?: return@getWorld DoubleValue.ZERO
|
||||
|
||||
return@getWorld world
|
||||
world
|
||||
.registryAccess()
|
||||
.registryOrThrow(Registries.DIMENSION)
|
||||
.wrapAsHolder(world)
|
||||
.asWorldMoLangValue()
|
||||
}
|
||||
|
||||
map["broadcast"] = { params ->
|
||||
functions["broadcast"] = { params ->
|
||||
val message = params.getString(0)
|
||||
server.playerList.broadcastSystemMessage(message.text(), params.getBooleanOrNull(1) == true)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
|
||||
map["get_player_by_uuid"] = getPlayerByUuid@{ params ->
|
||||
functions["get_player_by_uuid"] = getPlayerByUuid@{ params ->
|
||||
val uuid = UUID.fromString(params.getString(0))
|
||||
val player = server.playerList.getPlayer(uuid) ?: return@getPlayerByUuid DoubleValue.ZERO
|
||||
return@getPlayerByUuid player.asMoLangValue()
|
||||
player.asMoLangValue()
|
||||
}
|
||||
|
||||
map["get_player_by_username"] = getPlayerByUsername@{ params ->
|
||||
functions["get_player_by_username"] = getPlayerByUsername@{ params ->
|
||||
val username = params.getString(0)
|
||||
val player = server.playerList.getPlayerByName(username) ?: return@getPlayerByUsername DoubleValue.ZERO
|
||||
return@getPlayerByUsername player.asMoLangValue()
|
||||
player.asMoLangValue()
|
||||
}
|
||||
|
||||
map["data"] = { params ->
|
||||
functions["data"] = { params ->
|
||||
Cobblemon.molangData.load(
|
||||
UUID(0L, 0L),
|
||||
params.getStringOrNull(0)
|
||||
params.getStringOrNull(0),
|
||||
)
|
||||
}
|
||||
|
||||
map["save_data"] = { params ->
|
||||
functions["save_data"] = { params ->
|
||||
Cobblemon.molangData.save(
|
||||
UUID(0L, 0L),
|
||||
params.getStringOrNull(index = 0)
|
||||
params.getStringOrNull(index = 0),
|
||||
)
|
||||
DoubleValue.ONE
|
||||
}
|
||||
|
||||
// Maybe later...
|
||||
// map.put("stop") { params ->
|
||||
// functions.put("stop") { params ->
|
||||
// Cobblemon.LOGGER.warn("Server is being stopped from a MoLang script.")
|
||||
// server.stopServer()
|
||||
// }
|
||||
|
||||
return map
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+28
-21
@@ -20,27 +20,34 @@ import net.minecraft.server.level.ServerPlayer
|
||||
object SpawnablePositionMoLangFunctions : AbstractMoLangFunctionHolder<SpawnablePosition>() {
|
||||
override fun SpawnablePosition.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val spawningContext = this
|
||||
val map = mutableMapOf<String, (MoParams) -> Any>()
|
||||
val worldValue = spawningContext.world.registryAccess().registryOrThrow(Registries.DIMENSION)
|
||||
.wrapAsHolder(spawningContext.world).asWorldMoLangValue()
|
||||
val biomeValue = spawningContext.biomeHolder.asBiomeMoLangValue()
|
||||
map["biome"] = { _ -> biomeValue }
|
||||
map["world"] = { _ -> worldValue }
|
||||
map["light"] = { _ -> DoubleValue(spawningContext.light.toDouble()) }
|
||||
map["x"] = { _ -> DoubleValue(spawningContext.position.x.toDouble()) }
|
||||
map["y"] = { _ -> DoubleValue(spawningContext.position.y.toDouble()) }
|
||||
map["z"] = { _ -> DoubleValue(spawningContext.position.z.toDouble()) }
|
||||
map["moon_phase"] = { _ -> DoubleValue(spawningContext.moonPhase.toDouble()) }
|
||||
map["can_see_sky"] = { _ -> DoubleValue(spawningContext.canSeeSky) }
|
||||
map["sky_light"] = { _ -> DoubleValue(spawningContext.skyLight.toDouble()) }
|
||||
map["player"] = put@{ _ ->
|
||||
val causeEntity = spawningContext.cause.entity ?: return@put DoubleValue.ZERO
|
||||
if (causeEntity is ServerPlayer) {
|
||||
return@put causeEntity.asMoLangValue()
|
||||
} else {
|
||||
return@put DoubleValue.ZERO
|
||||
}
|
||||
val worldValue =
|
||||
spawningContext
|
||||
.world
|
||||
.registryAccess()
|
||||
.registryOrThrow(Registries.DIMENSION)
|
||||
.wrapAsHolder(spawningContext.world)
|
||||
.asWorldMoLangValue()
|
||||
val biomeValue =
|
||||
spawningContext
|
||||
.biomeHolder
|
||||
.asBiomeMoLangValue()
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
functions["biome"] = { biomeValue }
|
||||
functions["world"] = { worldValue }
|
||||
functions["light"] = { DoubleValue(spawningContext.light.toDouble()) }
|
||||
functions["x"] = { DoubleValue(spawningContext.position.x.toDouble()) }
|
||||
functions["y"] = { DoubleValue(spawningContext.position.y.toDouble()) }
|
||||
functions["z"] = { DoubleValue(spawningContext.position.z.toDouble()) }
|
||||
functions["moon_phase"] = { DoubleValue(spawningContext.moonPhase.toDouble()) }
|
||||
functions["can_see_sky"] = { DoubleValue(spawningContext.canSeeSky) }
|
||||
functions["sky_light"] = { DoubleValue(spawningContext.skyLight.toDouble()) }
|
||||
functions["player"] = player@{
|
||||
val causeEntity = spawningContext.cause.entity ?: return@player DoubleValue.ZERO
|
||||
if (causeEntity is ServerPlayer) return@player causeEntity.asMoLangValue()
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
return map
|
||||
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+17
-17
@@ -17,23 +17,23 @@ import com.cobblemon.mod.common.util.asArrayValue
|
||||
object SpeciesMoLangFunctions : AbstractMoLangFunctionHolder<Species>() {
|
||||
override fun Species.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
val species = this
|
||||
val map = mutableMapOf<String, (MoParams) -> Any>(
|
||||
"identifier" to { StringValue(species.resourceIdentifier.toString()) },
|
||||
"name" to { StringValue(species.name) },
|
||||
"primary_type" to { StringValue(species.primaryType.showdownId) },
|
||||
"secondary_type" to { StringValue(species.secondaryType?.showdownId ?: "null") },
|
||||
"experience_group" to { StringValue(species.experienceGroup.name) },
|
||||
"height" to { DoubleValue(species.height) },
|
||||
"weight" to { DoubleValue(species.weight) },
|
||||
"base_scale" to { DoubleValue(species.baseScale) },
|
||||
"hitbox_width" to { DoubleValue(species.hitbox.width) },
|
||||
"hitbox_height" to { DoubleValue(species.hitbox.height) },
|
||||
"hitbox_fixed" to { DoubleValue(species.hitbox.fixed) },
|
||||
"catch_rate" to { DoubleValue(species.catchRate) },
|
||||
"labels" to { species.labels.asArrayValue { StringValue(it) } },
|
||||
"has_label" to { params -> DoubleValue(species.labels.contains(params.getString(0))) }
|
||||
)
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
return map
|
||||
functions["identifier"] = { StringValue(species.resourceIdentifier.toString()) }
|
||||
functions["name"] = { StringValue(species.name) }
|
||||
functions["primary_type"] = { StringValue(species.primaryType.showdownId) }
|
||||
functions["secondary_type"] = { StringValue(species.secondaryType?.showdownId ?: "null") }
|
||||
functions["experience_group"] = { StringValue(species.experienceGroup.name) }
|
||||
functions["height"] = { DoubleValue(species.height) }
|
||||
functions["weight"] = { DoubleValue(species.weight) }
|
||||
functions["base_scale"] = { DoubleValue(species.baseScale) }
|
||||
functions["hitbox_width"] = { DoubleValue(species.hitbox.width) }
|
||||
functions["hitbox_height"] = { DoubleValue(species.hitbox.height) }
|
||||
functions["hitbox_fixed"] = { DoubleValue(species.hitbox.fixed) }
|
||||
functions["catch_rate"] = { DoubleValue(species.catchRate) }
|
||||
functions["labels"] = { species.labels.asArrayValue { StringValue(it) } }
|
||||
functions["has_label"] = { params -> DoubleValue(species.labels.contains(params.getString(0))) }
|
||||
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+96
-87
@@ -24,7 +24,6 @@ import com.cobblemon.mod.common.entity.npc.NPCEntity
|
||||
import com.cobblemon.mod.common.net.messages.client.effect.SpawnSnowstormParticlePacket
|
||||
import com.cobblemon.mod.common.net.messages.client.sound.UnvalidatedPlaySoundS2CPacket
|
||||
import com.cobblemon.mod.common.util.*
|
||||
import java.util.UUID
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.Holder
|
||||
import net.minecraft.core.registries.Registries
|
||||
@@ -46,85 +45,89 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams
|
||||
import net.minecraft.world.phys.AABB
|
||||
import net.minecraft.world.phys.Vec3
|
||||
import java.util.UUID
|
||||
|
||||
object WorldMoLangFunctions : AbstractMoLangFunctionHolder<Holder<Level>>() {
|
||||
override fun Holder<Level>.moLangFunctions(): MutableMap<String, (MoParams) -> Any> {
|
||||
|
||||
val world = this.value()
|
||||
val map = mutableMapOf<String, (MoParams) -> Any>(
|
||||
)
|
||||
val functions = hashMapOf<String, (MoParams) -> Any>()
|
||||
|
||||
map["is_time_of_day"] = put@{ params ->
|
||||
functions["is_time_of_day"] = isTimeOfDay@{ params ->
|
||||
val timeOfDay =
|
||||
TimeRange.timeRanges[params.getString(0).lowercase()]
|
||||
?: return@isTimeOfDay DoubleValue.ZERO
|
||||
val time = world.dayTime % 24000
|
||||
|
||||
val timeOfDay = TimeRange.timeRanges[params.getString(0).lowercase()]
|
||||
?: return@put DoubleValue.ZERO
|
||||
val time = world.dayTime % 24000
|
||||
return@put DoubleValue(timeOfDay.contains(time.toInt()))
|
||||
DoubleValue(timeOfDay.contains(time.toInt()))
|
||||
}
|
||||
map["game_time"] = { _ -> DoubleValue(world.gameTime.toDouble()) }
|
||||
map["time_of_day"] = put@{
|
||||
val time = world.dayTime % 24000
|
||||
return@put DoubleValue(time.toDouble())
|
||||
}
|
||||
map["server"] = { _ -> server()?.asMoLangValue() ?: DoubleValue.ZERO }
|
||||
map["is_raining_at"] = put@{ params ->
|
||||
functions["game_time"] = { DoubleValue(world.gameTime.toDouble()) }
|
||||
functions["time_of_day"] = { DoubleValue((world.dayTime % 24000).toDouble()) }
|
||||
functions["server"] = { server()?.asMoLangValue() ?: DoubleValue.ZERO }
|
||||
functions["is_raining_at"] = { params ->
|
||||
val x = params.getInt(0)
|
||||
val y = params.getInt(1)
|
||||
val z = params.getInt(2)
|
||||
return@put DoubleValue(world.isRainingAt(BlockPos(x, y, z)))
|
||||
DoubleValue(world.isRainingAt(BlockPos(x, y, z)))
|
||||
}
|
||||
map["is_snowing_at"] = put@{ params ->
|
||||
functions["is_snowing_at"] = { params ->
|
||||
val x = params.getInt(0)
|
||||
val y = params.getInt(1)
|
||||
val z = params.getInt(2)
|
||||
val blockPos = BlockPos(x, y, z)
|
||||
when {
|
||||
!world.isRaining -> return@put DoubleValue.ZERO
|
||||
!world.canSeeSky(blockPos) -> return@put DoubleValue.ZERO
|
||||
!world.isRaining -> {
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
|
||||
!world.canSeeSky(blockPos) -> {
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
|
||||
(world.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, blockPos).y > blockPos.y) -> {
|
||||
return@put DoubleValue.ZERO
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
|
||||
else -> {
|
||||
val biome = world.getBiome(blockPos).value() as Biome
|
||||
return@put DoubleValue(biome.getPrecipitationAt(blockPos) == Biome.Precipitation.SNOW)
|
||||
DoubleValue(biome.getPrecipitationAt(blockPos) == Biome.Precipitation.SNOW)
|
||||
}
|
||||
}
|
||||
}
|
||||
map["is_chunk_loaded_at"] = put@{ params ->
|
||||
functions["is_chunk_loaded_at"] = { params ->
|
||||
val x = params.getInt(0)
|
||||
val y = params.getInt(1)
|
||||
val z = params.getInt(2)
|
||||
return@put DoubleValue(world.isLoaded(BlockPos(x, y, z)))
|
||||
DoubleValue(world.isLoaded(BlockPos(x, y, z)))
|
||||
}
|
||||
map["is_thundering"] = { _ -> DoubleValue(world.isThundering) }
|
||||
map["is_raining"] = { _ -> DoubleValue(world.isRaining) }
|
||||
map["set_block"] = put@{ params ->
|
||||
functions["is_thundering"] = { DoubleValue(world.isThundering) }
|
||||
functions["is_raining"] = { DoubleValue(world.isRaining) }
|
||||
functions["set_block"] = setBlock@{ params ->
|
||||
val x = params.getInt(0)
|
||||
val y = params.getInt(1)
|
||||
val z = params.getInt(2)
|
||||
val block = world.blockRegistry.get(params.getString(3).asIdentifierDefaultingNamespace())
|
||||
?: run {
|
||||
Cobblemon.LOGGER.error("Unknown block: ${params.getString(3)}")
|
||||
return@put DoubleValue.ZERO
|
||||
}
|
||||
val block =
|
||||
world.blockRegistry.get(params.getString(3).asIdentifierDefaultingNamespace())
|
||||
?: run {
|
||||
Cobblemon.LOGGER.error("Unknown block: ${params.getString(3)}")
|
||||
return@setBlock DoubleValue.ZERO
|
||||
}
|
||||
world.setBlock(BlockPos(x, y, z), block.defaultBlockState(), Block.UPDATE_ALL)
|
||||
}
|
||||
map["is_air"] = put@{ params ->
|
||||
functions["is_air"] = { params ->
|
||||
val x = params.getDouble(0).toInt()
|
||||
val y = params.getDouble(1).toInt()
|
||||
val z = params.getDouble(2).toInt()
|
||||
val blockState = world.getBlockState(BlockPos(x, y, z))
|
||||
return@put DoubleValue(blockState.isAir)
|
||||
DoubleValue(blockState.isAir)
|
||||
}
|
||||
map["get_block"] = put@{ params ->
|
||||
functions["get_block"] = { params ->
|
||||
val x = params.getInt(0)
|
||||
val y = params.getInt(1)
|
||||
val z = params.getInt(2)
|
||||
val block = world.getBlockState(BlockPos(x, y, z)).block
|
||||
return@put world.blockRegistry.wrapAsHolder(block).asMoLangValue(Registries.BLOCK)
|
||||
world.blockRegistry.wrapAsHolder(block).asMoLangValue(Registries.BLOCK)
|
||||
}
|
||||
map["spawn_explosion"] = { params ->
|
||||
functions["spawn_explosion"] = { params ->
|
||||
val x = params.getDouble(0)
|
||||
val y = params.getDouble(1)
|
||||
val z = params.getDouble(2)
|
||||
@@ -136,32 +139,33 @@ object WorldMoLangFunctions : AbstractMoLangFunctionHolder<Holder<Level>>() {
|
||||
z,
|
||||
range,
|
||||
ExplosionInteraction.valueOf(
|
||||
params.getStringOrNull(4)?.uppercase() ?: ExplosionInteraction.TNT.name
|
||||
)
|
||||
params.getStringOrNull(4)?.uppercase() ?: ExplosionInteraction.TNT.name,
|
||||
),
|
||||
)
|
||||
}
|
||||
map["spawn_lightning"] = put@{ params ->
|
||||
functions["spawn_lightning"] = { params ->
|
||||
val x = params.getDouble(0)
|
||||
val y = params.getDouble(1)
|
||||
val z = params.getDouble(2)
|
||||
val lightning = LightningBolt(EntityType.LIGHTNING_BOLT, world)
|
||||
lightning.setPos(x, y, z)
|
||||
world.addFreshEntity(lightning)
|
||||
return@put DoubleValue.ONE
|
||||
DoubleValue.ONE
|
||||
}
|
||||
// q.entity.world.spawn_bedrock_particles(effect, x, y, z, [player]) - sends to everyone nearby or just to the player if they're set.
|
||||
map["spawn_bedrock_particles"] = { params ->
|
||||
functions["spawn_bedrock_particles"] = { params ->
|
||||
val particle = params.getString(0).asResource()
|
||||
val x = params.getDouble(1)
|
||||
val y = params.getDouble(2)
|
||||
val z = params.getDouble(3)
|
||||
val player = params.getOrNull<MoValue>(4)?.let {
|
||||
when (it) {
|
||||
is StringValue -> world.getPlayerByUUID(UUID.fromString(it.value))
|
||||
is ObjectValue<*> -> it.obj
|
||||
else -> null
|
||||
}
|
||||
} as? ServerPlayer
|
||||
val player =
|
||||
params.getOrNull<MoValue>(4)?.let {
|
||||
when (it) {
|
||||
is StringValue -> world.getPlayerByUUID(UUID.fromString(it.value))
|
||||
is ObjectValue<*> -> it.obj
|
||||
else -> null
|
||||
}
|
||||
} as? ServerPlayer
|
||||
val pos = Vec3(x, y, z)
|
||||
|
||||
val packet = SpawnSnowstormParticlePacket(particle, pos)
|
||||
@@ -171,7 +175,7 @@ object WorldMoLangFunctions : AbstractMoLangFunctionHolder<Holder<Level>>() {
|
||||
packet.sendToPlayersAround(x, y, z, 64.0, world.dimension())
|
||||
}
|
||||
}
|
||||
map["spawn_pokemon"] = put@{ params ->
|
||||
functions["spawn_pokemon"] = spawnPokemon@{ params ->
|
||||
val x = params.getInt(0)
|
||||
val y = params.getInt(1)
|
||||
val z = params.getInt(2)
|
||||
@@ -179,49 +183,50 @@ object WorldMoLangFunctions : AbstractMoLangFunctionHolder<Holder<Level>>() {
|
||||
|
||||
val pos = BlockPos(x, y, z)
|
||||
|
||||
if (!Level.isInSpawnableBounds(pos)) {
|
||||
return@put DoubleValue.ZERO
|
||||
}
|
||||
if (!Level.isInSpawnableBounds(pos)) return@spawnPokemon DoubleValue.ZERO
|
||||
|
||||
val pokemon = props.createEntity(world)
|
||||
pokemon.moveTo(pos, pokemon.yRot, pokemon.xRot)
|
||||
|
||||
if (world.addFreshEntity(pokemon)) {
|
||||
return@put pokemon.struct
|
||||
} else {
|
||||
return@put DoubleValue.ZERO
|
||||
}
|
||||
if (world.addFreshEntity(pokemon)) return@spawnPokemon pokemon.struct
|
||||
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
map["spawn_npc"] = put@{ params ->
|
||||
functions["spawn_npc"] = spawnNpc@{ params ->
|
||||
val x = params.getDouble(0)
|
||||
val y = params.getDouble(1)
|
||||
val z = params.getDouble(2)
|
||||
val npcClass = params.getStringOrNull(3)
|
||||
?.let { NPCClasses.getByIdentifier(it.asIdentifierDefaultingNamespace()) }
|
||||
val npcClass =
|
||||
params
|
||||
.getStringOrNull(3)
|
||||
?.let { NPCClasses.getByIdentifier(it.asIdentifierDefaultingNamespace()) }
|
||||
val level = params.getInt(4)
|
||||
if (npcClass == null) return@put DoubleValue.ZERO
|
||||
|
||||
if (npcClass == null) return@spawnNpc DoubleValue.ZERO
|
||||
|
||||
val npc = NPCEntity(world)
|
||||
npc.moveTo(x, y, z, npc.yRot, npc.xRot)
|
||||
npc.npc = npcClass
|
||||
npc.initialize(level)
|
||||
if (world.addFreshEntity(npc)) {
|
||||
return@put npc.asMoLangValue()
|
||||
}
|
||||
return@put DoubleValue.ZERO
|
||||
|
||||
if (world.addFreshEntity(npc)) return@spawnNpc npc.asMoLangValue()
|
||||
|
||||
DoubleValue.ZERO
|
||||
}
|
||||
map["play_sound_on_server"] = { params ->
|
||||
functions["play_sound_on_server"] = { params ->
|
||||
val sound = params.getString(0).asResource()
|
||||
val soundSource = params.getString(1).uppercase()
|
||||
val x = params.getDouble(2)
|
||||
val y = params.getDouble(3)
|
||||
val z = params.getDouble(4)
|
||||
val player = params.getOrNull<MoValue>(5)?.let {
|
||||
when (it) {
|
||||
is StringValue -> world.getPlayerByUUID(UUID.fromString(it.value))
|
||||
is ObjectValue<*> -> it.obj
|
||||
else -> null
|
||||
}
|
||||
} as? ServerPlayer
|
||||
val player =
|
||||
params.getOrNull<MoValue>(5)?.let {
|
||||
when (it) {
|
||||
is StringValue -> world.getPlayerByUUID(UUID.fromString(it.value))
|
||||
is ObjectValue<*> -> it.obj
|
||||
else -> null
|
||||
}
|
||||
} as? ServerPlayer
|
||||
val volume = params.getDoubleOrNull(6)?.toFloat() ?: 1.0f
|
||||
val pitch = params.getDoubleOrNull(7)?.toFloat() ?: 1.0f
|
||||
|
||||
@@ -233,29 +238,30 @@ object WorldMoLangFunctions : AbstractMoLangFunctionHolder<Holder<Level>>() {
|
||||
packet.sendToPlayersAround(x, y, z, 16.0, world.dimension())
|
||||
}
|
||||
}
|
||||
map["get_entities_around"] = put@{ params ->
|
||||
functions["get_entities_around"] = { params ->
|
||||
val x = params.getDouble(0)
|
||||
val y = params.getDouble(1)
|
||||
val z = params.getDouble(2)
|
||||
val range = params.getDouble(3) * 2
|
||||
val entities = world.getEntities(null, AABB.ofSize(Vec3(x, y, z), range, range, range))
|
||||
return@put entities
|
||||
entities
|
||||
.filterIsInstance<LivingEntity>()
|
||||
.map { it.asMostSpecificMoLangValue() }
|
||||
.asArrayValue()
|
||||
}
|
||||
map["is_healer_in_use"] = put@{ params ->
|
||||
functions["is_healer_in_use"] = isHealerInUse@{ params ->
|
||||
val pos = params.get<ArrayStruct>(0).asBlockPos()
|
||||
val healer = world.getBlockEntity(pos, CobblemonBlockEntities.HEALING_MACHINE).orElse(null)
|
||||
?: return@put DoubleValue.ONE
|
||||
return@put DoubleValue(healer.isInUse)
|
||||
val healer =
|
||||
world.getBlockEntity(pos, CobblemonBlockEntities.HEALING_MACHINE).orElse(null)
|
||||
?: return@isHealerInUse DoubleValue.ONE
|
||||
return@isHealerInUse DoubleValue(healer.isInUse)
|
||||
}
|
||||
|
||||
map["spawn_loot_table_items"] = put@{ params ->
|
||||
functions["spawn_loot_table_items"] = spawnLootTableItems@{ params ->
|
||||
val serverLevel = world as? ServerLevel
|
||||
if (serverLevel == null) {
|
||||
Cobblemon.LOGGER.warn("spawn_loot_table_items: world is not a ServerLevel")
|
||||
return@put DoubleValue.ZERO
|
||||
return@spawnLootTableItems DoubleValue.ZERO
|
||||
}
|
||||
val lootTableId = params.getString(0).asIdentifierDefaultingNamespace()
|
||||
val x = params.getDouble(1)
|
||||
@@ -265,9 +271,11 @@ object WorldMoLangFunctions : AbstractMoLangFunctionHolder<Holder<Level>>() {
|
||||
val lootTableKey = ResourceKey.create(Registries.LOOT_TABLE, lootTableId)
|
||||
val lootTable = serverLevel.server.reloadableRegistries().getLootTable(lootTableKey)
|
||||
|
||||
val lootParams = LootParams.Builder(serverLevel)
|
||||
.withParameter(LootContextParams.ORIGIN, Vec3(x, y, z))
|
||||
.create(LootContextParamSets.COMMAND)
|
||||
val lootParams =
|
||||
LootParams
|
||||
.Builder(serverLevel)
|
||||
.withParameter(LootContextParams.ORIGIN, Vec3(x, y, z))
|
||||
.create(LootContextParamSets.COMMAND)
|
||||
|
||||
val items = lootTable.getRandomItems(lootParams)
|
||||
val spawnedItems = ArrayStruct(hashMapOf())
|
||||
@@ -285,9 +293,10 @@ object WorldMoLangFunctions : AbstractMoLangFunctionHolder<Holder<Level>>() {
|
||||
}
|
||||
}
|
||||
}
|
||||
return@put spawnedItems
|
||||
|
||||
spawnedItems
|
||||
}
|
||||
|
||||
return map
|
||||
return functions
|
||||
}
|
||||
}
|
||||
|
||||
+23
-7
@@ -8,8 +8,10 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.orientation
|
||||
|
||||
import com.cobblemon.mod.common.util.math.QuatSpring
|
||||
import com.cobblemon.mod.common.util.math.geometry.toDegrees
|
||||
import com.cobblemon.mod.common.util.math.geometry.toRadians
|
||||
import com.cobblemon.mod.common.util.math.simpleSpringDamperQuat
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.util.Mth
|
||||
import net.minecraft.world.entity.LivingEntity
|
||||
@@ -26,6 +28,8 @@ open class OrientationController(val entity: LivingEntity) {
|
||||
val FORWARDS: Vector3f = Vector3f(0.0f, 0.0f, -1.0f)
|
||||
val UP: Vector3f = Vector3f(0.0f, 1.0f, 0.0f)
|
||||
val LEFT: Vector3f = Vector3f(-1.0f, 0.0f, 0.0f)
|
||||
private const val TICK_DT = 1f / 20f // Minecraft server tick rate
|
||||
private const val RENDER_SMOOTH_HALFLIFE = 0.1f // seconds to close ~half the gap
|
||||
}
|
||||
|
||||
open var active: Boolean = false
|
||||
@@ -33,6 +37,8 @@ open class OrientationController(val entity: LivingEntity) {
|
||||
var orientation: Matrix3f? = null
|
||||
private set
|
||||
|
||||
private val renderSpring = QuatSpring()
|
||||
|
||||
private var renderOrientationO: Matrix3f? = null
|
||||
private var renderOrientation: Matrix3f? = null
|
||||
|
||||
@@ -54,6 +60,8 @@ open class OrientationController(val entity: LivingEntity) {
|
||||
orientation = null
|
||||
renderOrientationO = null
|
||||
renderOrientation = null
|
||||
renderSpring.quat.identity()
|
||||
renderSpring.angVel.set(0f, 0f, 0f)
|
||||
active = false
|
||||
}
|
||||
|
||||
@@ -77,18 +85,26 @@ open class OrientationController(val entity: LivingEntity) {
|
||||
return oldQuat
|
||||
}
|
||||
|
||||
/** Every tick move the current render orientation towards the last known true orientation **/
|
||||
fun tick() {
|
||||
if (!active || orientation == null) return
|
||||
renderOrientationO = renderOrientation
|
||||
val current = orientation
|
||||
val renderMatrix = this.renderOrientation ?: current
|
||||
val renderQuat = Quaternionf().setFromUnnormalized(renderMatrix)
|
||||
val targetQuat = Quaternionf().setFromUnnormalized(current)
|
||||
val dampingFactor = 0.66f // Smooth interpolation to reduce jitter of orientations recieved from the server.
|
||||
renderQuat.slerp(targetQuat, dampingFactor)
|
||||
val current = orientation!!
|
||||
val targetQuat = Quaternionf().setFromUnnormalized(current)
|
||||
|
||||
if (renderOrientation == null) {
|
||||
// First tick: snap the spring to the target instead of easing in from identity
|
||||
renderSpring.quat.set(targetQuat)
|
||||
renderSpring.angVel.set(0f, 0f, 0f)
|
||||
}
|
||||
|
||||
// Use a "quat spring" to smoothly move the render orientation towards the goal orientation.
|
||||
// It takes into account the orientations angular velocities and should be much more resilient
|
||||
// to sharp changes in goal orientation or late/missed packets.
|
||||
simpleSpringDamperQuat(renderSpring, targetQuat, 0.15f, TICK_DT)
|
||||
|
||||
val newRenderOrientation = Matrix3f()
|
||||
renderQuat.get(newRenderOrientation)
|
||||
renderSpring.quat.get(newRenderOrientation)
|
||||
renderOrientation = newRenderOrientation
|
||||
}
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ object PokeBalls : JsonDataRegistry<PokeBall> {
|
||||
createDefault("dive_ball", CatchRateModifiers.SUBMERGED_IN_WATER, waterDragValue = 0.99F)
|
||||
createDefault("nest_ball", CatchRateModifiers.NEST)
|
||||
createDefault("repeat_ball", CatchRateModifiers.REPEAT)
|
||||
createDefault("timer_ball", CatchRateModifiers.turnBased { turn -> (1F * turn * (1229F / 4096F)).coerceAtMost(4F) })
|
||||
createDefault("timer_ball", CatchRateModifiers.turnBased { turn -> (1F + turn * (1229F / 4096F)).coerceAtMost(4F) })
|
||||
createDefault("luxury_ball", effects = listOf(FriendshipEarningBoostEffect(2F)))
|
||||
createDefault("premier_ball")
|
||||
createDefault("dusk_ball", CatchRateModifiers.LIGHT_LEVEL)
|
||||
@@ -278,7 +278,7 @@ object PokeBalls : JsonDataRegistry<PokeBall> {
|
||||
createDefault("cherish_ball")
|
||||
createDefault("park_ball", CatchRateModifiers.PARK)
|
||||
createDefault("dream_ball", CatchRateModifiers.statusBoosting(4F, Statuses.SLEEP))
|
||||
createDefault("beast_ball", LabelModifier(5F, true, CobblemonPokemonLabels.ULTRA_BEAST)/*, LabelModifier(0.1F, false, CobblemonPokemonLabels.ULTRA_BEAST))*/)
|
||||
createDefault("beast_ball", DynamicMultiplierModifier({ _, pokemon -> if (pokemon.hasLabels(CobblemonPokemonLabels.ULTRA_BEAST)) 5F else 0.1F }) { _, _ -> true })
|
||||
createDefault("ancient_poke_ball", ancient = true)
|
||||
createDefault("ancient_citrine_ball", ancient = true)
|
||||
createDefault("ancient_verdant_ball", ancient = true)
|
||||
@@ -297,13 +297,15 @@ object PokeBalls : JsonDataRegistry<PokeBall> {
|
||||
createDefault("ancient_origin_ball", GuaranteedModifier(), ancient = true)
|
||||
// Luxury ball effect, low priority as it must be triggered before soothe bell as of gen 4
|
||||
CobblemonEvents.FRIENDSHIP_UPDATED.subscribe(priority = Priority.LOW) { event ->
|
||||
var increment = (event.newFriendship - event.pokemon.friendship).toFloat()
|
||||
if (increment <= 0) //these affects are only meant to affect positive gains
|
||||
if (!event.earned) {
|
||||
return@subscribe
|
||||
if (increment <= 1F) {
|
||||
event.pokemon.caughtBall.effects.filterIsInstance<FriendshipEarningBoostEffect>()
|
||||
.forEach { increment *= it.multiplier }
|
||||
}
|
||||
var increment = (event.newFriendship - event.pokemon.friendship).toFloat()
|
||||
if (increment <= 0) {
|
||||
return@subscribe
|
||||
}
|
||||
event.pokemon.caughtBall.effects.filterIsInstance<FriendshipEarningBoostEffect>()
|
||||
.forEach { increment *= it.multiplier }
|
||||
event.newFriendship = event.pokemon.friendship + increment.roundToInt()
|
||||
}
|
||||
}
|
||||
@@ -338,7 +340,6 @@ object PokeBalls : JsonDataRegistry<PokeBall> {
|
||||
ancient: Boolean = false
|
||||
): PokeBall {
|
||||
val identifier = cobblemonResource(name)
|
||||
//val finalModifiers = if (appendUltraBeastPenalty) modifiers + listOf(LabelModifier(0.1F, true, CobblemonPokemonLabels.ULTRA_BEAST)) else modifiers
|
||||
val pokeball = PokeBall(identifier, modifier, effects, waterDragValue, model2d, model3d, throwPower, ancient)
|
||||
this.defaults[identifier] = pokeball
|
||||
return pokeball
|
||||
|
||||
+12
-14
@@ -54,22 +54,20 @@ object CatchRateModifiers {
|
||||
|
||||
/**
|
||||
* Used by [PokeBalls.LOVE_BALL].
|
||||
* Boosts the catch rate if the Pokémon is of the same species and opposite gender
|
||||
* Boosts the catch rate 2.5× if any of the player's active Pokémon is of the opposite gender,
|
||||
* or 8× if that Pokémon is also of the same species.
|
||||
*/
|
||||
val LOVE = BattleModifier { _, playerPokemon, pokemon ->
|
||||
if (
|
||||
pokemon.gender != Gender.GENDERLESS
|
||||
&& playerPokemon.mapNotNull { it.battlePokemon?.originalPokemon }
|
||||
.any {
|
||||
it.gender != Gender.GENDERLESS &&
|
||||
it.species.name.equals(pokemon.species.name, true) &&
|
||||
it.gender != pokemon.gender
|
||||
}
|
||||
) {
|
||||
if (playerPokemon.any { it.battlePokemon?.originalPokemon?.species?.resourceIdentifier == pokemon.species.resourceIdentifier }) 8F else 2.5F
|
||||
if (pokemon.gender == Gender.GENDERLESS) {
|
||||
return@BattleModifier 1F
|
||||
}
|
||||
else {
|
||||
1F
|
||||
val oppositeGender = playerPokemon
|
||||
.mapNotNull { it.battlePokemon?.originalPokemon }
|
||||
.filter { it.gender != Gender.GENDERLESS && it.gender != pokemon.gender }
|
||||
when {
|
||||
oppositeGender.any { it.species.resourceIdentifier == pokemon.species.resourceIdentifier } -> 8F
|
||||
oppositeGender.isNotEmpty() -> 2.5F
|
||||
else -> 1F
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +79,7 @@ object CatchRateModifiers {
|
||||
* 1× otherwise.
|
||||
*/
|
||||
val MOON_PHASES: CatchRateModifier = WorldStateModifier { _, entity ->
|
||||
if (entity.level().gameTime in 12000..24000)
|
||||
if (entity.level().dayTime % 24000 < 12000)
|
||||
return@WorldStateModifier 1F
|
||||
when (entity.level().moonPhase) {
|
||||
2, 6 -> 1.5F
|
||||
|
||||
@@ -42,7 +42,7 @@ class PokedexManager(
|
||||
}
|
||||
|
||||
// Java interop isn't great lol
|
||||
@Deprecated("Use encounter(PokedexEntityData) instead")
|
||||
@Deprecated("Use obtain(Pokemon) instead")
|
||||
fun catch(pokemon: Pokemon) {
|
||||
obtain(pokemon)
|
||||
}
|
||||
|
||||
@@ -54,8 +54,8 @@ enum class Stats(override val identifier: ResourceLocation, override val display
|
||||
"hp" -> HP
|
||||
"atk", "attack" -> ATTACK // Hyper Cutter states the full stat name "Attack"
|
||||
"def", "defense", "defence" -> DEFENCE // Big Pecks states the full stat name "Defense"
|
||||
"spa" -> SPECIAL_ATTACK
|
||||
"spd" -> SPECIAL_DEFENCE
|
||||
"spa", "special_attack" -> SPECIAL_ATTACK
|
||||
"spd", "special_defence", "special_defense" -> SPECIAL_DEFENCE
|
||||
"spe", "speed" -> SPEED
|
||||
"evasion" -> EVASION
|
||||
else -> ACCURACY
|
||||
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.api.riding.util
|
||||
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.phys.AABB
|
||||
import kotlin.math.floor
|
||||
|
||||
/**
|
||||
* Walks every block position inside [searchBox] and turns each solid block into one
|
||||
* full-cube [FieldPrimitive].
|
||||
*
|
||||
* @author Jackson
|
||||
* @since July 27th, 2026
|
||||
*/
|
||||
|
||||
fun collectPrimitivesFromBlocks(
|
||||
level: BlockGetter,
|
||||
searchBox: AABB,
|
||||
shape: PrimitiveShape,
|
||||
includeFluids: Boolean = false
|
||||
): List<FieldPrimitive> {
|
||||
val primitives = mutableListOf<FieldPrimitive>()
|
||||
|
||||
val minX = floor(searchBox.minX).toInt()
|
||||
val maxX = floor(searchBox.maxX).toInt()
|
||||
val minY = floor(searchBox.minY).toInt()
|
||||
val maxY = floor(searchBox.maxY).toInt()
|
||||
val minZ = floor(searchBox.minZ).toInt()
|
||||
val maxZ = floor(searchBox.maxZ).toInt()
|
||||
|
||||
val pos = BlockPos.MutableBlockPos()
|
||||
for (x in minX..maxX) {
|
||||
for (y in minY..maxY) {
|
||||
for (z in minZ..maxZ) {
|
||||
pos.set(x, y, z)
|
||||
val state = level.getBlockState(pos)
|
||||
|
||||
val isSolid = !state.getCollisionShape(level, pos).isEmpty
|
||||
val isFluid = includeFluids && !state.fluidState.isEmpty
|
||||
if (!isSolid && !isFluid) continue
|
||||
|
||||
primitives.add(
|
||||
FieldPrimitive(
|
||||
shape = shape,
|
||||
centerX = x + 0.5f, centerY = y + 0.5f, centerZ = z + 0.5f,
|
||||
halfWidth = 0.5f, halfHeight = 0.5f, halfDepth = 0.5f
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return primitives
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.api.riding.util
|
||||
|
||||
import net.minecraft.world.phys.Vec3
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
import kotlin.math.sqrt
|
||||
|
||||
/**
|
||||
* Helpful Functions when working with signed distance fields/functions.
|
||||
* https://iquilezles.org/articles/distfunctions/
|
||||
*
|
||||
* @author Jackson
|
||||
* @since July 27th, 2026
|
||||
*/
|
||||
|
||||
/** Which distance formula a primitive uses. */
|
||||
enum class PrimitiveShape {
|
||||
BOX,
|
||||
ROUNDED_BOX,
|
||||
ELLIPSOID
|
||||
}
|
||||
|
||||
/** Tunable constants for the field. */
|
||||
data class DistanceFieldTuning(
|
||||
val smoothingRange: Float = 0.5f,
|
||||
val roundingRadius: Float = 0.08f
|
||||
)
|
||||
|
||||
/** A single shape in the field - a center position, half-extents, and which formula to use. */
|
||||
data class FieldPrimitive(
|
||||
val shape: PrimitiveShape,
|
||||
val centerX: Float, val centerY: Float, val centerZ: Float,
|
||||
val halfWidth: Float, val halfHeight: Float, val halfDepth: Float
|
||||
)
|
||||
|
||||
/** Fast approximate 1/sqrt(x) - the Quake III trick, cheaper than a real sqrt + divide. */
|
||||
fun fastInverseSqrt(value: Float): Float {
|
||||
var x = value
|
||||
val halfX = 0.5f * x
|
||||
var bits = java.lang.Float.floatToIntBits(x)
|
||||
bits = 0x5f3759df - (bits shr 1)
|
||||
x = java.lang.Float.intBitsToFloat(bits)
|
||||
x *= (1.5f - halfX * x * x)
|
||||
return x
|
||||
}
|
||||
|
||||
/** Exact distance from a point to an axis-aligned box. Inputs are relative to the box's own center. */
|
||||
fun boxDistance(relX: Float, relY: Float, relZ: Float, halfWidth: Float, halfHeight: Float, halfDepth: Float): Float {
|
||||
val qx = abs(relX) - halfWidth
|
||||
val qy = abs(relY) - halfHeight
|
||||
val qz = abs(relZ) - halfDepth
|
||||
val ox = max(qx, 0f)
|
||||
val oy = max(qy, 0f)
|
||||
val oz = max(qz, 0f)
|
||||
val outside = sqrt(ox * ox + oy * oy + oz * oz)
|
||||
val inside = min(max(qx, max(qy, qz)), 0f)
|
||||
return outside + inside
|
||||
}
|
||||
|
||||
/** Same as boxDistance but with rounded corners/edges https://iquilezles.org/articles/distfunctions/ */
|
||||
fun roundedBoxDistance(relX: Float, relY: Float, relZ: Float, halfWidth: Float, halfHeight: Float, halfDepth: Float, roundingRadius: Float): Float =
|
||||
boxDistance(relX, relY, relZ, halfWidth - roundingRadius, halfHeight - roundingRadius, halfDepth - roundingRadius) - roundingRadius
|
||||
|
||||
/** Approximate (lower-bound) distance to an ellipsoid https://iquilezles.org/articles/ellipsoids/. */
|
||||
fun ellipsoidDistance(relX: Float, relY: Float, relZ: Float, halfWidth: Float, halfHeight: Float, halfDepth: Float): Float {
|
||||
val px = relX / halfWidth
|
||||
val py = relY / halfHeight
|
||||
val pz = relZ / halfDepth
|
||||
val inverseMagnitude = fastInverseSqrt(px * px + py * py + pz * pz)
|
||||
val trueDistance = sqrt(relX * relX + relY * relY + relZ * relZ)
|
||||
return trueDistance * (1.0f - inverseMagnitude)
|
||||
}
|
||||
|
||||
/** Distance from a point to one primitive, dispatched by its shape. */
|
||||
fun distanceToPrimitive(primitive: FieldPrimitive, sampleX: Float, sampleY: Float, sampleZ: Float, tuning: DistanceFieldTuning): Float {
|
||||
val relX = sampleX - primitive.centerX
|
||||
val relY = sampleY - primitive.centerY
|
||||
val relZ = sampleZ - primitive.centerZ
|
||||
return when (primitive.shape) {
|
||||
PrimitiveShape.BOX -> boxDistance(relX, relY, relZ, primitive.halfWidth, primitive.halfHeight, primitive.halfDepth)
|
||||
PrimitiveShape.ROUNDED_BOX -> roundedBoxDistance(relX, relY, relZ, primitive.halfWidth, primitive.halfHeight, primitive.halfDepth, tuning.roundingRadius)
|
||||
PrimitiveShape.ELLIPSOID -> ellipsoidDistance(relX, relY, relZ, primitive.halfWidth, primitive.halfHeight, primitive.halfDepth)
|
||||
}
|
||||
}
|
||||
|
||||
///** Normalized quadratic smooth-min https://iquilezles.org/articles/smin/ */
|
||||
//fun smoothMinimum(a: Float, b: Float, smoothingRange: Float): Float {
|
||||
// if (smoothingRange <= 0.001f) return min(a, b)
|
||||
// val k = smoothingRange * 4.0f
|
||||
// val h = (0.5f + 0.5f * (b - a) / k).coerceIn(0f, 1f)
|
||||
// return b + (a - b) * h - k * h * (1f - h)
|
||||
//}
|
||||
//
|
||||
///** Folds every primitive's distance together into one field value at a point. */
|
||||
//fun sampleField(primitives: List<FieldPrimitive>, sampleX: Float, sampleY: Float, sampleZ: Float, tuning: DistanceFieldTuning): Float {
|
||||
// var result = Float.POSITIVE_INFINITY
|
||||
// for (primitive in primitives) {
|
||||
// val distance = distanceToPrimitive(primitive, sampleX, sampleY, sampleZ, tuning)
|
||||
// result = if (result == Float.POSITIVE_INFINITY) distance else smoothMinimum(result, distance, tuning.smoothingRange)
|
||||
// }
|
||||
// return result
|
||||
//}
|
||||
|
||||
/** Normalized quadratic smooth-min https://iquilezles.org/articles/smin/ */
|
||||
fun smoothMinimum(a: Float, b: Float, smoothingRange: Float): Float {
|
||||
if (smoothingRange <= 0.001f) return min(a, b)
|
||||
val k = smoothingRange * 4.0f
|
||||
val h = (0.5f + 0.5f * (b - a) / k).coerceIn(0f, 1f)
|
||||
return b + (a - b) * h - k * h * (1f - h)
|
||||
}
|
||||
|
||||
/** Folds nearby primitive distances together into one field value at a point. */
|
||||
fun sampleField(primitives: List<FieldPrimitive>, sampleX: Float, sampleY: Float, sampleZ: Float, tuning: DistanceFieldTuning): Float {
|
||||
if (primitives.isEmpty()) return Float.POSITIVE_INFINITY
|
||||
|
||||
val distances = FloatArray(primitives.size) { distanceToPrimitive(primitives[it], sampleX, sampleY, sampleZ, tuning) }
|
||||
val minDistance = distances.min()
|
||||
|
||||
if (tuning.smoothingRange <= 0.001f) return minDistance
|
||||
|
||||
// Anything more than a few blend-widths past the closest primitive is cut - its
|
||||
// contribution would be negligible in a correct blend anyway, but left in, it still
|
||||
// drags the chained result down the more of them there are.
|
||||
val cutoff = tuning.smoothingRange * 3f
|
||||
|
||||
var result = Float.POSITIVE_INFINITY
|
||||
for (distance in distances) {
|
||||
if (distance - minDistance > cutoff) continue
|
||||
result = if (result == Float.POSITIVE_INFINITY) distance else smoothMinimum(result, distance, tuning.smoothingRange)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/** Finite-difference gradient of the field at a point - points away from the surface, magnitude ~1 for a clean field. */
|
||||
fun estimateGradient(primitives: List<FieldPrimitive>, point: Vec3, tuning: DistanceFieldTuning, epsilon: Float = 0.05f): Vec3 {
|
||||
val px = point.x.toFloat()
|
||||
val py = point.y.toFloat()
|
||||
val pz = point.z.toFloat()
|
||||
|
||||
val dx = sampleField(primitives, px + epsilon, py, pz, tuning) - sampleField(primitives, px - epsilon, py, pz, tuning)
|
||||
val dy = sampleField(primitives, px, py + epsilon, pz, tuning) - sampleField(primitives, px, py - epsilon, pz, tuning)
|
||||
val dz = sampleField(primitives, px, py, pz + epsilon, tuning) - sampleField(primitives, px, py, pz - epsilon, tuning)
|
||||
|
||||
val gradient = Vec3(dx.toDouble(), dy.toDouble(), dz.toDouble())
|
||||
return if (gradient.lengthSqr() > 1e-8) gradient.normalize() else Vec3(0.0, 1.0, 0.0)
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.api.riding.util
|
||||
|
||||
import net.minecraft.core.particles.DustParticleOptions
|
||||
import net.minecraft.server.level.ServerLevel
|
||||
import net.minecraft.world.entity.Entity
|
||||
import net.minecraft.world.phys.AABB
|
||||
import net.minecraft.world.phys.Vec3
|
||||
import org.joml.Vector3f
|
||||
|
||||
/** One shell to draw - a target field value, a color, a particle size. */
|
||||
data class DistanceFieldLayer(
|
||||
val isoValue: Float,
|
||||
val color: Vector3f,
|
||||
val particleSize: Float = 1.0f
|
||||
)
|
||||
|
||||
/**
|
||||
* Marches a grid of vertical columns through the field around [center] and spawns a
|
||||
* particle everywhere it crosses one of [layers]' target values. Server-side only.
|
||||
*/
|
||||
fun visualizeDistanceField(
|
||||
referenceEntity: Entity,
|
||||
center: Vec3,
|
||||
layers: List<DistanceFieldLayer>,
|
||||
shape: PrimitiveShape = PrimitiveShape.BOX,
|
||||
horizontalRadius: Double = 4.0,
|
||||
verticalRange: Double = 4.0,
|
||||
sampleSpacing: Double = 0.5,
|
||||
marchStep: Double = 0.1,
|
||||
tuning: DistanceFieldTuning = DistanceFieldTuning()
|
||||
) {
|
||||
val level = referenceEntity.level()
|
||||
if (level !is ServerLevel) return
|
||||
|
||||
val searchBox = AABB(
|
||||
center.x - horizontalRadius, center.y - verticalRange, center.z - horizontalRadius,
|
||||
center.x + horizontalRadius, center.y, center.z + horizontalRadius
|
||||
)
|
||||
|
||||
val primitives = collectPrimitivesFromBlocks(level, searchBox, shape, includeFluids = true)
|
||||
if (primitives.isEmpty()) return
|
||||
|
||||
var x = -horizontalRadius
|
||||
while (x <= horizontalRadius) {
|
||||
var z = -horizontalRadius
|
||||
while (z <= horizontalRadius) {
|
||||
marchColumn(level, primitives, center, x, z, verticalRange, marchStep, layers, tuning)
|
||||
z += sampleSpacing
|
||||
}
|
||||
x += sampleSpacing
|
||||
}
|
||||
}
|
||||
|
||||
private fun marchColumn(
|
||||
level: ServerLevel,
|
||||
primitives: List<FieldPrimitive>,
|
||||
center: Vec3,
|
||||
offsetX: Double,
|
||||
offsetZ: Double,
|
||||
verticalRange: Double,
|
||||
marchStep: Double,
|
||||
layers: List<DistanceFieldLayer>,
|
||||
tuning: DistanceFieldTuning
|
||||
) {
|
||||
val previousValue = FloatArray(layers.size) { Float.NaN }
|
||||
|
||||
var y = verticalRange
|
||||
while (y >= -verticalRange) {
|
||||
val worldX = (center.x + offsetX).toFloat()
|
||||
val worldY = (center.y + y).toFloat()
|
||||
val worldZ = (center.z + offsetZ).toFloat()
|
||||
val fieldValue = sampleField(primitives, worldX, worldY, worldZ, tuning)
|
||||
|
||||
for (layerIndex in layers.indices) {
|
||||
val layer = layers[layerIndex]
|
||||
val previous = previousValue[layerIndex]
|
||||
|
||||
if (!previous.isNaN() && crossedTarget(previous, fieldValue, layer.isoValue)) {
|
||||
val t = (layer.isoValue - previous) / (fieldValue - previous)
|
||||
val crossingY = (y + marchStep) - marchStep * t
|
||||
spawnLayerParticle(level, center.add(offsetX, crossingY, offsetZ), layer)
|
||||
}
|
||||
|
||||
previousValue[layerIndex] = fieldValue
|
||||
}
|
||||
|
||||
y -= marchStep
|
||||
}
|
||||
}
|
||||
|
||||
private fun crossedTarget(previous: Float, current: Float, target: Float): Boolean =
|
||||
(previous - target) * (current - target) < 0f
|
||||
|
||||
private fun spawnLayerParticle(level: ServerLevel, pos: Vec3, layer: DistanceFieldLayer) {
|
||||
val particle = DustParticleOptions(layer.color, layer.particleSize)
|
||||
level.sendParticles(particle, pos.x, pos.y, pos.z, 1, 0.0, 0.0, 0.0, 0.0)
|
||||
}
|
||||
+1
-1
@@ -71,7 +71,7 @@ class FishingSpawnCause(
|
||||
}
|
||||
|
||||
fun alterSize(pokemonEntity: PokemonEntity, effect: SpawnBait.Effect) {
|
||||
pokemonEntity.pokemon.scaleModifier *= effect.value.toFloat() / 1000.0f
|
||||
pokemonEntity.pokemon.scaleModifier += effect.value.toFloat() / 1000.0f
|
||||
}
|
||||
|
||||
fun saveDropsReroll(pokemonEntity: PokemonEntity, effect: SpawnBait.Effect) {
|
||||
|
||||
@@ -17,10 +17,10 @@ import com.cobblemon.mod.common.api.storage.factory.PokemonStoreFactory
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.util.DataKeys
|
||||
import com.google.gson.JsonObject
|
||||
import java.util.UUID
|
||||
import net.minecraft.core.RegistryAccess
|
||||
import net.minecraft.nbt.CompoundTag
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import java.util.UUID
|
||||
|
||||
/**
|
||||
* The base class for all stores of [Pokemon]. A store specifies the kind of coordinate it needs to be given
|
||||
@@ -77,7 +77,6 @@ abstract class PokemonStore<T : StorePosition> : Iterable<Pokemon> {
|
||||
remove(pokemon)
|
||||
val position = getFirstAvailablePosition() ?: return false // Couldn't fit, shrug emoji
|
||||
set(position, pokemon)
|
||||
Cobblemon.playerDataManager.getTMData(uuid)?.syncTMsFromPokemon(pokemon)
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.block.decor
|
||||
|
||||
import com.cobblemon.mod.common.util.rotateShape
|
||||
import com.mojang.serialization.MapCodec
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.Direction
|
||||
import net.minecraft.util.StringRepresentable
|
||||
import net.minecraft.world.InteractionResult
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.item.context.BlockPlaceContext
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.LevelAccessor
|
||||
import net.minecraft.world.level.block.*
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties.HORIZONTAL_FACING
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties.WATERLOGGED
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty
|
||||
import net.minecraft.world.level.gameevent.GameEvent
|
||||
import net.minecraft.world.level.material.FluidState
|
||||
import net.minecraft.world.level.material.Fluids
|
||||
import net.minecraft.world.phys.BlockHitResult
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.Shapes
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
|
||||
class ActivatableDecorationBlock(settings: Properties, val type: ActivatableDecorationBlockType) : HorizontalDirectionalBlock(settings), SimpleWaterloggedBlock {
|
||||
enum class ActivatableDecorationBlockType: StringRepresentable {
|
||||
//For basic use, also ignore camelcase errors, it's just dumb
|
||||
CENTERED_8x,
|
||||
//For specific items
|
||||
METRONOME;
|
||||
|
||||
override fun getSerializedName(): String = this.name.lowercase()
|
||||
|
||||
companion object {
|
||||
val CODEC = StringRepresentable.fromEnum(::values)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
val CODEC: MapCodec<ActivatableDecorationBlock> = RecordCodecBuilder.mapCodec { it.group(
|
||||
propertiesCodec(),
|
||||
ActivatableDecorationBlockType.CODEC.fieldOf("type").forGetter(ActivatableDecorationBlock::type)
|
||||
).apply(it, ::ActivatableDecorationBlock) }
|
||||
val ACTIVE = BooleanProperty.create("active")
|
||||
|
||||
val CENTERED_8x = Shapes.box(0.25, 0.0, 0.25, 0.75, 0.5, 0.75)
|
||||
val METRONOME_HITBOX = Shapes.box(0.25, 0.0, 0.375, 0.75, 0.8125, 0.75)
|
||||
|
||||
fun getShape(type: ActivatableDecorationBlockType): VoxelShape {
|
||||
return when (type) {
|
||||
ActivatableDecorationBlockType.METRONOME -> METRONOME_HITBOX
|
||||
else -> CENTERED_8x
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
registerDefaultState(stateDefinition.any()
|
||||
.setValue(HORIZONTAL_FACING, Direction.NORTH)
|
||||
.setValue(ACTIVE, false)
|
||||
.setValue(WATERLOGGED, false)
|
||||
)
|
||||
}
|
||||
|
||||
override fun codec(): MapCodec<ActivatableDecorationBlock> = CODEC
|
||||
|
||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||
builder.add(HORIZONTAL_FACING, ACTIVE, WATERLOGGED)
|
||||
}
|
||||
|
||||
override fun getFluidState(blockState: BlockState): FluidState? = if (blockState.getValue(WATERLOGGED)) Fluids.WATER.getSource(false) else super.getFluidState(blockState)
|
||||
|
||||
override fun updateShape(state: BlockState, direction: Direction, neighborState: BlockState, world: LevelAccessor, pos: BlockPos, neighborPos: BlockPos): BlockState {
|
||||
if (state.getValue(WATERLOGGED)) {
|
||||
world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world))
|
||||
}
|
||||
return if (state.getValue(HORIZONTAL_FACING).opposite == direction && !state.canSurvive(world, pos)) Blocks.AIR.defaultBlockState()
|
||||
else super.updateShape(state, direction, neighborState, world, pos, neighborPos)
|
||||
}
|
||||
|
||||
override fun getCollisionShape(state: BlockState, level: BlockGetter, pos: BlockPos, context: CollisionContext): VoxelShape {
|
||||
val direction = state.getValue(HORIZONTAL_FACING)
|
||||
return rotateShape(Direction.NORTH, direction, getShape(type))
|
||||
}
|
||||
|
||||
override fun getShape(state: BlockState, level: BlockGetter, pos: BlockPos, context: CollisionContext): VoxelShape {
|
||||
return getCollisionShape(state, level, pos, context).singleEncompassing()
|
||||
}
|
||||
|
||||
override fun getStateForPlacement(context: BlockPlaceContext): BlockState? {
|
||||
val fluidState = context.level.getFluidState(context.clickedPos)
|
||||
return super.getStateForPlacement(context)?.setValue(HORIZONTAL_FACING, context.horizontalDirection.opposite)?.setValue(WATERLOGGED, fluidState.type === Fluids.WATER)
|
||||
}
|
||||
|
||||
override fun useWithoutItem(
|
||||
state: BlockState,
|
||||
level: Level,
|
||||
pos: BlockPos,
|
||||
player: Player,
|
||||
hitResult: BlockHitResult
|
||||
): InteractionResult {
|
||||
if (level.isClientSide) {
|
||||
level.setBlockAndUpdate(pos, state.cycle(ACTIVE))
|
||||
return InteractionResult.SUCCESS
|
||||
} else {
|
||||
this.push(state, level, pos, null as Player?)
|
||||
return InteractionResult.CONSUME
|
||||
}
|
||||
}
|
||||
|
||||
fun push(state: BlockState, level: Level, pos: BlockPos?, player: Player?) {
|
||||
var state = state
|
||||
state = state.cycle(ACTIVE)
|
||||
level.setBlock(pos!!, state, 3)
|
||||
level.gameEvent(player, if (state.getValue(ACTIVE)) GameEvent.BLOCK_ACTIVATE else GameEvent.BLOCK_DEACTIVATE, pos)
|
||||
}
|
||||
|
||||
override fun hasAnalogOutputSignal(state: BlockState): Boolean {
|
||||
return true
|
||||
}
|
||||
//TODO: Replace this forced 4 with a value that can be set by the block, only relevant when more blocks of this class are added.
|
||||
override fun getAnalogOutputSignal(state: BlockState, level: Level, pos: BlockPos): Int {
|
||||
return if (level.getBlockState(pos).getValue(ACTIVE) as Boolean) 4 else 0
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.block
|
||||
|
||||
import com.cobblemon.mod.common.util.rotateShape
|
||||
import com.mojang.serialization.MapCodec
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.Direction
|
||||
import net.minecraft.util.StringRepresentable
|
||||
import net.minecraft.world.item.context.BlockPlaceContext
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.LevelAccessor
|
||||
import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.level.block.Blocks
|
||||
import net.minecraft.world.level.block.HorizontalDirectionalBlock
|
||||
import net.minecraft.world.level.block.SimpleWaterloggedBlock
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties.HORIZONTAL_FACING
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties.WATERLOGGED
|
||||
import net.minecraft.world.level.material.FluidState
|
||||
import net.minecraft.world.level.material.Fluids
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.Shapes
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
|
||||
class DecorativeItemBlock(settings: Properties, val type: DecorativeItemBlockType): HorizontalDirectionalBlock(settings), SimpleWaterloggedBlock {
|
||||
|
||||
enum class DecorativeItemBlockType: StringRepresentable {
|
||||
//For basic use, also ignore camelcase errors, it's just dumb
|
||||
CENTERED_8x,
|
||||
CENTERED_6x,
|
||||
FLATTENED_8x6,
|
||||
FLATTENED_8x4,
|
||||
FLATTENED_10x4,
|
||||
//For specific items
|
||||
TEACUP,
|
||||
TEAPOT,
|
||||
KNOT,
|
||||
POUCH,
|
||||
NEVERMELT,
|
||||
SCOPE,
|
||||
WIDE,
|
||||
ZOOM;
|
||||
|
||||
override fun getSerializedName(): String = this.name.lowercase()
|
||||
|
||||
companion object {
|
||||
val CODEC = StringRepresentable.fromEnum(::values)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
val CODEC: MapCodec<DecorativeItemBlock> = RecordCodecBuilder.mapCodec { it.group(
|
||||
propertiesCodec(),
|
||||
DecorativeItemBlockType.CODEC.fieldOf("type").forGetter(DecorativeItemBlock::type)
|
||||
).apply(it, ::DecorativeItemBlock) }
|
||||
|
||||
val CENTERED_8x = Shapes.box(0.25, 0.0, 0.25, 0.75, 0.5, 0.75)
|
||||
val CENTERED_6x = Shapes.box(0.3125, 0.0, 0.3125, 0.6875, 0.375, 0.6875)
|
||||
val FLAT6_HITBOX = Shapes.box(0.25, 0.0, 0.25, 0.75, 0.375, 0.75)
|
||||
val FLAT4_HITBOX = Shapes.box(0.25, 0.0, 0.25, 0.75, 0.25, 0.75)
|
||||
val SMOOSHED4_HITBOX = Shapes.box(0.1875, 0.0, 0.1875, 0.8125, 0.25, 0.8125)
|
||||
val TEACUP_HITBOX = Shapes.box(0.3125, 0.0, 0.3125, 0.6875, 0.25, 0.6875)
|
||||
val TEAPOT_HITBOX = Shapes.box(0.1875, 0.0, 0.1875, 0.8125, 0.625, 0.8125)
|
||||
val KNOT_HITBOX = Shapes.box(0.375, 0.0, 0.375, 0.75, 0.375, 0.75)
|
||||
val POUCH_HITBOX = Shapes.box(0.3125, 0.0, 0.3125, 0.6875, 0.3125, 0.6875)
|
||||
val NEVERMELT_HITBOX = Shapes.box(0.25, 0.0, 0.3125, 0.6875, 0.25, 0.75)
|
||||
val SCOPE_HITBOX = Shapes.box(0.625, 0.0, 0.4375, 0.9375, 0.125, 0.75)
|
||||
val WIDE_HITBOX = Shapes.box(0.625, 0.0, 0.125, 0.9375, 0.0625, 0.625)
|
||||
val ZOOM_HITBOX = Shapes.box(0.125, 0.0, 0.1875, 0.375, 0.1875, 0.5)
|
||||
|
||||
fun getShape(type: DecorativeItemBlockType): VoxelShape {
|
||||
return when (type) {
|
||||
DecorativeItemBlockType.TEAPOT -> TEAPOT_HITBOX
|
||||
DecorativeItemBlockType.TEACUP -> TEACUP_HITBOX
|
||||
DecorativeItemBlockType.KNOT -> KNOT_HITBOX
|
||||
DecorativeItemBlockType.POUCH -> POUCH_HITBOX
|
||||
DecorativeItemBlockType.NEVERMELT -> NEVERMELT_HITBOX
|
||||
DecorativeItemBlockType.SCOPE -> SCOPE_HITBOX
|
||||
DecorativeItemBlockType.WIDE -> WIDE_HITBOX
|
||||
DecorativeItemBlockType.ZOOM -> ZOOM_HITBOX
|
||||
DecorativeItemBlockType.FLATTENED_10x4 -> SMOOSHED4_HITBOX
|
||||
DecorativeItemBlockType.FLATTENED_8x4 -> FLAT4_HITBOX
|
||||
DecorativeItemBlockType.FLATTENED_8x6 -> FLAT6_HITBOX
|
||||
DecorativeItemBlockType.CENTERED_6x -> CENTERED_6x
|
||||
else -> CENTERED_8x
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
registerDefaultState(stateDefinition.any()
|
||||
.setValue(HORIZONTAL_FACING, Direction.NORTH)
|
||||
.setValue(WATERLOGGED, false))
|
||||
}
|
||||
|
||||
override fun codec(): MapCodec<DecorativeItemBlock> = CODEC
|
||||
|
||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||
builder.add(HORIZONTAL_FACING, WATERLOGGED)
|
||||
}
|
||||
|
||||
override fun getFluidState(blockState: BlockState): FluidState? = if (blockState.getValue(WATERLOGGED)) Fluids.WATER.getSource(false) else super.getFluidState(blockState)
|
||||
|
||||
override fun updateShape(state: BlockState, direction: Direction, neighborState: BlockState, world: LevelAccessor, pos: BlockPos, neighborPos: BlockPos): BlockState {
|
||||
if (state.getValue(WATERLOGGED)) {
|
||||
world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world))
|
||||
}
|
||||
return if (state.getValue(HORIZONTAL_FACING).opposite == direction && !state.canSurvive(world, pos)) Blocks.AIR.defaultBlockState()
|
||||
else super.updateShape(state, direction, neighborState, world, pos, neighborPos)
|
||||
}
|
||||
|
||||
override fun getShape(state: BlockState, level: BlockGetter, pos: BlockPos, context: CollisionContext): VoxelShape {
|
||||
val direction = state.getValue(HORIZONTAL_FACING)
|
||||
return rotateShape(Direction.NORTH, direction, getShape(type))
|
||||
}
|
||||
|
||||
override fun getStateForPlacement(context: BlockPlaceContext): BlockState? {
|
||||
val fluidState = context.level.getFluidState(context.clickedPos)
|
||||
return super.getStateForPlacement(context)?.setValue(HORIZONTAL_FACING, context.horizontalDirection.opposite)?.setValue(WATERLOGGED, fluidState.type === Fluids.WATER)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.block
|
||||
|
||||
import com.cobblemon.mod.common.util.rotateShape
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.Direction
|
||||
import net.minecraft.world.item.context.BlockPlaceContext
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.LevelAccessor
|
||||
import net.minecraft.world.level.LevelReader
|
||||
import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.level.block.Blocks
|
||||
import net.minecraft.world.level.block.ButtonBlock
|
||||
import net.minecraft.world.level.block.SimpleWaterloggedBlock
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.block.state.properties.AttachFace
|
||||
import net.minecraft.world.level.block.state.properties.BlockSetType
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties.WATERLOGGED
|
||||
import net.minecraft.world.level.material.FluidState
|
||||
import net.minecraft.world.level.material.Fluids
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.Shapes
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
|
||||
class EjectButtonBlock(properties: Properties, ticksToStayPressed: Int) : ButtonBlock(BlockSetType.IRON, ticksToStayPressed, properties), SimpleWaterloggedBlock {
|
||||
companion object {
|
||||
val FLOOR_UNPOWERED = Shapes.or(
|
||||
Shapes.box(0.125, 0.0, 0.125, 0.875, 0.1875, 0.875),
|
||||
Shapes.box(0.375, 0.1875, 0.375, 0.625, 0.3125, 0.625) )
|
||||
val FLOOR_POWERED = Shapes.or(
|
||||
Shapes.box(0.125, 0.0, 0.125, 0.875, 0.1875, 0.875),
|
||||
Shapes.box(0.375, 0.1875, 0.375, 0.625, 0.25, 0.625) )
|
||||
val FLOOR_PANEL = Shapes.box(0.125, 0.0, 0.125, 0.875, 0.1875, 0.875)
|
||||
val CEILING_UNPOWERED = Shapes.or(
|
||||
Shapes.box(0.125, 0.8125, 0.125, 0.875, 1.0, 0.875),
|
||||
Shapes.box(0.375, 0.6875, 0.375, 0.625, 0.8125, 0.625) )
|
||||
val CEILING_POWERED = Shapes.or(
|
||||
Shapes.box(0.125, 0.8125, 0.125, 0.875, 1.0, 0.875),
|
||||
Shapes.box(0.375, 0.75, 0.375, 0.625, 0.8125, 0.625) )
|
||||
val CEILING_PANEL = Shapes.box(0.125, 0.8125, 0.125, 0.875, 1.0, 0.875)
|
||||
val WALL_UNPOWERED = Shapes.or(
|
||||
Shapes.box(0.125, 0.125, 0.8125, 0.875, 0.875, 1.0),
|
||||
Shapes.box(0.375, 0.375, 0.6875, 0.625, 0.625, 0.8125) )
|
||||
val WALL_POWERED = Shapes.or(
|
||||
Shapes.box(0.125, 0.125, 0.8125, 0.875, 0.875, 1.0),
|
||||
Shapes.box(0.375, 0.375, 0.75, 0.625, 0.625, 0.8125) )
|
||||
val WALL_PANEL = Shapes.box(0.125, 0.125, 0.8125, 0.875, 0.875, 1.0)
|
||||
}
|
||||
|
||||
init {
|
||||
registerDefaultState(stateDefinition.any()
|
||||
.setValue(FACING, Direction.NORTH)
|
||||
.setValue(FACE, AttachFace.WALL)
|
||||
.setValue(POWERED, false)
|
||||
.setValue(WATERLOGGED, false)
|
||||
)
|
||||
}
|
||||
|
||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||
builder.add(FACING, FACE, POWERED, WATERLOGGED)
|
||||
}
|
||||
|
||||
override fun getFluidState(blockState: BlockState): FluidState? {
|
||||
return if (blockState.getValue(WATERLOGGED)) Fluids.WATER.getSource(false) else super.getFluidState(blockState);
|
||||
}
|
||||
|
||||
override fun getStateForPlacement(context: BlockPlaceContext): BlockState? {
|
||||
val fluidState = context.level.getFluidState(context.clickedPos)
|
||||
for (direction in context.nearestLookingDirections) {
|
||||
val blockState: BlockState
|
||||
if (direction.getAxis() === Direction.Axis.Y) {
|
||||
blockState = (defaultBlockState()
|
||||
.setValue(FACE, if (direction == Direction.UP) AttachFace.CEILING else AttachFace.FLOOR) as BlockState)
|
||||
.setValue(FACING, context.horizontalDirection.opposite)
|
||||
.setValue(WATERLOGGED, fluidState.type === Fluids.WATER
|
||||
) as BlockState
|
||||
} else {
|
||||
blockState = (defaultBlockState()
|
||||
.setValue(FACE, AttachFace.WALL) as BlockState)
|
||||
.setValue(FACING, direction.opposite)
|
||||
.setValue(WATERLOGGED, fluidState.type === Fluids.WATER
|
||||
) as BlockState
|
||||
}
|
||||
if (blockState.canSurvive(context.getLevel(), context.getClickedPos())) {
|
||||
return blockState
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getShape(state: BlockState, blockGetter: BlockGetter, pos: BlockPos, collisionContext: CollisionContext): VoxelShape {
|
||||
val direction = state.getValue(FACING)
|
||||
return when (state.getValue(FACE)) {
|
||||
AttachFace.FLOOR -> if (state.getValue(POWERED)) {FLOOR_POWERED} else {FLOOR_UNPOWERED}
|
||||
AttachFace.WALL ->
|
||||
when (direction) {
|
||||
Direction.NORTH, Direction.UP, Direction.DOWN -> if (state.getValue(POWERED)) {WALL_POWERED} else {WALL_UNPOWERED}
|
||||
else -> rotateShape(Direction.NORTH, direction, if (state.getValue(POWERED)) {WALL_POWERED} else {WALL_UNPOWERED})
|
||||
}
|
||||
AttachFace.CEILING -> if (state.getValue(POWERED)) {CEILING_POWERED} else {CEILING_UNPOWERED}
|
||||
}
|
||||
}
|
||||
override fun getCollisionShape(state: BlockState, level: BlockGetter, pos: BlockPos, context: CollisionContext): VoxelShape {
|
||||
val direction = state.getValue(FACING)
|
||||
return when (state.getValue(FACE)) {
|
||||
AttachFace.FLOOR -> FLOOR_PANEL
|
||||
AttachFace.WALL -> when (direction) {
|
||||
Direction.NORTH, Direction.UP, Direction.DOWN -> WALL_PANEL
|
||||
else -> rotateShape(Direction.NORTH, direction, WALL_PANEL)
|
||||
}
|
||||
AttachFace.CEILING -> CEILING_PANEL
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateShape(state: BlockState, direction: Direction, neighborState: BlockState, world: LevelAccessor, pos: BlockPos, neighborPos: BlockPos): BlockState {
|
||||
if (state.getValue(WATERLOGGED)) {
|
||||
world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world))
|
||||
}
|
||||
return if (getConnectedDirection(state).opposite == direction && !state.canSurvive(world, pos)) Blocks.AIR.defaultBlockState()
|
||||
else super.updateShape(state, direction, neighborState, world, pos, neighborPos)
|
||||
}
|
||||
|
||||
override fun canSurvive(state: BlockState, level: LevelReader, pos: BlockPos): Boolean {
|
||||
return if (state.getValue(FACE) != AttachFace.WALL) {
|
||||
val direction = getConnectedDirection(state)
|
||||
canSupportCenter(level, pos.relative(direction.opposite), direction)
|
||||
} else {
|
||||
level.getBlockState(pos.relative(state.getValue(FACING).opposite)).isSolid
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.block
|
||||
|
||||
import com.cobblemon.mod.common.util.rotateShape
|
||||
import com.mojang.serialization.MapCodec
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.Direction
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.properties.AttachFace
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties.WATERLOGGED
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.Shapes
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
|
||||
class GalaricaWreathBlock(properties: Properties) : SixFaceRotationalBlock(properties) {
|
||||
companion object {
|
||||
val CODEC: MapCodec<GalaricaWreathBlock> = RecordCodecBuilder.mapCodec {
|
||||
it.group(propertiesCodec()).apply(it, ::GalaricaWreathBlock)
|
||||
}
|
||||
|
||||
val FLOOR_NORTH = Shapes.box(0.125, 0.0, 0.125, 0.875, 0.25, 0.875)
|
||||
val WALL_NORTH = Shapes.box(0.125, 0.125, 0.75, 0.875, 0.875, 1.0)
|
||||
val CEILING_NORTH = Shapes.box(0.125, 0.125, 0.375, 0.875, 0.625, 0.5625)
|
||||
}
|
||||
|
||||
init {
|
||||
registerDefaultState(stateDefinition.any()
|
||||
.setValue(FACING, Direction.NORTH)
|
||||
.setValue(FACE, AttachFace.WALL)
|
||||
.setValue(WATERLOGGED, false)
|
||||
)
|
||||
}
|
||||
|
||||
override fun codec(): MapCodec<GalaricaWreathBlock> = CODEC
|
||||
|
||||
override fun getShape(state: BlockState, blockGetter: BlockGetter, pos: BlockPos, collisionContext: CollisionContext): VoxelShape {
|
||||
val direction = state.getValue(FACING)
|
||||
return when (state.getValue(FACE)) {
|
||||
AttachFace.FLOOR ->
|
||||
if (direction.axis === Direction.Axis.X) {
|
||||
rotateShape(Direction.NORTH, Direction.WEST, FLOOR_NORTH)
|
||||
} else FLOOR_NORTH
|
||||
AttachFace.WALL ->
|
||||
when (direction) {
|
||||
Direction.NORTH, Direction.UP, Direction.DOWN -> WALL_NORTH
|
||||
else -> rotateShape(Direction.NORTH, direction, WALL_NORTH)
|
||||
}
|
||||
AttachFace.CEILING ->
|
||||
if (direction.axis === Direction.Axis.X) {
|
||||
rotateShape(Direction.NORTH, Direction.WEST, CEILING_NORTH)
|
||||
} else CEILING_NORTH
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.block
|
||||
|
||||
import com.cobblemon.mod.common.util.rotateShape
|
||||
import com.mojang.serialization.MapCodec
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.Direction
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.LevelReader
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.properties.AttachFace
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties.WATERLOGGED
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.Shapes
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
|
||||
class MagnetBlock(properties: Properties) : SixFaceRotationalBlock(properties) {
|
||||
companion object {
|
||||
val CODEC: MapCodec<MagnetBlock> = RecordCodecBuilder.mapCodec {
|
||||
it.group(propertiesCodec()).apply(it, ::MagnetBlock)
|
||||
}
|
||||
|
||||
val FLOOR_NORTH = Shapes.box(0.25, 0.0, 0.25, 0.75, 0.1875, 0.75)
|
||||
val WALL_NORTH = Shapes.box(0.25, 0.25, 0.8125, 0.75, 0.75, 1.0)
|
||||
val CEILING_NORTH = Shapes.box(0.25, 0.8125, 0.25, 0.75, 1.0, 0.75)
|
||||
}
|
||||
|
||||
init {
|
||||
registerDefaultState(stateDefinition.any()
|
||||
.setValue(FACING, Direction.NORTH)
|
||||
.setValue(FACE, AttachFace.WALL)
|
||||
.setValue(WATERLOGGED, false)
|
||||
)
|
||||
}
|
||||
|
||||
override fun codec(): MapCodec<MagnetBlock> = CODEC
|
||||
|
||||
override fun getShape(state: BlockState, blockGetter: BlockGetter, pos: BlockPos, collisionContext: CollisionContext): VoxelShape {
|
||||
val direction = state.getValue(FACING)
|
||||
return when (state.getValue(FACE)) {
|
||||
AttachFace.FLOOR ->
|
||||
if (direction.axis === Direction.Axis.X) {
|
||||
rotateShape(Direction.NORTH, Direction.WEST, FLOOR_NORTH)
|
||||
} else FLOOR_NORTH
|
||||
AttachFace.WALL ->
|
||||
when (direction) {
|
||||
Direction.NORTH, Direction.UP, Direction.DOWN -> WALL_NORTH
|
||||
else -> rotateShape(Direction.NORTH, direction, WALL_NORTH)
|
||||
}
|
||||
AttachFace.CEILING ->
|
||||
if (direction.axis === Direction.Axis.X) {
|
||||
rotateShape(Direction.NORTH, Direction.WEST, CEILING_NORTH)
|
||||
} else CEILING_NORTH
|
||||
}
|
||||
}
|
||||
|
||||
override fun canSurvive(state: BlockState, level: LevelReader, pos: BlockPos): Boolean {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.block
|
||||
|
||||
import com.cobblemon.mod.common.util.rotateShape
|
||||
import com.mojang.serialization.MapCodec
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.Direction
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.LevelReader
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.properties.AttachFace
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties.WATERLOGGED
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.Shapes
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
|
||||
class OrbBlock(properties: Properties) : SixFaceRotationalBlock(properties) {
|
||||
companion object {
|
||||
val CODEC: MapCodec<OrbBlock> = RecordCodecBuilder.mapCodec {
|
||||
it.group(propertiesCodec()).apply(it, ::OrbBlock)
|
||||
}
|
||||
|
||||
val FLOOR_NORTH = Shapes.box(0.3125, 0.0, 0.3125, 0.6875, 0.375, 0.6875)
|
||||
val WALL_NORTH = Shapes.box(0.3125, 0.3125, 0.625, 0.6875, 0.6875, 1.0)
|
||||
val CEILING_NORTH = Shapes.box(0.3125, 0.625, 0.375, 0.6875, 1.0, 0.6875)
|
||||
}
|
||||
|
||||
init {
|
||||
registerDefaultState(stateDefinition.any()
|
||||
.setValue(FACING, Direction.NORTH)
|
||||
.setValue(FACE, AttachFace.WALL)
|
||||
.setValue(WATERLOGGED, false)
|
||||
)
|
||||
}
|
||||
|
||||
override fun codec(): MapCodec<OrbBlock> = CODEC
|
||||
|
||||
override fun getShape(state: BlockState, blockGetter: BlockGetter, pos: BlockPos, collisionContext: CollisionContext): VoxelShape {
|
||||
val direction = state.getValue(FACING)
|
||||
return when (state.getValue(FACE)) {
|
||||
AttachFace.FLOOR ->
|
||||
if (direction.axis === Direction.Axis.X) {
|
||||
rotateShape(Direction.NORTH, Direction.WEST, FLOOR_NORTH)
|
||||
} else FLOOR_NORTH
|
||||
AttachFace.WALL ->
|
||||
when (direction) {
|
||||
Direction.NORTH, Direction.UP, Direction.DOWN -> WALL_NORTH
|
||||
else -> rotateShape(Direction.NORTH, direction, WALL_NORTH)
|
||||
}
|
||||
AttachFace.CEILING ->
|
||||
if (direction.axis === Direction.Axis.X) {
|
||||
rotateShape(Direction.NORTH, Direction.WEST, CEILING_NORTH)
|
||||
} else CEILING_NORTH
|
||||
}
|
||||
}
|
||||
|
||||
override fun canSurvive(state: BlockState, level: LevelReader, pos: BlockPos): Boolean {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -13,25 +13,15 @@ import com.mojang.serialization.MapCodec
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.Direction
|
||||
import net.minecraft.world.item.context.BlockPlaceContext
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.LevelAccessor
|
||||
import net.minecraft.world.level.LevelReader
|
||||
import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.level.block.Blocks
|
||||
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock
|
||||
import net.minecraft.world.level.block.SimpleWaterloggedBlock
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.block.state.properties.AttachFace
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties.WATERLOGGED
|
||||
import net.minecraft.world.level.material.FluidState
|
||||
import net.minecraft.world.level.material.Fluids
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.Shapes
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
|
||||
class PlaqueBlock(properties : Properties) : FaceAttachedHorizontalDirectionalBlock(properties), SimpleWaterloggedBlock {
|
||||
class PlaqueBlock(properties : Properties) : SixFaceRotationalBlock(properties) {
|
||||
companion object {
|
||||
val CODEC: MapCodec<PlaqueBlock> = RecordCodecBuilder.mapCodec {
|
||||
it.group(propertiesCodec()).apply(it, ::PlaqueBlock)
|
||||
@@ -54,40 +44,6 @@ class PlaqueBlock(properties : Properties) : FaceAttachedHorizontalDirectionalBl
|
||||
)
|
||||
}
|
||||
|
||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||
builder.add(FACING, FACE, WATERLOGGED)
|
||||
}
|
||||
|
||||
override fun getFluidState(blockState: BlockState): FluidState? {
|
||||
return if (blockState.getValue(WATERLOGGED)) Fluids.WATER.getSource(false) else super.getFluidState(blockState);
|
||||
}
|
||||
|
||||
override fun getStateForPlacement(context: BlockPlaceContext): BlockState? {
|
||||
val fluidState = context.level.getFluidState(context.clickedPos)
|
||||
for (direction in context.nearestLookingDirections) {
|
||||
val blockState: BlockState
|
||||
if (direction.getAxis() === Direction.Axis.Y) {
|
||||
blockState = (defaultBlockState()
|
||||
.setValue(FACE, if (direction == Direction.UP) AttachFace.CEILING else AttachFace.FLOOR) as BlockState)
|
||||
.setValue(FACING, context.horizontalDirection.opposite)
|
||||
.setValue(WATERLOGGED, fluidState.type === Fluids.WATER
|
||||
) as BlockState
|
||||
} else {
|
||||
blockState = (defaultBlockState()
|
||||
.setValue(FACE, AttachFace.WALL) as BlockState)
|
||||
.setValue(FACING, direction.opposite)
|
||||
.setValue(WATERLOGGED, fluidState.type === Fluids.WATER
|
||||
) as BlockState
|
||||
|
||||
}
|
||||
|
||||
if (blockState.canSurvive(context.getLevel(), context.getClickedPos())) {
|
||||
return blockState
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun codec(): MapCodec<PlaqueBlock> = CODEC
|
||||
|
||||
override fun getShape(state: BlockState, blockGetter: BlockGetter, pos: BlockPos, collisionContext: CollisionContext): VoxelShape {
|
||||
@@ -108,21 +64,4 @@ class PlaqueBlock(properties : Properties) : FaceAttachedHorizontalDirectionalBl
|
||||
} else CEILING_NORTH
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateShape(state: BlockState, direction: Direction, neighborState: BlockState, world: LevelAccessor, pos: BlockPos, neighborPos: BlockPos): BlockState {
|
||||
if (state.getValue(WATERLOGGED)) {
|
||||
world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world))
|
||||
}
|
||||
return if (getConnectedDirection(state).opposite == direction && !state.canSurvive(world, pos)) Blocks.AIR.defaultBlockState()
|
||||
else super.updateShape(state, direction, neighborState, world, pos, neighborPos)
|
||||
}
|
||||
|
||||
override fun canSurvive(state: BlockState, level: LevelReader, pos: BlockPos): Boolean {
|
||||
return if (state.getValue(FACE) == AttachFace.CEILING) {
|
||||
val direction = getConnectedDirection(state)
|
||||
canSupportCenter(level, pos.relative(direction.opposite), direction)
|
||||
} else {
|
||||
super.canSurvive(state, level, pos)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.block.decor
|
||||
|
||||
import com.mojang.serialization.MapCodec
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.Direction
|
||||
import net.minecraft.world.item.context.BlockPlaceContext
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.LevelAccessor
|
||||
import net.minecraft.world.level.LevelReader
|
||||
import net.minecraft.world.level.block.*
|
||||
import net.minecraft.world.level.block.HorizontalDirectionalBlock.FACING
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties.WATERLOGGED
|
||||
import net.minecraft.world.level.block.state.properties.Property
|
||||
import net.minecraft.world.level.material.FluidState
|
||||
import net.minecraft.world.level.material.Fluids
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.Shapes
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
|
||||
class RingTargetBlock(settings: Properties) : TargetBlock(settings), SimpleWaterloggedBlock {
|
||||
init {
|
||||
registerDefaultState(stateDefinition.any()
|
||||
.setValue(FACING, Direction.NORTH)
|
||||
.setValue(WATERLOGGED, false)
|
||||
.setValue(OUTPUT_POWER, 0))
|
||||
}
|
||||
|
||||
override fun getStateForPlacement(ctx: BlockPlaceContext): BlockState? {
|
||||
var blockState = defaultBlockState()
|
||||
.setValue(WATERLOGGED, ctx.level.getFluidState(ctx.clickedPos).type == Fluids.WATER)
|
||||
val worldView = ctx.level
|
||||
val blockPos = ctx.clickedPos
|
||||
ctx.nearestLookingDirections.forEach { direction ->
|
||||
if (direction.axis.isHorizontal) {
|
||||
blockState = blockState.setValue(FACING, direction.opposite) as BlockState
|
||||
if (blockState.canSurvive(worldView, blockPos)) {
|
||||
return blockState
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getFluidState(blockState: BlockState): FluidState? {
|
||||
return if (blockState.getValue(WATERLOGGED)) Fluids.WATER.getSource(false) else super.getFluidState(blockState)
|
||||
}
|
||||
|
||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||
builder.add(FACING)
|
||||
builder.add(WATERLOGGED)
|
||||
builder.add(*arrayOf<Property<*>>(OUTPUT_POWER))
|
||||
}
|
||||
|
||||
override fun getShape(
|
||||
state: BlockState,
|
||||
blockGetter: BlockGetter,
|
||||
pos: BlockPos,
|
||||
collisionContext: CollisionContext
|
||||
): VoxelShape {
|
||||
return when (state.getValue(FACING)) {
|
||||
Direction.SOUTH -> FULL_PLANE_SOUTH
|
||||
Direction.WEST -> FULL_PLANE_WEST
|
||||
Direction.EAST -> FULL_PLANE_EAST
|
||||
else -> FULL_PLANE_NORTH
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateShape(
|
||||
state: BlockState,
|
||||
direction: Direction,
|
||||
neighborState: BlockState,
|
||||
world: LevelAccessor,
|
||||
pos: BlockPos,
|
||||
neighborPos: BlockPos
|
||||
): BlockState {
|
||||
if (state.getValue(WATERLOGGED)) {
|
||||
world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world))
|
||||
}
|
||||
return if (direction.opposite == state.getValue(FACING) && !state.canSurvive(world, pos)) Blocks.AIR.defaultBlockState()
|
||||
else super.updateShape(state, direction, neighborState, world, pos, neighborPos)
|
||||
}
|
||||
|
||||
override fun rotate(state: BlockState, rotation: Rotation): BlockState {
|
||||
return state.setValue(FACING, rotation.rotate(state.getValue(FACING)))
|
||||
}
|
||||
|
||||
override fun canSurvive(state: BlockState, level: LevelReader, pos: BlockPos): Boolean {
|
||||
return level.getBlockState(pos.relative(state.getValue(FACING).opposite)).isSolid
|
||||
}
|
||||
|
||||
companion object {
|
||||
val CODEC: MapCodec<RingTargetBlock> = RecordCodecBuilder.mapCodec {
|
||||
it.group(
|
||||
propertiesCodec()
|
||||
).apply(it, ::RingTargetBlock) }
|
||||
|
||||
val OUTPUT_POWER = BlockStateProperties.POWER;
|
||||
|
||||
val FULL_PLANE_NORTH = Shapes.box(0.0, 0.0, 0.925, 1.0, 1.0, 1.0)
|
||||
val FULL_PLANE_WEST = Shapes.box(0.925, 0.0, 0.0, 1.0, 1.0, 1.0)
|
||||
val FULL_PLANE_SOUTH = Shapes.box(0.0, 0.0, 0.0, 1.0, 1.0, 0.075)
|
||||
val FULL_PLANE_EAST = Shapes.box(0.0, 0.0, 0.0, 0.075, 1.0, 1.0)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.block
|
||||
|
||||
import com.mojang.serialization.MapCodec
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.Direction
|
||||
import net.minecraft.world.item.context.BlockPlaceContext
|
||||
import net.minecraft.world.level.LevelAccessor
|
||||
import net.minecraft.world.level.LevelReader
|
||||
import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.level.block.Blocks
|
||||
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock
|
||||
import net.minecraft.world.level.block.SimpleWaterloggedBlock
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.block.state.properties.AttachFace
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties.WATERLOGGED
|
||||
import net.minecraft.world.level.material.FluidState
|
||||
import net.minecraft.world.level.material.Fluids
|
||||
|
||||
open class SixFaceRotationalBlock(properties : Properties) : FaceAttachedHorizontalDirectionalBlock(properties), SimpleWaterloggedBlock {
|
||||
companion object {
|
||||
val CODEC = simpleCodec(::SixFaceRotationalBlock)
|
||||
}
|
||||
|
||||
override fun codec(): MapCodec<out SixFaceRotationalBlock> = CODEC
|
||||
|
||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
||||
builder.add(FACING, FACE, WATERLOGGED)
|
||||
}
|
||||
|
||||
override fun getFluidState(blockState: BlockState): FluidState? {
|
||||
return if (blockState.getValue(WATERLOGGED)) Fluids.WATER.getSource(false) else super.getFluidState(blockState);
|
||||
}
|
||||
|
||||
override fun getStateForPlacement(context: BlockPlaceContext): BlockState? {
|
||||
val fluidState = context.level.getFluidState(context.clickedPos)
|
||||
for (direction in context.nearestLookingDirections) {
|
||||
val blockState: BlockState
|
||||
if (direction.getAxis() === Direction.Axis.Y) {
|
||||
blockState = (defaultBlockState()
|
||||
.setValue(FACE, if (direction == Direction.UP) AttachFace.CEILING else AttachFace.FLOOR) as BlockState)
|
||||
.setValue(FACING, context.horizontalDirection.opposite)
|
||||
.setValue(WATERLOGGED, fluidState.type === Fluids.WATER
|
||||
) as BlockState
|
||||
} else {
|
||||
blockState = (defaultBlockState()
|
||||
.setValue(FACE, AttachFace.WALL) as BlockState)
|
||||
.setValue(FACING, direction.opposite)
|
||||
.setValue(WATERLOGGED, fluidState.type === Fluids.WATER
|
||||
) as BlockState
|
||||
|
||||
}
|
||||
|
||||
if (blockState.canSurvive(context.getLevel(), context.getClickedPos())) {
|
||||
return blockState
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun updateShape(state: BlockState, direction: Direction, neighborState: BlockState, world: LevelAccessor, pos: BlockPos, neighborPos: BlockPos): BlockState {
|
||||
if (state.getValue(WATERLOGGED)) {
|
||||
world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world))
|
||||
}
|
||||
return if (getConnectedDirection(state).opposite == direction && !state.canSurvive(world, pos)) Blocks.AIR.defaultBlockState()
|
||||
else super.updateShape(state, direction, neighborState, world, pos, neighborPos)
|
||||
}
|
||||
|
||||
override fun canSurvive(state: BlockState, level: LevelReader, pos: BlockPos): Boolean {
|
||||
return if (state.getValue(FACE) == AttachFace.CEILING) {
|
||||
val direction = getConnectedDirection(state)
|
||||
canSupportCenter(level, pos.relative(direction.opposite), direction)
|
||||
} else if (state.getValue(FACE) == AttachFace.WALL) {
|
||||
level.getBlockState(pos.relative(state.getValue(FACING).opposite)).isSolid
|
||||
} else {
|
||||
super.canSurvive(state, level, pos)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,13 @@ class StackableItemBlock(settings: Properties, val type: StackableItemBlockType)
|
||||
ETHER,
|
||||
MAX_POTION,
|
||||
POTION,
|
||||
STATUS_RESTORE;
|
||||
STATUS_RESTORE,
|
||||
VITAMIN,
|
||||
METAL_COAT,
|
||||
IRON_BALL,
|
||||
THROAT_SPRAY,
|
||||
UPGRADE,
|
||||
DICE;
|
||||
|
||||
override fun getSerializedName(): String = this.name.lowercase()
|
||||
|
||||
@@ -57,98 +63,78 @@ class StackableItemBlock(settings: Properties, val type: StackableItemBlockType)
|
||||
StackableItemBlockType.CODEC.fieldOf("type").forGetter(StackableItemBlock::type)
|
||||
).apply(it, ::StackableItemBlock) }
|
||||
|
||||
val northShapeMap: Map<StackableItemBlockType, List<VoxelShape>> = mapOf(
|
||||
StackableItemBlockType.BATTLE_ITEM to listOf(
|
||||
Shapes.box(0.34375, 0.0, 0.34375, 0.65625, 0.4375, 0.65625),
|
||||
Shapes.or(
|
||||
Shapes.box(0.09375, 0.0, 0.34375, 0.40625, 0.4375, 0.65625),
|
||||
Shapes.box(0.59375, 0.0, 0.40625, 0.90625, 0.4375, 0.71875)
|
||||
val northShapeMap: Map<StackableItemBlockType, List<VoxelShape>>
|
||||
get() = mapOf(
|
||||
StackableItemBlockType.BATTLE_ITEM to listOf(
|
||||
Shapes.box(0.34375, 0.0, 0.34375, 0.65625, 0.4375, 0.65625),
|
||||
Shapes.box(0.09375, 0.0, 0.34375, 0.90625, 0.4375, 0.71875),
|
||||
Shapes.box(0.09375, 0.0, 0.09375, 0.90625, 0.4375, 0.90625),
|
||||
Shapes.box(0.09375, 0.0, 0.09375, 0.96875, 0.4375, 0.90625)
|
||||
),
|
||||
Shapes.or(
|
||||
Shapes.box(0.59375, 0.0, 0.59375, 0.90625, 0.4375, 0.90625),
|
||||
Shapes.box(0.09375, 0.0, 0.53125, 0.40625, 0.4375, 0.84375),
|
||||
Shapes.box(0.34375, 0.0, 0.09375, 0.65625, 0.4375, 0.40625)
|
||||
StackableItemBlockType.ETHER to listOf(
|
||||
Shapes.box(0.375, 0.0, 0.3125, 0.625, 0.5, 0.6875),
|
||||
Shapes.box(0.125, 0.0, 0.3125, 0.875, 0.5, 0.75),
|
||||
Shapes.box(0.125, 0.0, 0.125, 0.875, 0.5, 1.0),
|
||||
Shapes.box(0.125, 0.0, 0.0625, 0.9375, 0.5, 1.0)
|
||||
),
|
||||
Shapes.or(
|
||||
Shapes.box(0.09375, 0.0, 0.09375, 0.40625, 0.4375, 0.40625),
|
||||
Shapes.box(0.59375, 0.0, 0.15625, 0.90625, 0.4375, 0.46875),
|
||||
Shapes.box(0.65625, 0.0, 0.59375, 0.96875, 0.4375, 0.90625),
|
||||
Shapes.box(0.15625, 0.0, 0.53125, 0.46875, 0.4375, 0.84375)
|
||||
)
|
||||
),
|
||||
StackableItemBlockType.ETHER to listOf(
|
||||
Shapes.box(0.375, 0.0, 0.3125, 0.625, 0.5, 0.6875),
|
||||
Shapes.or(
|
||||
Shapes.box(0.625, 0.0, 0.375, 0.875, 0.5, 0.75),
|
||||
Shapes.box(0.125, 0.0, 0.3125, 0.375, 0.5, 0.6875)
|
||||
StackableItemBlockType.MAX_POTION to listOf(
|
||||
Shapes.box(0.34375, 0.0, 0.3125, 0.65625, 0.5, 0.6875),
|
||||
Shapes.box(0.09375, 0.0, 0.3125, 0.90625, 0.5, 0.75),
|
||||
Shapes.box(0.09375, 0.0, 0.0625, 0.90625, 0.5, 1.0),
|
||||
Shapes.box(0.09375, 0.0, 0.0625, 0.96875, 0.5, 1.0)
|
||||
),
|
||||
Shapes.or(
|
||||
Shapes.box(0.375, 0.0, 0.125, 0.625, 0.5, 0.5),
|
||||
Shapes.box(0.125, 0.0, 0.5625, 0.375, 0.5, 0.9375),
|
||||
Shapes.box(0.625, 0.0, 0.625, 0.875, 0.5, 1.0)
|
||||
StackableItemBlockType.POTION to listOf(
|
||||
Shapes.box(0.375, 0.0, 0.3125, 0.625, 0.5625, 0.75),
|
||||
Shapes.box(0.125, 0.0, 0.3125, 0.875, 0.5625, 0.8125),
|
||||
Shapes.box(0.125, 0.0, 0.0625, 0.875, 0.5625, 1.0),
|
||||
Shapes.box(0.125, 0.0, 0.0, 0.9375, 0.5625, 1.0)
|
||||
),
|
||||
Shapes.or(
|
||||
Shapes.box(0.125, 0.0, 0.0625, 0.375, 0.5, 0.4375),
|
||||
Shapes.box(0.625, 0.0, 0.125, 0.875, 0.5, 0.5),
|
||||
Shapes.box(0.6875, 0.0, 0.625, 0.9375, 0.5, 1.0),
|
||||
Shapes.box(0.1875, 0.0, 0.5625, 0.4375, 0.5, 0.9375)
|
||||
)
|
||||
),
|
||||
StackableItemBlockType.MAX_POTION to listOf(
|
||||
Shapes.box(0.34375, 0.0, 0.3125, 0.65625, 0.5, 0.6875),
|
||||
Shapes.or(
|
||||
Shapes.box(0.09375, 0.0, 0.3125, 0.40625, 0.5, 0.6875),
|
||||
Shapes.box(0.59375, 0.0, 0.375, 0.90625, 0.5, 0.75)
|
||||
StackableItemBlockType.STATUS_RESTORE to listOf(
|
||||
Shapes.box(0.375, 0.0, 0.3125, 0.625, 0.4375, 0.6875),
|
||||
Shapes.box(0.125, 0.0, 0.3125, 0.875, 0.4375, 0.75),
|
||||
Shapes.box(0.125, 0.0, 0.0625, 0.875, 0.4375, 0.9375),
|
||||
Shapes.box(0.125, 0.0, 0.0, 0.9375, 0.4375, 0.9375)
|
||||
),
|
||||
Shapes.or(
|
||||
Shapes.box(0.34375, 0.0, 0.0625, 0.65625, 0.5, 0.4375),
|
||||
Shapes.box(0.09375, 0.0, 0.5625, 0.40625, 0.5, 0.9375),
|
||||
Shapes.box(0.59375, 0.0, 0.625, 0.90625, 0.5, 1.0)
|
||||
StackableItemBlockType.METAL_COAT to listOf(
|
||||
Shapes.box(0.3125, 0.0, 0.3125, 0.6875, 0.375, 0.6875),
|
||||
Shapes.box(0.125, 0.0, 0.125, 0.875, 0.375, 0.875),
|
||||
Shapes.box(0.125, 0.0, 0.0625, 0.9375, 0.375, 0.875),
|
||||
Shapes.box(0.0625, 0.0, 0.0625, 0.9375, 0.375, 0.9375)
|
||||
),
|
||||
Shapes.or(
|
||||
Shapes.box(0.09375, 0.0, 0.0625, 0.40625, 0.5, 0.4375),
|
||||
Shapes.box(0.15625, 0.0, 0.5625, 0.46875, 0.5, 0.9375),
|
||||
Shapes.box(0.65625, 0.0, 0.625, 0.96875, 0.5, 1.0),
|
||||
Shapes.box(0.59375, 0.0, 0.125, 0.90625, 0.5, 0.5)
|
||||
).singleEncompassing()
|
||||
),
|
||||
StackableItemBlockType.POTION to listOf(
|
||||
Shapes.box(0.375, 0.0, 0.3125, 0.625, 0.5625, 0.75),
|
||||
Shapes.or(
|
||||
Shapes.box(0.125, 0.0, 0.3125, 0.375, 0.5625, 0.75),
|
||||
Shapes.box(0.625, 0.0, 0.375, 0.875, 0.5625, 0.8125)
|
||||
StackableItemBlockType.VITAMIN to listOf(
|
||||
Shapes.box(0.375, 0.0, 0.375, 0.625, 0.4375, 0.625),
|
||||
Shapes.box(0.1875, 0.0, 0.3125, 0.8125, 0.4375, 0.6875),
|
||||
Shapes.box(0.1875, 0.0, 0.1875, 0.8125, 0.4375, 0.8125),
|
||||
Shapes.box(0.125, 0.0, 0.125, 0.875, 0.4375, 0.875)
|
||||
),
|
||||
Shapes.or(
|
||||
Shapes.box(0.375, 0.0, 0.0625, 0.625, 0.5625, 0.5),
|
||||
Shapes.box(0.625, 0.0, 0.5625, 0.875, 0.5625, 1.0),
|
||||
Shapes.box(0.125, 0.0, 0.5, 0.375, 0.5625, 0.9375)
|
||||
StackableItemBlockType.IRON_BALL to listOf(
|
||||
Shapes.box(0.25, 0.0, 0.25, 0.75, 0.4375, 0.75),
|
||||
Shapes.box(0.0, 0.0, 0.1875, 1.0, 0.4375, 0.8125),
|
||||
Shapes.box(0.0, 0.0, 0.0, 1.0, 0.4375, 1.0),
|
||||
Shapes.or(
|
||||
Shapes.box(0.0, 0.0, 0.0, 1.0, 0.4375, 1.0),
|
||||
Shapes.box(0.25, 0.4375, 0.3125, 0.6875, 0.875, 0.75)
|
||||
)
|
||||
),
|
||||
Shapes.or(
|
||||
Shapes.box(0.125, 0.0, 0.0, 0.375, 0.5625, 0.4375),
|
||||
Shapes.box(0.625, 0.0, 0.0625, 0.875, 0.5625, 0.5),
|
||||
Shapes.box(0.6875, 0.0, 0.5625, 0.9375, 0.5625, 1.0),
|
||||
Shapes.box(0.1875, 0.0, 0.5, 0.4375, 0.5625, 0.9375)
|
||||
)
|
||||
),
|
||||
StackableItemBlockType.STATUS_RESTORE to listOf(
|
||||
Shapes.box(0.375, 0.0, 0.3125, 0.625, 0.4375, 0.6875),
|
||||
Shapes.or(
|
||||
Shapes.box(0.125, 0.0, 0.3125, 0.375, 0.4375, 0.75),
|
||||
Shapes.box(0.625, 0.0, 0.375, 0.875, 0.4375, 0.75)
|
||||
StackableItemBlockType.THROAT_SPRAY to listOf(
|
||||
Shapes.box(0.375, 0.0, 0.1875, 0.625, 0.5625, 0.75),
|
||||
Shapes.box(0.125, 0.0, 0.1875, 0.875, 0.5625, 0.8125),
|
||||
Shapes.box(0.125, 0.0, 0.0, 0.875, 0.5625, 1.0),
|
||||
Shapes.box(0.075, 0.0, 0.0, 0.9375, 0.5625, 1.0)
|
||||
),
|
||||
Shapes.or(
|
||||
Shapes.box(0.125, 0.0, 0.5, 0.375, 0.4375, 0.875),
|
||||
Shapes.box(0.625, 0.0, 0.5625, 0.875, 0.4375, 0.9375),
|
||||
Shapes.box(0.375, 0.0, 0.0625, 0.625, 0.4375, 0.4375)
|
||||
StackableItemBlockType.UPGRADE to listOf(
|
||||
Shapes.box(0.3125, 0.0, 0.3125, 0.6875, 0.125, 0.6875),
|
||||
Shapes.box(0.3125, 0.0, 0.3125, 0.6875, 0.25, 0.6875),
|
||||
Shapes.box(0.3125, 0.0, 0.3125, 0.6875, 0.375, 0.6875),
|
||||
Shapes.box(0.3125, 0.0, 0.3125, 0.6875, 0.5, 0.6875)
|
||||
),
|
||||
Shapes.or(
|
||||
Shapes.box(0.1875, 0.0, 0.5, 0.4375, 0.4375, 0.875),
|
||||
Shapes.box(0.125, 0.0, 0.0, 0.375, 0.4375, 0.375),
|
||||
Shapes.box(0.625, 0.0, 0.0625, 0.875, 0.4375, 0.4375),
|
||||
Shapes.box(0.6875, 0.0, 0.5625, 0.9375, 0.4375, 0.9375)
|
||||
StackableItemBlockType.DICE to listOf(
|
||||
Shapes.box(0.125, 0.0, 0.6875, 0.3125, 0.1875, 0.875),
|
||||
Shapes.box(0.125, 0.0, 0.625, 0.5625, 0.1875, 0.875),
|
||||
Shapes.box(0.125, 0.0, 0.4375, 0.5625, 0.1875, 0.875),
|
||||
Shapes.box(0.125, 0.0, 0.4375, 0.5625, 0.375, 0.875)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
fun getShape(type: StackableItemBlockType, count: Int): VoxelShape = northShapeMap[type]?.let { list -> list[(count - 1).coerceIn(0, list.lastIndex)] } ?: Shapes.block()
|
||||
fun getMaxAmount(type: StackableItemBlockType): Int = min(northShapeMap[type]?.size ?: 1 , MAX_AMOUNT)
|
||||
@@ -184,7 +170,7 @@ class StackableItemBlock(settings: Properties, val type: StackableItemBlockType)
|
||||
}
|
||||
|
||||
override fun getShape(state: BlockState, level: BlockGetter, pos: BlockPos, context: CollisionContext): VoxelShape {
|
||||
return getCollisionShape(state, level, pos, context).singleEncompassing()
|
||||
return getCollisionShape(state, level, pos, context)
|
||||
}
|
||||
|
||||
override fun getStateForPlacement(context: BlockPlaceContext): BlockState? {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
package com.cobblemon.mod.common.block
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.CobblemonBlocks
|
||||
import com.cobblemon.mod.common.api.tags.CobblemonBlockTags
|
||||
import com.cobblemon.mod.common.block.TypeGemClusterBlock.Companion.SHOULD_GROW
|
||||
@@ -33,6 +34,9 @@ class TypeGemCoreBlock(properties: Properties) : Block(properties) {
|
||||
const val MIN_DISTANCE_BETWEEN_GEMS = 1
|
||||
const val CONTINUATION_CHANCE = 0.8f
|
||||
|
||||
// Upper safety check to prevent infinite loops
|
||||
const val MAX_FORCE_GROW_ATTEMPTS = 64
|
||||
|
||||
val BLOCK_TO_CLUSTER: Map<ResourceLocation, Block> by lazy {
|
||||
mapOf(
|
||||
ResourceLocation.parse("cobblemon:normal_gem_block") to CobblemonBlocks.TYPE_GEM_CLUSTER_NORMAL,
|
||||
@@ -112,13 +116,16 @@ class TypeGemCoreBlock(properties: Properties) : Block(properties) {
|
||||
fun forceGrow(level: WorldGenLevel, pos: BlockPos, random: RandomSource, percentage: Float) {
|
||||
val desiredLength = MAX_CONNECTED_GEMS * percentage
|
||||
|
||||
while (true) {
|
||||
val growInfo = grow(level, pos, random, true)
|
||||
val grown = growInfo.first
|
||||
val clusterSize = growInfo.second
|
||||
|
||||
if (!grown || clusterSize >= desiredLength) break
|
||||
repeat(MAX_FORCE_GROW_ATTEMPTS) {
|
||||
val (grown, clusterSize) = grow(level, pos, random, true)
|
||||
if (!grown || clusterSize >= desiredLength) return
|
||||
}
|
||||
|
||||
Cobblemon.LOGGER.warn(
|
||||
"Forced type gem growth at {} stopped after {} attempts without reaching its target size; keeping the partial formation.",
|
||||
pos,
|
||||
MAX_FORCE_GROW_ATTEMPTS
|
||||
)
|
||||
}
|
||||
|
||||
private fun grow(
|
||||
@@ -130,7 +137,7 @@ class TypeGemCoreBlock(properties: Properties) : Block(properties) {
|
||||
val connectedGems = getConnectedGemBlocks(level, pos) // maybe we can store this and access it for better performance? check for changes in list rather than checking each time grow is called? idk
|
||||
val gemCount = connectedGems.size
|
||||
val overLimit = gemCount >= MAX_CONNECTED_GEMS
|
||||
|
||||
|
||||
if (overLimit) {
|
||||
// if there is no open air pockets to grow any new clusters then exit early
|
||||
if (!hasBreathingRoom(level, connectedGems)) {
|
||||
@@ -165,6 +172,11 @@ class TypeGemCoreBlock(properties: Properties) : Block(properties) {
|
||||
|
||||
level.setBlock(targetPos, placeState, UPDATE_ALL)
|
||||
|
||||
// During world gen, the region silently discards writes into neighboring chunks that are already fully generated.
|
||||
// Through ImposterProtoChunk with writes set to disabled. Checks if the block is still air after the write and skips if so as it can't be filled.
|
||||
// Preventing infinite loops.
|
||||
if (!level.getBlockState(targetPos).`is`(clusterBlock)) continue
|
||||
|
||||
if (forced) {
|
||||
forceAdvanceClusterGrowth(level, targetPos, random)
|
||||
}
|
||||
@@ -210,4 +222,4 @@ class TypeGemCoreBlock(properties: Properties) : Block(properties) {
|
||||
}
|
||||
|
||||
override fun isRandomlyTicking(state: BlockState): Boolean = true
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import com.cobblemon.mod.common.api.storage.player.client.ClientPokedexManager
|
||||
import com.cobblemon.mod.common.api.storage.player.client.ClientTMMoveManager
|
||||
import com.cobblemon.mod.common.api.tags.CobblemonItemTags
|
||||
import com.cobblemon.mod.common.block.entity.TintBlockEntity
|
||||
import com.cobblemon.mod.common.block.sign.CobblemonSignBlock
|
||||
import com.cobblemon.mod.common.client.battle.ClientBattle
|
||||
import com.cobblemon.mod.common.client.gui.PartyOverlay
|
||||
import com.cobblemon.mod.common.client.gui.PartyOverlayDataControl
|
||||
@@ -238,6 +239,12 @@ object CobblemonClient {
|
||||
CobblemonBlocks.POKE_CAKE
|
||||
)
|
||||
|
||||
this.implementation.registerBlockRenderType(
|
||||
RenderType.translucent(),
|
||||
CobblemonBlocks.UPGRADE,
|
||||
CobblemonBlocks.DUBIOUS_DISC
|
||||
)
|
||||
|
||||
this.implementation.registerBlockRenderType(
|
||||
RenderType.cutout(),
|
||||
CobblemonBlocks.GILDED_CHEST,
|
||||
@@ -383,7 +390,31 @@ object CobblemonClient {
|
||||
CobblemonBlocks.X_SP_ATK,
|
||||
CobblemonBlocks.X_SP_DEF,
|
||||
CobblemonBlocks.X_SPEED,
|
||||
CobblemonBlocks.TM_MACHINE
|
||||
CobblemonBlocks.TM_MACHINE,
|
||||
|
||||
CobblemonBlocks.GALARICA_CUFF,
|
||||
CobblemonBlocks.GALARICA_WREATH,
|
||||
CobblemonBlocks.CHIPPED_POT,
|
||||
CobblemonBlocks.CRACKED_POT,
|
||||
CobblemonBlocks.UNREMARKABLE_TEACUP,
|
||||
CobblemonBlocks.MASTERPIECE_TEACUP,
|
||||
CobblemonBlocks.LUMINOUS_MOSS,
|
||||
CobblemonBlocks.ICY_ROCK,
|
||||
CobblemonBlocks.HEAT_ROCK,
|
||||
CobblemonBlocks.SMOOTH_ROCK,
|
||||
CobblemonBlocks.DAMP_ROCK,
|
||||
CobblemonBlocks.DESTINY_KNOT,
|
||||
CobblemonBlocks.METRONOME,
|
||||
CobblemonBlocks.KINGS_ROCK,
|
||||
CobblemonBlocks.FLAME_ORB,
|
||||
CobblemonBlocks.LIFE_ORB,
|
||||
CobblemonBlocks.TOXIC_ORB,
|
||||
CobblemonBlocks.LIGHT_BALL,
|
||||
CobblemonBlocks.SMOKE_BALL,
|
||||
CobblemonBlocks.NEVER_MELT_ICE,
|
||||
CobblemonBlocks.WIDE_LENS,
|
||||
CobblemonBlocks.ZOOM_LENS,
|
||||
CobblemonBlocks.SCOPE_LENS
|
||||
)
|
||||
|
||||
this.createBoatModelLayers()
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ open class VariableObjectSelectionList(x: Int, y: Int, width: Int, height: Int):
|
||||
var stackHeight = -scrollAmount.toInt()
|
||||
guiGraphics.enableScissor(x, y, x + width, y + height)
|
||||
children.forEachIndexed { index, entry ->
|
||||
if (stackHeight in 1..<height || stackHeight + entry.height in 1..<height) {
|
||||
if (stackHeight < height && stackHeight + entry.height > 0) {
|
||||
entry.render(guiGraphics, index, x, y + stackHeight, mouseX, mouseY, partialTick)
|
||||
}
|
||||
stackHeight += entry.height
|
||||
|
||||
+4
-6
@@ -8,12 +8,10 @@
|
||||
|
||||
package com.cobblemon.mod.common.client.gui.startselection.widgets
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.CobblemonSounds
|
||||
import com.cobblemon.mod.common.api.gui.blitk
|
||||
import com.cobblemon.mod.common.api.text.bold
|
||||
import com.cobblemon.mod.common.client.gui.CobblemonRenderable
|
||||
import com.cobblemon.mod.common.client.gui.PokemonGUIAnimationStyle
|
||||
import com.cobblemon.mod.common.client.gui.VariableObjectSelectionList
|
||||
import com.cobblemon.mod.common.client.gui.drawProfilePokemon
|
||||
import com.cobblemon.mod.common.client.gui.startselection.StarterSelectionScreen
|
||||
@@ -29,12 +27,11 @@ import org.joml.Quaternionf
|
||||
import org.joml.Vector3f
|
||||
|
||||
class CategoryList(
|
||||
private val paneWidth: Int,
|
||||
private val paneHeight: Int,
|
||||
paneWidth: Int,
|
||||
paneHeight: Int,
|
||||
private val categories: List<RenderableStarterCategory>,
|
||||
val listX: Int,
|
||||
val listY: Int,
|
||||
private val minecraft: Minecraft = Minecraft.getInstance(),
|
||||
private val starterSelectionScreen: StarterSelectionScreen
|
||||
) : VariableObjectSelectionList(
|
||||
listX,
|
||||
@@ -70,7 +67,8 @@ class CategoryList(
|
||||
}
|
||||
|
||||
private fun createEntries() = categories.map { category ->
|
||||
val rows = (category.pokemon.size - 1) / 3 + 1
|
||||
val pokemonCount = category.pokemon.size - if (category.randomStarter) 0 else 1
|
||||
val rows = pokemonCount / 3 + 1
|
||||
val height = CONTAINER_BUTTON_SIZE * rows + BUTTON_SEPERATION * (rows + 1) + HEADER_HEIGHT + 3
|
||||
Category(category, height)
|
||||
}
|
||||
|
||||
+4
-1
@@ -21,7 +21,10 @@ object SetActiveTMPacketHandler : ServerNetworkPacketHandler<SetActiveTMPacket>
|
||||
val menu = player.containerMenu as? TMMachineMenu ?: return
|
||||
val tmData = Cobblemon.playerDataManager.getTMData(player)
|
||||
|
||||
if (packet.tm != null && (!packet.tm.isPassivelyObtained() && packet.tm.id !in tmData.learnedTMs)) {
|
||||
if (packet.tm != null
|
||||
&& !Cobblemon.config.unlockAllMoveDexMovesByDefault
|
||||
&& !packet.tm.isPassivelyObtained()
|
||||
&& packet.tm.id !in tmData.learnedTMs) {
|
||||
return // Hacker smh
|
||||
}
|
||||
|
||||
|
||||
+81
-20
@@ -40,7 +40,8 @@ import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.item.ItemStack
|
||||
|
||||
class PokemonOnShoulderRenderer<T : Player>(renderLayerParent: RenderLayerParent<T, PlayerModel<T>>) : RenderLayer<T, PlayerModel<T>>(renderLayerParent) {
|
||||
class PokemonOnShoulderRenderer<T : Player>(renderLayerParent: RenderLayerParent<T, PlayerModel<T>>) :
|
||||
RenderLayer<T, PlayerModel<T>>(renderLayerParent) {
|
||||
|
||||
val context = RenderContext().also {
|
||||
it.put(RenderContext.RENDER_STATE, RenderContext.RenderState.WORLD)
|
||||
@@ -68,19 +69,62 @@ class PokemonOnShoulderRenderer<T : Player>(renderLayerParent: RenderLayerParent
|
||||
// It's unclear why Minecraft's providing a partial ticks based on 60FPS regardless of the real FPS.
|
||||
// Whatever - the delta manager works correctly.
|
||||
val realPartialTicks = Minecraft.getInstance().timer.realtimeDeltaTicks
|
||||
this.render(matrixStack, buffer, packedLight, livingEntity, limbSwing, limbSwingAmount, realPartialTicks, ageInTicks, netHeadYaw, headPitch, true)
|
||||
this.render(matrixStack, buffer, packedLight, livingEntity, limbSwing, limbSwingAmount, realPartialTicks, ageInTicks, netHeadYaw, headPitch, false)
|
||||
this.render(
|
||||
matrixStack,
|
||||
buffer,
|
||||
packedLight,
|
||||
livingEntity,
|
||||
limbSwing,
|
||||
limbSwingAmount,
|
||||
realPartialTicks,
|
||||
ageInTicks,
|
||||
netHeadYaw,
|
||||
headPitch,
|
||||
true
|
||||
)
|
||||
this.render(
|
||||
matrixStack,
|
||||
buffer,
|
||||
packedLight,
|
||||
livingEntity,
|
||||
limbSwing,
|
||||
limbSwingAmount,
|
||||
realPartialTicks,
|
||||
ageInTicks,
|
||||
netHeadYaw,
|
||||
headPitch,
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
fun configureState(state: FloatingState, model: PosableModel, leftShoulder: Boolean, shoulderData: ShoulderData): FloatingState {
|
||||
fun configureState(
|
||||
state: FloatingState,
|
||||
model: PosableModel,
|
||||
leftShoulder: Boolean,
|
||||
shoulderData: ShoulderData
|
||||
): FloatingState {
|
||||
state.currentModel = model
|
||||
state.setPoseToFirstSuitable(if (leftShoulder) PoseType.SHOULDER_LEFT else PoseType.SHOULDER_RIGHT)
|
||||
|
||||
state.runtime.environment.query.addFunction("is_holding_item") { return@addFunction DoubleValue(shoulderData.shownItem.let {
|
||||
!it.isEmpty && !it.`is`(CobblemonItemTags.WEARABLE_HAT_ITEMS) && !it.`is`(CobblemonItemTags.WEARABLE_FACE_ITEMS)
|
||||
}) }
|
||||
state.runtime.environment.query.addFunction("is_wearing_hat") { return@addFunction DoubleValue(shoulderData.shownItem.`is`(CobblemonItemTags.WEARABLE_HAT_ITEMS)) }
|
||||
state.runtime.environment.query.addFunction("is_wearing_face") { return@addFunction DoubleValue(shoulderData.shownItem.`is`(CobblemonItemTags.WEARABLE_FACE_ITEMS)) }
|
||||
state.runtime.environment.query.addFunction("is_holding_item") {
|
||||
return@addFunction DoubleValue(shoulderData.shownItem.let {
|
||||
!it.isEmpty && !it.`is`(CobblemonItemTags.WEARABLE_HAT_ITEMS) && !it.`is`(CobblemonItemTags.WEARABLE_FACE_ITEMS)
|
||||
})
|
||||
}
|
||||
state.runtime.environment.query.addFunction("is_wearing_hat") {
|
||||
return@addFunction DoubleValue(
|
||||
shoulderData.shownItem.`is`(
|
||||
CobblemonItemTags.WEARABLE_HAT_ITEMS
|
||||
)
|
||||
)
|
||||
}
|
||||
state.runtime.environment.query.addFunction("is_wearing_face") {
|
||||
return@addFunction DoubleValue(
|
||||
shoulderData.shownItem.`is`(
|
||||
CobblemonItemTags.WEARABLE_FACE_ITEMS
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
return state
|
||||
}
|
||||
@@ -100,12 +144,12 @@ class PokemonOnShoulderRenderer<T : Player>(renderLayerParent: RenderLayerParent
|
||||
) {
|
||||
val compoundTag = if (pLeftShoulder) livingEntity.shoulderEntityLeft else livingEntity.shoulderEntityRight
|
||||
if (compoundTag.isPokemonEntity()) {
|
||||
livingEntity.level().profiler.push("shoulder_render_".plus(if(pLeftShoulder) "left" else "right"))
|
||||
livingEntity.level().profiler.push("shoulder_render_".plus(if (pLeftShoulder) "left" else "right"))
|
||||
val cache = playerCache.getOrPut(livingEntity.uuid) { ShoulderCache() }
|
||||
val shoulderData = shoulderDataFrom(compoundTag)
|
||||
if (pLeftShoulder) cache.lastKnownLeft = shoulderData else cache.lastKnownRight = shoulderData
|
||||
|
||||
if (shoulderData == null){
|
||||
if (shoulderData == null) {
|
||||
// Nothing to do
|
||||
return
|
||||
}
|
||||
@@ -137,11 +181,11 @@ class PokemonOnShoulderRenderer<T : Player>(renderLayerParent: RenderLayerParent
|
||||
matrixStack.scale(scale, scale, scale)
|
||||
matrixStack.translate(0f, 1.5f, 0f)
|
||||
|
||||
state = if (pLeftShoulder && shoulderData != lastRenderedLeft) {
|
||||
state = if (pLeftShoulder && !shoulderData.matches(lastRenderedLeft)) {
|
||||
leftState = configureState(state, model, true, shoulderData)
|
||||
lastRenderedLeft = shoulderData
|
||||
leftState
|
||||
} else if (!pLeftShoulder && shoulderData != lastRenderedRight) {
|
||||
} else if (!pLeftShoulder && !shoulderData.matches(lastRenderedRight)) {
|
||||
rightState = configureState(state, model, false, shoulderData)
|
||||
lastRenderedRight = shoulderData
|
||||
rightState
|
||||
@@ -151,7 +195,14 @@ class PokemonOnShoulderRenderer<T : Player>(renderLayerParent: RenderLayerParent
|
||||
state.updatePartialTicks(partialTicks)
|
||||
context.put(RenderContext.POSABLE_STATE, state)
|
||||
state.currentModel = model
|
||||
val vertexConsumer = buffer.getBuffer(RenderType.entityCutout(VaryingModelRepository.getTexture(shoulderData.species.resourceIdentifier, state)))
|
||||
val vertexConsumer = buffer.getBuffer(
|
||||
RenderType.entityCutout(
|
||||
VaryingModelRepository.getTexture(
|
||||
shoulderData.species.resourceIdentifier,
|
||||
state
|
||||
)
|
||||
)
|
||||
)
|
||||
val i = LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0f)
|
||||
|
||||
model.applyAnimations(
|
||||
@@ -164,7 +215,11 @@ class PokemonOnShoulderRenderer<T : Player>(renderLayerParent: RenderLayerParent
|
||||
ageInTicks = livingEntity.tickCount.toFloat()
|
||||
)
|
||||
model.render(context, matrixStack, vertexConsumer, packedLight, i, -0x1)
|
||||
model.withLayerContext(buffer, state, VaryingModelRepository.getLayers(shoulderData.species.resourceIdentifier, state)) {
|
||||
model.withLayerContext(
|
||||
buffer,
|
||||
state,
|
||||
VaryingModelRepository.getLayers(shoulderData.species.resourceIdentifier, state)
|
||||
) {
|
||||
model.render(context, matrixStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY, -0x1)
|
||||
}
|
||||
|
||||
@@ -179,8 +234,7 @@ class PokemonOnShoulderRenderer<T : Player>(renderLayerParent: RenderLayerParent
|
||||
model.setDefault()
|
||||
matrixStack.popPose()
|
||||
livingEntity.level().profiler.pop()
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
val entry = playerCache.getOrPut(livingEntity.uuid) { ShoulderCache() }
|
||||
if (pLeftShoulder) entry.lastKnownLeft = null else entry.lastKnownRight = null
|
||||
}
|
||||
@@ -191,14 +245,21 @@ class PokemonOnShoulderRenderer<T : Player>(renderLayerParent: RenderLayerParent
|
||||
var lastKnownRight: ShoulderData? = null
|
||||
)
|
||||
|
||||
data class ShoulderData(
|
||||
class ShoulderData(
|
||||
val uuid: UUID,
|
||||
val species: Species,
|
||||
val form: FormData,
|
||||
val aspects: Set<String>,
|
||||
val scaleModifier: Float,
|
||||
val shownItem: ItemStack
|
||||
)
|
||||
val shownItem: ItemStack,
|
||||
) {
|
||||
fun matches(other: ShoulderData?): Boolean = other != null
|
||||
&& uuid == other.uuid
|
||||
&& species == other.species
|
||||
&& form == other.form
|
||||
&& aspects == other.aspects
|
||||
&& shownItem.item == other.shownItem.item
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen5
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.QuadrupedWalkAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.QuadrupedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
import net.minecraft.client.model.geom.ModelPart
|
||||
import net.minecraft.world.phys.Vec3
|
||||
|
||||
class DeerlingModel(root: ModelPart) : PokemonPosableModel(root), HeadedFrame, QuadrupedFrame {
|
||||
override val rootPart = root.registerChildWithAllChildren("deerling")
|
||||
override val head = getPart("head")
|
||||
|
||||
override var portraitScale = 3.5F
|
||||
override var portraitTranslation = Vec3(-0.55, -1.1, 0.0)
|
||||
|
||||
override var profileScale = 1.0F
|
||||
override var profileTranslation = Vec3(0.0, 0.25, 0.0)
|
||||
|
||||
override val foreLeftLeg= getPart("leg_front_left")
|
||||
override val foreRightLeg = getPart("leg_front_right")
|
||||
override val hindLeftLeg = getPart("leg_back_left")
|
||||
override val hindRightLeg = getPart("leg_back_right")
|
||||
|
||||
lateinit var standing: Pose
|
||||
lateinit var walk: Pose
|
||||
|
||||
override fun registerPoses() {
|
||||
standing = registerPose(
|
||||
poseName = "standing",
|
||||
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES,
|
||||
animations = arrayOf(
|
||||
singleBoneLook(),
|
||||
// bedrock("deerling", "ground_idle")
|
||||
)
|
||||
)
|
||||
|
||||
walk = registerPose(
|
||||
poseName = "walk",
|
||||
poseTypes = PoseType.MOVING_POSES,
|
||||
animations = arrayOf(
|
||||
singleBoneLook(),
|
||||
QuadrupedWalkAnimation(this, periodMultiplier = 0.8F, amplitudeMultiplier = 0.8F)
|
||||
// bedrock("deerling", "ground_walk")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// override fun getFaintAnimation(
|
||||
// pokemonEntity: PokemonEntity,
|
||||
// state: PosableState<PokemonEntity>
|
||||
// ) = if (state.isPosedIn(standing, walk)) bedrockStateful("deerling", "faint") else null
|
||||
}
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen5
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.QuadrupedWalkAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.QuadrupedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
import net.minecraft.client.model.geom.ModelPart
|
||||
import net.minecraft.world.phys.Vec3
|
||||
|
||||
class SawsbuckModel(root: ModelPart) : PokemonPosableModel(root), HeadedFrame, QuadrupedFrame {
|
||||
override val rootPart = root.registerChildWithAllChildren("sawsbuck")
|
||||
override val head = getPart("head")
|
||||
|
||||
override var portraitScale = 2.0F
|
||||
override var portraitTranslation = Vec3(-0.5, 1.1, 0.0)
|
||||
|
||||
override var profileScale = 0.65F
|
||||
override var profileTranslation = Vec3(0.0, 0.75, 0.0)
|
||||
|
||||
override val foreLeftLeg= getPart("leg_front_left")
|
||||
override val foreRightLeg = getPart("leg_front_right")
|
||||
override val hindLeftLeg = getPart("leg_back_left")
|
||||
override val hindRightLeg = getPart("leg_back_right")
|
||||
|
||||
lateinit var standing: Pose
|
||||
lateinit var walk: Pose
|
||||
|
||||
override fun registerPoses() {
|
||||
standing = registerPose(
|
||||
poseName = "standing",
|
||||
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES,
|
||||
animations = arrayOf(
|
||||
singleBoneLook(),
|
||||
// bedrock("sawsbuck", "ground_idle")
|
||||
)
|
||||
)
|
||||
|
||||
walk = registerPose(
|
||||
poseName = "walk",
|
||||
poseTypes = PoseType.MOVING_POSES,
|
||||
animations = arrayOf(
|
||||
singleBoneLook(),
|
||||
QuadrupedWalkAnimation(this, periodMultiplier = 0.9F, amplitudeMultiplier = 0.9F)
|
||||
// bedrock("sawsbuck", "ground_walk")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// override fun getFaintAnimation(
|
||||
// pokemonEntity: PokemonEntity,
|
||||
// state: PosableState<PokemonEntity>
|
||||
// ) = if (state.isPosedIn(standing, walk)) bedrockStateful("sawsbuck", "faint") else null
|
||||
}
|
||||
-90
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen9
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.PosableState
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.createTransformation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.ModelPartTransformation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
import net.minecraft.client.model.geom.ModelPart
|
||||
import net.minecraft.world.phys.Vec3
|
||||
|
||||
class GlimmetModel (root: ModelPart) : PokemonPosableModel(root) {
|
||||
override val rootPart = root.registerChildWithAllChildren("glimmet")
|
||||
|
||||
override var portraitScale = 2.0F
|
||||
override var portraitTranslation = Vec3(-0.5, 1.3, 0.0)
|
||||
|
||||
override var profileScale = 0.7F
|
||||
override var profileTranslation = Vec3(0.0, 0.8, 0.0)
|
||||
|
||||
lateinit var standing: Pose
|
||||
lateinit var walk: Pose
|
||||
lateinit var sleep: Pose
|
||||
lateinit var shoulderLeft: Pose
|
||||
lateinit var shoulderRight: Pose
|
||||
|
||||
val shoulderOffset = 8
|
||||
|
||||
override val cryAnimation = CryProvider { bedrockStateful("glimmet", "cry") }
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk { bedrockStateful("glimmet", "blink") }
|
||||
sleep = registerPose(
|
||||
poseType = PoseType.SLEEP,
|
||||
animations = arrayOf(bedrock("glimmet", "sleep"))
|
||||
)
|
||||
|
||||
standing = registerPose(
|
||||
poseName = "standing",
|
||||
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
animations = arrayOf(
|
||||
bedrock("glimmet", "ground_idle")
|
||||
)
|
||||
)
|
||||
|
||||
walk = registerPose(
|
||||
poseName = "walk",
|
||||
poseTypes = PoseType.MOVING_POSES,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
animations = arrayOf(
|
||||
bedrock("glimmet", "ground_walk")
|
||||
)
|
||||
)
|
||||
|
||||
shoulderLeft = registerPose(
|
||||
poseType = PoseType.SHOULDER_LEFT,
|
||||
quirks = arrayOf(blink),
|
||||
animations = arrayOf(
|
||||
bedrock("glimmet", "ground_idle")
|
||||
),
|
||||
transformedParts = arrayOf(
|
||||
rootPart.createTransformation().addPosition(ModelPartTransformation.X_AXIS, shoulderOffset)
|
||||
)
|
||||
)
|
||||
|
||||
shoulderRight = registerPose(
|
||||
poseType = PoseType.SHOULDER_RIGHT,
|
||||
quirks = arrayOf(blink),
|
||||
animations = arrayOf(
|
||||
bedrock("glimmet", "ground_idle")
|
||||
),
|
||||
transformedParts = arrayOf(
|
||||
rootPart.createTransformation().addPosition(ModelPartTransformation.X_AXIS, -shoulderOffset)
|
||||
)
|
||||
)
|
||||
}
|
||||
override fun getFaintAnimation(state: PosableState) = if (state.isPosedIn(standing, walk)) bedrockStateful("glimmet", "faint") else null
|
||||
}
|
||||
-79
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen9
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.PosableState
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
import com.cobblemon.mod.common.util.isBattling
|
||||
import net.minecraft.client.model.geom.ModelPart
|
||||
import net.minecraft.world.phys.Vec3
|
||||
|
||||
class GlimmoraModel (root: ModelPart) : PokemonPosableModel(root) {
|
||||
override val rootPart = root.registerChildWithAllChildren("glimmora")
|
||||
|
||||
override var portraitScale = 2.0F
|
||||
override var portraitTranslation = Vec3(-0.6, -0.1, 0.0)
|
||||
|
||||
override var profileScale = 0.7F
|
||||
override var profileTranslation = Vec3(0.0, 0.8, 0.0)
|
||||
|
||||
lateinit var standing: Pose
|
||||
lateinit var walk: Pose
|
||||
lateinit var sleep: Pose
|
||||
lateinit var battleidle: Pose
|
||||
|
||||
override val cryAnimation = CryProvider { bedrockStateful("glimmora", "cry") }
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk { bedrockStateful("glimmora", "blink") }
|
||||
sleep = registerPose(
|
||||
poseType = PoseType.SLEEP,
|
||||
animations = arrayOf(bedrock("glimmora", "sleep"))
|
||||
)
|
||||
|
||||
standing = registerPose(
|
||||
poseName = "standing",
|
||||
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES,
|
||||
transformTicks = 10,
|
||||
condition = { !it.isBattling },
|
||||
quirks = arrayOf(blink),
|
||||
animations = arrayOf(
|
||||
bedrock("glimmora", "ground_idle")
|
||||
)
|
||||
)
|
||||
|
||||
walk = registerPose(
|
||||
poseName = "walk",
|
||||
poseTypes = PoseType.MOVING_POSES,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
animations = arrayOf(
|
||||
bedrock("glimmora", "ground_walk")
|
||||
)
|
||||
)
|
||||
|
||||
battleidle = registerPose(
|
||||
poseName = "battle_idle",
|
||||
poseTypes = PoseType.STATIONARY_POSES,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
condition = { it.isBattling },
|
||||
animations = arrayOf(
|
||||
bedrock("glimmora", "battle_idle")
|
||||
)
|
||||
|
||||
)
|
||||
}
|
||||
override fun getFaintAnimation(state: PosableState) = if (state.isPosedIn(standing, walk, sleep)) bedrockStateful("glimmora", "faint") else
|
||||
if (state.isPosedIn(battleidle)) bedrockStateful("glimmora", "faint2")
|
||||
else null
|
||||
}
|
||||
-4
@@ -304,8 +304,6 @@ object VaryingModelRepository {
|
||||
inbuilt("sizzlipede", ::SizzlipedeModel)
|
||||
inbuilt("kleavor", ::KleavorModel)
|
||||
inbuilt("pyukumuku", ::PyukumukuModel)
|
||||
inbuilt("deerling", ::DeerlingModel)
|
||||
inbuilt("sawsbuck", ::SawsbuckModel)
|
||||
inbuilt("natu", ::NatuModel)
|
||||
inbuilt("xatu", ::XatuModel)
|
||||
inbuilt("milcery", :: MilceryModel)
|
||||
@@ -399,8 +397,6 @@ object VaryingModelRepository {
|
||||
inbuilt("sirfetchd", ::SirfetchdModel)
|
||||
inbuilt("duskull", ::DuskullModel)
|
||||
inbuilt("dusclops", ::DusclopsModel)
|
||||
inbuilt("glimmet", ::GlimmetModel)
|
||||
inbuilt("glimmora", ::GlimmoraModel)
|
||||
inbuilt("bonsly", ::BonslyModel)
|
||||
inbuilt("sudowoodo", ::SudowoodoModel)
|
||||
inbuilt("cetoddle", ::CetoddleModel)
|
||||
|
||||
@@ -55,8 +55,10 @@ import java.util.UUID
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.server.packs.PackType
|
||||
import net.minecraft.server.packs.resources.PreparableReloadListener
|
||||
import net.minecraft.server.packs.resources.ResourceManager
|
||||
import net.minecraft.server.packs.resources.ResourceManagerReloadListener
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
object CobblemonDataProvider : DataProvider {
|
||||
|
||||
@@ -67,6 +69,11 @@ object CobblemonDataProvider : DataProvider {
|
||||
|
||||
private val scheduledActions = mutableMapOf<UUID, MutableList<() -> Unit>>()
|
||||
|
||||
// client is public only so we can use it cross-module. maybe a more elegant solution exists, but this works
|
||||
@ApiStatus.Internal
|
||||
val clientResourceReloader: PreparableReloadListener = SimpleResourceReloader(PackType.CLIENT_RESOURCES)
|
||||
private val serverResourceReloader: PreparableReloadListener = SimpleResourceReloader(PackType.SERVER_DATA)
|
||||
|
||||
fun registerDefaults() {
|
||||
this.register(CobblemonScripts, reloadable = true)
|
||||
this.register(SpeciesFeatures, reloadable = false)
|
||||
@@ -119,9 +126,9 @@ object CobblemonDataProvider : DataProvider {
|
||||
}
|
||||
|
||||
ifClient {
|
||||
Cobblemon.implementation.registerResourceReloader(cobblemonResource("client_resources"), SimpleResourceReloader(PackType.CLIENT_RESOURCES), PackType.CLIENT_RESOURCES, emptyList())
|
||||
Cobblemon.implementation.registerResourceReloader(cobblemonResource("client_resources"), clientResourceReloader, PackType.CLIENT_RESOURCES, emptyList())
|
||||
}
|
||||
Cobblemon.implementation.registerResourceReloader(cobblemonResource("data_resources"), SimpleResourceReloader(PackType.SERVER_DATA), PackType.SERVER_DATA, emptyList())
|
||||
Cobblemon.implementation.registerResourceReloader(cobblemonResource("data_resources"), serverResourceReloader, PackType.SERVER_DATA, emptyList())
|
||||
}
|
||||
|
||||
override fun <T : DataRegistry> register(registry: T, reloadable: Boolean): T {
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.cobblemon.mod.common.item.TumblestoneItem
|
||||
import net.minecraft.world.item.BlockItem
|
||||
import com.cobblemon.mod.common.platform.events.ServerPlayerEvent
|
||||
import com.cobblemon.mod.common.api.storage.player.PlayerInstancedDataStoreTypes
|
||||
import com.cobblemon.mod.common.item.GemItem
|
||||
import com.cobblemon.mod.common.platform.events.PlatformEvents
|
||||
import com.cobblemon.mod.common.util.effectiveName
|
||||
import com.cobblemon.mod.common.util.getPlayer
|
||||
@@ -40,6 +41,7 @@ object AdvancementHandler : EventHandler {
|
||||
override fun registerListeners() {
|
||||
PlatformEvents.RIGHT_CLICK_BLOCK.subscribe(Priority.LOWEST, ::onTumbleStonePlaced)
|
||||
PlatformEvents.RIGHT_CLICK_BLOCK.subscribe(Priority.LOWEST, ::onTypeGemClusterPlaced)
|
||||
PlatformEvents.RIGHT_CLICK_BLOCK.subscribe(Priority.LOWEST, ::onTypeGemItemPlaced)
|
||||
POKEMON_CAPTURED.subscribe(Priority.LOWEST, ::onCapture)
|
||||
BATTLE_VICTORY.subscribe(Priority.LOWEST, ::onWinBattle)
|
||||
EVOLUTION_COMPLETE.subscribe(Priority.LOWEST, ::onEvolve)
|
||||
@@ -206,6 +208,12 @@ object AdvancementHandler : EventHandler {
|
||||
CobblemonCriteria.PLANT_TYPE_GEM.trigger(event.player, PlantTypeGemContext(event.pos, block))
|
||||
}
|
||||
|
||||
fun onTypeGemItemPlaced(event: ServerPlayerEvent.RightClickBlock){
|
||||
val item = event.player.getItemInHand(event.hand).item as? GemItem ?: return
|
||||
val block = item.block as? TypeGemClusterBlock ?: return
|
||||
CobblemonCriteria.PLANT_TYPE_GEM.trigger(event.player, PlantTypeGemContext(event.pos, block))
|
||||
}
|
||||
|
||||
fun startRiding(event: RidePokemonEvent.Post) {
|
||||
CobblemonCriteria.RIDING_STAT_BOOST.trigger(event.player, RidingStatBoostContext(event.pokemon))
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ object PokedexHandler : EventHandler {
|
||||
}
|
||||
|
||||
fun onPokemonGained(event: PokemonGainedEvent) {
|
||||
Cobblemon.playerDataManager.getPokedexData(event.playerId).catch(event.pokemon)
|
||||
Cobblemon.playerDataManager.getPokedexData(event.playerId).obtain(event.pokemon)
|
||||
Cobblemon.playerDataManager.getTMData(event.playerId).syncTMsFromPokemon(event.pokemon)
|
||||
}
|
||||
|
||||
fun onPokemonSeen(event: PokemonSeenEvent) {
|
||||
@@ -34,7 +35,7 @@ object PokedexHandler : EventHandler {
|
||||
|
||||
fun onPokemonAspectsChanged(event: PokemonAspectsChangedEvent) {
|
||||
if (event.ownerId != null) {
|
||||
Cobblemon.playerDataManager.getPokedexData(event.ownerId).catch(event.pokemon)
|
||||
Cobblemon.playerDataManager.getPokedexData(event.ownerId).obtain(event.pokemon)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.item
|
||||
|
||||
import net.minecraft.world.item.ItemNameBlockItem
|
||||
import net.minecraft.world.level.block.Block
|
||||
|
||||
class WearableBlockItem(override val name: String, block: Block): ItemNameBlockItem(block, Properties()), WearableItem{
|
||||
|
||||
}
|
||||
@@ -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.item
|
||||
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import com.cobblemon.mod.common.util.traceFirstEntityCollision
|
||||
import net.minecraft.world.InteractionHand
|
||||
import net.minecraft.world.InteractionResultHolder
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.level.Level
|
||||
|
||||
|
||||
class WearableHatItem(override val name: String): CobblemonItem(Properties()), WearableItem {
|
||||
override fun use(level: Level, player: Player, usedHand: InteractionHand): InteractionResultHolder<ItemStack> {
|
||||
val itemStack = player.getItemInHand(usedHand)
|
||||
val hitPokemon = player.traceFirstEntityCollision(
|
||||
entityClass = PokemonEntity::class.java,
|
||||
maxDistance = player.entityInteractionRange().toFloat()
|
||||
)
|
||||
// If the player is looking at a Pokémon within range, block the ability to swap the item onto their head
|
||||
return if (player.isCrouching && hitPokemon != null && hitPokemon.isOwnedBy(player)) {
|
||||
InteractionResultHolder.fail(itemStack)
|
||||
} else this.swapWithEquipmentSlot(this, level, player, usedHand)
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,9 @@ import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.world.entity.EquipmentSlot
|
||||
import net.minecraft.world.item.Equipable
|
||||
|
||||
class WearableItem(val name: String): CobblemonItem(Properties()), Equipable {
|
||||
interface WearableItem: Equipable {
|
||||
val name: String
|
||||
|
||||
companion object {
|
||||
const val MODEL_PATH = "item/wearable"
|
||||
}
|
||||
|
||||
+10
-22
@@ -11,29 +11,26 @@ package com.cobblemon.mod.common.item.interactive
|
||||
import com.cobblemon.mod.common.api.item.PokemonSelectingItem
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.ItemEvSource
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stat
|
||||
import com.cobblemon.mod.common.item.CobblemonItem
|
||||
import com.cobblemon.mod.common.item.battle.BagItem
|
||||
import com.cobblemon.mod.common.pokemon.EVs
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.util.giveOrDropItemStack
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.sounds.SoundEvent
|
||||
import net.minecraft.world.InteractionHand
|
||||
import net.minecraft.world.InteractionResultHolder
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.Items
|
||||
import net.minecraft.world.level.Level
|
||||
|
||||
abstract class EVIncreaseItem(
|
||||
val stat: Stat,
|
||||
val evIncreaseAmount: Int,
|
||||
) : CobblemonItem(Properties()), PokemonSelectingItem {
|
||||
override val bagItem = null
|
||||
interface EVIncreaseItem: PokemonSelectingItem {
|
||||
val stat: Stat
|
||||
val evIncreaseAmount: Int
|
||||
|
||||
override val bagItem: BagItem?
|
||||
get() = null
|
||||
|
||||
override fun canUseOnPokemon(stack: ItemStack, pokemon: Pokemon) = pokemon.evs.getOrDefault(stat) < EVs.MAX_STAT_VALUE &&
|
||||
super.canUseOnPokemon(stack, pokemon)
|
||||
|
||||
abstract val sound: SoundEvent
|
||||
|
||||
override fun applyToPokemon(
|
||||
player: ServerPlayer,
|
||||
stack: ItemStack,
|
||||
@@ -41,21 +38,12 @@ abstract class EVIncreaseItem(
|
||||
): InteractionResultHolder<ItemStack> {
|
||||
val evsGained = pokemon.evs.add(stat, evIncreaseAmount, ItemEvSource(player, stack, pokemon))
|
||||
return if (evsGained > 0) {
|
||||
pokemon.entity?.playSound(sound, 1F, 1F)
|
||||
stack.consume(1, player)
|
||||
if (!player.hasInfiniteMaterials()) {
|
||||
player.giveOrDropItemStack(ItemStack(Items.GLASS_BOTTLE))
|
||||
}
|
||||
onSuccessfulApply(player, stack, pokemon)
|
||||
InteractionResultHolder.success(stack)
|
||||
} else {
|
||||
InteractionResultHolder.fail(stack)
|
||||
}
|
||||
}
|
||||
|
||||
override fun use(world: Level, user: Player, hand: InteractionHand): InteractionResultHolder<ItemStack> {
|
||||
if (user is ServerPlayer) {
|
||||
return use(user, user.getItemInHand(hand))
|
||||
}
|
||||
return InteractionResultHolder.success(user.getItemInHand(hand))
|
||||
}
|
||||
fun onSuccessfulApply(player: ServerPlayer, stack: ItemStack, pokemon: Pokemon)
|
||||
}
|
||||
@@ -10,8 +10,27 @@ package com.cobblemon.mod.common.item.interactive
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonSounds
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stat
|
||||
import net.minecraft.sounds.SoundEvent
|
||||
import com.cobblemon.mod.common.item.CobblemonItem
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.world.InteractionHand
|
||||
import net.minecraft.world.InteractionResultHolder
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.level.Level
|
||||
|
||||
class FeatherItem(stat: Stat) : EVIncreaseItem(stat, 1) {
|
||||
override val sound: SoundEvent = CobblemonSounds.MEDICINE_FEATHER_USE
|
||||
class FeatherItem(override val stat: Stat): CobblemonItem(Properties()), EVIncreaseItem {
|
||||
override val evIncreaseAmount: Int = 1
|
||||
|
||||
override fun use(world: Level, user: Player, hand: InteractionHand): InteractionResultHolder<ItemStack> {
|
||||
if (user is ServerPlayer) {
|
||||
return use(user, user.getItemInHand(hand))
|
||||
}
|
||||
return InteractionResultHolder.success(user.getItemInHand(hand))
|
||||
}
|
||||
|
||||
override fun onSuccessfulApply(player: ServerPlayer, stack: ItemStack, pokemon: Pokemon) {
|
||||
pokemon.entity?.playSound(CobblemonSounds.MEDICINE_FEATHER_USE)
|
||||
stack.consume(1, player)
|
||||
}
|
||||
}
|
||||
@@ -9,15 +9,18 @@
|
||||
package com.cobblemon.mod.common.item.interactive
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonSounds
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stats
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stat
|
||||
import com.cobblemon.mod.common.item.CobblemonItem
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.sounds.SoundEvent
|
||||
import net.minecraft.world.InteractionHand
|
||||
import net.minecraft.world.InteractionResultHolder
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.level.Level
|
||||
|
||||
class MochiItem(stat: Stats): EVIncreaseItem(stat, 4) {
|
||||
override val sound: SoundEvent = CobblemonSounds.MOCHI_USE
|
||||
class MochiItem(override val stat: Stat): CobblemonItem(Properties()), EVIncreaseItem {
|
||||
override val evIncreaseAmount: Int = 4
|
||||
|
||||
override fun applyToPokemon(player: ServerPlayer, stack: ItemStack, pokemon: Pokemon): InteractionResultHolder<ItemStack> {
|
||||
if (!canUseOnPokemon(stack, pokemon)) {
|
||||
@@ -28,4 +31,16 @@ class MochiItem(stat: Stats): EVIncreaseItem(stat, 4) {
|
||||
|
||||
return super.applyToPokemon(player, stack, pokemon)
|
||||
}
|
||||
|
||||
override fun use(world: Level, user: Player, hand: InteractionHand): InteractionResultHolder<ItemStack> {
|
||||
if (user is ServerPlayer) {
|
||||
return use(user, user.getItemInHand(hand))
|
||||
}
|
||||
return InteractionResultHolder.success(user.getItemInHand(hand))
|
||||
}
|
||||
|
||||
override fun onSuccessfulApply(player: ServerPlayer, stack: ItemStack, pokemon: Pokemon) {
|
||||
pokemon.entity?.playSound(CobblemonSounds.MOCHI_USE)
|
||||
stack.consume(1, player)
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@ package com.cobblemon.mod.common.item.interactive
|
||||
import com.cobblemon.mod.common.CobblemonSounds
|
||||
import com.cobblemon.mod.common.api.item.PokemonAndMoveSelectingItem
|
||||
import com.cobblemon.mod.common.api.moves.Move
|
||||
import com.cobblemon.mod.common.item.CobblemonItem
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.util.giveOrDropItemStack
|
||||
import net.minecraft.world.entity.player.Player
|
||||
@@ -19,13 +18,15 @@ import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.world.InteractionHand
|
||||
import net.minecraft.world.InteractionResultHolder
|
||||
import net.minecraft.world.item.ItemNameBlockItem
|
||||
import net.minecraft.world.item.Items
|
||||
import net.minecraft.world.item.Rarity
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.block.Block
|
||||
|
||||
class PPUpItem(
|
||||
val amount: Int
|
||||
) : CobblemonItem(Properties().apply {
|
||||
val amount: Int, block: Block
|
||||
) : ItemNameBlockItem(block, Properties().apply {
|
||||
if (amount>1) rarity(Rarity.UNCOMMON)
|
||||
}), PokemonAndMoveSelectingItem {
|
||||
|
||||
|
||||
@@ -9,9 +9,34 @@
|
||||
package com.cobblemon.mod.common.item.interactive
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonSounds
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stats
|
||||
import net.minecraft.sounds.SoundEvent
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stat
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.util.giveOrDropItemStack
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.world.InteractionHand
|
||||
import net.minecraft.world.InteractionResultHolder
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.item.ItemNameBlockItem
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.Items
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.block.Block
|
||||
|
||||
class VitaminItem(stat: Stats) : EVIncreaseItem(stat, 10) {
|
||||
override val sound: SoundEvent = CobblemonSounds.MEDICINE_PILLS_USE
|
||||
class VitaminItem(override val stat: Stat, block: Block): ItemNameBlockItem(block, Properties()), EVIncreaseItem {
|
||||
override val evIncreaseAmount: Int = 10
|
||||
|
||||
override fun use(world: Level, user: Player, hand: InteractionHand): InteractionResultHolder<ItemStack> {
|
||||
if (user is ServerPlayer) {
|
||||
return use(user, user.getItemInHand(hand))
|
||||
}
|
||||
return InteractionResultHolder.success(user.getItemInHand(hand))
|
||||
}
|
||||
|
||||
override fun onSuccessfulApply(player: ServerPlayer, stack: ItemStack, pokemon: Pokemon) {
|
||||
pokemon.entity?.playSound(CobblemonSounds.MEDICINE_PILLS_USE)
|
||||
stack.consume(1, player)
|
||||
if (!player.hasInfiniteMaterials()) {
|
||||
player.giveOrDropItemStack(Items.GLASS_BOTTLE.defaultInstance)
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -32,6 +32,11 @@ object TMMachineTeachMoveHandler : ServerNetworkPacketHandler<TMMachineTeachMove
|
||||
val menu = player.containerMenu as? TMMachineMenu ?: return
|
||||
val inventory = menu.inventory ?: return
|
||||
|
||||
// This is checked on the client, but a modified client could still try to teach an illegal move.
|
||||
if (moveTemplate !in pokemon.form.moves.tmLearnableMoves()) {
|
||||
return
|
||||
}
|
||||
|
||||
if (ItemStack.isSameItemSameComponents(packet.heldStack, menu.carried) &&
|
||||
moveTemplate == TMMoveComponent.getTMMove(packet.heldStack) &&
|
||||
packet.heldStack.count == menu.carried.count &&
|
||||
@@ -53,4 +58,4 @@ object TMMachineTeachMoveHandler : ServerNetworkPacketHandler<TMMachineTeachMove
|
||||
player.playNotifySound(CobblemonSounds.MOVE_LEARN, SoundSource.MASTER, 1.0F, 1.0F)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -18,6 +18,11 @@ import net.minecraft.server.level.ServerPlayer
|
||||
|
||||
object SaveHabitatBlockSettingsHandler : ServerNetworkPacketHandler<SaveHabitatBlockSettingsPacket> {
|
||||
override fun handle(packet: SaveHabitatBlockSettingsPacket, server: MinecraftServer, player: ServerPlayer) {
|
||||
if (!player.isCreative) {
|
||||
// mf does not have permission
|
||||
return
|
||||
}
|
||||
|
||||
val world = player.serverLevel()
|
||||
val blockEntity = world.getBlockEntity(packet.blockPos) as? HabitatBlockEntity ?: return // it's broken
|
||||
val pre = SaveHabitatBlockSettingsEvent.Pre(
|
||||
@@ -28,11 +33,6 @@ object SaveHabitatBlockSettingsHandler : ServerNetworkPacketHandler<SaveHabitatB
|
||||
settings = packet.settings
|
||||
)
|
||||
|
||||
if (!player.isCreative) {
|
||||
// mf does not have permission
|
||||
return
|
||||
}
|
||||
|
||||
CobblemonEvents.HABITAT_SETTINGS_SAVED_PRE.postThen(pre) {
|
||||
blockEntity.applySettings(habitatSettingsDTO = packet.settings)
|
||||
val post = SaveHabitatBlockSettingsEvent.Post(
|
||||
|
||||
@@ -391,15 +391,19 @@ open class Pokemon : ShowdownIdentifiable {
|
||||
*/
|
||||
var friendship = this.form.baseFriendship
|
||||
private set(value) {
|
||||
val earned = this.friendshipEarned
|
||||
this.friendshipEarned = false
|
||||
if (!this.isPossibleFriendship(value)) {
|
||||
return
|
||||
}
|
||||
FRIENDSHIP_UPDATED.post(FriendshipUpdatedEvent(this, value)) {
|
||||
FRIENDSHIP_UPDATED.post(FriendshipUpdatedEvent(this, value, earned)) {
|
||||
field = it.newFriendship
|
||||
onChange(FriendshipUpdatePacket({ this }, it.newFriendship))
|
||||
}
|
||||
}
|
||||
|
||||
private var friendshipEarned = false
|
||||
|
||||
var currentFullness = 0
|
||||
set(value) {
|
||||
val clamped = value.coerceIn(0, getMaxFullness())
|
||||
@@ -595,7 +599,7 @@ open class Pokemon : ShowdownIdentifiable {
|
||||
var scaleModifier: Float = 1F
|
||||
set(value) {
|
||||
if (field != value) {
|
||||
field = value
|
||||
field = value.coerceAtLeast(0.05F)
|
||||
onChange(ScaleModifierUpdatePacket({ this }, value))
|
||||
}
|
||||
}
|
||||
@@ -1601,6 +1605,7 @@ open class Pokemon : ShowdownIdentifiable {
|
||||
val sanitizedAmount = if (coerceSafe) amount.absoluteValue.coerceAtMost(Cobblemon.config.maxPokemonFriendship - this.friendship) else amount.absoluteValue
|
||||
val newValue = this.friendship + sanitizedAmount
|
||||
if (this.isPossibleFriendship(newValue)) {
|
||||
this.friendshipEarned = true
|
||||
this.friendship = newValue
|
||||
}
|
||||
return this.friendship == newValue
|
||||
|
||||
+1
@@ -68,6 +68,7 @@ object CobblemonRequirementAdapter : RequirementAdapter {
|
||||
this.registerType(AdvancementRequirement.ADAPTER_VARIANT, AdvancementRequirement::class)
|
||||
this.registerType(OwnerHoldsItemRequirement.ADAPTER_VARIANT, OwnerHoldsItemRequirement::class)
|
||||
this.registerType(ChanceRequirement.ADAPTER_VARIANT, ChanceRequirement::class)
|
||||
this.registerType(NegateRequirement.ADAPTER_VARIANT, NegateRequirement::class)
|
||||
}
|
||||
|
||||
val gson: Gson by lazy {
|
||||
|
||||
+21
@@ -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.pokemon.requirements
|
||||
|
||||
import com.cobblemon.mod.common.api.pokemon.requirement.Requirement
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
|
||||
class NegateRequirement(val inner: Requirement) : Requirement {
|
||||
|
||||
override fun check(pokemon: Pokemon) = !inner.check(pokemon)
|
||||
|
||||
companion object {
|
||||
const val ADAPTER_VARIANT = "negate"
|
||||
}
|
||||
}
|
||||
+7
-3
@@ -9,6 +9,7 @@
|
||||
package com.cobblemon.mod.common.pokemon.requirements
|
||||
|
||||
import com.cobblemon.mod.common.api.pokemon.requirement.Requirement
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stat
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stats
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
|
||||
@@ -17,10 +18,13 @@ class StatCompareRequirement : Requirement {
|
||||
const val ADAPTER_VARIANT = "stat_compare"
|
||||
}
|
||||
|
||||
val highStat = Stats.ATTACK.name
|
||||
val lowStat = Stats.DEFENCE.name
|
||||
val highStat = Stats.ATTACK.identifier.path
|
||||
val lowStat = Stats.DEFENCE.identifier.path
|
||||
|
||||
override fun check(pokemon: Pokemon): Boolean {
|
||||
return pokemon.getStat(Stats.getStat(highStat)) > pokemon.getStat(Stats.getStat(lowStat))
|
||||
val high = Stats.getStat(highStat)
|
||||
val low = Stats.getStat(lowStat)
|
||||
if (high.type != Stat.Type.PERMANENT || low.type != Stat.Type.PERMANENT) return false
|
||||
return pokemon.getStat(high) > pokemon.getStat(low)
|
||||
}
|
||||
}
|
||||
+7
-3
@@ -9,6 +9,7 @@
|
||||
package com.cobblemon.mod.common.pokemon.requirements
|
||||
|
||||
import com.cobblemon.mod.common.api.pokemon.requirement.Requirement
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stat
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stats
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
|
||||
@@ -17,10 +18,13 @@ class StatEqualRequirement : Requirement {
|
||||
const val ADAPTER_VARIANT = "stat_equal"
|
||||
}
|
||||
|
||||
val statOne = Stats.ATTACK.name
|
||||
val statTwo = Stats.DEFENCE.name
|
||||
val statOne = Stats.ATTACK.identifier.path
|
||||
val statTwo = Stats.DEFENCE.identifier.path
|
||||
|
||||
override fun check(pokemon: Pokemon): Boolean {
|
||||
return pokemon.getStat(Stats.getStat(statOne)) == pokemon.getStat(Stats.getStat(statTwo))
|
||||
val one = Stats.getStat(statOne)
|
||||
val two = Stats.getStat(statTwo)
|
||||
if (one.type != Stat.Type.PERMANENT || two.type != Stat.Type.PERMANENT) return false
|
||||
return pokemon.getStat(one) == pokemon.getStat(two)
|
||||
}
|
||||
}
|
||||
@@ -53,4 +53,60 @@ fun Quaternionf.toEulerXYZDegrees(): Vector3f {
|
||||
vector.z = vector.z.toDegrees()
|
||||
|
||||
return vector
|
||||
}
|
||||
|
||||
|
||||
/* // is not allocation free so just inline ".get(AxisAngle4f)" like in the function below this
|
||||
fun Quaternionf.toScaledAngleAxis(angAxisScaled: Vector3f) {
|
||||
val axisAng4 = AxisAngle4f()
|
||||
this.get(axisAng4)
|
||||
|
||||
angAxisScaled.x = axisAng4.x
|
||||
angAxisScaled.y = axisAng4.y
|
||||
angAxisScaled.z = axisAng4.z
|
||||
angAxisScaled.mul(axisAng4.angle)
|
||||
} */
|
||||
|
||||
fun Quaternionf.toScaledAngleAxis(dest: Vector3f) {
|
||||
var x = this.x
|
||||
var y = this.y
|
||||
var z = this.z
|
||||
var w = this.w
|
||||
|
||||
if (w > 1.0f) {
|
||||
val invNorm = 1.0f / kotlin.math.sqrt(x * x + y * y + z * z + w * w)
|
||||
x *= invNorm
|
||||
y *= invNorm
|
||||
z *= invNorm
|
||||
w *= invNorm
|
||||
}
|
||||
|
||||
val angle = 2.0f * kotlin.math.acos(w)
|
||||
val s = kotlin.math.sqrt(1.0f - w * w)
|
||||
|
||||
if (s < 0.001f) {
|
||||
dest.x = x * angle
|
||||
dest.y = y * angle
|
||||
dest.z = z * angle
|
||||
} else {
|
||||
val invS = angle / s
|
||||
dest.x = x * invS
|
||||
dest.y = y * invS
|
||||
dest.z = z * invS
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun Quaternionf.setFromScaledAngleAxis(angAxisScaled: Vector3f) {
|
||||
val len = angAxisScaled.length()
|
||||
if (len > 1e-5f) {
|
||||
this.rotationAxis(
|
||||
len,
|
||||
angAxisScaled.x / len,
|
||||
angAxisScaled.y / len,
|
||||
angAxisScaled.z / len
|
||||
)
|
||||
} else {
|
||||
this.identity()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.util.math
|
||||
|
||||
import net.minecraft.util.Mth
|
||||
import kotlin.math.max
|
||||
import kotlin.math.sqrt
|
||||
import kotlin.math.abs
|
||||
import org.joml.Quaternionf
|
||||
import org.joml.Vector3f
|
||||
|
||||
/**
|
||||
* Much of the code here is directly taken or inspired off this great article:
|
||||
* https://theorangeduck.com/page/spring-roll-call#critical
|
||||
*
|
||||
* Very much worth the read.
|
||||
*
|
||||
* Util funcitons for using springs to smoothly/naturally approach one value towards a target
|
||||
*/
|
||||
|
||||
/**
|
||||
* Need to pass in and mutate both a value and a velocity to a spring
|
||||
*/
|
||||
class FloatSpring(
|
||||
var value: Float = 0f,
|
||||
var velocity: Float = 0f
|
||||
)
|
||||
|
||||
class QuatSpring(
|
||||
var quat: Quaternionf = Quaternionf(),
|
||||
var angVel: Vector3f = Vector3f()
|
||||
)
|
||||
|
||||
|
||||
/**
|
||||
* Provides a fast negative exponent approximation for e^-x
|
||||
*/
|
||||
fun negExp(x: Float): Float {
|
||||
return 1.0f / (1.0f + x + 0.48f*x*x + 0.235f*x*x*x)
|
||||
}
|
||||
|
||||
fun halflifeToDamping(halflife: Float, eps: Float = 1e-5f): Float {
|
||||
return (4.0f * 0.69314718056f) / (halflife + eps)
|
||||
}
|
||||
|
||||
fun simpleSpringDamper(
|
||||
spring: FloatSpring,
|
||||
goalValue: Float,
|
||||
halflife: Float,
|
||||
dt: Float,
|
||||
isAngle: Boolean = false
|
||||
) {
|
||||
val y = halflifeToDamping(halflife) / 2.0f
|
||||
val j0 = if (isAngle) Mth.wrapDegrees(spring.value - goalValue) else spring.value - goalValue
|
||||
val j1 = spring.velocity + j0*y;
|
||||
val eydt = negExp(y*dt);
|
||||
|
||||
spring.value = eydt*(j0 + j1*dt) + goalValue;
|
||||
spring.velocity = eydt*(spring.velocity - j1*y*dt);
|
||||
}
|
||||
|
||||
fun simpleSpringDamperQuat(
|
||||
spring: QuatSpring,
|
||||
goalQuat: Quaternionf,
|
||||
halflife: Float,
|
||||
dt: Float
|
||||
) {
|
||||
val y = halflifeToDamping(halflife) / 2.0f
|
||||
|
||||
// Quaternions have double cover q and -q represent the same rotation.
|
||||
// so an accidentally rotation the long way could be calculated.
|
||||
// account for that specifically
|
||||
val goal = if (spring.quat.dot(goalQuat) < 0f) {
|
||||
Quaternionf(-goalQuat.x, -goalQuat.y, -goalQuat.z, -goalQuat.w)
|
||||
} else {
|
||||
goalQuat
|
||||
}
|
||||
|
||||
// Gather the rotation from the goal to the current
|
||||
val goalToCurrQuat = Quaternionf(spring.quat).mul(Quaternionf(goal).conjugate())
|
||||
|
||||
val j0 = Vector3f()
|
||||
goalToCurrQuat.toScaledAngleAxis(j0)
|
||||
|
||||
val j1: Vector3f = Vector3f(spring.angVel).add(Vector3f(j0).mul(y))
|
||||
|
||||
val eydt: Float = negExp(y * dt)
|
||||
|
||||
val scaledAxis = Vector3f(j0).add(Vector3f(j1).mul(dt)).mul(eydt)
|
||||
|
||||
spring.quat.setFromScaledAngleAxis(scaledAxis)
|
||||
spring.quat.mul(goal)
|
||||
|
||||
spring.angVel.sub(j1.mul(y * dt))
|
||||
spring.angVel.mul(eydt)
|
||||
}
|
||||
|
||||
/**
|
||||
* Below is essentially the same code as found here: https://github.com/orangeduck/Spring-It-On/blob/main/inertialeasing.c
|
||||
* https://theorangeduck.com/page/inertial-easing <- the blogpost
|
||||
*/
|
||||
|
||||
// Class to hold the "time" along the curve/function and scale of the function currently
|
||||
// Held in this class so both can be mutated and returned in one function call
|
||||
class InertialVals(
|
||||
var t: Float = 0f,
|
||||
var s: Float = 0f,
|
||||
var offset: Float = 0f,
|
||||
)
|
||||
|
||||
// Includes the negative portion
|
||||
fun smoothstep(t: Float, s: Float): Float {
|
||||
return s * (if(t > 1.0f) 1.0f else 3*t*t - 2*t*t*t)
|
||||
}
|
||||
|
||||
// Derivative of the above smoothstep
|
||||
fun smoothstepDt(t: Float, s: Float): Float {
|
||||
return s * (if(t > 1.0f) 0.0f else 6*t - 6*t*t)
|
||||
}
|
||||
|
||||
// Solve for smoothstep parameters `t` and `s` given new target `x` and velocity `v`
|
||||
fun smoothstepSolve( //TODO change these names to make more sense
|
||||
vals: InertialVals,
|
||||
x: Float, // Target Value x
|
||||
v: Float, // Goal velocity
|
||||
overshoot: Float = 0.05f,
|
||||
eps: Float = 1e-8f
|
||||
) {
|
||||
// If velocity is low enough then start from time zero
|
||||
if (abs(v) < 1e-8f) {
|
||||
vals.t = 0f
|
||||
vals.s = x
|
||||
return
|
||||
}
|
||||
|
||||
// If x is negative then invert signs and re-Solve
|
||||
if (x < 0f) {
|
||||
smoothstepSolve(vals, -x, -v, overshoot, eps)
|
||||
vals.s *= -1f
|
||||
return
|
||||
}
|
||||
|
||||
// Find the possible times that solve for the given `x` and `v`
|
||||
// Quadratic formula!
|
||||
val q: Float = sqrt(max((6*x - v)*(6*x - v) + 8*v*v, eps))
|
||||
val t0: Float = (v - 6*x + q) / (4*v)
|
||||
val t1: Float = (v - 6*x - q) / (4*v)
|
||||
|
||||
// Overshoot if the alternative time is between -0.5f and -(0.5f + overshoot)
|
||||
vals.t = if(-0.5f > t1 && t1 > -(0.5f + overshoot)) t1 else t0;
|
||||
|
||||
// Find the un-scaled velocity at the fitted time
|
||||
val vt: Float = smoothstepDt(vals.t, 1f);
|
||||
|
||||
// Find the scaling factor so that the velocity at the fitted time matches
|
||||
vals.s = if(abs(vt) < eps) 0f else v / vt;
|
||||
}
|
||||
@@ -8,16 +8,11 @@
|
||||
|
||||
package com.cobblemon.mod.common.world.feature
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonBlocks
|
||||
import com.cobblemon.mod.common.CobblemonBlocks.TYPE_GEM_CORE
|
||||
import com.cobblemon.mod.common.CobblemonBlocks.typeGemBlocks
|
||||
import com.cobblemon.mod.common.CobblemonBlocks.typeGemClusters
|
||||
import com.cobblemon.mod.common.block.TypeGemClusterBlock
|
||||
import com.cobblemon.mod.common.block.TypeGemCoreBlock
|
||||
import com.cobblemon.mod.common.util.random
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.Direction
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.tags.BlockTags
|
||||
import net.minecraft.world.level.WorldGenLevel
|
||||
import net.minecraft.world.level.block.Block.UPDATE_ALL
|
||||
@@ -47,9 +42,12 @@ class TypeGemFeature : Feature<BlockStateConfiguration>(BlockStateConfiguration.
|
||||
val gemState = gemBlock.defaultBlockState()
|
||||
val coreState = TYPE_GEM_CORE.defaultBlockState()
|
||||
|
||||
// Place core and initial gem
|
||||
worldGenLevel.setBlock(origin, coreState, UPDATE_ALL)
|
||||
// Place the gem first then make sure it placed before placing the core.
|
||||
worldGenLevel.setBlock(chosenPos, gemState, UPDATE_ALL)
|
||||
if (!worldGenLevel.getBlockState(chosenPos).`is`(gemBlock)) {
|
||||
return false
|
||||
}
|
||||
worldGenLevel.setBlock(origin, coreState, UPDATE_ALL)
|
||||
|
||||
// Trigger forced growth with clusters
|
||||
val coreBlock = coreState.block as TypeGemCoreBlock
|
||||
@@ -72,4 +70,4 @@ class TypeGemFeature : Feature<BlockStateConfiguration>(BlockStateConfiguration.
|
||||
|
||||
return airBlocks
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-6
@@ -46,11 +46,6 @@
|
||||
"effect": "cobblemon:swordsdance_sword3",
|
||||
"type": "emitter_bound"
|
||||
}
|
||||
},
|
||||
"event_sound": {
|
||||
"sound_effect": {
|
||||
"event_name": "cobblemon:move.swordsdance.actor"
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
@@ -61,7 +56,7 @@
|
||||
"active_time": 2.5
|
||||
},
|
||||
"minecraft:emitter_lifetime_events": {
|
||||
"creation_event": ["event_sword2", "event_sword3", "event_sword4", "event_sound"]
|
||||
"creation_event": ["event_sword2", "event_sword3", "event_sword4"]
|
||||
},
|
||||
"minecraft:emitter_shape_point": {},
|
||||
"minecraft:particle_lifetime_expression": {
|
||||
|
||||
+1
-1
@@ -592,7 +592,7 @@
|
||||
},
|
||||
"sound_effects": {
|
||||
"0.0": {
|
||||
"effect": "pokemon.raticate_alolan.alola.cry"
|
||||
"effect": "pokemon.raticate_alolan.cry"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
+7173
-195
File diff suppressed because it is too large
Load Diff
+1805
-337
File diff suppressed because it is too large
Load Diff
+245
-151
@@ -1,192 +1,286 @@
|
||||
{
|
||||
"format_version": "1.8.0",
|
||||
"animations": {
|
||||
"animation.absol.render": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"hips": {
|
||||
"rotation": [-2.5, 0, 0]
|
||||
},
|
||||
"chest": {
|
||||
"rotation": [12.5, 0, 0]
|
||||
},
|
||||
"tail": {
|
||||
"rotation": [-8.01788, 32.61138, -0.66603]
|
||||
},
|
||||
"neck": {
|
||||
"rotation": [15.34479, -13.10699, 9.18372]
|
||||
},
|
||||
"head": {
|
||||
"rotation": [-25.32307, -13.66763, -4.61603]
|
||||
},
|
||||
"hair": {
|
||||
"rotation": [0, 0, 45]
|
||||
},
|
||||
"hair2": {
|
||||
"rotation": [1.95155, 7.24305, 27.62353]
|
||||
},
|
||||
"hair3": {
|
||||
"rotation": [8.61775, 34.05444, 17.64371]
|
||||
},
|
||||
"neck_fur_right2": {
|
||||
"rotation": [0, 0, -30]
|
||||
},
|
||||
"neck_fur_left2": {
|
||||
"rotation": [0, 0, 40]
|
||||
},
|
||||
"neck_fur_back2": {
|
||||
"rotation": [-45, 0, 0]
|
||||
},
|
||||
"chest_fur": {
|
||||
"rotation": [-42.5, 0, 0]
|
||||
},
|
||||
"chest_fur_right": {
|
||||
"rotation": [0, 35, 0]
|
||||
},
|
||||
"chest_fur_left": {
|
||||
"rotation": [0, -25, 0]
|
||||
},
|
||||
"chest_fur_1": {
|
||||
"rotation": [27.5, 0, 0]
|
||||
},
|
||||
"chest_fur_2": {
|
||||
"rotation": [7.5, 0, 0]
|
||||
},
|
||||
"leg_back_left": {
|
||||
"rotation": [21.9659, -13.44762, -0.11731]
|
||||
},
|
||||
"leg_back_left2": {
|
||||
"rotation": [-10, 0, 0]
|
||||
},
|
||||
"leg_back_left3": {
|
||||
"rotation": [5, 0, 0]
|
||||
},
|
||||
"foot__back_left": {
|
||||
"rotation": [-14.82005, -12.39135, -1.6575]
|
||||
},
|
||||
"leg_front_left": {
|
||||
"rotation": [-25.47479, -17.22575, 3.13388],
|
||||
"position": [0, -0.25, 0]
|
||||
},
|
||||
"leg_front_left2": {
|
||||
"rotation": [14.61364, 12.22219, 2.52829]
|
||||
},
|
||||
"foot_front_left": {
|
||||
"rotation": [12.15846, -18.26883, -13.36473]
|
||||
},
|
||||
"eyes_open": {
|
||||
"position": [0, 0, 0]
|
||||
},
|
||||
"eyes_happy": {
|
||||
"position": [0, 0, 0]
|
||||
},
|
||||
"eyes_closed": {
|
||||
"position": [0, 0, 0]
|
||||
},
|
||||
"eyes_halfclosed": {
|
||||
"position": [0, 0, 0]
|
||||
},
|
||||
"leg_back_right": {
|
||||
"rotation": [0, -22.5, 0],
|
||||
"position": [-0.11888, 0, -1.67283]
|
||||
},
|
||||
"foot_back_right": {
|
||||
"rotation": [0, 15, 0]
|
||||
},
|
||||
"waist": {
|
||||
"rotation": [0, -20, 0]
|
||||
},
|
||||
"leg_front_right": {
|
||||
"rotation": [12.5, 0, 0]
|
||||
},
|
||||
"leg_front_right2": {
|
||||
"rotation": [0, 0, -10]
|
||||
},
|
||||
"foot_front_right": {
|
||||
"rotation": [-12.07362, 14.63639, 13.31914]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.absol.ground_idle": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"neck": {
|
||||
"rotation": [20, 0, 0]
|
||||
"rotation": [30, 0, 0]
|
||||
},
|
||||
"head": {
|
||||
"rotation": [-17.5, 0, 0]
|
||||
},
|
||||
"hair": {
|
||||
"rotation": [0, 0, 47]
|
||||
"rotation": [0, 0, -2.5]
|
||||
},
|
||||
"hair2": {
|
||||
"rotation": [0, 8.5, 38]
|
||||
"rotation": [2.5, 10, 0]
|
||||
},
|
||||
"hair3": {
|
||||
"rotation": [9.69368, 25.60466, 13.24197]
|
||||
"rotation": [1.9544, 7.5589, 12.4168]
|
||||
},
|
||||
"neck_fur_right2": {
|
||||
"rotation": [0, 0, -30]
|
||||
"neck_fluff_left": {
|
||||
"rotation": [0, 0, 67.5]
|
||||
},
|
||||
"neck_fur_left2": {
|
||||
"rotation": [0, 0, 40]
|
||||
},
|
||||
"neck_fur_back2": {
|
||||
"neck_fluff_back": {
|
||||
"rotation": [-45, 0, 0]
|
||||
},
|
||||
"chest_fur": {
|
||||
"rotation": [-30, 0, 0]
|
||||
"chest_fluff": {
|
||||
"rotation": [-12.5, 0, 0]
|
||||
},
|
||||
"chest_fur_right": {
|
||||
"rotation": [0, 35, 0]
|
||||
"chest_fluff_right": {
|
||||
"rotation": [0, 37.5, 0]
|
||||
},
|
||||
"chest_fur_left": {
|
||||
"rotation": [0, -25, 0]
|
||||
"chest_fluff_left": {
|
||||
"rotation": [0, -37.5, 0]
|
||||
},
|
||||
"chest_fur_1": {
|
||||
"rotation": [27.5, 0, 0]
|
||||
"chest_fluff2": {
|
||||
"rotation": [-7.5, 0, 0]
|
||||
},
|
||||
"chest_fur_2": {
|
||||
"chest_fluff3": {
|
||||
"rotation": [7.5, 0, 0]
|
||||
},
|
||||
"tail": {
|
||||
"rotation": [-22.5, 0, 0]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.absol.cry": {
|
||||
"animation_length": 2,
|
||||
"bones": {
|
||||
"mouth": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.17],
|
||||
"0.25": {"pre": [0, 0, 0.17], "post": [0, 0, -1]},
|
||||
"1.7917": {"pre": [0, 0, -1], "post": [0, 0, 0.17]}
|
||||
}
|
||||
}
|
||||
},
|
||||
"sound_effects": {
|
||||
"0.04": {
|
||||
"effect": "pokemon.absol.cry"
|
||||
"rotation": [10, 0, 0]
|
||||
},
|
||||
"neck_fluff_right": {
|
||||
"rotation": [0, 0, -67.5]
|
||||
},
|
||||
"torso": {
|
||||
"rotation": [2.5, 0, 0]
|
||||
},
|
||||
"torso2": {
|
||||
"rotation": [-5, 0, 0]
|
||||
},
|
||||
"head_angle": {
|
||||
"rotation": [-5, 0, 0]
|
||||
},
|
||||
"leg_front_left": {
|
||||
"rotation": [-4.9083, 1.8509, 2.416]
|
||||
},
|
||||
"leg_back_left": {
|
||||
"rotation": [0, -10, 0]
|
||||
},
|
||||
"leg_back_left2": {
|
||||
"rotation": [5, 0, 0]
|
||||
},
|
||||
"leg_back_left3": {
|
||||
"rotation": [10, 0, 0]
|
||||
},
|
||||
"foot_back_left": {
|
||||
"rotation": [-13.9904, -4.9952, -0.2186]
|
||||
},
|
||||
"foot_front_left": {
|
||||
"rotation": [4.991, -1.4949, -3.2033]
|
||||
},
|
||||
"neck_fluff_back2": {
|
||||
"rotation": [-50, 0, 0]
|
||||
},
|
||||
"leg_front_right": {
|
||||
"rotation": [2.585, -1.6431, -2.3501]
|
||||
},
|
||||
"leg_front_right2": {
|
||||
"rotation": [2.5, 0, 0]
|
||||
},
|
||||
"foot_front_right": {
|
||||
"rotation": [-4.9201, 6.845, 3.7466]
|
||||
},
|
||||
"leg_back_right": {
|
||||
"rotation": [0, 10, 0]
|
||||
},
|
||||
"leg_back_right2": {
|
||||
"rotation": [5, 0, 0]
|
||||
},
|
||||
"leg_back_right3": {
|
||||
"rotation": [10, 0, 0]
|
||||
},
|
||||
"foot_back_right": {
|
||||
"rotation": [-13.9904, 4.9952, 0.2186]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.absol.blink": {
|
||||
"animation_length": 0.1667,
|
||||
"bones": {
|
||||
"eyes_open": {
|
||||
"eye_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 1],
|
||||
"0.125": {"pre": [0, 0, 1], "post": [0, 0, 1]},
|
||||
"0.1667": {"pre": [0, 0, 1], "post": [0, 0, 0]}
|
||||
"0.0": [-0.1, 0, 0.1],
|
||||
"0.1667": {"pre": [-0.1, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_closed": {
|
||||
"eye_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -1],
|
||||
"0.125": {"pre": [0, 0, -1], "post": [0, 0, -1]},
|
||||
"0.1667": {"pre": [0, 0, -1], "post": [0, 0, 0]}
|
||||
"0.0": [0.1, 0, 0.1],
|
||||
"0.1667": {"pre": [0.1, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyelid_right": {
|
||||
"position": {
|
||||
"0.0": [-0.1, 0, -0.1],
|
||||
"0.1667": {"pre": [-0.1, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyelid_left": {
|
||||
"position": {
|
||||
"0.0": [0.1, 0, -0.1],
|
||||
"0.1667": {"pre": [0.1, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_blink_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.absol.ditto_face": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"face": {
|
||||
"position": [0, 0, 0.1],
|
||||
"scale": 0
|
||||
},
|
||||
"face_ditto": {
|
||||
"position": [0, 0, -0.1]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.absol.pose": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"neck": {
|
||||
"rotation": [30.3812, -8.6492, -5.0384]
|
||||
},
|
||||
"head": {
|
||||
"rotation": [-17.5, 0, 0]
|
||||
},
|
||||
"hair": {
|
||||
"rotation": [0, 0, -2.5]
|
||||
},
|
||||
"hair2": {
|
||||
"rotation": [2.5, 10, 0]
|
||||
},
|
||||
"hair3": {
|
||||
"rotation": [1.9544, 7.5589, 12.4168]
|
||||
},
|
||||
"neck_fluff_left": {
|
||||
"rotation": [0, 0, 67.5]
|
||||
},
|
||||
"neck_fluff_back": {
|
||||
"rotation": [-45, 0, 0]
|
||||
},
|
||||
"chest_fluff": {
|
||||
"rotation": [-17.5, 0, 0]
|
||||
},
|
||||
"chest_fluff_right": {
|
||||
"rotation": [0, 37.5, 0]
|
||||
},
|
||||
"chest_fluff_left": {
|
||||
"rotation": [0, -37.5, 0]
|
||||
},
|
||||
"chest_fluff2": {
|
||||
"rotation": [-5, 0, 0]
|
||||
},
|
||||
"chest_fluff3": {
|
||||
"rotation": [7.5, 0, 0]
|
||||
},
|
||||
"tail": {
|
||||
"rotation": [-2.2793, -9.656, -2.6129]
|
||||
},
|
||||
"horn": {
|
||||
"rotation": [0, -10, 0]
|
||||
},
|
||||
"neck_fluff_right": {
|
||||
"rotation": [0, 0, -52.5]
|
||||
},
|
||||
"body": {
|
||||
"rotation": [0, 65, 0],
|
||||
"position": [2, -0.55, 0]
|
||||
},
|
||||
"torso": {
|
||||
"rotation": [9.9864, 0.6469, -2.4149]
|
||||
},
|
||||
"torso2": {
|
||||
"rotation": [-5, 0, 0]
|
||||
},
|
||||
"head_angle": {
|
||||
"rotation": [-5.7686, -29.8743, 2.8806]
|
||||
},
|
||||
"leg_front_left": {
|
||||
"rotation": [16.5711, -9.4592, -13.6836],
|
||||
"position": [0.75, -2, 0]
|
||||
},
|
||||
"leg_front_left2": {
|
||||
"rotation": [-45, 0, 0]
|
||||
},
|
||||
"leg_back_left": {
|
||||
"rotation": [14.2119, -9.413, -10.1281]
|
||||
},
|
||||
"leg_back_left2": {
|
||||
"rotation": [-2.5, 0, 0]
|
||||
},
|
||||
"leg_back_left3": {
|
||||
"rotation": [17.5, 0, 0]
|
||||
},
|
||||
"foot_back_left": {
|
||||
"rotation": [-27.3943, 4.3233, 8.0916]
|
||||
},
|
||||
"iris_left": {
|
||||
"position": [1, 0, 0]
|
||||
},
|
||||
"foot_front_left": {
|
||||
"rotation": [41.9868, -4.2611, 0.0665],
|
||||
"position": [0, 0, -0.75]
|
||||
},
|
||||
"claw_middle_front_left": {
|
||||
"rotation": [7.5, 0, 0]
|
||||
},
|
||||
"claw_outer_front_left": {
|
||||
"rotation": [7.5, 0, 0]
|
||||
},
|
||||
"claw_inner_front_left": {
|
||||
"rotation": [7.5, 0, 0]
|
||||
},
|
||||
"neck_fluff_back2": {
|
||||
"rotation": [-50, 0, 0]
|
||||
},
|
||||
"leg_front_right": {
|
||||
"rotation": [-37.5352, -0.064, 9.7291],
|
||||
"position": [-0.25, -1.75, 0]
|
||||
},
|
||||
"leg_front_right2": {
|
||||
"rotation": [3.5, 0, 0]
|
||||
},
|
||||
"foot_front_right": {
|
||||
"rotation": [34.0275, 7.3656, -7.2548],
|
||||
"position": [0, 0.3, 0]
|
||||
},
|
||||
"leg_back_right": {
|
||||
"rotation": [-18.2881, 9.413, 10.1281],
|
||||
"position": [-0.25, 0, 0]
|
||||
},
|
||||
"leg_back_right2": {
|
||||
"rotation": [16.5248, 0.124, 0.1823]
|
||||
},
|
||||
"leg_back_right3": {
|
||||
"rotation": [6, 0, 0]
|
||||
},
|
||||
"foot_back_right": {
|
||||
"rotation": [-2.4124, 5.5284, -9.8095]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.absol.cry": {
|
||||
"sound_effects": {
|
||||
"0.04": {
|
||||
"effect": "pokemon.absol.cry"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1028
-26
File diff suppressed because it is too large
Load Diff
+208
@@ -0,0 +1,208 @@
|
||||
{
|
||||
"format_version": "1.8.0",
|
||||
"animations": {
|
||||
"animation.burmy_plant.ground_idle": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"body": {
|
||||
"rotation": [2.5201, 0.3141, 0.0322],
|
||||
"position": [0, 6, 0]
|
||||
},
|
||||
"body_rotation": {
|
||||
"rotation": [2.5, 0, 0]
|
||||
},
|
||||
"spring2": {
|
||||
"rotation": [-2.5, 0, 0]
|
||||
},
|
||||
"segment1": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"leg_left1": {
|
||||
"rotation": [0, 15, 0]
|
||||
},
|
||||
"leg_right1": {
|
||||
"rotation": [0, -15, 0]
|
||||
},
|
||||
"segment2": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"segment3": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"leg_left2": {
|
||||
"rotation": [0, 17.5, 0]
|
||||
},
|
||||
"leg_left3": {
|
||||
"rotation": [0, 25, 0]
|
||||
},
|
||||
"leg_right2": {
|
||||
"rotation": [0, -17.5, 0]
|
||||
},
|
||||
"leg_right3": {
|
||||
"rotation": [0, -25, 0]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.burmy_plant.ground_idle_naked": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"body_rotation": {
|
||||
"rotation": [7.5, 0, 0],
|
||||
"position": [0, 0, -3]
|
||||
},
|
||||
"segment1": {
|
||||
"rotation": [75, 0, 0]
|
||||
},
|
||||
"leg_left1": {
|
||||
"rotation": [0.00002, 0.00005, 0.00002]
|
||||
},
|
||||
"cloak_plant": {
|
||||
"scale": 0
|
||||
},
|
||||
"body": {
|
||||
"rotation": [2.5, 0, 0],
|
||||
"position": [0, -7.25, 0]
|
||||
},
|
||||
"leg_right1": {
|
||||
"rotation": [0.00002, -0.00005, -0.00002]
|
||||
},
|
||||
"segment2": {
|
||||
"rotation": [5, 0, 0]
|
||||
},
|
||||
"segment3": {
|
||||
"rotation": [2.5781, -0.5734, 0.2485]
|
||||
},
|
||||
"leg_left2": {
|
||||
"rotation": [2.53742, -4.92385, -0.87038]
|
||||
},
|
||||
"leg_left3": {
|
||||
"rotation": [7.53742, -4.92385, -0.87038]
|
||||
},
|
||||
"leg_right2": {
|
||||
"rotation": [2.53742, 4.92385, 0.87038]
|
||||
},
|
||||
"leg_right3": {
|
||||
"rotation": [7.53742, 4.92385, 0.87038]
|
||||
},
|
||||
"face": {
|
||||
"position": [0, 0, 1]
|
||||
},
|
||||
"cloaked_face": {
|
||||
"scale": 0
|
||||
},
|
||||
"face_ditto": {
|
||||
"position": [0, 0, 1]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.burmy_plant.spring": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"body": {
|
||||
"rotation": [2.5201, 0.3141, 0.0322],
|
||||
"position": [0, 6, 0]
|
||||
},
|
||||
"body_rotation": {
|
||||
"rotation": [2.5, 0, 0],
|
||||
"position": [0, -3, 0]
|
||||
},
|
||||
"spring2": {
|
||||
"rotation": [35.9366, -29.087, 32.6804]
|
||||
},
|
||||
"segment1": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"leg_left1": {
|
||||
"rotation": [0, 15, 0]
|
||||
},
|
||||
"spring": {
|
||||
"rotation": [-26.941, -5.7358, -11.1249]
|
||||
},
|
||||
"spring3": {
|
||||
"rotation": [-24.3803, 6.6782, -46.9093]
|
||||
},
|
||||
"spring4": {
|
||||
"rotation": [0, 0, -35]
|
||||
},
|
||||
"leg_right1": {
|
||||
"rotation": [0, -15, 0]
|
||||
},
|
||||
"segment2": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"segment3": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"leg_left2": {
|
||||
"rotation": [0, 17.5, 0]
|
||||
},
|
||||
"leg_left3": {
|
||||
"rotation": [0, 25, 0]
|
||||
},
|
||||
"leg_right2": {
|
||||
"rotation": [0, -17.5, 0]
|
||||
},
|
||||
"leg_right3": {
|
||||
"rotation": [0, -25, 0]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.burmy_plant.ditto_face": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"face": {
|
||||
"position": [0, 0, 0.1],
|
||||
"scale": 0
|
||||
},
|
||||
"face_ditto": {
|
||||
"position": [0, 0, -0.1]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.burmy_plant.blink": {
|
||||
"animation_length": 0.1667,
|
||||
"bones": {
|
||||
"pupil_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.125": {"pre": [0, 0, 0.1], "post": [0, 0, 0.1]},
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_closed_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.125": {"pre": [0, 0, -0.1], "post": [0, 0, -0.1]},
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.125": {"pre": [0, 0, 0.1], "post": [0, 0, 0.1]},
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_closed_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.125": {"pre": [0, 0, -0.1], "post": [0, 0, -0.1]},
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_blink_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+208
@@ -0,0 +1,208 @@
|
||||
{
|
||||
"format_version": "1.8.0",
|
||||
"animations": {
|
||||
"animation.burmy_sandy.ground_idle": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"body": {
|
||||
"rotation": [2.5201, 0.3141, 0.0322],
|
||||
"position": [0, 6, 0]
|
||||
},
|
||||
"body_rotation": {
|
||||
"rotation": [2.5, 0, 0]
|
||||
},
|
||||
"spring2": {
|
||||
"rotation": [-2.5, 0, 0]
|
||||
},
|
||||
"segment1": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"leg_left1": {
|
||||
"rotation": [0, 15, 0]
|
||||
},
|
||||
"leg_right1": {
|
||||
"rotation": [0, -15, 0]
|
||||
},
|
||||
"segment2": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"segment3": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"leg_left2": {
|
||||
"rotation": [0, 17.5, 0]
|
||||
},
|
||||
"leg_left3": {
|
||||
"rotation": [0, 25, 0]
|
||||
},
|
||||
"leg_right2": {
|
||||
"rotation": [0, -17.5, 0]
|
||||
},
|
||||
"leg_right3": {
|
||||
"rotation": [0, -25, 0]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.burmy_sandy.ground_idle_naked": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"body_rotation": {
|
||||
"rotation": [7.5, 0, 0],
|
||||
"position": [0, 0, -3]
|
||||
},
|
||||
"segment1": {
|
||||
"rotation": [75, 0, 0]
|
||||
},
|
||||
"leg_left1": {
|
||||
"rotation": [0.00002, 0.00005, 0.00002]
|
||||
},
|
||||
"cloak_plant": {
|
||||
"scale": 0
|
||||
},
|
||||
"body": {
|
||||
"rotation": [2.5, 0, 0],
|
||||
"position": [0, -7.25, 0]
|
||||
},
|
||||
"leg_right1": {
|
||||
"rotation": [0.00002, -0.00005, -0.00002]
|
||||
},
|
||||
"segment2": {
|
||||
"rotation": [5, 0, 0]
|
||||
},
|
||||
"segment3": {
|
||||
"rotation": [2.5781, -0.5734, 0.2485]
|
||||
},
|
||||
"leg_left2": {
|
||||
"rotation": [2.53742, -4.92385, -0.87038]
|
||||
},
|
||||
"leg_left3": {
|
||||
"rotation": [7.53742, -4.92385, -0.87038]
|
||||
},
|
||||
"leg_right2": {
|
||||
"rotation": [2.53742, 4.92385, 0.87038]
|
||||
},
|
||||
"leg_right3": {
|
||||
"rotation": [7.53742, 4.92385, 0.87038]
|
||||
},
|
||||
"face": {
|
||||
"position": [0, 0, 1]
|
||||
},
|
||||
"cloaked_face": {
|
||||
"scale": 0
|
||||
},
|
||||
"face_ditto": {
|
||||
"position": [0, 0, 1]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.burmy_sandy.spring": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"body": {
|
||||
"rotation": [2.5201, 0.3141, 0.0322],
|
||||
"position": [0, 6, 0]
|
||||
},
|
||||
"body_rotation": {
|
||||
"rotation": [2.5, 0, 0],
|
||||
"position": [0, -3, 0]
|
||||
},
|
||||
"spring2": {
|
||||
"rotation": [35.9366, -29.087, 32.6804]
|
||||
},
|
||||
"segment1": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"leg_left1": {
|
||||
"rotation": [0, 15, 0]
|
||||
},
|
||||
"spring": {
|
||||
"rotation": [-26.941, -5.7358, -11.1249]
|
||||
},
|
||||
"spring3": {
|
||||
"rotation": [-24.3803, 6.6782, -46.9093]
|
||||
},
|
||||
"spring4": {
|
||||
"rotation": [0, 0, -35]
|
||||
},
|
||||
"leg_right1": {
|
||||
"rotation": [0, -15, 0]
|
||||
},
|
||||
"segment2": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"segment3": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"leg_left2": {
|
||||
"rotation": [0, 17.5, 0]
|
||||
},
|
||||
"leg_left3": {
|
||||
"rotation": [0, 25, 0]
|
||||
},
|
||||
"leg_right2": {
|
||||
"rotation": [0, -17.5, 0]
|
||||
},
|
||||
"leg_right3": {
|
||||
"rotation": [0, -25, 0]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.burmy_sandy.ditto_face": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"face": {
|
||||
"position": [0, 0, 0.1],
|
||||
"scale": 0
|
||||
},
|
||||
"face_ditto": {
|
||||
"position": [0, 0, -0.1]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.burmy_sandy.blink": {
|
||||
"animation_length": 0.1667,
|
||||
"bones": {
|
||||
"pupil_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.125": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_closed_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.125": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.125": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_closed_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.125": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_blink_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+208
@@ -0,0 +1,208 @@
|
||||
{
|
||||
"format_version": "1.8.0",
|
||||
"animations": {
|
||||
"animation.burmy_trash.ground_idle": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"body": {
|
||||
"rotation": [2.5201, 0.3141, 0.0322],
|
||||
"position": [0, 6, 0]
|
||||
},
|
||||
"body_rotation": {
|
||||
"rotation": [2.5, 0, 0]
|
||||
},
|
||||
"spring2": {
|
||||
"rotation": [-2.5, 0, 0]
|
||||
},
|
||||
"segment1": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"leg_left1": {
|
||||
"rotation": [0, 15, 0]
|
||||
},
|
||||
"leg_right1": {
|
||||
"rotation": [0, -15, 0]
|
||||
},
|
||||
"segment2": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"segment3": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"leg_left2": {
|
||||
"rotation": [0, 17.5, 0]
|
||||
},
|
||||
"leg_left3": {
|
||||
"rotation": [0, 25, 0]
|
||||
},
|
||||
"leg_right2": {
|
||||
"rotation": [0, -17.5, 0]
|
||||
},
|
||||
"leg_right3": {
|
||||
"rotation": [0, -25, 0]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.burmy_trash.ground_idle_naked": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"body_rotation": {
|
||||
"rotation": [7.5, 0, 0],
|
||||
"position": [0, 0, -3]
|
||||
},
|
||||
"segment1": {
|
||||
"rotation": [75, 0, 0]
|
||||
},
|
||||
"leg_left1": {
|
||||
"rotation": [0.00002, 0.00005, 0.00002]
|
||||
},
|
||||
"cloak_plant": {
|
||||
"scale": 0
|
||||
},
|
||||
"body": {
|
||||
"rotation": [2.5, 0, 0],
|
||||
"position": [0, -7.25, 0]
|
||||
},
|
||||
"leg_right1": {
|
||||
"rotation": [0.00002, -0.00005, -0.00002]
|
||||
},
|
||||
"segment2": {
|
||||
"rotation": [5, 0, 0]
|
||||
},
|
||||
"segment3": {
|
||||
"rotation": [2.5781, -0.5734, 0.2485]
|
||||
},
|
||||
"leg_left2": {
|
||||
"rotation": [2.53742, -4.92385, -0.87038]
|
||||
},
|
||||
"leg_left3": {
|
||||
"rotation": [7.53742, -4.92385, -0.87038]
|
||||
},
|
||||
"leg_right2": {
|
||||
"rotation": [2.53742, 4.92385, 0.87038]
|
||||
},
|
||||
"leg_right3": {
|
||||
"rotation": [7.53742, 4.92385, 0.87038]
|
||||
},
|
||||
"face": {
|
||||
"position": [0, 0, 1]
|
||||
},
|
||||
"cloaked_face": {
|
||||
"scale": 0
|
||||
},
|
||||
"face_ditto": {
|
||||
"position": [0, 0, 1]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.burmy_trash.spring": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"body": {
|
||||
"rotation": [2.5201, 0.3141, 0.0322],
|
||||
"position": [0, 6, 0]
|
||||
},
|
||||
"body_rotation": {
|
||||
"rotation": [2.5, 0, 0],
|
||||
"position": [0, -3, 0]
|
||||
},
|
||||
"spring2": {
|
||||
"rotation": [35.9366, -29.087, 32.6804]
|
||||
},
|
||||
"segment1": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"leg_left1": {
|
||||
"rotation": [0, 15, 0]
|
||||
},
|
||||
"spring": {
|
||||
"rotation": [-26.941, -5.7358, -11.1249]
|
||||
},
|
||||
"spring3": {
|
||||
"rotation": [-24.3803, 6.6782, -46.9093]
|
||||
},
|
||||
"spring4": {
|
||||
"rotation": [0, 0, -35]
|
||||
},
|
||||
"leg_right1": {
|
||||
"rotation": [0, -15, 0]
|
||||
},
|
||||
"segment2": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"segment3": {
|
||||
"position": [0, 0.5, 0]
|
||||
},
|
||||
"leg_left2": {
|
||||
"rotation": [0, 17.5, 0]
|
||||
},
|
||||
"leg_left3": {
|
||||
"rotation": [0, 25, 0]
|
||||
},
|
||||
"leg_right2": {
|
||||
"rotation": [0, -17.5, 0]
|
||||
},
|
||||
"leg_right3": {
|
||||
"rotation": [0, -25, 0]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.burmy_trash.ditto_face": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"face": {
|
||||
"position": [0, 0, 0.1],
|
||||
"scale": 0
|
||||
},
|
||||
"face_ditto": {
|
||||
"position": [0, 0, -0.1]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.burmy_trash.blink": {
|
||||
"animation_length": 0.1667,
|
||||
"bones": {
|
||||
"pupil_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.125": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_closed_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.125": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.125": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_closed_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.125": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_blink_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
{
|
||||
"format_version": "1.8.0",
|
||||
"animations": {
|
||||
"animation.wormadam_plant.ground_idle": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"body": {
|
||||
"rotation": [5, 0, 0],
|
||||
"position": [0, 6, 0]
|
||||
},
|
||||
"body_rotation": {
|
||||
"rotation": [0, 0, 0]
|
||||
},
|
||||
"antenna": {
|
||||
"rotation": [-2.5, 0, 0]
|
||||
},
|
||||
"ear_left": {
|
||||
"rotation": [0, -12.5, 0]
|
||||
},
|
||||
"ear_left2": {
|
||||
"rotation": [0, 0, 20]
|
||||
},
|
||||
"ear_left3": {
|
||||
"rotation": [0, 0, 22.5]
|
||||
},
|
||||
"ear_back_left": {
|
||||
"rotation": [-7.5, 0, 25]
|
||||
},
|
||||
"ear_left4": {
|
||||
"rotation": [0, 0, 17.5]
|
||||
},
|
||||
"ear_right": {
|
||||
"rotation": [0, 12.5, 0]
|
||||
},
|
||||
"ear_right2": {
|
||||
"rotation": [0, 0, -20]
|
||||
},
|
||||
"ear_right3": {
|
||||
"rotation": [0, 0, -22.5]
|
||||
},
|
||||
"ear_right4": {
|
||||
"rotation": [0, 0, -17.5]
|
||||
},
|
||||
"ear_back_right": {
|
||||
"rotation": [-7.5, 0, -25]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.wormadam_plant.blink": {
|
||||
"animation_length": 0.1667,
|
||||
"bones": {
|
||||
"pupil_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.125": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_closed_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.125": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.125": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_closed_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.125": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_blink_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.wormadam_plant.ditto_face": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"face": {
|
||||
"position": [0, 0, 0.1],
|
||||
"scale": 0
|
||||
},
|
||||
"face_ditto": {
|
||||
"position": [0, 0, -0.1]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
{
|
||||
"format_version": "1.8.0",
|
||||
"animations": {
|
||||
"animation.wormadam_sandy.ground_idle": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"body": {
|
||||
"rotation": [5, 0, 0],
|
||||
"position": [0, 6, 0]
|
||||
},
|
||||
"body_rotation": {
|
||||
"rotation": [0, 0, 0]
|
||||
},
|
||||
"antenna": {
|
||||
"rotation": [-2.5, 0, 0]
|
||||
},
|
||||
"ear_left": {
|
||||
"rotation": [0, -12.5, 0]
|
||||
},
|
||||
"ear_left2": {
|
||||
"rotation": [0, 0, 20]
|
||||
},
|
||||
"ear_left3": {
|
||||
"rotation": [0, 0, 22.5]
|
||||
},
|
||||
"ear_back_left": {
|
||||
"rotation": [-7.5, 0, 25]
|
||||
},
|
||||
"ear_left4": {
|
||||
"rotation": [0, 0, 17.5]
|
||||
},
|
||||
"ear_right": {
|
||||
"rotation": [0, 12.5, 0]
|
||||
},
|
||||
"ear_right2": {
|
||||
"rotation": [0, 0, -20]
|
||||
},
|
||||
"ear_right3": {
|
||||
"rotation": [0, 0, -22.5]
|
||||
},
|
||||
"ear_right4": {
|
||||
"rotation": [0, 0, -17.5]
|
||||
},
|
||||
"ear_back_right": {
|
||||
"rotation": [-7.5, 0, -25]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.wormadam_sandy.blink": {
|
||||
"animation_length": 0.1667,
|
||||
"bones": {
|
||||
"pupil_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.125": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_closed_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.125": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.125": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_closed_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.125": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_blink_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.wormadam_sandy.ditto_face": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"face": {
|
||||
"position": [0, 0, 0.1],
|
||||
"scale": 0
|
||||
},
|
||||
"face_ditto": {
|
||||
"position": [0, 0, -0.1]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
{
|
||||
"format_version": "1.8.0",
|
||||
"animations": {
|
||||
"animation.wormadam_trash.ground_idle": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"body": {
|
||||
"rotation": [5, 0, 0],
|
||||
"position": [0, 6, 0]
|
||||
},
|
||||
"body_rotation": {
|
||||
"rotation": [0, 0, 0]
|
||||
},
|
||||
"antenna": {
|
||||
"rotation": [-2.5, 0, 0]
|
||||
},
|
||||
"ear_left": {
|
||||
"rotation": [0, -12.5, 0]
|
||||
},
|
||||
"ear_left2": {
|
||||
"rotation": [0, 0, 20]
|
||||
},
|
||||
"ear_left3": {
|
||||
"rotation": [0, 0, 22.5]
|
||||
},
|
||||
"ear_back_left": {
|
||||
"rotation": [-7.5, 0, 25]
|
||||
},
|
||||
"ear_left4": {
|
||||
"rotation": [0, 0, 17.5]
|
||||
},
|
||||
"ear_right": {
|
||||
"rotation": [0, 12.5, 0]
|
||||
},
|
||||
"ear_right2": {
|
||||
"rotation": [0, 0, -20]
|
||||
},
|
||||
"ear_right3": {
|
||||
"rotation": [0, 0, -22.5]
|
||||
},
|
||||
"ear_right4": {
|
||||
"rotation": [0, 0, -17.5]
|
||||
},
|
||||
"ear_back_right": {
|
||||
"rotation": [-7.5, 0, -25]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.wormadam_trash.blink": {
|
||||
"animation_length": 0.1667,
|
||||
"bones": {
|
||||
"pupil_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.125": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_closed_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.125": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.125": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_closed_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.125": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_blink_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.wormadam_trash.ditto_face": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"face": {
|
||||
"position": [0, 0, 0.1],
|
||||
"scale": 0
|
||||
},
|
||||
"face_ditto": {
|
||||
"position": [0, 0, -0.1]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
{
|
||||
"format_version": "1.8.0",
|
||||
"animations": {
|
||||
"animation.mothim.ground_idle": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"torso": {
|
||||
"rotation": [5, 0, 0]
|
||||
},
|
||||
"wing_upper_left": {
|
||||
"rotation": [1.3185, -9.9136, -7.6143]
|
||||
},
|
||||
"wing_lower_left": {
|
||||
"rotation": [-2.5, -12.5, 0]
|
||||
},
|
||||
"head": {
|
||||
"rotation": [-5, 0, 0]
|
||||
},
|
||||
"antenna_left": {
|
||||
"rotation": [-22.4229, 1.9113, 4.6211]
|
||||
},
|
||||
"antenna_left2": {
|
||||
"rotation": [-7.5, 0, 0]
|
||||
},
|
||||
"tail": {
|
||||
"rotation": [-12.5, 0, 0]
|
||||
},
|
||||
"antenna_right": {
|
||||
"rotation": [-22.4229, -1.9113, -4.6211]
|
||||
},
|
||||
"antenna_right2": {
|
||||
"rotation": [-7.5, 0, 0]
|
||||
},
|
||||
"arm_left": {
|
||||
"rotation": [-0.9096, 19.9802, 44.8398]
|
||||
},
|
||||
"arm_right": {
|
||||
"rotation": [-0.9096, -19.9802, -44.8398]
|
||||
},
|
||||
"leg_left": {
|
||||
"rotation": [-9.041, -41.7073, 13.4501]
|
||||
},
|
||||
"leg_right": {
|
||||
"rotation": [-9.041, 41.7073, -13.4501]
|
||||
},
|
||||
"wing_upper_right": {
|
||||
"rotation": [1.3185, 9.9136, 7.6143]
|
||||
},
|
||||
"wing_lower_right": {
|
||||
"rotation": [-2.5, 12.5, 0]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.mothim.blink": {
|
||||
"animation_length": 0.1667,
|
||||
"bones": {
|
||||
"eye_open_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.125": {"pre": [0, 0, 0.1], "post": [0, 0, 0.1]},
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eye_open_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.125": {"pre": [0, 0, 0.1], "post": [0, 0, 0.1]},
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eye_closed_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.125": {"pre": [0, 0, -0.1], "post": [0, 0, -0.1]},
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, -0.1]}
|
||||
}
|
||||
},
|
||||
"eye_closed_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.125": {"pre": [0, 0, -0.1], "post": [0, 0, -0.1]},
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, -0.1]}
|
||||
}
|
||||
},
|
||||
"eyes_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_blink_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+211
-1542
File diff suppressed because it is too large
Load Diff
+104
@@ -0,0 +1,104 @@
|
||||
{
|
||||
"format_version": "1.8.0",
|
||||
"animations": {
|
||||
"animation.snover.ground_idle": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"tail": {
|
||||
"rotation": [-7.44134, 0.07948, 0.53084]
|
||||
},
|
||||
"arm_right": {
|
||||
"rotation": [0, 0, "-32.5-5*Math.sin((query.anim_time-0.5) * 90 * 1)"]
|
||||
},
|
||||
"arm_right2": {
|
||||
"rotation": [0, "-12.5+5*Math.sin((query.anim_time-0.75) * 90 * 1)", 0]
|
||||
},
|
||||
"torso": {
|
||||
"rotation": ["-2.5+2*Math.sin((query.anim_time-0) * 90 * 1)", 0, "-2*Math.sin((query.anim_time-0.8) * 90 * 0.5)"],
|
||||
"position": [0, "0.1*Math.sin((query.anim_time-0.75) * 90 * 1)", 0]
|
||||
},
|
||||
"torso2": {
|
||||
"rotation": ["5+1*Math.sin((query.anim_time-0.25) * 90 * 1)", 0, 0]
|
||||
},
|
||||
"arm_left": {
|
||||
"rotation": [0, 0, "32.5+5*Math.sin((query.anim_time-0.5) * 90 * 1)"]
|
||||
},
|
||||
"arm_left2": {
|
||||
"rotation": [0, "12.5-5*Math.sin((query.anim_time-0.75) * 90 * 1)", 0]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.snover.blink": {
|
||||
"animation_length": 0.1667,
|
||||
"bones": {
|
||||
"pupil_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_closed_right": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"pupil_closed_left": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, 0.1],
|
||||
"0.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
},
|
||||
"eyes_blink_ditto": {
|
||||
"position": {
|
||||
"0.0": [0, 0, -0.1],
|
||||
"0.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.snover.ditto_face": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"eyes": {
|
||||
"scale": 0
|
||||
},
|
||||
"face_ditto": {
|
||||
"position": [0, 0, -0.1]
|
||||
}
|
||||
}
|
||||
},
|
||||
"animation.snover.berries_female": {
|
||||
"loop": true,
|
||||
"bones": {
|
||||
"berry_front": {
|
||||
"position": [0, 0, -4]
|
||||
},
|
||||
"berry_front_right": {
|
||||
"position": [-4, 0, -4]
|
||||
},
|
||||
"berry_back_right": {
|
||||
"position": [-4, 0, 4]
|
||||
},
|
||||
"berry_front_left": {
|
||||
"position": [4, 0, -4]
|
||||
},
|
||||
"berry_back_left": {
|
||||
"position": [4, 0, 4]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user