Compare commits

..
Author SHA1 Message Date
Licious 6dcee2b8f3 Port PokemonBehaviour to Codecs 2023-10-15 15:09:58 +01:00
Licious 224c3faa4c Port Evolution stuff to codecs, rework RegistryLikeCondition to accept any registry type without implementation need. 2023-10-15 14:06:17 +01:00
Licious c42a2a6933 Merge branch 'main' into custom-type-support
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/CobblemonImplementation.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/pokemon/PokemonProperties.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/api/types/ElementalTypes.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/gui/battle/subscreen/BattleMoveSelection.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
#	common/src/main/resources/assets/cobblemon/showdown.zip
#	fabric/src/main/kotlin/com/cobblemon/mod/fabric/CobblemonFabric.kt
#	forge/src/main/kotlin/com/cobblemon/mod/forge/CobblemonForge.kt
2023-10-13 15:57:18 +01:00
Paul 072ad5ff12 Fixed Haban hitbox, fixed one weird Pomeg berry placement 2023-10-13 15:27:22 +10:00
Hiroku b3757113ac Merge branch 'pokemon-drops' into 'main'
Pokemon drops

Closes #552

See merge request cable-mc/cobblemon!678
2023-10-12 21:29:06 +00:00
Nick 3bb17ffc6e Merge branch 'pokemon-removing-fix' into 'main'
Fixes owned Pokemon not being removed, when they should.

See merge request cable-mc/cobblemon!682
2023-10-12 18:15:32 +00:00
Deltric f37924fb0c Fixes owned Pokemon not being removed, when they should. 2023-10-12 10:44:16 -05:00
Hiroku 6e2765902e Merge branch '1.4-Spawns' into 'main'
lAsT miNuTE Spawn edits.

See merge request cable-mc/cobblemon!681
2023-10-12 11:02:30 +00:00
tyzillion d7c32e4ad8 A few spawns updated. 2023-10-11 18:12:24 -04:00
tyzillion 8732094c28 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into 1.4-Spawns
# Conflicts:
#	common/src/main/resources/data/cobblemon/spawn_detail_presets/shipwreck.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0025_pikachu.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0026_raichu.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0037_vulpix.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0038_ninetales.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0043_oddish.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0044_gloom.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0052_meowth.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0053_persian.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0058_growlithe.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0059_arcanine.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0063_abra.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0064_kadabra.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0065_alakazam.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0072_tentacool.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0073_tentacruel.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0077_ponyta.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0078_rapidash.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0083_farfetchd.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0088_grimer.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0089_muk.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0090_shellder.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0091_cloyster.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0092_gastly.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0096_drowzee.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0097_hypno.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0100_voltorb.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0101_electrode.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0102_exeggcute.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0103_exeggutor.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0109_koffing.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0110_weezing.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0113_chansey.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0116_horsea.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0117_seadra.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0122_mrmime.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0124_jynx.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0132_ditto.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0133_eevee.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0134_vaporeon.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0135_jolteon.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0136_flareon.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0147_dratini.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0148_dragonair.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0149_dragonite.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0152_chikorita.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0153_bayleef.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0154_meganium.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0167_spinarak.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0168_ariados.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0170_chinchou.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0171_lanturn.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0177_natu.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0178_xatu.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0190_aipom.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0193_yanma.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0196_espeon.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0197_umbreon.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0209_snubbull.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0210_granbull.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0216_teddiursa.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0217_ursaring.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0230_kingdra.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0238_smoochum.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0241_miltank.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0242_blissey.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0261_poochyena.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0262_mightyena.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0278_wingull.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0279_pelipper.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0280_ralts.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0281_kirlia.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0282_gardevoir.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0283_surskit.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0284_masquerain.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0290_nincada.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0293_whismur.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0294_loudred.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0295_exploud.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0313_volbeat.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0314_illumise.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0343_baltoy.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0344_claydol.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0355_duskull.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0356_dusclops.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0366_clamperl.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0367_huntail.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0368_gorebyss.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0369_relicanth.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0374_beldum.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0375_metang.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0376_metagross.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0396_starly.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0397_staravia.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0398_staraptor.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0415_combee.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0416_vespiquen.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0424_ambipom.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0427_buneary.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0428_lopunny.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0439_mimejr.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0440_happiny.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0442_spiritomb.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0469_yanmega.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0470_leafeon.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0471_glaceon.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0475_gallade.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0477_dusknoir.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0506_lillipup.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0507_herdier.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0508_stoutland.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0519_pidove.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0520_tranquill.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0521_unfezant.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0532_timburr.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0533_gurdurr.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0534_conkeldurr.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0561_sigilyph.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0562_yamask.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0563_cofagrigus.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0622_golett.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0623_golurk.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0664_scatterbug.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0665_spewpa.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0666_vivillon.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0679_honedge.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0681_aegislash.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0700_sylveon.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0742_cutiefly.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0743_ribombee.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0764_comfey.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0767_wimpod.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0768_golisopod.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0778_mimikyu.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0835_yamper.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0836_boltund.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0863_perrserker.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0868_milcery.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0869_alcremie.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0870_falinks.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0901_ursaluna.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0924_tandemaus.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0925_maushold.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0926_fidough.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0927_dachsbun.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0931_squawkabilly.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0935_charcadet.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0936_armarouge.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0937_ceruledge.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0942_maschiff.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0943_mabosstiff.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0944_shroodle.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0945_grafaiai.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0974_cetoddle.json
#	common/src/main/resources/data/cobblemon/spawn_pool_world/0975_cetitan.json
#	common/src/main/resources/data/cobblemon/species/generation6/spewpa.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_beach.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_cold.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_cold_ocean.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_deep.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_desert.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_frozen.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_jungle.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_lush.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_mountain.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_mushroom.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_nether_basalt.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_nether_crimson.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_nether_fungus.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_nether_quartz.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_nether_soul_sand.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_nether_wasteland.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_ocean.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_peak.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_plains.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_plateau.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_spooky.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_spring.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_swamp.json
#	common/src/main/resources/data/cobblemon/tags/worldgen/biome/is_taiga.json
2023-10-11 18:05:10 -04:00
Hiroku 38fecf337e Merge branch 'implement_pokemon' into 'main'
Last minute Pokemon fixes and updates.

See merge request cable-mc/cobblemon!679
2023-10-11 20:44:18 +00:00
tyzillion 3c7c640217 Last minute changes? More like last minute bugs. Amiright? 2023-10-10 23:58:38 -04:00
tyzillion b7e8cad3bd Fixed Pokemon not playing faint animations if fainted while asleep. Also fixed Alolan Raichu T-posing while battling. 2023-10-10 21:34:59 -04:00
tyzillion d553332017 Fixed Icy snow and High plains Vivillon not spawning as Meadow. Also fixed Spewpa evolving into Meadow instead of Icy and High Plains. Updated Alolan Exeggutor model, animations, and texture. Updated Boltund animation, updated Raticate models and animations. Added Stufful and Bewears shiny textures. 2023-10-10 20:46:14 -04:00
Lily 03b0bb9937 a bunch of missed pokemon drops 2023-10-10 18:23:58 +00:00
Lily 51a3d686ff gen 6 drops done 2023-10-10 15:47:42 +00:00
Lily 267c14cdd5 and here's 14 more because my IDE broke again somehow 2023-10-10 15:45:39 +00:00
Lily c9367f63b4 only 6 pokemon drops because my IDE broke and i dont wanna lose these 2023-10-10 15:30:15 +00:00
Lily 48f8561662 fixed typos 2023-10-10 14:44:16 +00:00
Lily 951a36f82e gen 9 drops 2023-10-10 14:22:51 +00:00
Lily e9edd7a1e9 gen 8 drops 2023-10-10 13:52:18 +00:00
Paul cb407bb649 Convenience dataTracker function [skip-ci] 2023-10-09 16:59:00 +10:00
Hiroku 5e28612d99 Actually the dip should probably still max at 1 2023-10-09 06:07:23 +00:00
Hiroku ea007d21db Fixed braised vivichokes and vivichoke dip not stacking, closes #560 2023-10-09 06:05:09 +00:00
Paul dc1a035dae Merge remote-tracking branch 'origin/main' into 1.4-fixes-5 2023-10-09 15:12:49 +10:00
Hiroku 71db46d86b Merge branch '1.4-Spawn-Fixes' into 'main'
1.4 spawn fixes

See merge request cable-mc/cobblemon!677
2023-10-09 05:12:13 +00:00
Paul a61b71205b Struck down by licenses again 2023-10-09 14:36:42 +10:00
Paul 63b14aa4ba Fixed pokemon selection GUIs not showing aspects, closes #547 2023-10-09 11:12:42 +10:00
Hiroku fb23e3961c Merge branch '1.4-fixes-4' into 'main'
Fixed animation stacking with cries and battle animations that made Typhlosion horrifying

See merge request cable-mc/cobblemon!675
2023-10-09 00:55:23 +00:00
Paul bdf9606d61 Fixed pasture click sounds not playing / playing when they shouldn't, fixes #404 2023-10-09 10:55:07 +10:00
Paul bf5b03398c Fix fakemon breaking PCs when the addon is removed 2023-10-09 10:41:16 +10:00
Hiroku 3a824b1971 Merge branch 'mongdb-datastore' into 'main'
Implemented MongoDB support for new PlayerData props.

See merge request cable-mc/cobblemon!674
2023-10-09 00:34:44 +00:00
Paul 0bbecc5951 Fixed Ninjask T-posing in battle, closes #555 2023-10-09 10:10:23 +10:00
Paul c60fb253cd Fixed no-fallback texture situations causing crashing, closes #557 2023-10-09 09:59:18 +10:00
navneetset 34240a101a Fixed paddlin' 2023-10-09 01:58:24 +02:00
Paul c6a4db47f4 Fixed animation stacking with cries and battle animations that made Typhlosion horrifying 2023-10-09 09:33:22 +10:00
Hiroku ac2dbde41e Merge branch '1.4-fixes-3' into 'main'
1.4 fixes 3

See merge request cable-mc/cobblemon!673
2023-10-08 23:20:06 +00:00
navneetset b8d19b3c4c Added support for new additional PlayerData props. 2023-10-09 01:10:17 +02:00
Paul 747aedca27 Fixed battle tile animations having the zoomies in Forge 2023-10-09 08:45:10 +10:00
Paul 9540bc9394 Fixed Forewarn message being silly 2023-10-09 08:44:59 +10:00
miasmus a7fed0d042 gen 5 drops, edits for consistency 2023-10-08 18:38:57 -04:00
Paul aedb0755f9 Added sleeping to Mareep line 2023-10-09 08:19:37 +10:00
Paul 23eb10f5ea Fixed sleeping pokemon in the wild never waking up 2023-10-09 08:19:28 +10:00
Paul 2c134c5e1b More shoulder effect backcompat (slow falling) 2023-10-09 07:05:40 +10:00
Paul f7f70f14bc Spawning JSON syntax fixes 2023-10-09 06:22:02 +10:00
Paul d3834b0bb7 Merge remote-tracking branch 'origin/main' into 1.4-Spawn-Fixes 2023-10-09 06:04:37 +10:00
Veraxiel 2033240b83 Added missing evo moves for gen 9 and some starters. 2023-10-08 15:49:49 -04:00
Veraxiel 1400505757 Made changes to spawn files, presets, tags, and loot tables. 2023-10-08 14:35:56 -04:00
Licious 40af1f0bdf More stuff n things. 2023-10-08 18:36:37 +01:00
miasmus 9da0459793 its not bonemeal its bone_meal silly 2023-10-07 20:20:16 -04:00
miasmus 7ac41e2f68 rearrange some json to be more consistent (gen 4) 2023-10-07 20:14:39 -04:00
miasmus e0cdc08cd3 gen 4 drops 2023-10-07 20:14:20 -04:00
Hiroku 438e502a5a Merge branch 'mongdb-datastore' into 'main'
Added MongoDB datastore piggybacking off JSON store. Fixed package typo.

See merge request cable-mc/cobblemon!601
2023-10-08 00:02:00 +00:00
navneetset d7b344cff8 Added to changelog. 2023-10-08 01:47:43 +02:00
Pebbles 249c305474 Merge branch 'main' into 'mongdb-datastore'
# Conflicts:
#   common/src/main/kotlin/com/cobblemon/mod/common/Cobblemon.kt
2023-10-07 23:16:29 +00:00
Lily 5b6ed359a3 gen 1, 2, 3, and 7 drops (i spent 4 hours on this :3) 2023-10-07 18:59:12 -04:00
Hiroku d14e16fe5b Merge branch 'battle-builder-fix' into 'main'
Missing returns for SuccessfulBattleStart

See merge request cable-mc/cobblemon!672
2023-10-07 22:45:42 +00:00
Deltric 65dd132081 Missing returns for SuccessfulBattleStart 2023-10-07 17:24:45 -05:00
Hiroku 7f8b241695 Merge branch 'shoulder-back-arm-leg-compat' into 'main'
Added light backwards compatibility for shoulder mount effects

See merge request cable-mc/cobblemon!671
2023-10-07 12:20:54 +00:00
Paul 0b824fe4c1 Added light backwards compatibility for shoulder mount effects 2023-10-07 21:23:02 +10:00
Hiroku c9fc2ce95d Merge branch 'datapack-fix' into 'main'
Switched to findAllResources instead of findResources

See merge request cable-mc/cobblemon!667
2023-10-07 10:56:21 +00:00
Deltric 91eff015dc Ordered loading alphabetically 2023-10-07 04:03:13 -05:00
Deltric a9c8825b3c Forgot to change method parameters 2023-10-07 03:06:42 -05:00
Hiroku 9d64b0f06a Merge branch 'untradeable-rework' into 'main'
Untradeable rework

See merge request cable-mc/cobblemon!669
2023-10-07 04:10:53 +00:00
Deltric 2b3c2358a5 Merge remote-tracking branch 'origin/datapack-fix' into datapack-fix 2023-10-06 22:11:00 -05:00
Deltric a84a2aac58 Progress on resource fix 2023-10-06 22:10:51 -05:00
Deltric fe86d644ad Switched to findAllResources instead of findResources 2023-10-06 22:10:51 -05:00
Deltric 9eb8d5e832 Progress on resource fix 2023-10-06 22:10:07 -05:00
Hiroku 5d2e877176 Merge branch 'berry-with-flywheel' into 'main'
Make berries render with flywheel, improve perf 100x

Closes #444

See merge request cable-mc/cobblemon!665
2023-10-07 03:08:28 +00:00
apion b2b08ac098 Rollback apricorn plank model change (but fr this time) 2023-10-06 22:08:19 -04:00
Lily ae8e4a4f3a gen 1 drops updated 2023-10-06 22:03:52 -04:00
apion e5f0911b83 Rollback apricorn plank model change 2023-10-06 21:52:29 -04:00
Paul e1ae600419 Properly implemented tradeable property in trade GUI 2023-10-07 11:13:59 +10:00
Paul 34315d9f1d Added a bunch of license files 2023-10-07 09:32:58 +10:00
Paul 773cef8e46 Forgot sprout texture 2023-10-07 09:32:25 +10:00
Paul 282a15b1b2 Updated Touga, Coba, Kelpsy, flower, and sprout assets 2023-10-07 09:30:48 +10:00
Hiroku 3b17ad4f54 Merge branch 'leaf-me-alone' into 'main'
Apricorn Leaf Update

See merge request cable-mc/cobblemon!668
2023-10-06 06:57:17 +00:00
dhi_holo 04c5b698c2 New colour, who this?
All the leaves are different again
2023-10-06 16:55:39 +10:00
Paul 123029199c Fixed UV rotations not being applied to berry models 2023-10-06 16:05:38 +10:00
Deltric 8f70bd5eaf Switched to findAllResources instead of findResources 2023-10-06 00:57:55 -05:00
Hiroku 24310d5144 Merge branch 'mulch-fix' into 'main'
Modified mulch code

Closes #550

See merge request cable-mc/cobblemon!666
2023-10-06 03:04:02 +00:00
Deltric b4b5d62632 Modified mulch code 2023-10-05 21:22:36 -05:00
apion d550d775a6 Fix dependency notation for flywheel 2023-10-05 22:05:01 -04:00
apion e572584dbf Remove render caching stuff from BerryBlockEntities 2023-10-05 22:02:03 -04:00
apion 6ac58cf7c2 Added fallback to vanilla renderer 2023-10-05 21:56:04 -04:00
apion e8a1e66658 Merge branch 'main' into berry-with-flywheel 2023-10-05 21:44:55 -04:00
apion 9c67d0ad6f Fixed forge build 2023-10-05 21:42:00 -04:00
apion 0747d08a90 Forge build not working, pushing to compare 2023-10-05 21:17:11 -04:00
apion 299ab3d5f7 Merge branch 'main' into berry-with-flywheel 2023-10-05 21:05:32 -04:00
Hiroku 7e0f48ea54 Merge branch 'main' into 'main'
Update aspects when applying PokemonProperties to a Pokemon or PokemonEntity

See merge request cable-mc/cobblemon!655
2023-10-05 21:06:06 +00:00
Xander Forrest 49a5090903 Merge branch cobblemon:main into main 2023-10-05 17:55:12 +00:00
Xander Forrest 7e0e55d126 Undo setting FormData changes on PokemonProperties 2023-10-05 17:13:10 +01:00
Hiroku f3fa765890 Merge branch 'fix-double-dipping' into 'main'
Items are double consumed

See merge request cable-mc/cobblemon!658
2023-10-05 09:08:31 +00:00
Hiroku a9a91a813a Merge branch 'nickname-fix' into 'main'
Fix nickname updates not applying when returning to species name.

See merge request cable-mc/cobblemon!662
2023-10-05 09:06:27 +00:00
Hiroku 579e48f93c Merge branch 'implement_pokemon' into 'main'
Some more minor fixes for Pokemon.

See merge request cable-mc/cobblemon!661
2023-10-05 09:01:41 +00:00
Hiroku e8520953f6 Merge branch 'sound' into 'main'
Updated the Healing Machine sound

See merge request cable-mc/cobblemon!663
2023-10-05 08:49:06 +00:00
apion 47deb6504b Get flywheel packaged into the fabric built jar, fix some create conflicts 2023-10-04 19:21:58 -04:00
Sterrezo cd0f95169a Merge branch 'main' into sound 2023-10-04 23:58:56 +02:00
Sterrezo a23b37ee47 Updated the Healing Machine sound 2023-10-04 23:57:10 +02:00
Pebbles 370d65284d Merge branch 'main' into 'mongdb-datastore'
# Conflicts:
#   common/src/main/kotlin/com/cobblemon/mod/common/api/storage/factory/FileBackedPokemonStoreFactory.kt
2023-10-04 14:10:01 +00:00
Deltric e2b2ee9031 Remove ignore case from check 2023-10-03 21:04:48 -05:00
Deltric 141b38b81c Fix nickname updates not applying when returning to species name. 2023-10-03 20:59:41 -05:00
Lily f41c2aa0c1 fixed 5 billion typos 2023-10-03 18:46:59 -04:00
tyzillion 87fffe67f5 Made Frogadiers cry not loop, fixed Patrat and Watchog emissives. Fixed Phantumps shiny emissive AGAIN, and fixed shiny phantump texture. 2023-10-03 17:18:42 -04:00
tyzillion 7a13a5a4d1 Updated Garchomp animation tweaks, updated Nidoking texture, updated Nidorino model and animations, Removed Blazing and Ender variants from Vivillon. 2023-10-03 16:58:02 -04:00
Lily 9efc3f1eef gen 8 drops 2023-10-03 18:47:53 +00:00
Lily 8188cabb4f gen 7 drops 2023-10-03 18:23:14 +00:00
Lily b545e01aef gen 6 drops 2023-10-03 18:01:54 +00:00
Lily c34a09430a gen 5 drops 2023-10-03 17:39:38 +00:00
Lily 403acf5822 gen 4 drops 2023-10-03 16:49:30 +00:00
Lily d53c17bc8e gen 3 drops 2023-10-03 15:00:24 +00:00
Lily 7bc9778ce3 gen 2 drops 2023-10-03 14:20:07 +00:00
Paul 57687ffcdb Fixed wild Pokémon not sleeping in the wild 2023-10-03 20:59:51 +10:00
Paul d40e2706c0 Merge remote-tracking branch 'origin/main' 2023-10-03 20:32:50 +10:00
Paul abecc6c74d Fixed light in spawning not being a very good condition at all 2023-10-03 20:32:38 +10:00
Hiroku 709b933661 Merge branch 'store_bug' into 'main'
Fixes an error in the Pokémon list in the BottomlessStore

See merge request cable-mc/cobblemon!659
2023-10-03 10:13:25 +00:00
Hiroku d426d6e843 Merge branch 'untinted-glasses' into 'main'
Updates the Apricorns

See merge request cable-mc/cobblemon!660
2023-10-03 07:31:06 +00:00
dhi_holo 234acf0787 consistency patch
makes stripped and unstripped logs have the same top
2023-10-03 14:37:33 +10:00
dhi_holo b4b0bed36c correction
wrong files lmao
2023-10-03 14:28:03 +10:00
dhi_holo 65f0bfdcd9 Update CobblemonClient.kt
knew I'd miss some random thing about leaf tinting, damn you line 96
2023-10-03 14:19:50 +10:00
dhi_holo f598af314a Fitting In
All the Apricorn Items (plus the Sprout blocks) now have fitting leaves

I also finally fixed the log textures not being updated 🗡️
2023-10-03 14:12:37 +10:00
dhi_holo cef14e938f Updates the Leaves
Leaves now no longer use tinting (commented out the code incase we need to roll it back eventually)
2023-10-03 13:32:53 +10:00
Pedro Souza f53cd87081 Fixed BottomlessStore 2023-10-03 00:26:36 -03:00
Deltric bfc820808f Items are double consumed 2023-10-02 04:20:57 -05:00
Hiroku 57a34e490d Merge branch 'new-tag-syncing' into 'main'
Unbattleable and Hide label spawn packet

See merge request cable-mc/cobblemon!657
2023-10-02 08:10:15 +00:00
Deltric e817496f7e Unbattleable and Hide label spawn packet 2023-10-02 02:47:03 -05:00
Paul 8aea2d5b74 Tweaks to relative berry growth speeds 2023-10-02 15:59:03 +10:00
Paul 47213c3ae4 Fixed growth mulch oops 2023-10-02 15:50:13 +10:00
Hiroku d70fbe70d2 Merge branch 'pd-extension-safety' into 'main'
PD Extension Load Safety

See merge request cable-mc/cobblemon!656
2023-10-02 03:09:48 +00:00
Deltric 3768d4278e Increase Mint grow chance x5 2023-10-01 20:05:15 -05:00
Xander Forrest 6283a0bee0 Merge remote-tracking branch 'origin/main' 2023-10-01 15:48:15 +01:00
Xander Forrest 43a24a9c98 Instead of just setting FormData field on a Pokemon when applying PokemonProperties, apply each aspect of that new Form Data.
When updating the form, get the current form, and remove those aspects first. If not, you can not switch a regional formed Pokemon "back to normal", because there is no "normal" aspect, "normal" form is just the default if the other Form's aspects aren't present.
2023-10-01 15:48:03 +01:00
Xander Forrest d8b401aee0 Merge branch cobblemon:main into main 2023-10-01 14:46:31 +00:00
Hiroku f64e919bf2 Merge branch 'no-more-advancement-for-you' into 'main'
Do more complicated check for level up trigger

Closes #536

See merge request cable-mc/cobblemon!653
2023-10-01 10:07:18 +00:00
Hiroku a727c099ae Slowed mints back down again, just a bit 2023-10-01 04:40:43 +00:00
Hiroku e4ae8fe6dd Merge branch 'rest-fix' into 'main'
fix rest move not updating client-side hp

Closes #539

See merge request cable-mc/cobblemon!654
2023-09-30 22:33:33 +00:00
Xander Forrest c46ab35af0 Update aspects when applying PokemonProperties to a Pokemon or PokemonEntity 2023-09-30 22:50:51 +01:00
miasmus 25bfdb3aa2 fix rest move not updating client-side hp 2023-09-30 17:14:52 -04:00
MoeBoy76 7d5b0c9648 increased complication of level up trigger to fix #536 2023-10-01 07:52:45 +11:00
Hiroku 2ccf49e65c Made mints ~10% rarer in each band 2023-09-30 20:11:37 +00:00
Licious bc12466e09 Merge branch 'more-1.4-fixes' into 'main'
Various bug fixes

Closes #507, #534, #504, #505, and #503

See merge request cable-mc/cobblemon!650
2023-09-30 19:54:55 +00:00
Hiroku 7d03f5f780 Faster mint growth 2023-09-30 05:45:53 +00:00
Hiroku 2eb23f0707 Merge branch 'pp-to-the-max' into 'main'
Update pp_max.json

See merge request cable-mc/cobblemon!651
2023-09-30 04:07:32 +00:00
dhi_holo cbe7626bdc Update pp_max.json
Changes the required berry to Hopo
2023-09-30 14:03:52 +10:00
Paul f83b10643c Added attack knockback attribute to Pokémon, closes #503 2023-09-30 13:23:53 +10:00
Paul 40be5a2060 Fixed most of the berry mulches not working, closes #505 2023-09-30 13:15:37 +10:00
Paul 2b26576a1c Fixed mutations not working woops, closes #504 2023-09-30 12:52:33 +10:00
Paul 48d6f7f707 Fixed pasture block drops and Pokémon not despawning from pastures under regular block break situations, closes #534 2023-09-30 12:29:03 +10:00
Paul ea6bf1fcd1 Make berries take a sec to break instead of being instant 2023-09-30 12:27:27 +10:00
Paul e0ab5e60d0 Fixed pasture and PC drop behaviour 2023-09-30 12:21:42 +10:00
Paul 3d4e941af2 Fixed errors when partying pastured Pokémon 2023-09-30 12:15:52 +10:00
Paul 6aa359d7cc Merge remote-tracking branch 'origin/main' 2023-09-30 10:58:13 +10:00
Hiroku 646fc606d6 Merge branch 'increase-mint-growth' into 'main'
Increase Mint grow chance x5

See merge request cable-mc/cobblemon!649
2023-09-30 00:42:19 +00:00
Deltric 37e9823fe0 Increase Mint grow chance x5 2023-09-29 19:41:17 -05:00
Paul 9cd24e76d2 Fixed party lock relating to switching in PvP battles, closes #507 2023-09-30 09:45:18 +10:00
Paul fb52c1badd Merge remote-tracking branch 'origin/main' 2023-09-30 08:55:42 +10:00
Paul 24126e582b Many crop rarity tweeks 2023-09-30 08:55:28 +10:00
Veraxiel a08ca9c8eb Update apricorns_normal.json 2023-09-29 22:38:21 +00:00
Hiroku 896198eca2 Merge branch 'implement_pokemon' into 'main'
Minor fixes to oversights on Pokemon

Closes #496

See merge request cable-mc/cobblemon!648
2023-09-29 21:44:36 +00:00
tyzillion 38a20c76a1 Made Gallades battle quirk more frequent. Added Garchomps battle idle. Added Floragato's battle cry. 2023-09-29 17:03:33 -04:00
tyzillion 7ac80cb716 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	common/src/main/resources/assets/cobblemon/bedrock/pokemon/animations/0497_serperior/serperior.animation.json
#	common/src/main/resources/assets/cobblemon/sounds/pokemon/cofagrigus/cofagrigus_cry.ogg
#	common/src/main/resources/assets/cobblemon/sounds/pokemon/yamask/yamask_cry.ogg
2023-09-29 16:35:24 -04:00
Sterrezo 2a83af5626 Updated audio assets, fixed Serperior missing a cry, fixed Floragato's sound keyframe, changed Gallade's cry to include the quirk 2023-09-29 10:23:50 +02:00
Hiroku 7cc8fd8201 Merge branch 'pasture-block-fixes' into 'main'
Pastured Pokémon fixes

Closes #522 and #520

See merge request cable-mc/cobblemon!646
2023-09-29 07:05:48 +00:00
Deltric 901de0031c Pastured Pokémon fixes 2023-09-29 00:46:21 -05:00
Paul f762ba7425 Fixed healing moves looking like they fully heal opponent Pokémon, closes #528 2023-09-29 14:36:21 +10:00
Hiroku f5b92c11a0 Merge branch 'mint-altitude-tweaks' into 'main'
Altitude placement for mints

See merge request cable-mc/cobblemon!645
2023-09-29 04:16:57 +00:00
Deltric ecc5143ae6 Altitude placement for mints 2023-09-28 22:57:36 -05:00
Hiroku c6a7dcde33 Merge branch 'pokemon-json-fix' into 'main'
Json safety checks for Pokemon loadFromJson

See merge request cable-mc/cobblemon!643
2023-09-29 01:50:03 +00:00
Hiroku 7821801c83 Merge branch '1.4-fixes' into 'main'
1.4 fixes

Closes #525, #521, #514, #518, and #511

See merge request cable-mc/cobblemon!642
2023-09-29 01:30:59 +00:00
Deltric 85f8f971da Json safety checks for Pokemon loadFromJson 2023-09-28 20:28:28 -05:00
Paul 2808e52873 Merge remote-tracking branch 'origin/1.4-fixes' into 1.4-fixes 2023-09-29 10:53:48 +10:00
Paul 69f8d4a306 Tweaked medicinal leek rarity, relates to #513 2023-09-29 10:52:39 +10:00
Paul e7351af2a8 Tweaked sparse berry rarity, relates to #512 2023-09-29 10:50:07 +10:00
Paul 7ad5ee633d Tweaked big root rarity and depth, relates to #510 2023-09-29 10:49:25 +10:00
Paul 742c4c8087 Fixed berries not having the correct generation weights, closes #511 2023-09-29 10:48:11 +10:00
Paul ae41d4ac58 Fixed Forge pasture block issues wherever pasture blocks are near the world center, closes #518 2023-09-29 10:21:53 +10:00
Paul 3f4086fc90 Fixed only one store saving on disconnect, closes #514 2023-09-29 10:08:38 +10:00
Paul 9e993df788 Moved brewing stand mixin to common to fix it not working on servers, closes #521 2023-09-29 08:10:00 +10:00
Paul a389c21b25 Fixed shoulder-mount icon displaying even for non-shoulder-mountable Pokémon, closes #525 2023-09-29 07:59:57 +10:00
Hiroku b20be79ce6 Merge branch 'json-changes' into 'main'
Recipe changes and some spawn fixes

Closes #524

See merge request cable-mc/cobblemon!641
2023-09-28 08:46:22 +00:00
dhi_holo 9b05db6c5f Recipe changes and some spawn fixes 2023-09-28 08:46:22 +00:00
Nick f7de61ce71 Merge branch 'tyzillion-main-patch-53704' into 'main'
Update 0_phantump_base.json

See merge request cable-mc/cobblemon!640
2023-09-27 22:10:00 +00:00
Tyzillion 9811390573 Update 0_phantump_base.json 2023-09-27 21:49:51 +00:00
Nick 11e7d193fb Merge branch 'arclight-incompat-fix' into 'main'
Fix Arclight incompat

See merge request cable-mc/cobblemon!639
2023-09-27 00:12:05 +00:00
Neovitalism 3e2788b789 Fix Arclight incompat 2023-09-26 19:31:20 -04:00
Hiroku bda999e1fd Merge branch 'small-changelog-fix' into 'main'
Update CHANGELOG.md - fixed typos and added two missing pokemon

See merge request cable-mc/cobblemon!638
2023-09-26 20:21:42 +00:00
Lily e249a96749 Update CHANGELOG.md - fixed typos and added two missing pokemon 2023-09-26 14:38:42 +00:00
Paul 2078108ea7 Fixed aspear berry behaving weirdly when harvested from above 2023-09-26 18:23:25 +10:00
Hiroku ddb24e9621 Merge branch '1.4-Spawns' into 'main'
Updated spawn files.

See merge request cable-mc/cobblemon!633
2023-09-26 08:08:03 +00:00
Tyzillion b07795e547 Updated spawn files. 2023-09-26 08:08:03 +00:00
miasmus 7e63cd9c1d adds drops for sneasels, fixes #496 2023-09-25 19:32:09 -04:00
Nick 8680f2ade0 Merge branch 'implement_pokemon' into 'main'
Final merge on Pokémon Implementation for 1.4!

See merge request cable-mc/cobblemon!637
2023-09-25 17:33:41 +00:00
Tyzillion 5679d4dc05 Final merge on Pokémon Implementation for 1.4! 2023-09-25 17:33:41 +00:00
tyzillion 980c0d4c37 Made Gallade's battle quirk not overlay on battle idle. 2023-09-25 09:24:36 -04:00
tyzillion 50f1abd47e Adjusted Sprigatito ui frames and fixed Oinkologne's gender differences not working. 2023-09-24 13:05:38 -04:00
Licious bb8dffdf50 More work towards species. 2023-09-24 11:08:41 +01:00
tyzillion a555ac8e6d Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-23 23:57:13 -04:00
Licious 952fdd8541 Add SpeciesForm 2023-09-22 23:22:00 +01:00
Licious c30789cea4 Bye bye species male ratio. 2023-09-22 23:08:37 +01:00
Licious 0ada2265ff Spacing annoyed me 2023-09-22 23:08:02 +01:00
Licious 9aacff4051 Add GenderSelector 2023-09-22 23:04:56 +01:00
Licious 3b72b558f6 StatMap & EvMap 2023-09-22 22:40:48 +01:00
Licious ba0d7299ef Bunch of random stuff, this is no longer just custom types. 2023-09-22 21:18:33 +01:00
Paul 9f2a4261f0 Fixed jump keyframes using smooth interpolation 2023-09-22 11:07:26 +10:00
Paul 1b6b0524e8 Merge remote-tracking branch 'origin/main' into implement_pokemon 2023-09-22 10:39:49 +10:00
Paul 5f740b1c58 Merge branch 'main' into berry-with-flywheel
# Conflicts:
#	gradle/libs.versions.yml
2023-09-22 10:07:53 +10:00
tyzillion f5e492a6ce Fixed Diggersby UI's, Fixed Sprigatito shiny, Make Boltunds cry not loop, and Made Pidgeotto's look animation us neck. 2023-09-21 19:45:13 -04:00
tyzillion c8c1677182 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-21 17:23:57 -04:00
tyzillion 8431e25c31 Fixed error that caused build to fail. 2023-09-21 17:02:37 -04:00
tyzillion 121f7c6a9a Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into 1.4-Spawns 2023-09-21 17:02:19 -04:00
tyzillion c523408fe0 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into 1.4-Spawns 2023-09-21 14:32:30 -04:00
Licious f0ef34f435 Fix loading of type data. 2023-09-21 17:09:55 +01:00
Licious 646ed14146 Implement Forge custom registry creation. 2023-09-21 15:55:10 +01:00
Licious e8d8499462 Update outdated data format on type assets. 2023-09-21 14:03:52 +01:00
Licious 7656d1e0d8 Boy that's a lot of work 2023-09-21 13:59:28 +01:00
tyzillion cef0ad7efa Forgot to update Cetitan animation. 2023-09-21 02:15:33 -04:00
tyzillion 592ead6674 Misc Fixes 2023-09-21 02:13:10 -04:00
Licious f6d298f228 Correct hidden power stat data to use Cobblemon IDs instead of Showdown. 2023-09-20 12:47:55 +01:00
Licious 44a2f9e859 Migrate types to data. 2023-09-20 12:07:09 +01:00
tyzillion eb159d0702 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-19 18:55:25 -04:00
Veraxiel d47197ab3b Updated spawn files. Added spawn compat for William Wythers' Overhauled Overworld. 2023-09-19 18:26:41 -04:00
tyzillion b4585cabd4 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-09-18 16:45:16 -04:00
tyzillion dd15de6e94 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-18 16:45:07 -04:00
Paul c5dab7208f License and registration, please 2023-09-18 18:46:29 +10:00
Paul 4a5d53a020 More fixes to Flywheel implementation, it renders all the berries correctly! 2023-09-18 18:45:04 +10:00
Paul cc163b73e1 Many fixes for flywheel 2023-09-18 15:51:25 +10:00
Sterrezo d1682b78c6 I didn't break anything
Accidentally removed a line for Mimikyu's shoulder mount last commit, readding it.
2023-09-17 11:39:11 +02:00
Sterrezo 52827c3be6 Documented all new cries in the changelog 2023-09-17 11:31:48 +02:00
tyzillion 3869fc590d Fixed Meowscarada spawning everywhere. 2023-09-16 20:33:09 -04:00
tyzillion ba4f4c8137 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into 1.4-Spawns 2023-09-16 20:32:15 -04:00
Paul 7f372c1f16 Merge remote-tracking branch 'origin/main' into berry-with-flywheel 2023-09-17 10:09:07 +10:00
tyzillion 4624e7cab2 Gave long boi Exeggutor a proper hit box. 2023-09-16 19:08:19 -04:00
tyzillion 95bc331dc9 Updated Changelog with Pokemon in previous versions that got a cry. 2023-09-16 19:04:23 -04:00
tyzillion 90b22316cb Combee flys when walking, adjusted Exegguttor and Exeggcute sizes. Updated Shulker Forretress texture. 2023-09-16 18:56:41 -04:00
tyzillion dc1aec75ba Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-16 18:56:23 -04:00
tyzillion f60b3f1f4f Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-09-16 18:56:00 -04:00
Paul 3e118dcca6 Reworking flywheel impl 2023-09-17 06:47:35 +10:00
Sterrezo 12aac4f52d Implemented 13 new cries , updated 9
Added cries to Hoothoot, Noctowl, Aipom, Shroomish, Breloom, Ambipom, Chingling, Yamask, Cofagrigus, Nickit, Thievul
2023-09-16 14:04:26 +02:00
tyzillion 97625d2750 Fixed Bergmite and Avalugg spawns. 2023-09-15 13:50:18 -04:00
tyzillion ef600fda79 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into 1.4-Spawns 2023-09-15 13:33:52 -04:00
navneetset bd6364deac Removed pretty printing for MongoDB Gson. 2023-09-15 19:00:40 +02:00
navneetset 1fbdf1fce1 Fixed single save not picking up dirtyStore other than first one. 2023-09-15 19:00:24 +02:00
navneetset 6060013110 Merge branch 'mongdb-datastore' of https://gitlab.com/navneetset/cobblemon-peb-fork into mongdb-datastore 2023-09-15 18:56:51 +02:00
navneetset 755cf731f0 Fix dumb rebasing I did to merge main, add back previous implementation. 2023-09-15 18:55:54 +02:00
navneetset 6246af2979 Added MongoDB support for Cobblemon playerdata. 2023-09-15 18:55:54 +02:00
navneetset 6b27f13396 Added MongoDB datastore piggybacking off JSON store. Fixed package typo. 2023-09-15 18:55:54 +02:00
apion f563f69afd Fixing rotations 2023-09-15 02:45:21 -04:00
tyzillion 354914105e Merge remote-tracking branch 'origin/1.4-Spawns' into 1.4-Spawns 2023-09-15 00:01:03 -04:00
tyzillion b154b6de64 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into 1.4-Spawns 2023-09-14 23:53:17 -04:00
tyzillion 7d55d52608 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-14 23:52:24 -04:00
tyzillion ce337e8fff Beldum line can fly, Updated Bunnelby and Sprigatito model, updated onix animation. Updated Trevenants and Vivillon textures. 2023-09-14 21:16:44 -04:00
apion 72b6f46c4b Merge branch 'main' into berry-with-flywheel 2023-09-14 21:04:28 -04:00
Veraxiel 547af6dd77 Fixed spawn files. 2023-09-14 21:02:10 -04:00
tyzillion 70119478a5 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-14 20:14:22 -04:00
tyzillion 10b2aecc12 Updated Floragato mode and Meowscarada model. Fixed Volbeat and Illumise taking baths in water. 2023-09-11 17:06:23 -04:00
tyzillion 565d38f085 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	common/src/main/resources/data/cobblemon/species/generation1/pikachu.json
2023-09-11 17:06:01 -04:00
Veraxiel 9adeb60abe Updated spawn files. 2023-09-11 04:35:58 -04:00
tyzillion d748241727 Fixed names on spawn files. 2023-09-11 01:06:11 -04:00
Veraxiel 77ee8b1743 Merge branch '1.4-Spawns' of https://gitlab.com/cable-mc/pokemon-cobbled into 1.4-Spawns 2023-09-10 21:21:16 -04:00
Veraxiel 5eef45b49a Fixed structure names in presets and spawns. 2023-09-10 21:21:03 -04:00
tyzillion 79f7dd1519 Funny liscense moment. 2023-09-10 19:35:50 -04:00
tyzillion 919dec6809 Fixed json loading error. 2023-09-10 19:02:20 -04:00
tyzillion f00f73491d Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-10 18:58:05 -04:00
tyzillion c7cf73812c Added spawns for many new pokemon, added biome based evos to Spewpa, and fixed issues. 2023-09-10 18:56:28 -04:00
tyzillion 80fbab35dc Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into 1.4-Spawns 2023-09-10 15:14:56 -04:00
navneetset 9f60ce51c7 Fix dumb rebasing I did to merge main, add back previous implementation. 2023-09-10 14:17:12 +02:00
navneetset 343e13d1ac Added MongoDB support for Cobblemon playerdata. 2023-09-10 14:10:38 +02:00
navneetset ca175ab164 Added MongoDB datastore piggybacking off JSON store. Fixed package typo. 2023-09-10 14:09:03 +02:00
tyzillion ebad166b12 Tweaked Emissives on Gengar, Fixed Quilava cries, Fixed Braixen emissive pixel. 2023-09-10 04:34:04 -04:00
tyzillion 92f5fd7cd6 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-10 04:33:30 -04:00
Veraxiel 507319fa0f Added new presets and biome tags. Updated presets and biome tags. Updated spawn files. 2023-09-10 04:12:10 -04:00
tyzillion 163e17fb3f Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-09 22:48:45 -04:00
miasmus 290f3e2845 adjusted steelix and dragalge hitboxes 2023-09-09 19:30:56 -04:00
miasmus 516e3c4cd9 fix typhlosion/quilava cry anim playing during battle idle 2023-09-09 19:10:38 -04:00
miasmus e419030339 pokemon that can fly will not fall to their deaths 2023-09-09 18:45:54 -04:00
tyzillion fe739cd644 Meganium and Galarian Meowth crash fixed. Updated hitboxes and frames for the last set of Pokemon implemented. 2023-09-09 18:23:14 -04:00
tyzillion dd5e9c08aa Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-09 18:22:48 -04:00
tyzillion 70c2404b20 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-09 16:01:43 -04:00
tyzillion fb56430213 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-08 19:05:26 -04:00
tyzillion 083b439049 Fixes, Frames, and Hitboxes. Fixed Gengar texture. 2023-09-08 19:05:02 -04:00
apion a8ac109a50 Allowed for the use of existing berry models in flywheel optimizations 2023-09-08 18:34:51 -04:00
tyzillion 1813baaa6f Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-08 16:04:21 -04:00
tyzillion 5b5171b9bc Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-09-08 16:04:09 -04:00
apion fbe31f3232 Try rendering berry trees with flywheel 2023-09-08 11:52:18 -04:00
Sterrezo b530af1ff6 Added missing placeholder assets to Exeggutor to prevent an error in the log 2023-09-08 12:47:13 +02:00
tyzillion 8ec91f7a40 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-07 21:28:01 -04:00
apion 41b9411d06 Merge branch 'berry' into berry-perf-improvements
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/block/entity/BerryBlockEntity.kt
2023-09-07 21:17:12 -04:00
tyzillion 3040eee59c Updated Gengar, Readded Shulker Forretress, Updated Doduo shiny texture, Updated Serperior textures. 2023-09-06 21:54:51 -04:00
apion 10033be4b5 Actually fix flower models 2023-09-06 11:19:54 -04:00
apion 914067038a Fix forge client, fix flower models 2023-09-06 11:13:28 -04:00
miasmus bf9f08826b Fixes #444 (some berries not consumed on use outside of battle) 2023-09-06 10:50:07 -04:00
ApionXD da27b80e82 Fixed bug where tall grass wouldn't be deleted when a berry tree replaced its lower block 2023-09-06 10:50:07 -04:00
miasmus e6c9c7798e Adds other crops to maintains_farmland tag 2023-09-06 10:50:07 -04:00
miasmus d0b7b956e8 Adds a #cobblemon:berry tag with all the berry blocks, adds them to the #maintains_farmland tag 2023-09-06 10:50:07 -04:00
Lily 0301064ed5 added missing particles for figy, micle, passho, starf, and wacan berries 2023-09-06 10:50:06 -04:00
Lily b8595f8d59 prevent player from interacting with pokemon when sneaking 2023-09-06 10:50:06 -04:00
tyzillion d120c8e031 Readded Phantump and Trevenants Emissives. License moment 🤙 2023-09-06 00:22:32 -04:00
tyzillion aa91b5b20b Misc Fixes, Many walk speeds modified, Removed Shulker Forretress and Minecraft tree variants of Phantump and Trevenant. 2023-09-05 23:58:16 -04:00
tyzillion 84dfaa0a77 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-05 23:57:23 -04:00
tyzillion 9987c0c13f Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-09-05 16:45:37 -04:00
Sterrezo b7a3e276f1 Implemented 82 cries
I'm gonna lie down
2023-09-05 20:14:40 +02:00
tyzillion d9774272ce Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2023-09-05 09:10:58 -04:00
apion 3b967933ca Licenses 2023-09-04 16:35:43 -04:00
apion 665aad40a8 Added logic to rerender blocks when necessary 2023-09-04 16:32:23 -04:00
apion 527f429c20 Use guava cache now, evict entries after a minute 2023-09-04 15:13:56 -04:00
Sterrezo 85803b11b4 Implemented cries for remaining starters 2023-09-04 21:01:03 +02:00
apion 6d3f3d1353 Fixed lighting issues (kinda) 2023-09-04 14:17:49 -04:00
apion b70748e1b8 BerryBlockRenderer now caches vertices, improves perf by about 4x (HOORAY) 2023-09-04 05:53:56 -04:00
tyzillion c6406ab0ea Small Fixes. 2023-09-04 05:08:57 -04:00
tyzillion 28c750caf9 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-04 05:08:32 -04:00
tyzillion ab22780598 Modified walk speeds for Roggenrola line, Quilava, Typhlosion, and Feraligatr. 😅 2023-09-04 02:00:08 -04:00
tyzillion 1b2e0fb58e Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-04 01:54:36 -04:00
tyzillion 6616234393 🥚 2023-09-04 01:52:57 -04:00
tyzillion e33420bab7 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-09-04 01:39:08 -04:00
tyzillion 17dcbb25c3 Implemented Teddiursa and Ursaring. Fixed Clodsire pivot, fixed Lickylicky crash. Added animated textures to Ponyta line, updated Tinkaton, Tevenant, Slowking, Boltund, Quaxwell, Delphox, Koffing, Weezing, Chikorita, Bayleef, Meganium, Mareep, Flaaffy, Ampharos, Oshawott, Dewott, Doduo, Dodrio, Abra, Kadabra, Alakazam, Emolga, Slowpoke, Slowbro, and Slowking. Updated animations for Bunnelby, Diggersby, Cetoddle, Cetitan, Sprigatito line, Snivy line, Hitmonchan, Lonoone, Beldum line, Chikorita line, Phantump line, Mareep line, Fennekin line, Yamper line, Doduo line, Slowpoke line, Hoothoot, Froakie, Komala, Galar Meowth, Quaxwell, and Granbull. 2023-09-04 01:38:50 -04:00
tyzillion 1b36c40959 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-04 01:36:08 -04:00
DoctorWafflePhD db2cd8501e A handful of UI & hitbox fixes. 2023-09-03 22:32:48 -05:00
tyzillion fd6348adbe Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-03 22:41:34 -04:00
tyzillion e3c9c16add Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-03 12:26:58 -04:00
apion d17f8f90b8 Made berry atlases actually work (only on Fabric for now, this is prototyped af) 2023-09-03 05:56:08 -04:00
DoctorWafflePhD bc9182e37f Numerous scaling fixes. Hitboxes not fixed (yet). 2023-09-02 13:42:20 -05:00
tyzillion 68923dd95f Updated Sprigatito and Braixen, Made Wooper not just be Paldean, Fixes Ratatta texture. Fixes Grotle crash. 2023-09-02 12:03:35 -04:00
tyzillion ab3449243f Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-02 02:25:51 -04:00
tyzillion a8f6e66ab4 Updated models and textures for Gyarados, Hitmonchan, Hitmonlee, Serperior, Haunter, Chansey, Blissey, Happiny, Sneasel, Weavile, Spiritomb, Dratini, Dragonair, Dragonite, Pidgey, Pidgeotto, and Pidgeot.
Implemented Paldean Wooper and Clodsire.
2023-09-02 00:50:32 -04:00
tyzillion f3cb2aab87 Implemented Crabrawler, Crabominable, Wimpod, Golisopod, Nincada, Ninjask, Shedinja, Ralts, Kirlia, Gardevoir, Gallade, Beldum, Metang, Metagross, Ursaluna, Lechonk, Oinkologne, Pidove, Tranquil, Unfezant, Timburr, Gurdurr, and Conkeldurr. 2023-09-01 20:56:09 -04:00
tyzillion d9c6522685 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-09-01 20:54:59 -04:00
Veraxiel 7074a63f95 Updated existing spawn files. Added preset for Flowers and Gemstones. Removed preset for Underground. Updated Natural preset. 2023-08-31 04:35:04 -04:00
Paul 3e005e5032 Merge branch 'main' into implement_pokemon 2023-08-28 18:27:51 +10:00
Paul f93e8e221a Fixes to particle effects in bedrock animations 2023-08-28 18:27:03 +10:00
Paul cc7433025f Slow torterra down so we can watch him do the walk 2023-08-28 18:26:34 +10:00
Paul aa17482a6e Fixed Mamoswine crash 2023-08-28 18:00:58 +10:00
tyzillion 7f0f6e7c4d Implemented Fletchling, Fletchinder, and Talonflame. Shulker Forretress. 2023-08-27 20:38:38 -04:00
tyzillion 2fc9d587d9 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-08-27 07:38:44 -04:00
tyzillion 1d950d9640 Update when? When Update? Implemented Johto Starters.
Update when? Update? Update when? Update? When Update? Update?
2023-08-26 02:55:28 -04:00
tyzillion 3b63f88669 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-08-26 02:52:51 -04:00
tyzillion 4f35e8348d Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-08-25 12:43:12 -04:00
tyzillion 36c76b96b3 Implemented Komala,Phantump,and Trevenant all with wood variants. 2023-08-25 12:42:39 -04:00
tyzillion 2fe98577b6 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-08-23 15:34:55 -04:00
tyzillion dadeb2670b Made fixes to my last push and implemented Starly, Staravia,
and Staraptor.
2023-08-20 14:22:46 -04:00
tyzillion aedca9e969 Updated Roggenrola line, Misdreavus line, Exeggcute, Golduck, Elekid, Electabuzz, and Chesnaught models, textures, and animations, updated Spinda model, texture, and animation. Added 2 new spots too. Updated Slowking texture, Implemented Alolan Exeggcute. 2023-08-20 12:14:25 -04:00
tyzillion e1ca6bbc94 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-08-20 12:13:14 -04:00
tyzillion d41ef023ff Implemented cries for Mudbray, Mudsdale, Fennekin, Braixen, Delphox, Buneary, Lopunny, Snivy, Servine, and Serperior. Updated models and textures for Snivy, Servine, Serperior, Buneary, and Lopunny. Updated animations for Mudbray and Mudsdale. 2023-08-17 20:59:30 -04:00
tyzillion 30b769db13 Fixed issues with Galarian Meowth and Perrserker. Added proper cries to Farfectchd and its Galar counterpart. Updated Corviknight, Fenniken, Braixen, and Delphox model and animations. Updated Rookidee and Corvisquire's animations. Merged Braixen's textures and gave it animated textures. 2023-08-17 00:17:36 -04:00
tyzillion ac7bd33f08 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-08-17 00:13:54 -04:00
tyzillion 69908c1ab5 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-08-13 22:24:13 -04:00
tyzillion f8cdcde27c Implemented cry animations for Miltank and Treeko. Updated Pikachu and Raichu and implemented their alolan counterparts. same for Rattata and Raticate but updated theirs, also gave alolans their own poser. Gave Krabby and Kingler a placeholder walk. Added Cherry tree Torterra with petal particles. Gave shiny Gastly blue particles. Made Slugma and Magcargo's particles match their shinies. Updated Corviknight, Fennekin, Braixen, Delphox, Snivy, Servine, Serperior, Steelix, Meowth, and Persian models. Updated Meowth and Persian Models. Update Mudbray and Mudsdale textures. Implemented Alolan and Galarian, Meowth and Persian. Implemented Miltanks Mooshtank forms. 2023-08-13 22:23:14 -04:00
tyzillion 948d599390 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2023-08-12 22:16:21 -04:00
DoctorWafflePhD 4be1ab3cac Cry implementation for Chimchar line, and Cleffa poser tweaks, 2023-08-12 15:34:39 -05:00
tyzillion fd5132b317 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-08-08 18:59:01 -04:00
tyzillion f021faf0d3 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-08-07 18:14:00 -04:00
tyzillion 2b562ace12 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-08-04 19:29:12 -04:00
tyzillion a56d24b9dc Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-08-01 19:33:32 -04:00
Sterrezo 607b59a978 Implemented cries for Spearow, Fearow, Arbok, Ekans, Pichu, Pikachu, Raichu
Removed empty space from Espeon's model.kt file
2023-08-02 00:47:00 +02:00
tyzillion b8eb2c708e Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-07-31 18:37:19 -04:00
tyzillion 7bffc44db0 Updated animations for Venusaur, Mankey, Tauros, Cleffa, Quagsire, Piplup, Prinplup, Empoleon, Primeape, Poppolio, Bionne, Prismarina, and Mimikyu. Tweaked some portraits. Fixed Aipom texture and Ambipom's crash. 2023-07-28 20:16:51 -04:00
tyzillion 1099ce055a Updated animations for Ponyta, Galarian Ponyta, Rapidash, Abra, Aipom, Ambipom, Chingling, Snubbull, Breloom, Gible, Gabite, Klank, Klinklang, Rookidee, Corvisquire, Quaxly, Quaquaval, Tinktaton, and Annihilape. Added cry sound to Ponyta, Galarian Ponyta, Rapidash, Quaxy, and Quaquaval cry animation. 2023-07-27 22:57:33 -04:00
tyzillion de5e958bf3 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2023-07-27 22:56:15 -04:00
Sterrezo ab6494a2f6 Implemented stuff properly this time. Added Fuecoco line cries.
My previous pushes were missing code in model.kt files. Everything's working now. Fuecoco line has final animations, I only added sound. I also corrected a typo in sounds.json
2023-07-26 18:56:16 +02:00
Sterrezo 967fbd2608 Placeholder cry animations for Espeon, Umbreon, Leafeon, Glaceon, Sylveon. Fixed Lucario's placeholder cry animation. 2023-07-26 17:03:54 +02:00
DoctorWafflePhD e6ffd2e16d Implemented cry animations for Turtwig, Grotle, and Torterra. 2023-07-25 04:47:07 -05:00
DoctorWafflePhD 8ff0835e4e Fixed Empoleon cry. 2023-07-25 03:29:43 -05:00
DoctorWafflePhD 301df2e1d1 Implemented cry animations for the Piplup line. 2023-07-25 00:39:20 -05:00
DoctorWafflePhD 4c4f79494b Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-07-24 21:59:40 -05:00
DoctorWafflePhD bcd998d690 Implemented cry animations for Cleffa, Wooper, Quagsire, Piplup, and Mimikyu. 2023-07-24 21:52:34 -05:00
Sterrezo 7ab3c18762 Added placeholder cry animations and 19 new cries
Placeholder cry animations for Riolu, Lucario, Wooloo, Dubwool. Added 19 new cries. Updated Tauros cry. I'll update the changelog once all cries are implemented.
2023-07-24 22:43:58 +02:00
tyzillion ddb426674f Added blank crys to all Pokemon that don't have a cry atm, added blank ambients to gen 9 Pokemon. Updated sound.json with new sound references. Edited or added cry animations with sounds for Bulbasaur line, Charmander line, Squirtle line, Caterpie line, Weedle line, Pidgey line, Rattata line, Clefairy line, Tauros, and Eevee gen one line. 2023-07-23 15:26:36 -04:00
tyzillion 6c93a6c1a8 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-07-23 15:20:42 -04:00
tyzillion 28d0ae9b75 Fixed Wishiwashi crash. Resized Turtwig. Added Paldea starters to starter select. Added blank crys to all Pokemon, added blank ambients to gen 9 Pokemon. Updated sound.json with new sound references. 2023-07-20 21:05:39 -04:00
tyzillion 742a6b244f Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2023-07-20 19:18:44 -04:00
tyzillion 4c5fcf5310 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2023-07-20 15:34:43 -04:00
tyzillion aaf5f4d354 Multiple Pokemon resized. Changed walkspeed for Bergmite, Linoone, Wingull, Turtwig line and Piplup line. Added flying ai to Cottonee, Whimsicott, and Kricketune. Made Avalugg properly float. Fixed Tinktatink line not using battle idle. Fixed Numels texture issues. Fixed Braixens texture. Edited hitbox for Granbull, Skeledirge, Maschiff, and Mabosstiff. Added implemented to json for Surskit line and Phanpy line. Fixed Caterpie animation. 2023-07-17 20:19:52 -04:00
tyzillion 5414cbcc14 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-07-16 22:10:53 -04:00
tyzillion 3104239a9f Implemented Wishiwashi, Galarian Zigzagoon, Galarian Linoone, and Obstagoon. Updated animations and models for Barboach, Wailord, Illumise, Volbeat, Scorbunny, Mimikyu, Turtwig, Grotle, Torterra, Kricketot, Kricketune, Bergmite, Avalugg , Shroomish, Bonsly, Mudsbray, Mudsdale, Arrokuda, and Barraskewda. Added emissive for Sharpedo. Tweaked walk speeds on Drowzee, Murkrow, Turtwig, Grotle, and Torterra. Added flying behavior to Honchkrow. Actually fixed Cacnea's size. 2023-07-16 22:10:41 -04:00
DoctorWafflePhD 32a360ba0c Updated Stufful and Bewear's model and animation files. 2023-07-16 17:32:04 -05:00
DoctorWafflePhD 99d190abff Fixed Vivillon wings issue for Icy Snow and High Plains patterns. 2023-07-16 16:54:46 -05:00
tyzillion 33aa3043c6 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-07-16 15:55:33 -04:00
tyzillion 4577c36afb Implemented Phanpy, Donphan, Buizel, Floatzel, Zigzagoon, Linoone, Cottonee, and Whimsicott. 2023-07-16 00:43:37 -04:00
tyzillion 6d9d5d1533 Implemented Snubbull, Granbull, Maschiff, and Mabosstiff. 2023-07-15 02:03:18 -04:00
tyzillion a6cc7b77bb Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-07-14 18:19:33 -04:00
tyzillion 3ef2eca934 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-07-12 18:11:01 -04:00
tyzillion e81eaa5b57 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-07-11 18:25:59 -04:00
tyzillion edc5ce5fb4 Implemented Fuecoco, Crocalor, Skeledirge, Quaxly, Quaxwell, and Quaquaval. Added a way to disable x or y head movement on the look animation. 2023-07-10 23:11:05 -04:00
tyzillion b1b7d3fea2 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-07-10 18:26:03 -04:00
tyzillion 7ee88cefe5 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	common/src/main/resources/data/cobblemon/species/generation1/pidgey.json
#	common/src/main/resources/data/cobblemon/species/generation1/pikachu.json
#	common/src/main/resources/data/cobblemon/species/generation1/zubat.json
#	common/src/main/resources/data/cobblemon/species/generation2/pichu.json
#	common/src/main/resources/data/cobblemon/species/generation2/wooper.json
#	common/src/main/resources/data/cobblemon/species/generation5/joltik.json
2023-07-10 18:23:45 -04:00
Soul Eternum 2cfa9f8985 Added a fallback locator for particle animations 2023-07-10 16:38:51 -05:00
tyzillion 5bab095036 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-07-09 21:56:38 -04:00
tyzillion c394f56548 Implemented Tinkatink, Tinkatuff, Tinkaton, Yamper, and
Boltund.
2023-07-09 21:55:54 -04:00
tyzillion dc270bb64e Implemented Volbeat, Illumise, Galarian Ponyta, and Galarian Rapidash. Fixed Wingull's animation typo. Implemented Wingull and Pelippers water surface animations. Made quirks play less frequently on Ponyta and Farfetched. Added "implemented": true, to Shroomish, Breloom, Hoothoot, Noctowl, Numel and Camerupt's species json. Fixed Serperior's crash. Exeggcute model and animations updated. Model updates for Chansey, Blissey. Texture update for Happiny. 2023-07-09 05:22:04 -04:00
tyzillion 8c6c3a6ca0 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2023-07-08 19:34:10 -04:00
tyzillion ac05f24646 Added Glimmora's battle idle. Fixed Riolu and Lucario models. Tweaked Riolu and Lucario's scale and hitbox. Updated Wingull and Pelipper's animations. 2023-07-06 23:27:09 -04:00
tyzillion 2b3045594b Deleted shoulder effects, learn to make potions, losers.
(You can always add them back via datapacks!)
2023-07-06 21:14:53 -04:00
tyzillion 86d8fb01ef Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-07-06 20:56:09 -04:00
tyzillion fe9a1c7e99 Implemented Annihilape, Squawkabilly, Shroodle, and Grafaiai. Updated Rapidash, Taillow, and Swellow's animation. Updated Mankey, Primeape, Haunter, Voltorb, Electrode, Riolu, Lucario, and Serperior with remodels/revamps. 2023-07-06 20:55:38 -04:00
tyzillion a9735c69cb Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-07-06 15:57:59 -04:00
tyzillion bf401d1ff0 Implemented Arrokuda, Barraskewda, Bunnelby, and Diggersby. Edited Wingull and Pelipper's scale and hitbox. 2023-07-05 23:13:16 -04:00
tyzillion fb6e65d868 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-07-05 14:17:04 -04:00
tyzillion aa04b27500 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-07-04 22:33:10 -04:00
tyzillion 954d6fa156 Added emissives to Yamask and Cofagrigus eyes. Made Yamask and Cofagrigus fly. Implemented Skrelp, Dragalge, Patrat, Watchog, Mareep, Flaaffy, and Ampharos. Made Wooloo and Dubwool smaller. Fixed Varoom and Revavroom's wheel spinning when changing from walk to idle. Updated model and texture of Mewtwo and Mew. 2023-07-04 22:32:47 -04:00
tyzillion dd2d22b793 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-07-04 13:36:14 -04:00
Xylopia 03bfce766d Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/repository/PokemonModelRepository.kt
2023-07-02 20:15:58 -04:00
Xylopia fab9eed4e1 Added Yamask and Cofagrigus 2023-07-02 20:13:42 -04:00
tyzillion 123ed403ae Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-07-02 20:08:19 -04:00
tyzillion 0c763e3715 Implemented Roggenrola, Boldore, Gigalith, Numel, Camerupt, Shinx, Luxio, Luxray, Aipom, Ambipom, Hoothoot, Noctowl, Wingull, and Pelipper. Added placeholder wing flying animations to Articuno, Zapdos, Moltres, Scyther, Scizor, Golbat, and Crobat. Updated Model of Mr.Mime, Cacnea, Prinplup, Empoleon, Hypno, Cacnea, and Farfetchd. Updated Animation of Cacnea, Cacturne, Scatterbug, Spewpa, Garganacl, Farfetchd, Ponyta, Drowzee, Piplup, Prinplup, and Empoleon. Mr_Mime texture updated. Tweaked UI frames of Exeggutor. Added particles to Spewpa. Gave Alolan Vulpix and Ninetales its own poser. 2023-07-02 19:23:49 -04:00
DoctorWafflePhD b52a0a0ebd Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-07-01 20:53:16 -05:00
tyzillion 9c1edea469 Updated Changelog. 2023-07-01 17:23:52 -04:00
tyzillion 87d8c17f4f Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/ArcanineModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/ElectabuzzModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/FearowModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen1/ScytherModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen2/ElekidModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen3/LotadModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/ElectivireModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen4/LickilickyModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen7/DecidueyeModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen7/RowletModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen9/WalkingwakeModel.kt
2023-07-01 17:22:13 -04:00
Paul 3ab5a4daf3 Use less inflation on torchic male form since it does every direction 2023-07-01 15:21:48 +10:00
Paul f7672e66ab Fixed Torchic gender difference not being visible due to pane with no inflation 2023-07-01 15:09:02 +10:00
Paul 61d926a23d Fixed Varoom and Revavroom crashing asset loading due to animation typos 2023-07-01 15:03:34 +10:00
Paul 5ab364f0ab Fixed Farfetch'd not having a Galarian form 2023-07-01 15:02:49 +10:00
tyzillion 734d2b2414 Added emissives to Lanturn and Relicanth. Made Corviknight 5 blocks big. Made Gorebyss and Huntail swim faster. 2023-06-30 14:16:26 -04:00
tyzillion 0763a96f34 Updated models for Garganacl and Magikarp Male. Updated animation for Mudbray, Mudsdale, Varoom, and Revavroom. 2023-06-30 13:18:05 -04:00
DoctorWafflePhD 2ae4ba68e4 Dugtrio also no longer floats in water. 2023-06-29 12:49:14 -05:00
DoctorWafflePhD 750adabba1 Diglett now sinks to the ocean floor instead of floating. Not that we intend to have Diglett in the water anyways, but...
Dodrio's legs move at a more appropriate pace when walking.
Slowpoke's placeholder leg movements are more noticable.
2023-06-29 12:48:42 -05:00
DoctorWafflePhD a914a69051 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-06-28 00:41:47 -05:00
DoctorWafflePhD beacc319b9 Fixed model issues on Scolipede and Espathra. 2023-06-28 00:41:38 -05:00
tyzillion c48b7b980b Updated Elekid line model overhaul. Fixed Whirlpede and Scolipede sleep crash and implemented their battle idles. Fixed Floragato's t-pose issue. Gave Wooper his floating and swimming poses. Dusknoir doesn't move his eye while in battle but will still look at the player outside of it. Ceruledge now has his passive blades outside of battle and his big blades in battle. 2023-06-28 00:34:18 -04:00
tyzillion d553483dcb Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2023-06-27 20:14:11 -04:00
DoctorWafflePhD c9f1a61bf5 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-06-26 04:20:50 -05:00
DoctorWafflePhD 84d58bf2d9 Changed the sizes of many Pokémon.
Fixed missing texture with Poké Ball Vivillon.
Fixed AI on a handful of Pokémon.
2023-06-26 04:20:37 -05:00
tyzillion df35528a53 Updated Dusknoir animation and Model. Framed and modified sizes and hitboxes of multiple Pokemon. 2023-06-21 19:22:26 -04:00
tyzillion 405f6e91de Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-06-21 19:11:22 -04:00
DoctorWafflePhD ac072e5a88 Adjusted walk speeds of Charcadet line, Exeggcute line, Popplio line, and Lickitung line. 2023-06-17 02:35:45 -05:00
DoctorWafflePhD ca0b098866 Merge branch 'main' into implement_pokemon 2023-06-16 21:11:40 -05:00
DoctorWafflePhD 3fd13dd47c Chingling now shoulder-mountable (and doesn't sleep on your shoulder). Also fixed advancements background. 2023-06-16 21:10:28 -05:00
DoctorWafflePhD 38bc7e1bde Merge branch 'main' into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2023-06-16 17:55:00 -05:00
DoctorWafflePhD 6497d770dd Chingling now shoulder-mountable 2023-06-16 17:48:32 -05:00
DoctorWafflePhD 2410fa6578 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen7/CutieflyModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen7/RibombeeModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen9/GlimmetModel.kt
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/gen9/GlimmoraModel.kt
2023-06-16 00:11:17 -05:00
DoctorWafflePhD 32e1623998 Implemented animations for Cutiefly line and Glimmet line. 2023-06-16 00:08:38 -05:00
tyzillion 31799ad144 Updated animations of Venipede, Whirlipede, Scolipede, Cutiefly, Ribombee, Falinks,Exeggcute, Exeggutor, Lickitung, Lickilicky, Breloom, Chimecho, Chingling, Golett, Glimmet, and Glimmora.
Updated Models of Cutiefly, Ribombee, Venipede, Whirlipede, Scolipede, and Breloom.
2023-06-15 21:10:09 -04:00
tyzillion b60f7ba22e Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2023-06-15 21:09:28 -04:00
DoctorWafflePhD c80ef7a8c0 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-06-10 16:43:06 -05:00
DoctorWafflePhD 7bdc302583 Implemented Venipede, Whirlipede, and Scolipede. 2023-06-10 16:32:22 -05:00
DoctorWafflePhD 8de2a12323 Implemented sleeping bubbles onto the sleeping particle. 2023-06-10 07:07:43 -05:00
tyzillion 6004c153d3 Broke up with Validate Animations.
- ValidateAnimations.kt removed
Pipeline restored.
2023-06-09 23:58:13 -04:00
DoctorWafflePhD ac96ad3720 Implemented updated Falinks. 2023-06-09 01:03:38 -05:00
DoctorWafflePhD a06793616d Tweaked the sleeping particle a bit, and tweaked the position of the sleep locator on Vivillon and Bonsly. 2023-06-09 00:44:24 -05:00
DoctorWafflePhD 97f545bd4e Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-06-09 00:35:29 -05:00
Paul a267b63df2 Fixed Falinks torso name replacement insanity I wanna unalive 2023-06-09 15:35:05 +10:00
Paul ea9d961fd8 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-06-09 09:00:48 +10:00
Paul 51396f94b1 Merge remote-tracking branch 'origin/main' into implement_pokemon 2023-06-09 08:59:25 +10:00
tyzillion 412dc73d9d "Sir, know why I pulled you over? No? Let me see your license. No? Well then I am gonna have to fail your pipeline. Sit tight."
Cacnea crash fixed and license updated.
2023-06-08 17:57:48 -04:00
DoctorWafflePhD c605e2d030 Tweaked the sleeping particle & made it exist on a special "particles" animation file so that any model may use it without having to edit every sleeping animation to include particle data. 2023-06-08 10:51:37 -05:00
DoctorWafflePhD d5c93b60a9 Implemented a proof-of-concept sleeping particle. Currently it only applies to Vivillon. 2023-06-07 11:44:13 -05:00
DoctorWafflePhD 7d8c6aef8e Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-06-06 21:57:02 -05:00
DoctorWafflePhD 3c593ea3ed Implemented (not-yet-officially-approved) Bonsly animations and made it a tad larger. Fixed a small issue with Cetitan's model rendering both mouths at once. Fixed a pivot point issue on Charcadet. Fixed an incorrectly-registered quirk on Alolan Exeggutor. 2023-06-06 21:39:10 -05:00
DoctorWafflePhD 5a7732588d Implemented Cetoddle and Cetitan. Touched up Glimmora's size. 2023-06-06 13:03:27 -05:00
DoctorWafflePhD 25488ae972 Implemented Bouffalant, and Cinderace remodel. Added missing "implemented" keys to Bonsly and Sudowoodo's species files. 2023-06-05 20:22:14 -05:00
tyzillion 4bf9733fe6 Implemented Cacnea, Cacturne, Nickit, Theivul, Duskull, Dusclops, and Dusknoir. 2023-06-05 21:19:45 -04:00
tyzillion 0672aebd61 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-06-05 21:18:52 -04:00
Waffle 5db7d6380f Bonsly, Sudowoodoo, Glimmet, & Glimmora implemented. 2023-06-05 19:38:01 -05:00
Waffle 7f90a6ffec Huntail now uses the same "slithering" behavior as Ekans when on land. Doduo and Dodrio now walk significantly faster. 2023-06-05 19:36:52 -05:00
Waffle d45f0e382b Fixed incorrect hitbox and scaling of Kricketot and Kricketune. Kricketune is now shoulder-mountable. 2023-06-05 14:27:01 -05:00
tyzillion fab6d6e82d Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2023-06-04 20:34:33 -04:00
Waffle a79c61c5a4 Touched up UI positioning for Popplio line & Aerodactyl. Fixed incorrect package lines in Popplio line posers. 2023-06-04 10:00:56 -05:00
Waffle 3dfe05dccd Implemented updated Bidoof/Bibarel shiny textures 2023-06-04 06:06:44 -05:00
tyzillion e485484051 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-06-03 13:07:35 -04:00
tyzillion 865ddcd59b Fixed Pidgeotto flapping during idle instead of while flying. 2023-06-03 13:07:16 -04:00
Waffle 999070b270 Touched up Tandemaus and Maushold and added/tweaked some of their anims. 2023-06-03 11:40:50 -05:00
Waffle 00d1590790 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-06-03 05:49:02 -05:00
tyzillion 6cc17a08dc Bird Pokemon are actually drones created by the government. Source: KFC
Added flying placeholder animations to Pidgey, Pidgeotto, Pidgeot, Chatot, Rookidee, Corvisquire, Corviknight, Taillow, Swellow, Rowlet, Dartrix, and Decidueye.
2023-06-03 01:23:58 -04:00
tyzillion 60911f3ec7 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-05-31 20:59:20 -04:00
tyzillion 7f1a35fffe funny license go brrrrrr
(Added "implemented": true, to the Pokemon I added so far, cuz oversight.)
2023-05-31 20:57:07 -04:00
tyzillion 10f5fd673e Implemented Alolan Exeggutor, Galarian Farfetchd, Rookidee, Corvisquire, Corviknight, and Sirfetchd. 2023-05-31 20:41:10 -04:00
Waffle 765921d219 Updated Bidoof's model to the pivot-fixed version. 2023-05-30 08:29:47 -05:00
tyzillion 2422e60aa1 Updated Popplio, Brionne, and Primarina's models. Updated animations for Popplio and Brionne. Fixed Exeggutor crash. Implemented Barboach, Whiscash, Combee, Vespiquen, Lillipup, Herdier, and Stoutland. 2023-05-29 18:37:16 -04:00
Paul e9265eb0a6 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-05-29 18:30:03 +10:00
Paul 07ad7db139 Improved test error clarity and removed unsafe operation in ValidateAnimations 2023-05-29 18:29:56 +10:00
Waffle 159ecf5ffa Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2023-05-29 00:33:16 -05:00
tyzillion 12be2c7b7b Removed Klevin, fixing pipeline fails. 2023-05-29 01:29:23 -04:00
Waffle 95590a2673 Fixed Maushold-Three's model not rendering. Pidgeot moves a little quicker. 2023-05-29 00:23:58 -05:00
tyzillion 869f6b1120 Added animations that just added sleep to Arcanine, Jigglypuff line and Vulpix Line. Updated animations to Greninja, Eiscue, Luvdisc, Chimchar, Monferno, Infernape, Flittle, Espathra, Sobble, Drizzile, and Inteleon. Updated Model for Chimchar, Espathra, Torchic, Combusken, Blaziken, Exeggcute, Exeggutor, Lickilicky, Pichu, and Drizzile. Fixed Flittle having float being used instead of hover. Updated model and animation for Raichu. updated conditions on multiple faints. 2023-05-29 00:54:33 -04:00
tyzillion 2cdfac02e6 Updated shiny Dwebble and Crustle texture. Updated Heatmor, Aerodactyl, Greninja, Charcadet, Armarouge, and Ceruledge animations. Added sleep behavior to Magnemite and Magneton. 2023-05-28 18:46:34 -04:00
tyzillion a9127c7021 Fixed Magnezone, Arcanine,and Mudsdale, fixed missing metal sparks particle. 2023-05-28 17:08:59 -04:00
tyzillion 3023de995a Updated Changelog with Pokemon to be added and remodels. Updated Arcanine, Magnemite, Magneton, Magnezone model and textures. 2023-05-28 14:34:23 -04:00
tyzillion 59c3df6a47 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-05-28 14:32:57 -04:00
Waffle 7391e3bc69 Merge branch 'main' into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2023-05-28 06:54:59 -05:00
Waffle 4ab72a6334 Implemented Lotad line's new animations. 2023-05-28 06:15:07 -05:00
Waffle af357aca51 fixup! Implemented Ditto, Shuckle, and Pumpkaboo line's new animations. Pumpkaboo and Gourgeist also now have size variance. 2023-05-28 06:00:08 -05:00
Waffle c7d060bb8d Yanma and Yanmega wings now flap much faster (this was making me irrationally angry) 2023-05-28 03:35:53 -05:00
Waffle c3db5c0525 Vivillon now defaults to Meadow pattern (likely temporary) 2023-05-28 03:35:36 -05:00
Waffle 04328d2b8a Implemented Ditto, Shuckle, and Pumpkaboo line's new animations. Pumpkaboo and Gourgeist also now have size variance. 2023-05-28 03:34:59 -05:00
tyzillion fb03f426c6 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-05-26 16:15:52 -04:00
Waffle 00ed7bb0e8 Added missing implemented keys to Scatterbug line's species files 2023-05-25 22:18:02 -05:00
Waffle 38d81ced56 Implemented Garganacl, added missing baseScale and hitbox keys in Nacli and Naclstack species files and fixed their hitboxes, tweaked their walkSpeeds 2023-05-25 22:17:11 -05:00
Waffle 95ecf75a3a Added the fixed Yanma shiny texture. 2023-05-25 20:01:41 -05:00
Waffle 0afde170f4 Tweaked some movement speeds (breloom & naclstack). Also tweaked Naclstack's walk animation slightly. 2023-05-25 19:59:20 -05:00
Waffle 5a312ee6c6 Somehow, Masquerain's wing textures got reverted. Re-reverted them - they should have transparency again. 2023-05-25 08:41:24 -05:00
Waffle 6533da0ed6 Fixed Scatterbug's baseScale and hitbox size. Spewpa now evolves into different Vivillon patterns based on biome. Some patterns are currently awaiting confirmation on obtainment method and are thus unavailable without the use of commands. 2023-05-25 08:37:29 -05:00
Waffle 339ad676ca Implemented Scatterbug, Spewpa, and Vivillon. Vivillon's wing pattern currently defaults to Meadow, and no behavior to determine Vivillon wing pattern based off evolution location is currently implemented. 2023-05-25 05:51:54 -05:00
Waffle 0edc762ff8 Butterfree no longer T-poses while flying, and moves at a speed of 0.4 2023-05-25 05:51:22 -05:00
Waffle 320a3a11b8 Implemented Stufful and Bewear. Both need shiny textures, and use placeholder animations. 2023-05-25 04:20:25 -05:00
Waffle f4d177ce8c Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon
# Conflicts:
#	common/src/main/resources/assets/cobblemon/bedrock/pokemon/animations/0870_falinks/falinks.animation.json
#	common/src/main/resources/data/cobblemon/species/generation8/falinks.json
2023-05-25 01:41:46 -05:00
Waffle f3598e915e Implemented Falinks & updated licenses (haven't run that command in a while teehee). 2023-05-24 23:31:20 -05:00
tyzillion 3314075f6e Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-05-24 19:21:10 -04:00
tyzillion 141296a2d5 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-05-24 19:19:59 -04:00
Waffle 48147f460b Implemented Falinks & updated licenses (haven't run that command in a while teehee). 2023-05-24 05:46:41 -05:00
Waffle 2d72fbb82a Implemented Carnivine. Needs animations. 2023-05-24 01:06:03 -05:00
Waffle 98b72f07b6 Added missing implemented key to Cutiefly and Ribombee's species files. 2023-05-24 01:05:33 -05:00
Waffle 465fb2bef4 Implemented the Wooper remodel, as well as some animations ++(.‿.)++ 2023-05-24 00:12:07 -05:00
Waffle d1f96af65f Separated Masquerain's texture into a base and wing texture, and made the wings slightly translucent. 2023-05-24 00:11:42 -05:00
Waffle 990dad0c51 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon
# Conflicts:
#	common/src/main/resources/data/cobblemon/species/generation7/cutiefly.json
#	common/src/main/resources/data/cobblemon/species/generation7/ribombee.json
2023-05-24 00:01:05 -05:00
Waffle 67a8230b91 Made Cutiefly & Ribombee's wings translucent, as well as fixed accidentally swapped names in their resolver files (oops) 2023-05-23 08:21:14 -05:00
Waffle 0d66e7bc1b Made Cutiefly & Ribombee's wings translucent, as well as fixed accidentally swapped names in their resolver files (oops) 2023-05-23 08:09:34 -05:00
tyzillion 56f0e0a1e2 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-05-22 20:42:23 -04:00
Waffle 1e5c48129c Implemented Cutiefly and Ribombee. 2023-05-22 06:58:28 -05:00
Waffle aed830b1ea Implemented Cutiefly and Ribombee. 2023-05-22 06:47:22 -05:00
tyzillion c30596c89b Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2023-05-20 12:19:43 -04:00
Waffle 851e0e56dd Parasect can no longer look around, moves at a speed of 0.45, and is always on the move. Sorry, zombie crab. 2023-05-20 05:13:06 -05:00
Waffle 0e92743da5 Implemented Cutiefly and Ribombee. Probably broken, I just needed to move to a new local copy of the IDE because intelliJ moment idk idk 2023-05-20 02:59:29 -05:00
Waffle 9dc3b910f4 Touched up Surskit and implemented Masquerain. 2023-05-11 10:18:50 -05:00
Waffle 089d75cf57 Fixed Walking Wake not actually walking on wakes. 2023-05-10 20:10:38 -05:00
Waffle 9ef45d6324 Touched up Surskit and implemented Masquerain. 2023-05-10 16:10:21 -05:00
Waffle 881a957f59 Added Surskit 2023-05-10 12:22:01 -05:00
Waffle 0e0562c1a3 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-05-09 17:38:23 -05:00
tyzillion 40cc7d30b2 Hopefully pipeline fix. 2023-05-09 18:01:05 -04:00
tyzillion c2b1d336db Updated Models for Aerodactyl, Spearow, Fearow, Drowzee, Hypno, Lickitung, Pidgeotto, Pidgeot, Scyther, Scizor, and Kleavor. All still need frames and scaling adjusted. 2023-05-09 17:41:27 -04:00
Waffle eca69b4d96 Increased Pikachu's movement speed to better fit its animation 2023-05-09 15:12:32 -05:00
Waffle c607198de9 Fixed an incorrect identifier of bidoof_female.geo.json 2023-05-09 13:40:27 -05:00
Waffle 3ce9bd05a8 Positioned Flittle & Espathra's portraits and profiles. Hopefully fixed Espathra's eye jank. 2023-05-09 13:34:17 -05:00
tyzillion d209918dde Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-05-09 14:06:38 -04:00
tyzillion c5de65044d Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-05-09 14:05:37 -04:00
Waffle 96fbe3a685 Removed some unused imports in Flittle's model
TODO: position Flittle and Espathra's portrait and profile
2023-05-08 20:34:20 -05:00
Waffle d33defea6a Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-05-08 20:31:11 -05:00
Waffle d16d3eac34 Implemented Flittle & Espathra. Flittle can be shoulder-mounted. 2023-05-08 20:30:57 -05:00
Waffle 99b175f72a Positioned Comfey's portrait, played with its shoulder mount position, & gave it behavior for flight and sleep. 2023-05-08 19:17:37 -05:00
Waffle ae4d16bfcb Positioned Comfey's portrait, played with its shoulder mount position, & gave it behavior for flight and sleep. 2023-05-08 18:14:00 -05:00
Waffle ff039c0d24 Tweaked Tandemaus and Maushold's hitboxes as well as their portraits and profile scales. 2023-05-08 16:57:51 -05:00
SPG f4ef41c130 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/repository/PokemonModelRepository.kt
2023-05-08 14:06:36 -07:00
SPG e572d22819 Implmented Poochyena
Implmented Mightyena
Implmented Sprigatto
Implmented Floragato
Implmented Meowscarada

Floragato is stuck in T-pose, will need to have someone look at it
2023-05-08 14:02:46 -07:00
Waffle 9c448eca97 Adds Ceruledge's textures 2023-05-08 15:37:44 -05:00
Waffle 742caa227d Added transformTicks to Golurk's animations, and made them slower than the default 10 ticks. 2023-05-08 15:37:02 -05:00
Waffle b095e87ec9 Implemented Charcadet, Armarouge, and Ceruledge. All 3 use placeholder animations. 2023-05-08 15:36:38 -05:00
Waffle b2c66efa83 Added TransformTicks to Golurk's model. They're a bit slower than the default of 10. 2023-05-08 14:22:28 -05:00
Waffle 7274713e50 Implemented Breloom's animations by Berri
Synced Breloom's movement speed to its animation speed
Scaled Shroomish back up just a tad (0.6 -> 0.8)
Scaled Breloom back up just a tad (0.8 -> 0.9)
Fixed Shuckle's portrait and profile placement
Made Garchomp even faster to better sync with its run animation
2023-05-08 13:53:20 -05:00
Waffle 094f943ab5 Implemented Shroomish and Breloom
Added missing transformTicks properties in Bidoof's poses (should transition between poses better)
2023-05-07 16:58:57 -05:00
Waffle f55198249f Implemented Drowzee and Hypno remodels (no anims)
Implemented Gligar and Gliscor (no anims)
Igglybuff is now shoulder mountable
Updated licenses
2023-05-07 06:49:13 -05:00
Waffle 2fddfe12e6 Implemented Chatot 2023-05-06 03:23:54 -05:00
Waffle 88619f0512 Implemented Fidough & Dachsbun
Gave Chimecho flight
Updated Chingling & Chimecho scale & hitboxes
2023-05-06 01:56:57 -05:00
Waffle 695368932d Implemented Fidough & Dachsbun
Gave Chimecho flight
Updated Chingling & Chimecho scale & hitboxes
2023-05-06 01:54:30 -05:00
Waffle 84926f12eb Made Golurk move slightly slower to better sync with its walking animation. 2023-05-03 06:52:42 -05:00
Waffle 9048c00021 Added Chingling and Chimecho, and posed them for portrait and profile. Neither have animations implemented currently. Updated licenses as well. 2023-05-03 06:43:00 -05:00
tyzillion ed5cc49b6d Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2023-05-02 13:31:07 -04:00
Waffle f348b4e8de Fixed Bidoof's sleep, tweaked its portrait, and added license to Chinchou's model file. 2023-05-02 01:21:28 -05:00
Waffle 6acd8167fb Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2023-05-01 22:15:54 -05:00
Waffle b131c2fe1f Gave Bidoof a sleeping animation & implemented sleeping behavior. 2023-04-29 15:08:10 -05:00
Waffle d848a2e78c Gave Bidoof a sleeping animation & implemented sleeping behavior. 2023-04-29 15:03:19 -05:00
Waffle 2447f61f8c Fixed Bidoof's movement. oops
Also, made its WATER_FLOAT animation a bit quicker.
2023-04-29 14:14:31 -05:00
Waffle 9839e48dee Reduced Bidoof's swim speed, and added water floating animation (also used as a placeholder for swimming ATM) 2023-04-29 00:35:15 -05:00
Waffle 95f4f96cda actually implemented blink whoops 2023-04-27 16:19:16 -05:00
Waffle 9ce697bf00 Bidoof
- Updated some model pivots
- walkSpeed 0.35 -> 0.3
- ground_idle and ground_walk animations made
- Implemented blink
2023-04-27 16:18:18 -05:00
Waffle 5424513e7e Changed the species files of several Pokemon, mostly to change their movement speeds, though Wailord did get a size bump.
Venusaur walkSpeed 0.35 -> 0.3
Charmander walkSpeed 0.35 -> 0.3
Charmeleon walkSpeed 0.35 -> 0.3
Squirtle walkSpeed 0.35 -> 0.29
Wartortle walkSpeed 0.35 -> 0.29
Blastoise walkSpeed 0.35 -> 0.3
Caterpie walkSpeed 0.35 -> 0.26
Weedle walkSpeed 0.35 -> 0.26
Beedrill walkSpeed 0.35 -> 0.4
Pidgeot walkSpeed 0.35 -> 0.38
Rattata walkSpeed 0.35 -> 0.41
Raticate walkSpeed 0.35 -> 0.33
Slowpoke walkSpeed 0.35 -> 0.125
Slowbro walkSpeed 0.35 -> 0.18
Slowking walkSpeed 0.35 -> 0.23
Wailord scaled up
  - baseScale 1.3 -> 2
  - width 3.5 -> 3.2
  - height 2.3 -> 2.1
Galvantula walkSpeed 0.35 -> 0.4
Naclstack walkSpeed 0.35 -> 0.23
Gargancl walkSpeed 0.35 -> 0.25
2023-04-27 07:06:07 -05:00
Waffle 4de268fcd8 Scaled Chinchou, Shuckle, Tandemaus, and Maushold. Additionally made Shuckle move slowly. 2023-04-27 02:12:35 -05:00
Waffle 86c415cc55 Fixed a couple stray palette-nonconforming pixels on Gorebyss's texture. 2023-04-27 02:11:49 -05:00
Waffle e08066a26c Added Chinchou, Clamperl, Huntail, and Gorebyss 2023-04-27 01:21:23 -05:00
Waffle eea985d56d Added canFly behavior 2023-04-27 00:42:16 -05:00
Nick 000d210b33 Adjust comment checker for even more fun formats that break the unit test :D 2023-04-24 21:14:55 -07:00
tyzillion 124d68a8fe Updated license 2023-04-24 23:22:25 -04:00
tyzillion 0c019b1c71 Updated Model and Texture of Pikachu. Updated weedle texture. 2023-04-24 22:28:06 -04:00
tyzillion fd5468ff6e Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2023-04-24 12:50:57 -04:00
SPG 1d2c1413da Implmented Lanturn
- Fixed License Violation
2023-04-23 21:21:56 -07:00
SPG 005945447b Implmented Lanturn 2023-04-23 21:20:44 -07:00
SPG d69ddef3e3 Implmented Lanturn 2023-04-23 17:53:29 -07:00
tyzillion 4ac7060e4d Implemented Spinarak, Ariados, Shuckle, Taillow, Swellow, Relicanth, Mudbray, Mudsdale, Comfey, Tandemaus, Maushold, Varoom, and Revavroom.
Updated model and textures of Farfetchd and Gengar.
Updated model of Sceptile.
Updated animation for Murkrow and Farfetchd.
2023-04-20 22:17:09 -04:00
2393 changed files with 63970 additions and 7561 deletions

No files matched your search

+90 -10
View File
@@ -1,4 +1,15 @@
# Changelog
## [1.?.?]()
### Developer
- Various breaking changes have been made to ElementalTypes, Moves and other registries, Cobblemon has migrated to make use of proper Minecraft registries.
- DamageCategory is now an Enum.
- Gender has been moved to an API package.
### Datapack & Resourcepack Creators
- Pokémon types can now be created via datapacks. Data path is ``your_mod_namespace/cobblemon/elemental_types/path_to_your_file``.
- Custom moves are now possible via datapacks, these require JavaScript/TypeScript programming knowledge. Data path is ``your_mod_namespace/cobblemon/moves/path_to_your_file``.
- Pokémon species data path has been changed to ``your_mod_namespace/cobblemon/species/path_to_your_file``.
## [1.4.0](#1-4-0)
### Additions
- Added nicknaming.
@@ -15,9 +26,7 @@
- Added support for jump keyframes (i.e. pre and post keyframes)
- Added AI for Nosepass to point towards world spawn when idle.
- Added structure spawn conditions
- Added cries for Gen 1-9 starters and their evolutions.
- Added recipes for Berry Juice, Heal Powder, Remedy, Fine Remedy, Superb Remedy, Revive, Max Revive, HP Up, Protein, Iron, Calcium, Zinc, Carbos, PP Up, PP Max, Pasture, Medicinal Leek to Magenta Dye, Roasted Leek, Leek and Potato Stew, Braised Vivichoke, Vivichoke Dip, Mulch Base, Growth Mulch, Surprise Mulch, Coarse Mulch, Humid Mulch, Rich Mulch, Loamy Mulch, Peat Mulch, Sandy Mulch, X Attack, X Defense, X Special Attack, X Special Defense, X Speed, X Accuracy, Dire Hit, Guard Spec, Power Anklet, Power Band, Power Belt, Power Bracelet, Power Lens, Power Weight, Bright Powder, Destiny Knot
- Added cries for Farfetchd, Galarian Farfetched, Rookidee, Corvisquire, Corviknight, Caterpie, Metapod, Butterfree, Weedle, Kakuna, Beedrill, Pidgey, Pidgeotto, Pidgeot, Rattata, Raticate, Clefairy, Clefable, Tauros, Eevee, Vaporeon, Flareon, Jolteon, Chatot, Darmanitan, Darumaka, Lucario, Mimikyu, Quagsire, Riolu, Wooper, Cleffa, Miltank, Buneary, Lopunny, Wooloo, Dubwool.
- Added a shoulder mount for Mimikyu
- Added Advancement trigger for defeating Pokémon and collecting varieties of Pokémon.
- Added sleep animations to Arcanine, Jigglypuff, Wigglytuff, Vulpix and Ninetales.
@@ -87,7 +96,7 @@
- Cacnea
- Cacturne
- Poochyena
- Mightyenna
- Mightyena
- Wingull
- Pelipper
- Numel
@@ -137,12 +146,12 @@
#### Gen 5
- Bouffolant
- Bouffalant
- Roggenrola
- Boldore
- Gigalith
- Venepede
- Whirlpede
- Venipede
- Whirlipede
- Scolipede
- Yamask
- Cofagrigus
@@ -164,7 +173,7 @@
- Scatterbug
- Spewpa
- Vivillion
- Vivillon
- Skrelp
- Dragalge
- Bunnelby
@@ -192,6 +201,8 @@
- Golisopod
- Crabrawler
- Crabominable
- Mudbray
- Mudsdale
#### Gen 8
@@ -218,7 +229,7 @@
#### Gen 9
- Sprigatitto
- Sprigatito
- Floragato
- Meowscarada
- Fuecoco
@@ -289,6 +300,74 @@
- Item interaction evolutions and held item requirements now support NBT by creating an object JSON containing the key ``item`` for what used to be the existing condition support and a ``nbt`` key for the NBT format, this is the string [format](https://minecraft.fandom.com/wiki/NBT_format) expected in commands. Existing data does not need to be updated.
- Shoulder mounts now match the shoulder position a bit more accurately when sneaking.
- Poison Heal will now cause poisoned Pokémon to heal outside of battle.
- Updated Pokéball, PC, UI, evolution and Healing Machine sounds.
### Added cries to the following Pokémon:
- All starters and their evolutions
- Caterpie, Metapod, Butterfree
- Weedle, Kakuna, Beedrill
- Pidgey, Pidgeotto, Pidgeot
- Rattata, Raticate
- Spearow, Fearow
- Ekans, Arbok
- Pichu, Pikachu, Raichu, Alolan Raichu
- Cleffa, Clefairy, Clefable
- Mankey, Primeape, Annihilape
- Ponyta, Rapidash, Galarian Ponyta, Galarian Rapidash
- Farfetch'd, Galarian Farfetch'd, Sirfetch'd
- Onix, Steelix
- Tauros
- Ditto
- Eevee, Vaporeon, Jolteon, Flareon, Espeon, Umbreon, Leafeon, Glaceon, Sylveon
- Hoothoot, Noctowl
- Mareep, Flaaffy, Ampharos
- Aipom, Ambipom
- Wooper, Quagsire, Clodsire
- Snubbull, Granbull
- Miltank
- Poochyena, Mightyena
- Taillow, Swellow
- Ralts, Kirlia, Gardevoir, Gallade
- Shroomish, Breloom
- Nincada, Ninjask, Shedinja
- Buneary, Lopunny
- Chingling
- Chatot
- Riolu, Lucario
- Pidove, Tranquill, Unfezant
- Roggenrola, Boldore, Gigalith
- Venipede, Whirlipede, Scolipede
- Maractus
- Dwebble, Crustle
- Yamask, Cofagrigus
- Bunnelby, Diggersby
- Fletchling, Fletchinder, Talonflame
- Scatterbug, Spewpa, Vivillon
- Honedge, Doublade, Aegislash
- Skrelp, Dragalge
- Phantump, Trevenant
- Pumpkaboo, Gourgeist
- Bergmite, Avalugg
- Mudbray, Mudsdale
- Stufful, Bewear
- Mimikyu
- Rookidee, Corvisquire, Corviknight
- Nickit, Thievul
- Wooloo, Dubwool
- Yamper, Boltund
- Tandemaus
- Fidough, Dachsbun
- Squawkabilly
- Nacli, Naclstack, Garganacl
- Charcadet, Armarouge, Ceruledge
- Maschiff, Mabosstiff
- Shroodle, Grafaiai
- Flittle, Espathra
- Tinkatink, Tinkatuff, Tinkaton
- Varoom, Revavroom
- Glimmet, Glimmora
- Cetoddle, Cetitan
- Tatsugiri
### Fixes
- Fixed spawning moon phase dependent Pokémon only when the moon phase is wrong
@@ -319,7 +398,7 @@
- Fixed particle animations not running when a Pokémon is off-screen.
- Fixed Pokémon variants and layers not rendering correctly when shouldered and playing on a dedicated server, existing shoulders affected will need to be retrieved and shouldered again.
- Shoulder effects will now stay applied through situations that remove potion effects such as drinking milk.
- Fixed Shedinja evolving to use the consumed Pokeball and removed the held item.
- Fixed Shedinja evolving to use the consumed PokéBall and removed the held item.
- Fixed non-existent species in spawn pool file causing random species to spawn.
- Fixed shearing Pokémon dropping 0-2 wool instead of 1-3.
- Fixed some alignment issues in the stat hexagon of the summary menu.
@@ -334,6 +413,7 @@
- Fixed Primeape, Qwilfish and Stantler not being able to evolve and by proxy the ``use_move`` evolution requirement.
- Fixed Bramblin, Pawmo, and Rellor not being able to evolve and by proxy the ``blocks_traveled`` evolution requirement.
- Fixed displayName property in spawn files not doing what it's meant to do.
- Fixed Pokémon not sleeping in the wild like we wanted them to.
### Developer
- Added SpawnEvent, ThrownPokeballHitEvent, PokemonSentEvent, PokemonRecalledEvent.
@@ -343,6 +423,7 @@
- Added capture check to BattleVictoryEvent.
- The various hardcoded potion shoulder effects have been removed, make use of PotionBaseEffect.
- Added ContextManager for tracking causes and contexts of conditions created during a battle. See BattleContext for types of conditions that are tracked.
- Added MongoDB support for storing Pokémon and Player data. Must be enabled in config, requires MongoDB core and sync drivers (4.10.0+).
### Datapack & Resourcepack Creators
- All potion related shoulder effects have had their IDs changed, they now all share the same type being `potion_effect` and use the vanilla Potion data [parameters](https://minecraft.fandom.com/wiki/Potion#Item_data), take for example the default Pidgey asset:
@@ -393,7 +474,6 @@
- Changed the recipes for Mystic Water, Miracle Seed, and Charcoal Stick to utilise the evolution stones, as well as Never-Melt Ice having an alternate recipe using the Ice Stone.
- Replaced the `Failed to handle` battle messages to `Missing interpretation` to make it more clear that mechanics do work just still pending dedicated messages.
- Healing Machine and PC are now mine-able with pickaxes and Apricorn leaves are mine-able using hoes.
- Updated Pokéball, UI and evolution sounds.
### Fixes
- Fixed killing a Dodrio killing your game. Dodrio will never look the same to us.
@@ -25,6 +25,7 @@ repositories {
mavenCentral()
//JEI
maven("https://maven.blamejared.com/")
maven("https://maven.tterrag.com/")
}
license {
+5
View File
@@ -27,6 +27,8 @@ dependencies {
implementation(libs.reflect)
modImplementation(libs.fabricLoader)
//Flywheel has no common dep so just pick one and don't use any platform specific code in common
modCompileOnly(libs.flywheelFabric)
modApi(libs.molang)
compileOnlyApi(libs.jeiApi)
@@ -35,6 +37,9 @@ dependencies {
//shadowCommon group: 'commons-io', name: 'commons-io', version: '2.6'
// For datastore
modCompileOnly(libs.mongoDriverCore)
modCompileOnly(libs.mongoDriverSync)
testRuntimeOnly(libs.junitEngine)
testImplementation(libs.junitApi)
@@ -9,36 +9,30 @@
package com.cobblemon.mod.common.mixin;
import com.cobblemon.mod.common.block.PreEmptsExplosion;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectListIterator;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.explosion.Explosion;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(value = Explosion.class)
public class ExplosionMixin {
@Shadow @Final private World world;
@Inject(
@Redirect(
method = "affectWorld",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/BlockState;getBlock()Lnet/minecraft/block/Block;"
),
locals = LocalCapture.CAPTURE_FAILSOFT
value = "INVOKE",
target = "Lnet/minecraft/world/World;getBlockState(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/BlockState;",
ordinal = 0
)
)
public void cobblemon$whenExploded(boolean particles, CallbackInfo ci, boolean bl, ObjectArrayList<?> objectArrayList, boolean bl2, ObjectListIterator<?> var5, BlockPos blockPos, BlockState blockState) {
if (blockState.getBlock() instanceof PreEmptsExplosion preExplosionBlock) {
preExplosionBlock.whenExploded(world, blockState, blockPos);
public BlockState cobblemon$whenExploded(World world, BlockPos pos) {
BlockState blockState = world.getBlockState(pos);
if(blockState.getBlock() instanceof PreEmptsExplosion preExplosionBlock) {
preExplosionBlock.whenExploded(world, blockState, pos);
}
return blockState;
}
}
@@ -1,52 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.mixin;
import com.cobblemon.mod.common.api.tags.CobblemonBiomeTags;
import com.cobblemon.mod.common.music.CustomMusic;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.sound.MusicSound;
import net.minecraft.world.biome.Biome;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@Mixin(MinecraftClient.class)
public class MinecraftClientMixin {
@Shadow
public ClientPlayerEntity player;
@Inject(method = "getMusicType", at = @At("RETURN"), cancellable = true)
private void cobblemon$getMusicType(CallbackInfoReturnable<MusicSound> cir) {
if (this.player != null) {
RegistryEntry<Biome> playerBiome = this.player.getWorld().getBiome(this.player.getBlockPos());
List<MusicSound> possibleTracks = new ArrayList<>();
possibleTracks.add(cir.getReturnValue());
// Custom BiomeTag check to add music to certain biomes
if (playerBiome.isIn(CobblemonBiomeTags.IS_ABYSS)) {
possibleTracks.add(CustomMusic.DEEP_DARK);
}
cir.setReturnValue(possibleTracks.get(new Random().nextInt(possibleTracks.size())));
}
}
}
@@ -6,6 +6,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
@file:Suppress("unused")
package com.cobblemon.mod.common
import com.cobblemon.mod.common.advancement.CobblemonCriteria
@@ -29,6 +31,7 @@ import com.cobblemon.mod.common.api.pokeball.catching.calculators.CaptureCalcula
import com.cobblemon.mod.common.api.pokeball.catching.calculators.CaptureCalculators
import com.cobblemon.mod.common.api.pokemon.PokemonSpecies
import com.cobblemon.mod.common.api.pokemon.effect.ShoulderEffectRegistry
import com.cobblemon.mod.common.api.pokemon.evolution.adapters.EvolutionRegistry
import com.cobblemon.mod.common.api.pokemon.experience.ExperienceCalculator
import com.cobblemon.mod.common.api.pokemon.experience.ExperienceGroups
import com.cobblemon.mod.common.api.pokemon.experience.StandardExperienceCalculator
@@ -40,6 +43,7 @@ import com.cobblemon.mod.common.api.pokemon.stats.EvCalculator
import com.cobblemon.mod.common.api.pokemon.stats.Generation8EvCalculator
import com.cobblemon.mod.common.api.pokemon.stats.StatProvider
import com.cobblemon.mod.common.api.properties.CustomPokemonProperty
import com.cobblemon.mod.common.api.registry.CobblemonRegistryKeys
import com.cobblemon.mod.common.api.scheduling.ScheduledTaskTracker
import com.cobblemon.mod.common.api.spawning.BestSpawner
import com.cobblemon.mod.common.api.spawning.CobblemonSpawningProspector
@@ -48,14 +52,18 @@ import com.cobblemon.mod.common.api.spawning.prospecting.SpawningProspector
import com.cobblemon.mod.common.api.starter.StarterHandler
import com.cobblemon.mod.common.api.storage.PokemonStoreManager
import com.cobblemon.mod.common.api.storage.adapter.conversions.ReforgedConversion
import com.cobblemon.mod.common.api.storage.adapter.flatifle.FileStoreAdapter
import com.cobblemon.mod.common.api.storage.adapter.flatifle.JSONStoreAdapter
import com.cobblemon.mod.common.api.storage.adapter.flatifle.NBTStoreAdapter
import com.cobblemon.mod.common.api.storage.adapter.database.MongoDBStoreAdapter
import com.cobblemon.mod.common.api.storage.adapter.flatfile.FileStoreAdapter
import com.cobblemon.mod.common.api.storage.adapter.flatfile.JSONStoreAdapter
import com.cobblemon.mod.common.api.storage.adapter.flatfile.NBTStoreAdapter
import com.cobblemon.mod.common.api.storage.factory.FileBackedPokemonStoreFactory
import com.cobblemon.mod.common.api.storage.pc.PCStore
import com.cobblemon.mod.common.api.storage.pc.link.PCLinkManager
import com.cobblemon.mod.common.api.storage.player.PlayerDataStoreManager
import com.cobblemon.mod.common.api.storage.player.factory.JsonPlayerDataStoreFactory
import com.cobblemon.mod.common.api.storage.player.factory.MongoPlayerDataStoreFactory
import com.cobblemon.mod.common.api.tags.CobblemonEntityTypeTags
import com.cobblemon.mod.common.api.types.ElementalType
import com.cobblemon.mod.common.battles.BagItems
import com.cobblemon.mod.common.battles.BattleFormat
import com.cobblemon.mod.common.battles.BattleRegistry
@@ -63,7 +71,12 @@ import com.cobblemon.mod.common.battles.BattleSide
import com.cobblemon.mod.common.battles.ShowdownThread
import com.cobblemon.mod.common.battles.actor.PokemonBattleActor
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
import com.cobblemon.mod.common.command.argument.*
import com.cobblemon.mod.common.command.argument.MoveArgumentType
import com.cobblemon.mod.common.command.argument.PartySlotArgumentType
import com.cobblemon.mod.common.command.argument.PokemonArgumentType
import com.cobblemon.mod.common.command.argument.PokemonPropertiesArgumentType
import com.cobblemon.mod.common.command.argument.PokemonStoreArgumentType
import com.cobblemon.mod.common.command.argument.SpawnBucketArgumentType
import com.cobblemon.mod.common.config.CobblemonConfig
import com.cobblemon.mod.common.config.LastChangedVersion
import com.cobblemon.mod.common.config.constraint.IntConstraint
@@ -83,15 +96,33 @@ import com.cobblemon.mod.common.pokemon.feature.TagSeasonResolver
import com.cobblemon.mod.common.pokemon.helditem.CobblemonHeldItemManager
import com.cobblemon.mod.common.pokemon.properties.HiddenAbilityPropertyType
import com.cobblemon.mod.common.pokemon.properties.UncatchableProperty
import com.cobblemon.mod.common.pokemon.properties.UntradeableProperty
import com.cobblemon.mod.common.pokemon.properties.tags.PokemonFlagProperty
import com.cobblemon.mod.common.pokemon.stat.CobblemonStatProvider
import com.cobblemon.mod.common.starter.CobblemonStarterHandler
import com.cobblemon.mod.common.trade.TradeManager
import com.cobblemon.mod.common.util.*
import com.cobblemon.mod.common.util.DataKeys
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.ifDedicatedServer
import com.cobblemon.mod.common.util.isLaterVersion
import com.cobblemon.mod.common.util.party
import com.cobblemon.mod.common.util.removeAmountIf
import com.cobblemon.mod.common.util.server
import com.cobblemon.mod.common.world.feature.CobblemonPlacedFeatures
import com.cobblemon.mod.common.world.feature.ore.CobblemonOrePlacedFeatures
import com.cobblemon.mod.common.world.gamerules.CobblemonGameRules
import com.mongodb.ConnectionString
import com.mongodb.MongoClientSettings
import com.mongodb.client.MongoClient
import com.mongodb.client.MongoClients
import java.io.File
import java.io.FileReader
import java.io.FileWriter
import java.io.PrintWriter
import java.util.UUID
import kotlin.properties.Delegates
import kotlin.reflect.full.memberProperties
import kotlin.reflect.jvm.isAccessible
import kotlin.reflect.jvm.javaField
import net.minecraft.client.MinecraftClient
import net.minecraft.command.argument.serialize.ConstantArgumentSerializer
import net.minecraft.entity.data.TrackedDataHandlerRegistry
@@ -101,15 +132,6 @@ import net.minecraft.registry.RegistryKey
import net.minecraft.util.WorldSavePath
import net.minecraft.world.World
import org.apache.logging.log4j.LogManager
import java.io.File
import java.io.FileReader
import java.io.FileWriter
import java.io.PrintWriter
import java.util.*
import kotlin.properties.Delegates
import kotlin.reflect.full.memberProperties
import kotlin.reflect.jvm.isAccessible
import kotlin.reflect.jvm.javaField
object Cobblemon {
const val MODID = "cobblemon"
@@ -144,6 +166,7 @@ object Cobblemon {
fun preInitialize(implementation: CobblemonImplementation) {
this.implementation = implementation
this.queueRegistryCreation()
implementation.registerPermissionValidator()
implementation.registerSoundEvents()
implementation.registerBlocks()
@@ -171,6 +194,8 @@ object Cobblemon {
ShoulderEffectRegistry.register()
EvolutionRegistry.init()
DATA_SYNCHRONIZED.subscribe {
storage.onPlayerDataSync(it)
playerData.get(it).sendToPlayer(it)
@@ -236,7 +261,6 @@ object Cobblemon {
DataKeys.HAS_BEEN_SHEARED,
FlagSpeciesFeatureProvider(keys = listOf(DataKeys.HAS_BEEN_SHEARED), default = false))
CustomPokemonProperty.register(UntradeableProperty)
CustomPokemonProperty.register(UncatchableProperty)
CustomPokemonProperty.register(PokemonFlagProperty)
CustomPokemonProperty.register(HiddenAbilityPropertyType)
@@ -249,15 +273,52 @@ object Cobblemon {
PlatformEvents.SERVER_STARTING.subscribe { event ->
val server = event.server
playerData = PlayerDataStoreManager().also { it.setup(server) }
val mongoClient: MongoClient?
val pokemonStoreRoot = server.getSavePath(WorldSavePath.ROOT).resolve("pokemon").toFile()
val storeAdapter = when (config.storageFormat) {
"nbt", "json" -> {
val jsonFactory = JsonPlayerDataStoreFactory()
jsonFactory.setup(server)
playerData.setFactory(jsonFactory)
if (config.storageFormat == "nbt") {
NBTStoreAdapter(pokemonStoreRoot.absolutePath, useNestedFolders = true, folderPerClass = true)
} else {
JSONStoreAdapter(
pokemonStoreRoot.absolutePath,
useNestedFolders = true,
folderPerClass = true
)
}
}
"mongodb" -> {
try {
Class.forName("com.mongodb.client.MongoClient")
val mongoClientSettings = MongoClientSettings.builder()
.applyConnectionString(ConnectionString(config.mongoDBConnectionString))
.build()
mongoClient = MongoClients.create(mongoClientSettings)
val mongoFactory = MongoPlayerDataStoreFactory(mongoClient, config.mongoDBDatabaseName)
playerData.setFactory(mongoFactory)
MongoDBStoreAdapter(mongoClient, config.mongoDBDatabaseName)
} catch (e: ClassNotFoundException) {
LOGGER.error("MongoDB driver not found.")
throw e
}
}
else -> throw IllegalArgumentException("Unsupported storageFormat: ${config.storageFormat}")
}
.with(ReforgedConversion(server.getSavePath(WorldSavePath.ROOT))) as FileStoreAdapter<*>
storage.registerFactory(
priority = Priority.LOWEST,
factory = FileBackedPokemonStoreFactory(
adapter = if (config.storageFormat == "nbt") {
NBTStoreAdapter(pokemonStoreRoot.absolutePath, useNestedFolders = true, folderPerClass = true)
} else {
JSONStoreAdapter(pokemonStoreRoot.absolutePath, useNestedFolders = true, folderPerClass = true)
}.with(ReforgedConversion(server.getSavePath(WorldSavePath.ROOT))) as FileStoreAdapter<*>,
adapter = storeAdapter,
createIfMissing = true,
pcConstructor = { uuid -> PCStore(uuid).also { it.resize(config.defaultBoxCount) } }
)
@@ -419,4 +480,8 @@ object Cobblemon {
this.implementation.registerCommandArgument(cobblemonResource("pokemon_store"), PokemonStoreArgumentType::class, ConstantArgumentSerializer.of(PokemonStoreArgumentType::pokemonStore))
}
private fun queueRegistryCreation() {
this.implementation.createRegistry(CobblemonRegistryKeys.ELEMENTAL_TYPE, ElementalType.CODEC, ElementalType.NETWORK_CODEC)
}
}
@@ -306,7 +306,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
private fun berryBlock(name: String): BerryBlock {
val identifier = cobblemonResource("${name}_berry")
val block = this.create(identifier.path, BerryBlock(identifier, AbstractBlock.Settings.copy(Blocks.WHEAT).dynamicBounds().sounds(BlockSoundGroup.CROP)))
val block = this.create(identifier.path, BerryBlock(identifier, AbstractBlock.Settings.copy(Blocks.WHEAT).dynamicBounds().sounds(BlockSoundGroup.CROP).strength(0.2F)))
this.berries[identifier] = block
return block
}
@@ -8,18 +8,22 @@
package com.cobblemon.mod.common
import com.cobblemon.mod.common.api.data.JsonDataRegistry
import com.cobblemon.mod.common.api.net.ClientNetworkPacketHandler
import com.cobblemon.mod.common.api.net.NetworkPacket
import com.cobblemon.mod.common.api.net.ServerNetworkPacketHandler
import com.mojang.brigadier.arguments.ArgumentType
import com.mojang.serialization.Codec
import kotlin.reflect.KClass
import net.minecraft.advancement.criterion.Criterion
import net.minecraft.command.argument.serialize.ArgumentSerializer
import net.minecraft.network.PacketByteBuf
import net.minecraft.network.listener.ClientPlayPacketListener
import net.minecraft.network.packet.Packet
import net.minecraft.registry.Registry
import net.minecraft.registry.RegistryKey
import net.minecraft.registry.tag.TagKey
import net.minecraft.resource.ResourceManager
import net.minecraft.resource.ResourceReloader
import net.minecraft.resource.ResourceType
import net.minecraft.server.MinecraftServer
@@ -29,6 +33,7 @@ import net.minecraft.world.GameRules
import net.minecraft.world.biome.Biome
import net.minecraft.world.gen.GenerationStep
import net.minecraft.world.gen.feature.PlacedFeature
import org.jetbrains.annotations.ApiStatus
interface CobblemonImplementation {
val modAPI: ModAPI
@@ -160,6 +165,41 @@ interface CobblemonImplementation {
*/
fun server(): MinecraftServer?
/**
* Handles platform independent reloading of a [JsonDataRegistry].
*
* @param registry The [JsonDataRegistry] to reload.
* @param manager The [ResourceManager] to reload from.
*/
fun <T> reloadJsonRegistry(registry: JsonDataRegistry<T>, manager: ResourceManager): HashMap<Identifier, T>
/**
* Queue the creation of a registry in the implementation.
* This registry will not be immediately available for access.
*
* @param T The type of the registry entries.
* @param registryKey The [RegistryKey] of this registry.
* @param codec The [Codec] used for this registry entries to be parsed on the server.
* @param networkCodec The [Codec] used when the client is synchronizing this registry from the server. If this is null the client will not require the registry aka not load any data.
*
* @see getRegistry
*/
@ApiStatus.Internal
fun <T> createRegistry(registryKey: RegistryKey<Registry<T>>, codec: Codec<T>, networkCodec: Codec<T>? = null)
/**
* Fetches a registry.
* This is intended for Cobblemon registries but can be used for any.
*
* @param T The type of the registry.
* @param registryKey The [RegistryKey] of the registry being fetched.
* @return The registry if present.
*
* @throws Exception If the registry doesn't exist or isn't loaded yet.
* @see createRegistry
*/
@ApiStatus.Internal
fun <T> getRegistry(registryKey: RegistryKey<Registry<T>>): Registry<T>
}
enum class ModAPI {
@@ -338,7 +338,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
@JvmField
val ROASTED_LEEK = create("roasted_leek", Item(Item.Settings().food(FoodComponent.Builder().snack().hunger(3).saturationModifier(0.3f).build())))
@JvmField
val BRAISED_VIVICHOKE = create("braised_vivichoke", Item(Item.Settings().maxCount(1).food(FoodComponent.Builder().hunger(6).saturationModifier(0.6f).build())))
val BRAISED_VIVICHOKE = create("braised_vivichoke", Item(Item.Settings().food(FoodComponent.Builder().hunger(6).saturationModifier(0.6f).build())))
@JvmField
val VIVICHOKE_DIP = create("vivichoke_dip", object : StewItem(Settings().maxCount(1)
.food(FoodComponent.Builder()
@@ -55,11 +55,8 @@ import com.cobblemon.mod.common.net.messages.client.battle.*
import com.cobblemon.mod.common.net.messages.client.callback.OpenMoveCallbackPacket
import com.cobblemon.mod.common.net.messages.client.callback.OpenPartyCallbackPacket
import com.cobblemon.mod.common.net.messages.client.callback.OpenPartyMoveCallbackPacket
import com.cobblemon.mod.common.net.messages.client.data.AbilityRegistrySyncPacket
import com.cobblemon.mod.common.net.messages.client.data.BerryRegistrySyncPacket
import com.cobblemon.mod.common.net.messages.client.data.MovesRegistrySyncPacket
import com.cobblemon.mod.common.net.messages.client.data.*
import com.cobblemon.mod.common.net.messages.client.data.PropertiesCompletionRegistrySyncPacket
import com.cobblemon.mod.common.net.messages.client.data.SpeciesRegistrySyncPacket
import com.cobblemon.mod.common.net.messages.client.data.UnlockReloadPacket
import com.cobblemon.mod.common.net.messages.client.effect.SpawnSnowstormParticlePacket
import com.cobblemon.mod.common.net.messages.client.pasture.ClosePasturePacket
@@ -211,6 +208,7 @@ object CobblemonNetwork : NetworkManager {
this.createClientBound(HeldItemUpdatePacket.ID, HeldItemUpdatePacket::decode, PokemonUpdatePacketHandler())
this.createClientBound(PokemonStateUpdatePacket.ID, PokemonStateUpdatePacket::decode, PokemonUpdatePacketHandler())
this.createClientBound(TetheringUpdatePacket.ID, TetheringUpdatePacket::decode, PokemonUpdatePacketHandler())
this.createClientBound(TradeableUpdatePacket.ID, TradeableUpdatePacket::decode, PokemonUpdatePacketHandler())
// Evolution start
this.createClientBound(AddEvolutionPacket.ID, AddEvolutionPacket::decode, PokemonUpdatePacketHandler())
@@ -88,9 +88,6 @@ object CobblemonSounds : PlatformRegistry<Registry<SoundEvent>, RegistryKey<Regi
@JvmField
val MULCH_REMOVE = this.create("mulch.remove")
@JvmField
val MUSIC_DEEP_DARK = this.create("music.deep_dark")
private fun create(name: String): SoundEvent = this.create(name, SoundEvent.of(cobblemonResource(name)))
}
@@ -32,7 +32,7 @@ object CobblemonTradeOffers {
* @return The resulting list.
*/
fun tradeOffersFor(profession: VillagerProfession): List<VillagerTradeOffer> = when (profession) {
VillagerProfession.FARMER -> listOf(VillagerTradeOffer(VillagerProfession.FARMER, 3, listOf(TradeOffers.SellItemFactory(CobblemonItems.VIVICHOKE_SEEDS, 32, 1, 1, 6))))
VillagerProfession.FARMER -> listOf(VillagerTradeOffer(VillagerProfession.FARMER, 3, listOf(TradeOffers.SellItemFactory(CobblemonItems.VIVICHOKE_SEEDS, 24, 1, 1, 6))))
else -> emptyList()
}
@@ -42,7 +42,7 @@ object CobblemonTradeOffers {
* @return The resulting list.
*/
fun resolveWanderingTradeOffers(): List<WandererTradeOffer> = listOf(
WandererTradeOffer(false, listOf(TradeOffers.SellItemFactory(CobblemonItems.VIVICHOKE_SEEDS, 32, 1, 1, 6)))
WandererTradeOffer(false, listOf(TradeOffers.SellItemFactory(CobblemonItems.VIVICHOKE_SEEDS, 24, 1, 1, 6)))
)
/**
@@ -8,6 +8,7 @@
package com.cobblemon.mod.common.advancement.criterion
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import com.google.gson.JsonObject
import net.minecraft.predicate.entity.LootContextPredicate
import net.minecraft.server.network.ServerPlayerEntity
@@ -30,7 +31,11 @@ class CaughtPokemonCriterionCondition(id: Identifier, predicate: LootContextPred
override fun fromJson(json: JsonObject) {
super.fromJson(json)
type = json.get("type")?.asString ?: "any"
var stored = json.get("type")?.asString
if (stored != null && stored != "any") {
stored = stored.asIdentifierDefaultingNamespace().toString()
}
type = stored ?: "any"
}
override fun matches(player: ServerPlayerEntity, context: CountablePokemonTypeContext): Boolean {
@@ -30,7 +30,10 @@ class LevelUpCriterionCondition(id: Identifier, entity: LootContextPredicate) :
override fun matches(player: ServerPlayerEntity, context: LevelUpContext): Boolean {
val preEvo = context.pokemon.preEvolution == null
val hasEvolution = !context.pokemon.evolutions.none()
val evolutionCheck = !(preEvo == hasEvolution)
var evolutionCheck = true
if (preEvo || hasEvolution) {
evolutionCheck = !(preEvo == hasEvolution)
}
return level == context.level && evolutionCheck == evolved
}
}
@@ -12,6 +12,8 @@ import com.cobblemon.mod.common.Cobblemon.LOGGER
import com.cobblemon.mod.common.api.PrioritizedList
import com.cobblemon.mod.common.api.Priority
import com.cobblemon.mod.common.pokemon.Species
import com.mojang.serialization.Codec
import com.mojang.serialization.DataResult
/**
* A pool of potential abilities, as a [PrioritizedList]. The added logic of this subclass
@@ -35,4 +37,22 @@ open class AbilityPool : PrioritizedList<PotentialAbility>() {
Exception().printStackTrace()
return Abilities.first().create() to Priority.LOWEST
}
companion object {
@JvmField
val CODEC: Codec<AbilityPool> = Codec.list(Codec.STRING)
.comapFlatMap(
{ raw ->
val pool = AbilityPool()
if (raw.isEmpty()) {
return@comapFlatMap DataResult.error { "Cannot create ability pool from an empty list" }
}
raw.forEach { }
DataResult.success(pool)
}
)
}
}
@@ -10,9 +10,12 @@ package com.cobblemon.mod.common.api.abilities
import com.cobblemon.mod.common.api.Priority
import com.google.gson.JsonElement
import com.mojang.serialization.Codec
interface PotentialAbilityType<T : PotentialAbility> {
fun parseFromJSON(element: JsonElement): T?
fun codec(): Codec<out PotentialAbilityType<*>>
}
/**
@@ -45,6 +48,10 @@ object CommonAbilityType : PotentialAbilityType<CommonAbility> {
}
}
}
override fun codec(): Codec<out PotentialAbilityType<*>> {
TODO("Not yet implemented")
}
}
open class CommonAbility(override val template: AbilityTemplate) : PotentialAbility {
@@ -10,6 +10,8 @@ package com.cobblemon.mod.common.api.ai
import com.cobblemon.mod.common.api.serialization.StringIdentifiedObjectAdapter
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.mojang.serialization.Codec
import com.mojang.serialization.DataResult
import net.minecraft.entity.ai.TargetPredicate
import net.minecraft.util.math.Box
@@ -35,7 +37,7 @@ interface SleepDepth {
override fun shouldWake(pokemonEntity: PokemonEntity): Boolean {
val nearbyPlayers = pokemonEntity.world.getPlayers(TargetPredicate.createNonAttackable(), pokemonEntity, Box.of(pokemonEntity.pos, 16.0, 16.0, 16.0))
return nearbyPlayers.none { !it.isSneaking }
return nearbyPlayers.any { !it.isSneaking }
}
}
@@ -44,6 +46,11 @@ interface SleepDepth {
"normal" to normal
)
val adapter = StringIdentifiedObjectAdapter { depths[it] ?: throw IllegalArgumentException("Unknown sleep depth: $it") }
val CODEC: Codec<SleepDepth> = Codec.STRING.flatXmap(
{ string -> depths[string]?.let { DataResult.success(it) } ?: DataResult.error { "Cannot find a SleepDepth with the ID $string" } },
{ depth -> depths.entries.firstOrNull { it.value == depth }?.let { DataResult.success(it.key) } ?: DataResult.error { "Cannot resolve a ID for the SleepDepth $depth" } }
)
}
fun canSleep(pokemonEntity: PokemonEntity): Boolean
@@ -10,6 +10,8 @@ package com.cobblemon.mod.common.api.battles.interpreter
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor
import com.cobblemon.mod.common.api.moves.MoveTemplate
import com.cobblemon.mod.common.api.moves.Moves
import com.cobblemon.mod.common.battles.ActiveBattlePokemon
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
import java.util.UUID
@@ -194,6 +196,11 @@ class BattleMessage(rawMessage: String) {
return Effect.parse(data)
}
fun moveAt(index: Int): MoveTemplate? {
val argument = argumentAt(index)?.lowercase()?.replace("[^a-z0-9]".toRegex(), "") ?: return null
return Moves.getByName(argument)
}
/**
* Queries an optional argument with given [argumentName] for a 'pnx' that will be parsed into a [BattleActor] and [ActiveBattlePokemon].
*
@@ -66,9 +66,6 @@ object Berries : JsonDataRegistry<Berry> {
private val berries = hashMapOf<Identifier, Berry>()
val PECHA
get() = this.getByName("")
override fun reload(data: Map<Identifier, Berry>) {
this.berries.clear()
data.forEach { (identifier, berry) ->
@@ -23,6 +23,7 @@ import com.cobblemon.mod.common.util.writeBox
import com.google.gson.annotations.SerializedName
import java.awt.Color
import java.util.EnumSet
import kotlin.math.min
import net.minecraft.block.Block
import net.minecraft.block.BlockState
import net.minecraft.client.model.ModelPart
@@ -159,16 +160,14 @@ class Berry(
val base = this.baseYield.random()
val bonus = this.bonusYield(world, state, pos)
var yield = base + bonus.first
val event = BerryYieldCalculationEvent(this, world, state, pos, placer, yield, bonus.second)
val treeEntity = world.getBlockEntity(pos) as BerryBlockEntity
if (BerryBlock.getMulch(state) == MulchVariant.RICH) {
yield = yield.times(1.2).coerceAtMost(maxYield().toDouble()).toInt()
yield = min(yield + 1, maxYield())
treeEntity.decrementMulchDuration(world, pos, state)
}
val event = BerryYieldCalculationEvent(this, world, state, pos, placer, yield, bonus.second)
CobblemonEvents.BERRY_YIELD.post(event) { yield = it.yield }
return yield
//Just for testing the renderer
//return growthPoints.size
}
/**
@@ -299,8 +298,7 @@ class Berry(
if (factor.isValid(world, state, pos)) {
bonus += factor.yield()
passed += factor
}
else if (hasBiomeMulch) {
} else if (hasBiomeMulch) {
bonus += factor.yield()
}
}
@@ -121,6 +121,7 @@ class PartySelectCallback(
open class PartySelectPokemonDTO(
val pokemonProperties: PokemonProperties,
val aspects: Set<String>,
val heldItem: ItemStack = ItemStack.EMPTY,
var currentHealth: Int,
var maxHealth: Int,
@@ -129,13 +130,13 @@ open class PartySelectPokemonDTO(
@JvmOverloads
constructor(pokemon: Pokemon, enabled: Boolean = true): this(
pokemonProperties = pokemon.createPokemonProperties(
PokemonPropertyExtractor.ASPECTS,
PokemonPropertyExtractor.SPECIES,
PokemonPropertyExtractor.LEVEL,
PokemonPropertyExtractor.NICKNAME,
PokemonPropertyExtractor.POKEBALL,
PokemonPropertyExtractor.STATUS
PokemonPropertyExtractor.STATUS,
),
aspects = pokemon.aspects,
heldItem = pokemon.heldItemNoCopy(),
currentHealth = pokemon.currentHealth,
maxHealth = pokemon.hp,
@@ -144,6 +145,7 @@ open class PartySelectPokemonDTO(
constructor(buffer: PacketByteBuf): this(
pokemonProperties = PokemonProperties().loadFromNBT(buffer.readNbt() as NbtCompound),
aspects = buffer.readList { it.readString() }.toSet(),
heldItem = buffer.readItemStack(),
currentHealth = buffer.readInt(),
maxHealth = buffer.readInt(),
@@ -152,6 +154,7 @@ open class PartySelectPokemonDTO(
fun writeToBuffer(buffer: PacketByteBuf) {
buffer.writeNbt(pokemonProperties.saveToNBT())
buffer.writeCollection(aspects) { _, aspect -> buffer.writeString(aspect) }
buffer.writeItemStack(heldItem)
buffer.writeInt(currentHealth)
buffer.writeInt(maxHealth)
@@ -0,0 +1,20 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.conditional
import net.minecraft.registry.Registry
import net.minecraft.util.Identifier
class RegistryElementCondition<T>(val element: T, private val source: Identifier) : RegistryLikeCondition<T> {
override fun fits(value: T, registry: Registry<T>): Boolean = value == this.element
override fun pretty(): String = this.source.toString()
}
@@ -1,31 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.conditional
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
import java.lang.reflect.Type
/**
* Adapter for [RegistryLikeCondition]s. Its logic is that the implementation of this adapter must
* provide a list of resolvers, and the deserializer will find the first resolver that returns a non-null
* value for the [JsonElement].
*
* @author Hiroku
* @since July 17th, 2022
*/
interface RegistryLikeAdapter<B> : JsonDeserializer<RegistryLikeCondition<B>> {
val registryLikeConditions: MutableList<(JsonElement) -> RegistryLikeCondition<B>?>
override fun deserialize(json: JsonElement, type: Type, ctx: JsonDeserializationContext): RegistryLikeCondition<B> {
return registryLikeConditions.firstNotNullOfOrNull { it(json) }
?: throw IllegalArgumentException("Unable to deserialize $json")
}
}
@@ -8,7 +8,11 @@
package com.cobblemon.mod.common.api.conditional
import com.mojang.serialization.Codec
import com.mojang.serialization.DataResult
import net.minecraft.registry.Registry
import net.minecraft.registry.tag.TagKey
import net.minecraft.util.Identifier
/**
* A condition which applies to an entry in some [Registry].
@@ -16,6 +20,43 @@ import net.minecraft.registry.Registry
* @author Hiroku
* @since July 16th, 2022
*/
interface RegistryLikeCondition<T> {
fun fits(t: T, registry: Registry<T>): Boolean
sealed interface RegistryLikeCondition<T> {
/**
* Checks if a given [value] matches this condition.
*
* @param value The value being matched against this condition.
* @param registry The [Registry] of type [T] being queried.
* @return If the condition is fulfilled.
*/
fun fits(value: T, registry: Registry<T>): Boolean
/**
* Generates a string like human-friendly representation used by the Codec when serializing.
*
* @return The string like human-friendly representation.
*/
fun pretty(): String
companion object {
@JvmStatic
fun <T> createCodec(registryAccessor: () -> Registry<T>): Codec<RegistryLikeCondition<T>> = Codec.STRING.comapFlatMap(
{ string ->
val registry = registryAccessor.invoke()
val isTag = string.startsWith("#")
val rawIdentifier = if (isTag) string.substringAfter("#") else string
val identifier = Identifier.tryParse(rawIdentifier) ?: return@comapFlatMap DataResult.error { "Cannot resolve identifier/tag from the string $string" }
if (isTag) {
val tag = TagKey.of(registry.key, identifier)
return@comapFlatMap DataResult.success(RegistryTagCondition(tag))
}
val element = registry.get(identifier) ?: return@comapFlatMap DataResult.error { "Cannot find an element in registry ${registry.key.value} with the ID $identifier" }
return@comapFlatMap DataResult.success(RegistryElementCondition(element, identifier))
},
{ it.pretty() }
)
}
}
@@ -1,28 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.conditional
import com.google.gson.JsonElement
import net.minecraft.registry.Registry
import net.minecraft.util.Identifier
/**
* A condition for some registry type which asserts that the entry must have the given [Identifier].
*
* @author Hiroku
* @since July 16th, 2022
*/
open class RegistryLikeIdentifierCondition<T>(val identifier: Identifier) : RegistryLikeCondition<T> {
companion object {
fun <T> resolver(
constructor: (Identifier) -> RegistryLikeIdentifierCondition<T>
): (JsonElement) -> RegistryLikeIdentifierCondition<T>? = { constructor(Identifier(it.asString)) }
}
override fun fits(t: T, registry: Registry<T>) = registry.getId(t) == identifier
}
@@ -1,54 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.conditional
import com.google.gson.JsonElement
import net.minecraft.registry.Registry
import net.minecraft.registry.RegistryKey
import net.minecraft.registry.tag.TagKey
import net.minecraft.util.Identifier
/**
* A condition for some registry type that asserts that the entry must be inside the given [TagKey]. This is presented
* in JSONs as an identifier prefixed with a hash.
*
* @author Hiroku
* @since July 16th, 2022
*/
open class RegistryLikeTagCondition<T>(val tag: TagKey<T>) : RegistryLikeCondition<T> {
companion object {
const val PREFIX = "#"
fun <T> resolver(
registryKey: RegistryKey<Registry<T>>,
constructor: (TagKey<T>) -> RegistryLikeTagCondition<T>
): (JsonElement) -> RegistryLikeTagCondition<T>? = {
val firstSymbol = it.asString.substring(0, 1)
if (firstSymbol == PREFIX) {
val identifier = Identifier(it.asString.substring(1))
constructor(TagKey.of(registryKey, identifier))
} else {
null
}
}
}
override fun fits(t: T, registry: Registry<T>): Boolean {
// val registryHasTag = registry.containsTag(tag)
// if (!registryHasTag) {
//// LOGGER.warn("No tag in registry: ${tag.id}")
// return false
// }
return registry.getKey(t)
.flatMap(registry::getEntry)
.map { entry -> entry.isIn(tag) }
.orElse(false)
}
}
@@ -0,0 +1,20 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.conditional
import net.minecraft.registry.Registry
import net.minecraft.registry.tag.TagKey
class RegistryTagCondition<T>(val tag: TagKey<T>) : RegistryLikeCondition<T> {
override fun fits(value: T, registry: Registry<T>): Boolean = registry.getEntry(value).isIn(this.tag)
override fun pretty(): String = "#${this.tag.id}"
}
@@ -8,11 +8,9 @@
package com.cobblemon.mod.common.api.data
import com.cobblemon.mod.common.util.endsWith
import com.cobblemon.mod.common.Cobblemon
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import java.io.File
import java.util.concurrent.ExecutionException
import net.minecraft.resource.ResourceManager
import net.minecraft.util.Identifier
@@ -44,23 +42,7 @@ interface JsonDataRegistry<T> : DataRegistry {
val resourcePath: String
override fun reload(manager: ResourceManager) {
val data = hashMapOf<Identifier, T>()
manager.findResources(this.resourcePath) { path -> path.endsWith(JSON_EXTENSION) }.forEach { (identifier, resource) ->
if (identifier.namespace == "pixelmon") {
return@forEach
}
resource.inputStream.use { stream ->
stream.bufferedReader().use { reader ->
val resolvedIdentifier = Identifier(identifier.namespace, File(identifier.path).nameWithoutExtension)
try {
data[resolvedIdentifier] = this.gson.fromJson(reader, this.typeToken.type)
} catch (exception: Exception) {
throw ExecutionException("Error loading JSON for data: $identifier", exception)
}
}
}
}
this.reload(data)
this.reload(Cobblemon.implementation.reloadJsonRegistry(this, manager))
}
/**
@@ -71,6 +53,6 @@ interface JsonDataRegistry<T> : DataRegistry {
fun reload(data: Map<Identifier, T>)
companion object {
private const val JSON_EXTENSION = ".json"
const val JSON_EXTENSION = ".json"
}
}
@@ -8,11 +8,7 @@
package com.cobblemon.mod.common.api.events
import com.cobblemon.mod.common.api.events.battles.BattleFaintedEvent
import com.cobblemon.mod.common.api.events.battles.BattleFledEvent
import com.cobblemon.mod.common.api.events.battles.BattleStartedPostEvent
import com.cobblemon.mod.common.api.events.battles.BattleStartedPreEvent
import com.cobblemon.mod.common.api.events.battles.BattleVictoryEvent
import com.cobblemon.mod.common.api.events.battles.*
import com.cobblemon.mod.common.api.events.berry.BerryHarvestEvent
import com.cobblemon.mod.common.api.events.berry.BerryMutationOfferEvent
import com.cobblemon.mod.common.api.events.berry.BerryMutationResultEvent
@@ -43,6 +39,7 @@ import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import net.minecraft.server.network.ServerPlayerEntity
@Suppress("unused")
object CobblemonEvents {
@JvmField
@@ -105,6 +102,7 @@ object CobblemonEvents {
@JvmField
val ENTITY_SPAWN = CancelableObservable<SpawnEvent<*>>()
@Suppress("UNCHECKED_CAST")
@JvmField
val POKEMON_ENTITY_SPAWN = ENTITY_SPAWN
.pipe(
@@ -180,10 +180,10 @@ fun drawPortraitPokemon(
partialTicks: Float
) {
val model = PokemonModelRepository.getPoser(species.resourceIdentifier, aspects)
val texture = PokemonModelRepository.getTexture(species.resourceIdentifier, aspects, state)
val texture = PokemonModelRepository.getTexture(species.resourceIdentifier, aspects, state?.animationSeconds ?: 0F)
val context = RenderContext()
PokemonModelRepository.variations[species.resourceIdentifier]?.getTexture(aspects, 0f).let { it -> context.put(RenderContext.TEXTURE, it) }
PokemonModelRepository.getTextureNoSubstitute(species.resourceIdentifier, aspects, 0f).let { it -> context.put(RenderContext.TEXTURE, it) }
context.put(RenderContext.SCALE, species.getForm(aspects).baseScale)
val renderType = model.getLayer(texture)
@@ -124,9 +124,6 @@ interface PokemonSelectingItem {
handler = { pk ->
if (stack.isHeld(player)) {
applyToPokemon(player, stack, pk)
if (!player.isCreative) {
stack.decrement(1)
}
CobblemonCriteria.POKEMON_INTERACT.trigger(player, PokemonInteractContext(pk.species.resourceIdentifier, Registries.ITEM.getId(stack.item)))
}
}
@@ -0,0 +1,43 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves
import com.cobblemon.mod.common.util.lang
import com.mojang.serialization.Codec
import net.minecraft.text.MutableText
import net.minecraft.util.StringIdentifiable
/**
* Represents the damage category of a [MoveTemplate]/[Move].
*
* @see MoveTemplate
* @see Move
*/
enum class DamageCategory : StringIdentifiable {
PHYSICAL,
SPECIAL,
STATUS;
override fun asString(): String = this.name
/**
* Resolves the display name of this damage category.
*
* @return The generated text.
*/
fun displayName(): MutableText = lang("move.category.${this.name.lowercase()}")
companion object {
val CODEC: Codec<DamageCategory> = StringIdentifiable.createCodec(DamageCategory::values)
}
}
@@ -8,7 +8,6 @@
package com.cobblemon.mod.common.api.moves
import com.cobblemon.mod.common.api.moves.categories.DamageCategory
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.api.types.ElementalType
import com.cobblemon.mod.common.net.IntSize
@@ -8,14 +8,15 @@
package com.cobblemon.mod.common.api.moves
import com.cobblemon.mod.common.api.moves.categories.DamageCategories
import com.cobblemon.mod.common.api.moves.categories.DamageCategory
import com.cobblemon.mod.common.api.registry.CobblemonRegistries
import com.cobblemon.mod.common.api.types.ElementalType
import com.cobblemon.mod.common.api.types.ElementalTypes
import com.cobblemon.mod.common.battles.MoveTarget
import com.cobblemon.mod.common.util.lang
import com.google.gson.annotations.SerializedName
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.text.MutableText
import net.minecraft.util.math.random.Random
/**
* This class represents the base of a Move.
@@ -48,6 +49,27 @@ open class MoveTemplate(
val effectChances: Array<Double>
) {
companion object {
fun dummy(name: String) = Dummy(name)
val CODEC: Codec<MoveTemplate> = RecordCodecBuilder.create { builder ->
builder.group(
Codec.STRING.fieldOf("name").forGetter(MoveTemplate::name),
Codec.INT.fieldOf("num").forGetter(MoveTemplate::num),
CobblemonRegistries.ELEMENTAL_TYPE.codec.fieldOf("type").forGetter(MoveTemplate::elementalType),
DamageCategory.CODEC.fieldOf("damageCategory").forGetter(MoveTemplate::damageCategory),
Codec.DOUBLE.fieldOf("power").forGetter(MoveTemplate::power),
MoveTarget.CODEC.fieldOf("target").forGetter(MoveTemplate::target),
Codec.DOUBLE.fieldOf("accuracy").forGetter(MoveTemplate::accuracy),
Codec.INT.fieldOf("pp").forGetter(MoveTemplate::pp),
Codec.INT.fieldOf("priority").forGetter(MoveTemplate::priority),
Codec.DOUBLE.fieldOf("critRatio").forGetter(MoveTemplate::critRatio),
Codec.list(Codec.DOUBLE).fieldOf("effectChances").xmap({ e -> e.toTypedArray() }, { e -> e.toList() }).forGetter(MoveTemplate::effectChances)
).apply(builder, ::MoveTemplate)
}
}
val displayName: MutableText
get() = lang("move.$name")
val description: MutableText
@@ -57,8 +79,8 @@ open class MoveTemplate(
class Dummy(name: String) : MoveTemplate(
name = name,
num = -1,
elementalType = ElementalTypes.NORMAL,
damageCategory = DamageCategories.STATUS,
elementalType = CobblemonRegistries.ELEMENTAL_TYPE.getRandom(Random.create()).orElseThrow().value(),
damageCategory = DamageCategory.STATUS,
power = 0.0,
target = MoveTarget.all,
accuracy = 100.0,
@@ -68,10 +90,6 @@ open class MoveTemplate(
effectChances = emptyArray()
)
companion object {
fun dummy(name: String) = Dummy(name)
}
/**
* Creates the Move with full PP
*/
@@ -92,4 +110,5 @@ open class MoveTemplate(
template = this
)
}
}
@@ -10,9 +10,8 @@ package com.cobblemon.mod.common.api.moves
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.data.DataRegistry
import com.cobblemon.mod.common.api.moves.categories.DamageCategories
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.api.types.ElementalTypes
import com.cobblemon.mod.common.api.registry.CobblemonRegistries
import com.cobblemon.mod.common.battles.MoveTarget
import com.cobblemon.mod.common.battles.runner.ShowdownService
import com.cobblemon.mod.common.net.messages.client.data.MovesRegistrySyncPacket
@@ -44,8 +43,8 @@ object Moves : DataRegistry {
val id = jsMove.get("id").asString
try {
val num = jsMove.get("num").asInt
val elementalType = ElementalTypes.getOrException(jsMove.get("type").asString)
val damageCategory = DamageCategories.getOrException(jsMove.get("category").asString)
val elementalType = CobblemonRegistries.ELEMENTAL_TYPE.first { it.showdownId() == jsMove.get("type").asString }
val damageCategory = DamageCategory.valueOf(jsMove.get("category").asString.uppercase())
val power = jsMove.get("basePower").asDouble
val target = MoveTarget.fromShowdownId(jsMove.get("target").asString)
// If not a double it's always true
@@ -1,30 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.adapters
import com.cobblemon.mod.common.api.moves.categories.DamageCategories
import com.cobblemon.mod.common.api.moves.categories.DamageCategory
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
import com.google.gson.JsonPrimitive
import com.google.gson.JsonSerializationContext
import com.google.gson.JsonSerializer
import java.lang.reflect.Type
object DamageCategoryAdapter: JsonSerializer<DamageCategory>, JsonDeserializer<DamageCategory> {
override fun serialize(src: DamageCategory, typeOfSrc: Type, context: JsonSerializationContext): JsonElement {
return JsonPrimitive(src.name)
}
override fun deserialize(json: JsonElement, typeOfT: Type, context: JsonDeserializationContext): DamageCategory {
return DamageCategories.getOrException(json.asString)
}
}
@@ -1,64 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.categories
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.text.Text
import net.minecraft.util.Identifier
object DamageCategories {
private val allCategories = mutableListOf<DamageCategory>()
val PHYSICAL = register(
name = "physical",
displayName = Text.translatable("cobblemon.move.category.physical"),
textureXMultiplier = 0
)
val SPECIAL = register(
name = "special",
displayName = Text.translatable("cobblemon.move.category.special"),
textureXMultiplier = 1
)
val STATUS = register(
name = "status",
displayName = Text.translatable("cobblemon.move.category.status"),
textureXMultiplier = 2
)
fun register(
name: String,
displayName: Text,
resourceLocation: Identifier = cobblemonResource("textures/gui/categories.png"),
textureXMultiplier: Int
): DamageCategory {
return DamageCategory(
name = name,
displayName = displayName,
textureXMultiplier = textureXMultiplier,
resourceLocation = resourceLocation
).also {
allCategories.add(it)
}
}
fun register(damageCategory: DamageCategory): DamageCategory {
allCategories.add(damageCategory)
return damageCategory
}
fun get(name: String): DamageCategory? {
return allCategories.firstOrNull { cat -> cat.name.equals(name, ignoreCase = true) }
}
fun getOrException(name: String): DamageCategory {
return allCategories.first { cat -> cat.name.equals(name, ignoreCase = true) }
}
fun count() = allCategories.size
}
@@ -1,28 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.moves.categories
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.text.Text
import net.minecraft.util.Identifier
/**
* Representing a DamageCategory from the Pokemon Game
*
* @param name: The English name used to load / find it (spaces -> _)
* @param displayName: A Component used to display the name, normally a TranslatableText
* @param resourceLocation: The location of the resource used in the GUI
*/
class DamageCategory(
val name: String,
val displayName: Text,
val textureXMultiplier: Int,
val resourceLocation: Identifier = cobblemonResource("textures/gui/categories.png")
) {
}
@@ -24,7 +24,7 @@ import com.cobblemon.mod.common.api.pokemon.labels.CobblemonPokemonLabels
import com.cobblemon.mod.common.api.pokemon.stats.Stats
import com.cobblemon.mod.common.api.pokemon.status.Statuses
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.api.types.ElementalTypes
import com.cobblemon.mod.common.api.types.CobblemonElementalTypeTags
import com.cobblemon.mod.common.pokeball.PokeBall
import com.cobblemon.mod.common.util.cobblemonResource
import com.google.gson.Gson
@@ -136,13 +136,13 @@ object PokeBalls : JsonDataRegistry<PokeBall> {
createDefault("fast_ball", BaseStatModifier(Stats.SPEED, { it >= 100 }, 4F))
createDefault("level_ball", CatchRateModifiers.LEVEL)
// ToDo we will need fishing context here once fishing is implemented for a multiplier
createDefault("lure_ball", CatchRateModifiers.typeBoosting(2F, ElementalTypes.WATER))
createDefault("lure_ball", CatchRateModifiers.typeBoosting(2F, CobblemonElementalTypeTags.LURE_BALL_BOOSTING))
createDefault("heavy_ball", CatchRateModifiers.WEIGHT_BASED)
createDefault("love_ball", CatchRateModifiers.LOVE)
createDefault("friend_ball", effects = listOf(CaptureEffects.friendshipSetter(150)))
createDefault("moon_ball", CatchRateModifiers.MOON_PHASES)
createDefault("sport_ball", MultiplierModifier(1.5F))
createDefault("net_ball", CatchRateModifiers.typeBoosting(3F, ElementalTypes.BUG, ElementalTypes.WATER))
createDefault("net_ball", CatchRateModifiers.typeBoosting(3F, CobblemonElementalTypeTags.NET_BALL_BOOSTING))
createDefault("dive_ball", CatchRateModifiers.SUBMERGED_IN_WATER, waterDragValue = 0.99F)
createDefault("nest_ball", CatchRateModifiers.NEST)
// ToDo implement effect once pokedex is implemented, we have a custom multiplier of 2.5 instead of the official pokeball
@@ -14,7 +14,8 @@ import com.cobblemon.mod.common.api.pokemon.status.Status
import com.cobblemon.mod.common.api.tags.CobblemonBiomeTags
import com.cobblemon.mod.common.api.types.ElementalType
import com.cobblemon.mod.common.battles.BattleRegistry
import com.cobblemon.mod.common.pokemon.Gender
import com.cobblemon.mod.common.api.pokemon.gender.Gender
import net.minecraft.registry.tag.TagKey
/**
* A collection of some default usages of [CatchRateModifier]s.
@@ -139,11 +140,11 @@ object CatchRateModifiers {
* Used by [PokeBalls.NET_BALL].
* Boosts the catch rate if the target is of the given types.
*
* @param multiplier The multiplier to be applied if the target has any of the accepted [types].
* @param types The [ElementalType]s that will trigger the multiplier.
* @param multiplier The multiplier to be applied if the target has any of the accepted [typeTag].
* @param typeTag The [ElementalType] [TagKey] that will trigger the multiplier.
* @return The multiplier modifier.
*/
fun typeBoosting(multiplier: Float, vararg types: ElementalType): CatchRateModifier = MultiplierModifier(multiplier) { _, pokemon -> pokemon.types.any { type -> types.contains(type) } }
fun typeBoosting(multiplier: Float, typeTag: TagKey<ElementalType>): CatchRateModifier = MultiplierModifier(multiplier) { _, pokemon -> pokemon.types.any { type -> type.isIn(typeTag) } }
/**
* Used by [PokeBalls.DREAM_BALL].
@@ -12,13 +12,14 @@ import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.abilities.Abilities
import com.cobblemon.mod.common.api.pokeball.PokeBalls
import com.cobblemon.mod.common.api.pokemon.aspect.AspectProvider
import com.cobblemon.mod.common.api.pokemon.gender.Gender
import com.cobblemon.mod.common.api.pokemon.stats.Stats
import com.cobblemon.mod.common.api.pokemon.status.Statuses
import com.cobblemon.mod.common.api.properties.CustomPokemonProperty
import com.cobblemon.mod.common.api.types.ElementalTypes
import com.cobblemon.mod.common.api.registry.CobblemonRegistries
import com.cobblemon.mod.common.api.types.ElementalType
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.pokemon.EVs
import com.cobblemon.mod.common.pokemon.Gender
import com.cobblemon.mod.common.pokemon.IVs
import com.cobblemon.mod.common.pokemon.Pokemon
import com.cobblemon.mod.common.pokemon.RenderablePokemon
@@ -30,10 +31,12 @@ import com.cobblemon.mod.common.util.splitMap
import com.google.gson.JsonArray
import com.google.gson.JsonObject
import kotlin.random.Random
import com.mojang.serialization.Codec
import net.minecraft.nbt.NbtCompound
import net.minecraft.nbt.NbtElement
import net.minecraft.nbt.NbtList
import net.minecraft.nbt.NbtString
import net.minecraft.registry.Registry
import net.minecraft.text.MutableText
import net.minecraft.text.Text
import net.minecraft.util.Identifier
@@ -91,9 +94,10 @@ open class PokemonProperties {
props.ability = parseStringOfRegistry(keyPairs, listOf("ability")) { Abilities.get(it)?.name }
props.status = parseStringOfRegistry(keyPairs, listOf("status")) { (Statuses.getStatus(it) ?: Statuses.getStatus(it.asIdentifierDefaultingNamespace()))?.showdownName }
props.nickname = parseText(keyPairs, listOf("nickname", "nick"))
props.teraType = parseStringOfRegistry(keyPairs, listOf("tera_type", "tera")) { ElementalTypes.get(it)?.name }
props.teraType = parseRegistryValue(CobblemonRegistries.ELEMENTAL_TYPE, keyPairs, "tera_type", "tera")
props.dmaxLevel = parseIntProperty(keyPairs, listOf("dmax_level", "dmax"))?.coerceIn(0, Cobblemon.config.maxDynamaxLevel)
props.gmaxFactor = parseBooleanProperty(keyPairs, listOf("gmax_factor", "gmax"))
props.tradeable = parseBooleanProperty(keyPairs, listOf("tradeable", "tradable"))
val maybeIVs = IVs()
val maybeEVs = EVs()
@@ -195,6 +199,17 @@ open class PokemonProperties {
}
}
private fun <T> parseRegistryValue(registry: Registry<T>, keyPairs: MutableList<Pair<String, String?>>, vararg labels: String): T? {
val matchingKeyPair = getMatchedKeyPair(keyPairs, labels.asIterable()) ?: return null
val rawId = matchingKeyPair.second ?: return null
return try {
val id = Identifier(rawId)
registry.get(id)
} catch (_: InvalidIdentifierException) {
null
}
}
private fun parseForm(keyPairs: MutableList<Pair<String, String?>>): String? {
val matchingKeyPair = getMatchedKeyPair(keyPairs, listOf("form")) ?: return null
keyPairs.remove(matchingKeyPair)
@@ -239,6 +254,9 @@ open class PokemonProperties {
}
return null
}
val CODEC: Codec<PokemonProperties> = Codec.STRING.xmap(PokemonProperties::parse, PokemonProperties::asString)
}
var originalString: String = ""
@@ -255,9 +273,10 @@ open class PokemonProperties {
var ability: String? = null
var aspects: Set<String> = emptySet()
var status: String? = null
var teraType: String? = null
var teraType: ElementalType? = null
var dmaxLevel: Int? = null
var gmaxFactor: Boolean? = null
var tradeable: Boolean? = null
var ivs: IVs? = null
var evs: EVs? = null
@@ -307,9 +326,11 @@ open class PokemonProperties {
pokemon.setEV(stat.key, stat.value)
}
}
teraType?.let { ElementalTypes.get(it)?.let { type -> pokemon.teraType = type } }
teraType?.let { type -> pokemon.teraType = type }
dmaxLevel?.let { pokemon.dmaxLevel = it }
gmaxFactor?.let { pokemon.gmaxFactor = it }
tradeable?.let { pokemon.tradeable = it }
pokemon.updateAspects()
}
fun apply(pokemonEntity: PokemonEntity) {
@@ -345,9 +366,11 @@ open class PokemonProperties {
pokemonEntity.pokemon.setEV(stat.key, stat.value)
}
}
teraType?.let { ElementalTypes.get(it)?.let { type -> pokemonEntity.pokemon.teraType = type } }
teraType?.let { type -> pokemonEntity.pokemon.teraType = type }
dmaxLevel?.let { pokemonEntity.pokemon.dmaxLevel = it }
gmaxFactor?.let { pokemonEntity.pokemon.gmaxFactor = it }
tradeable?.let { pokemonEntity.pokemon.tradeable = it }
pokemonEntity.pokemon.updateAspects()
}
fun matches(pokemon: Pokemon): Boolean {
@@ -381,9 +404,10 @@ open class PokemonProperties {
evs?.forEach{ stat ->
if (stat.value != pokemon.evs[stat.key]) { return false }
}
teraType?.takeIf { it != pokemon.teraType.name }?.let { return false }
teraType?.takeIf { it != pokemon.teraType }?.let { return false }
dmaxLevel?.takeIf { it != pokemon.dmaxLevel }?.let { return false }
gmaxFactor?.takeIf { it != pokemon.gmaxFactor }?.let { return false }
tradeable?.takeIf { it != pokemon.tradeable }?.let { return false }
return customProperties.none { !it.matches(pokemon) }
}
@@ -401,7 +425,7 @@ open class PokemonProperties {
if (pokemonEntity.pokemon.species != species) {
return false
}
} catch (e: InvalidIdentifierException) {}
} catch (_: InvalidIdentifierException) {}
}
nickname?.takeIf { it != pokemonEntity.pokemon.nickname }?.let { return false }
form?.takeIf { !it.equals(pokemonEntity.pokemon.form.name, true) }?.let { return false }
@@ -416,9 +440,10 @@ open class PokemonProperties {
evs?.forEach{ stat ->
if (stat.value != pokemonEntity.pokemon.evs[stat.key]) { return false }
}
teraType?.takeIf { it != pokemonEntity.pokemon.teraType.name }?.let { return false }
teraType?.takeIf { it != pokemonEntity.pokemon.teraType }?.let { return false }
dmaxLevel?.takeIf { it != pokemonEntity.pokemon.dmaxLevel }?.let { return false }
gmaxFactor?.takeIf { it != pokemonEntity.pokemon.gmaxFactor }?.let { return false }
tradeable?.takeIf { it != pokemonEntity.pokemon.tradeable }?.let { return false }
return customProperties.none { !it.matches(pokemonEntity) }
}
@@ -436,7 +461,7 @@ open class PokemonProperties {
if (properties.species != species.toString()) {
return false
}
} catch (e: InvalidIdentifierException) {}
} catch (_: InvalidIdentifierException) {}
}
nickname?.takeIf { it != properties.nickname }?.let { return false }
form?.takeIf { !it.equals(properties.form, true) }?.let { return false }
@@ -462,6 +487,7 @@ open class PokemonProperties {
teraType?.takeIf { it != properties.teraType }?.let { return false }
dmaxLevel?.takeIf { it != properties.dmaxLevel }?.let { return false }
gmaxFactor?.takeIf { it != properties.gmaxFactor }?.let { return false }
tradeable?.takeIf { it != properties.tradeable }?.let { return false }
return true
}
@@ -479,7 +505,7 @@ open class PokemonProperties {
if (this.shiny == null) pokemon.shiny = Cobblemon.config.shinyRate.checkRate()
if (this.gmaxFactor == null) pokemon.gmaxFactor = Cobblemon.config.gigantamaxFactorRate.checkRate()
if (this.teraType == null) pokemon.teraType =
if (Cobblemon.config.teraTypeRate.checkRate()) ElementalTypes.all().filter { !baseTypes.contains(it) }.random()
if (Cobblemon.config.teraTypeRate.checkRate()) CobblemonRegistries.ELEMENTAL_TYPE.filter { !baseTypes.contains(it) }.random()
else baseTypes.random()
}
@@ -506,9 +532,10 @@ open class PokemonProperties {
status?.let { nbt.putString(DataKeys.POKEMON_STATUS_NAME, it) }
ivs?.let { nbt.put(DataKeys.POKEMON_IVS, it.saveToNBT(NbtCompound())) }
evs?.let { nbt.put(DataKeys.POKEMON_EVS, it.saveToNBT(NbtCompound())) }
teraType?.let { nbt.putString(DataKeys.POKEMON_TERA_TYPE, it) }
teraType?.let { nbt.putString(DataKeys.POKEMON_TERA_TYPE, it.id().toString()) }
dmaxLevel?.let { nbt.putInt(DataKeys.POKEMON_DMAX_LEVEL, it) }
gmaxFactor?.let { nbt.putBoolean(DataKeys.POKEMON_GMAX_FACTOR, it) }
tradeable?.let { nbt.putBoolean(DataKeys.POKEMON_TRADEABLE, it) }
val custom = NbtList()
customProperties.map { NbtString.of(it.asString()) }.forEach { custom.add(it) }
nbt.put(DataKeys.POKEMON_PROPERTIES_CUSTOM, custom)
@@ -530,9 +557,10 @@ open class PokemonProperties {
status = if (tag.contains(DataKeys.POKEMON_STATUS_NAME)) tag.getString(DataKeys.POKEMON_STATUS_NAME) else null
ivs = if (tag.contains(DataKeys.POKEMON_IVS)) ivs?.loadFromNBT(tag.getCompound(DataKeys.POKEMON_IVS)) as IVs? else null
evs = if (tag.contains(DataKeys.POKEMON_EVS)) evs?.loadFromNBT(tag.getCompound(DataKeys.POKEMON_EVS)) as EVs? else null
teraType = if (tag.contains(DataKeys.POKEMON_TERA_TYPE)) tag.getString(DataKeys.POKEMON_TERA_TYPE) else null
teraType = if (tag.contains(DataKeys.POKEMON_TERA_TYPE)) CobblemonRegistries.ELEMENTAL_TYPE.get(Identifier(tag.getString(DataKeys.POKEMON_TERA_TYPE))) else null
dmaxLevel = if (tag.contains(DataKeys.POKEMON_DMAX_LEVEL)) tag.getInt(DataKeys.POKEMON_DMAX_LEVEL) else null
gmaxFactor = if (tag.contains(DataKeys.POKEMON_GMAX_FACTOR)) tag.getBoolean(DataKeys.POKEMON_GMAX_FACTOR) else null
tradeable = if (tag.contains(DataKeys.POKEMON_TRADEABLE)) tag.getBoolean(DataKeys.POKEMON_TRADEABLE) else null
val custom = tag.getList(DataKeys.POKEMON_PROPERTIES_CUSTOM, NbtElement.STRING_TYPE.toInt())
// This is kinda gross
custom.forEach { customProperties.addAll(parse(it.asString()).customProperties) }
@@ -556,9 +584,10 @@ open class PokemonProperties {
status?.let { json.addProperty(DataKeys.POKEMON_STATUS_NAME, it) }
ivs?.let { json.add(DataKeys.POKEMON_IVS, it.saveToJSON(JsonObject())) }
evs?.let { json.add(DataKeys.POKEMON_EVS, it.saveToJSON(JsonObject())) }
teraType?.let { json.addProperty(DataKeys.POKEMON_TERA_TYPE, it) }
teraType?.let { json.addProperty(DataKeys.POKEMON_TERA_TYPE, it.id().toString()) }
dmaxLevel?.let { json.addProperty(DataKeys.POKEMON_DMAX_LEVEL, it) }
gmaxFactor?.let { json.addProperty(DataKeys.POKEMON_GMAX_FACTOR, it) }
tradeable?.let { json.addProperty(DataKeys.POKEMON_TRADEABLE, it) }
val custom = JsonArray()
customProperties.map { it.asString() }.forEach { custom.add(it) }
json.add(DataKeys.POKEMON_PROPERTIES_CUSTOM, custom)
@@ -581,9 +610,12 @@ open class PokemonProperties {
status = json.get(DataKeys.POKEMON_STATUS_NAME)?.asString
ivs?.loadFromJSON(json.getAsJsonObject(DataKeys.POKEMON_IVS))
evs?.loadFromJSON(json.getAsJsonObject(DataKeys.POKEMON_EVS))
teraType = json.get(DataKeys.POKEMON_TERA_TYPE)?.asString
teraType = json.get(DataKeys.POKEMON_TERA_TYPE)?.asString?.let { CobblemonRegistries.ELEMENTAL_TYPE.get(
Identifier(it)
) }
dmaxLevel = json.get(DataKeys.POKEMON_DMAX_LEVEL)?.asInt
gmaxFactor = json.get(DataKeys.POKEMON_GMAX_FACTOR)?.asBoolean
tradeable = json.get(DataKeys.POKEMON_TRADEABLE)?.asBoolean
val custom = json.get(DataKeys.POKEMON_PROPERTIES_CUSTOM)?.asJsonArray
// This is still kinda gross
custom?.forEach { customProperties.addAll(parse(it.asString).customProperties) }
@@ -610,9 +642,10 @@ open class PokemonProperties {
evs?.forEach{ stat ->
pieces.add("${stat.key}_ev=${stat.value}")
}
teraType?.let { pieces.add("tera_type=$it") }
teraType?.let { pieces.add("tera_type=${it.id()}") }
dmaxLevel?.let { pieces.add("dmax_level=$it") }
gmaxFactor?.let { pieces.add("gmax_factor=$it") }
tradeable?.let { pieces.add("tradeable=$it") }
customProperties.forEach { pieces.add(it.asString()) }
return pieces.joinToString(separator)
}
@@ -23,7 +23,6 @@ import com.cobblemon.mod.common.api.pokemon.effect.ShoulderEffect
import com.cobblemon.mod.common.api.pokemon.effect.adapter.ShoulderEffectAdapter
import com.cobblemon.mod.common.api.pokemon.egg.EggGroup
import com.cobblemon.mod.common.api.pokemon.evolution.Evolution
import com.cobblemon.mod.common.api.pokemon.evolution.PreEvolution
import com.cobblemon.mod.common.api.pokemon.evolution.requirement.EvolutionRequirement
import com.cobblemon.mod.common.api.pokemon.experience.ExperienceGroup
import com.cobblemon.mod.common.api.pokemon.experience.ExperienceGroupAdapter
@@ -38,14 +37,14 @@ import com.cobblemon.mod.common.net.messages.client.data.SpeciesRegistrySyncPack
import com.cobblemon.mod.common.pokemon.FormData
import com.cobblemon.mod.common.pokemon.Species
import com.cobblemon.mod.common.pokemon.SpeciesAdditions
import com.cobblemon.mod.common.pokemon.evolution.adapters.CobblemonEvolutionAdapter
import com.cobblemon.mod.common.pokemon.evolution.adapters.CobblemonPreEvolutionAdapter
import com.cobblemon.mod.common.pokemon.evolution.adapters.CobblemonRequirementAdapter
import com.cobblemon.mod.common.pokemon.evolution.adapters.NbtItemPredicateAdapter
import com.cobblemon.mod.common.pokemon.evolution.predicate.NbtItemPredicate
import com.cobblemon.mod.common.pokemon.helditem.CobblemonHeldItemManager
import com.cobblemon.mod.common.util.adapters.*
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.codec.toTypeAdapter
import com.cobblemon.mod.common.util.server
import com.google.common.collect.HashBasedTable
import com.google.gson.Gson
import com.google.gson.GsonBuilder
@@ -56,6 +55,7 @@ import net.minecraft.entity.effect.StatusEffect
import net.minecraft.item.Item
import net.minecraft.nbt.NbtCompound
import net.minecraft.registry.Registries
import net.minecraft.registry.RegistryKeys
import net.minecraft.resource.ResourceType
import net.minecraft.server.network.ServerPlayerEntity
import net.minecraft.util.Identifier
@@ -76,11 +76,8 @@ object PokemonSpecies : JsonDataRegistry<Species> {
.registerTypeAdapter(ExperienceGroup::class.java, ExperienceGroupAdapter)
.registerTypeAdapter(EntityDimensions::class.java, EntityDimensionsAdapter)
.registerTypeAdapter(Learnset::class.java, LearnsetAdapter)
.registerTypeAdapter(Evolution::class.java, CobblemonEvolutionAdapter)
.registerTypeAdapter(Box::class.java, BoxAdapter)
.registerTypeAdapter(AbilityPool::class.java, AbilityPoolAdapter)
.registerTypeAdapter(EvolutionRequirement::class.java, CobblemonRequirementAdapter)
.registerTypeAdapter(PreEvolution::class.java, CobblemonPreEvolutionAdapter)
.registerTypeAdapter(TypeToken.getParameterized(Set::class.java, Evolution::class.java).type, LazySetAdapter(Evolution::class))
.registerTypeAdapter(IntRange::class.java, IntRangeAdapter)
.registerTypeAdapter(PokemonProperties::class.java, pokemonPropertiesShortAdapter)
@@ -90,9 +87,9 @@ object PokemonSpecies : JsonDataRegistry<Species> {
.registerTypeAdapter(SleepDepth::class.java, SleepDepth.adapter)
.registerTypeAdapter(DropEntry::class.java, DropEntryAdapter)
.registerTypeAdapter(NbtCompound::class.java, NbtCompoundAdapter)
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Biome::class.java).type, BiomeLikeConditionAdapter)
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Block::class.java).type, BlockLikeConditionAdapter)
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Item::class.java).type, ItemLikeConditionAdapter)
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Biome::class.java).type, RegistryLikeCondition.createCodec { server()!!.registryManager.get(RegistryKeys.BIOME) }.toTypeAdapter())
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Block::class.java).type, RegistryLikeCondition.createCodec { Registries.BLOCK }.toTypeAdapter())
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Item::class.java).type, RegistryLikeCondition.createCodec { Registries.ITEM }.toTypeAdapter())
.registerTypeAdapter(EggGroup::class.java, EggGroupAdapter)
.registerTypeAdapter(StatusEffect::class.java, RegistryElementAdapter<StatusEffect> { Registries.STATUS_EFFECT })
.registerTypeAdapter(NbtItemPredicate::class.java, NbtItemPredicateAdapter)
@@ -211,7 +208,7 @@ object PokemonSpecies : JsonDataRegistry<Species> {
"H" to "No Ability",
"S" to "No Ability"
)
val types = (form?.types ?: species.types).map { it.name.replaceFirstChar(Char::uppercase) }
val types = (form?.types ?: species.types).map { it.showdownId() }
val preevo: String? = (form?.preEvolution ?: species.preEvolution)?.let { if (it.form == it.species.standardForm) createShowdownName(it.species) else "${createShowdownName(it.species)}-${it.form.name}" }
// For the context of battles the content here doesn't matter whatsoever and due to how PokemonProperties work we can't guarantee an actual specific species is defined.
val evos = if ((form?.evolutions ?: species.evolutions).isEmpty()) emptyList() else arrayListOf("")
@@ -10,11 +10,14 @@ package com.cobblemon.mod.common.api.pokemon.effect.adapter
import com.cobblemon.mod.common.api.pokemon.effect.ShoulderEffect
import com.cobblemon.mod.common.api.pokemon.effect.ShoulderEffectRegistry
import com.cobblemon.mod.common.pokemon.effects.PotionBaseEffect
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
import com.google.gson.JsonObject
import java.lang.reflect.Type
import net.minecraft.registry.Registries
import net.minecraft.util.Identifier
object ShoulderEffectAdapter: JsonDeserializer<ShoulderEffect> {
override fun deserialize(json: JsonElement, typeOfT: Type, context: JsonDeserializationContext): ShoulderEffect {
@@ -23,7 +26,18 @@ object ShoulderEffectAdapter: JsonDeserializer<ShoulderEffect> {
} else {
json.asJsonObject.get("type").asString to json.asJsonObject
}
val effect = ShoulderEffectRegistry.get(typeId) ?: throw IllegalArgumentException("Cannot find shoulder effect with type '$typeId'")
val effect = ShoulderEffectRegistry.get(typeId) ?: run {
try {
val effectId = Identifier(typeId.replace("-", "_").replace("slow_fall", "slow_falling"))
val registry = Registries.STATUS_EFFECT
val effect = registry.get(effectId)
if (effect != null) {
return PotionBaseEffect(effect, 0, true, false, false)
}
} catch (_: Exception) {}
throw IllegalArgumentException("Cannot find shoulder effect with type '$typeId'")
}
return context.deserialize(obj, effect)
}
}
@@ -8,6 +8,9 @@
package com.cobblemon.mod.common.api.pokemon.egg
import com.mojang.serialization.Codec
import net.minecraft.util.StringIdentifiable
/**
* These represent categories which determine which Pokémon are able to interbreed.
*
@@ -15,7 +18,7 @@ package com.cobblemon.mod.common.api.pokemon.egg
*
* @property showdownID used for data synchronization with Showdown data format.
*/
enum class EggGroup(internal val showdownID: String) {
enum class EggGroup(internal val showdownID: String) : StringIdentifiable {
MONSTER("Monster"),
WATER_1("Water 1"),
@@ -31,6 +34,15 @@ enum class EggGroup(internal val showdownID: String) {
WATER_2("Water 2"),
DITTO("Ditto"),
DRAGON("Dragon"),
UNDISCOVERED("Undiscovered")
UNDISCOVERED("Undiscovered");
override fun asString(): String = this.name
companion object {
@JvmField
val CODEC: Codec<EggGroup> = StringIdentifiable.createCodec(EggGroup::values)
}
}
@@ -9,12 +9,12 @@
package com.cobblemon.mod.common.api.pokemon.evolution
import com.cobblemon.mod.common.CobblemonSounds
import com.cobblemon.mod.common.api.abilities.AbilityPool
import com.cobblemon.mod.common.api.events.CobblemonEvents
import com.cobblemon.mod.common.api.events.pokemon.evolution.EvolutionCompleteEvent
import com.cobblemon.mod.common.api.moves.BenchedMove
import com.cobblemon.mod.common.api.moves.MoveTemplate
import com.cobblemon.mod.common.api.pokemon.PokemonProperties
import com.cobblemon.mod.common.api.pokemon.evolution.adapters.Variant
import com.cobblemon.mod.common.api.pokemon.evolution.requirement.EvolutionRequirement
import com.cobblemon.mod.common.pokemon.Pokemon
import com.cobblemon.mod.common.pokemon.activestate.ShoulderedState
@@ -22,6 +22,7 @@ import com.cobblemon.mod.common.pokemon.evolution.variants.ItemInteractionEvolut
import com.cobblemon.mod.common.pokemon.evolution.variants.LevelUpEvolution
import com.cobblemon.mod.common.pokemon.evolution.variants.TradeEvolution
import com.cobblemon.mod.common.util.lang
import com.mojang.serialization.Codec
import net.minecraft.item.ItemStack
import net.minecraft.sound.SoundCategory
@@ -61,6 +62,11 @@ interface Evolution : EvolutionLike {
*/
val learnableMoves: MutableSet<MoveTemplate>
/**
* The [Variant] of this [Evolution].
*/
val variant: Variant<Evolution>
/**
* Checks if the given [Pokemon] passes all the conditions and is ready to evolve.
*
@@ -120,4 +126,12 @@ interface Evolution : EvolutionLike {
fun applyTo(pokemon: Pokemon) {
result.apply(pokemon)
}
/**
* TODO
*
* @return
*/
fun codec(): Codec<out Evolution> = this.variant.codec
}
@@ -8,9 +8,10 @@
package com.cobblemon.mod.common.api.pokemon.evolution
import com.cobblemon.mod.common.pokemon.FormData
import com.cobblemon.mod.common.pokemon.Species
import com.cobblemon.mod.common.pokemon.evolution.StandardPreEvolution
import com.cobblemon.mod.common.api.pokemon.species.Species
import com.cobblemon.mod.common.api.registry.CobblemonRegistries
import com.mojang.serialization.Codec
import net.minecraft.util.Identifier
/**
* Represents the previous stage in the evolutionary line of a given Pokémon.
@@ -19,15 +20,14 @@ import com.cobblemon.mod.common.pokemon.evolution.StandardPreEvolution
* @author Licious
* @since March 22nd, 2022
*/
interface PreEvolution {
class PreEvolution internal constructor(private val speciesKey: Identifier){
val species: Species
val form: FormData
val species: Species by lazy { CobblemonRegistries.SPECIES.get(this.speciesKey)!! }
companion object {
fun of(species: Species, form: FormData = species.standardForm): PreEvolution = StandardPreEvolution(species, form)
@JvmField
val CODEC: Codec<PreEvolution> = Identifier.CODEC.xmap(::PreEvolution, PreEvolution::speciesKey)
}
@@ -1,35 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.pokemon.evolution.adapters
import com.cobblemon.mod.common.api.pokemon.evolution.Evolution
import com.cobblemon.mod.common.pokemon.evolution.adapters.CobblemonEvolutionAdapter
import com.google.gson.JsonDeserializer
import com.google.gson.JsonSerializer
import kotlin.reflect.KClass
/**
* Saves and loads [Evolution]s with JSON.
* For the default implementation see [CobblemonEvolutionAdapter].
*
* @author Licious
* @since March 20th, 2022
*/
interface EvolutionAdapter : JsonDeserializer<Evolution>, JsonSerializer<Evolution> {
/**
* Registers the given type of [Evolution] to it's associated ID for deserialization.
*
* @param T The type of [Evolution].
* @param id The id of the evolution event.
* @param type The [KClass] of the type.
*/
fun <T : Evolution> registerType(id: String, type: KClass<T>)
}
@@ -0,0 +1,112 @@
/*
* 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.pokemon.evolution.adapters
import com.cobblemon.mod.common.api.pokemon.evolution.Evolution
import com.cobblemon.mod.common.api.pokemon.evolution.requirement.EvolutionRequirement
import com.cobblemon.mod.common.pokemon.evolution.requirements.*
import com.cobblemon.mod.common.pokemon.evolution.variants.BlockClickEvolution
import com.cobblemon.mod.common.pokemon.evolution.variants.ItemInteractionEvolution
import com.cobblemon.mod.common.pokemon.evolution.variants.LevelUpEvolution
import com.cobblemon.mod.common.pokemon.evolution.variants.TradeEvolution
import com.cobblemon.mod.common.util.cobblemonResource
import com.mojang.serialization.Codec
import com.mojang.serialization.Lifecycle
import net.minecraft.registry.RegistryKey
import net.minecraft.registry.SimpleRegistry
/**
*
*/
object EvolutionRegistry {
private val EVOLUTION_REGISTRY = SimpleRegistry<Variant<Evolution>>(RegistryKey.ofRegistry(cobblemonResource("evolution_variants")), Lifecycle.stable())
private val REQUIREMENT_REGISTRY = SimpleRegistry<Variant<EvolutionRequirement>>(RegistryKey.ofRegistry(cobblemonResource("evolution_requirements")), Lifecycle.stable())
/**
* A [Codec] for [Evolution].
* If you wish to register more variants see [registerEvolutionVariant].
*/
@JvmField
val EVOLUTION_CODEC: Codec<Evolution> = EVOLUTION_REGISTRY.codec.dispatch("variant", Evolution::variant) { variant -> variant.codec }
/**
* A [Codec] for [EvolutionRequirement].
* If you wish to register more variants see [registerRequirementVariant].
*/
@JvmField
val REQUIREMENT_CODEC: Codec<EvolutionRequirement> = REQUIREMENT_REGISTRY.codec.dispatch("variant", EvolutionRequirement::variant) { variant -> variant.codec }
/**
* Registers an [Evolution] type.
*
* @param variant The [Variant] of an [Evolution] being registered.
*
* @throws IllegalStateException If the backing registry already contains an entry with the [Variant.identifier].
* @throws AssertionError If the registry is missing an intrusive holder.
*/
@JvmStatic
fun registerEvolutionVariant(variant: Variant<Evolution>) {
EVOLUTION_REGISTRY.add(RegistryKey.of(EVOLUTION_REGISTRY.key, variant.identifier), variant, Lifecycle.stable())
}
/**
* Registers an [EvolutionRequirement] type.
*
* @param variant The [Variant] of an [EvolutionRequirement] being registered.
*
* @throws IllegalStateException If the backing registry already contains an entry with the [Variant.identifier].
* @throws AssertionError If the registry is missing an intrusive holder.
*/
@JvmStatic
fun registerRequirementVariant(variant: Variant<EvolutionRequirement>) {
REQUIREMENT_REGISTRY.add(RegistryKey.of(REQUIREMENT_REGISTRY.key, variant.identifier), variant, Lifecycle.stable())
}
internal fun init() {
this.registerDefaultEvolutions()
this.registerDefaultRequirements()
}
private fun registerDefaultEvolutions() {
this.registerEvolutionVariant(BlockClickEvolution.VARIANT)
this.registerEvolutionVariant(ItemInteractionEvolution.VARIANT)
this.registerEvolutionVariant(LevelUpEvolution.MAIN_VARIANT)
this.registerEvolutionVariant(LevelUpEvolution.ALTERNATIVE_VARIANT)
this.registerEvolutionVariant(TradeEvolution.VARIANT)
}
private fun registerDefaultRequirements() {
this.registerRequirementVariant(AllOfRequirement.VARIANT)
this.registerRequirementVariant(AnyOfRequirement.VARIANT)
this.registerRequirementVariant(AreaRequirement.VARIANT)
this.registerRequirementVariant(AttackDefenceRatioRequirement.VARIANT)
this.registerRequirementVariant(BattleCriticalHitsRequirement.VARIANT)
this.registerRequirementVariant(BiomeRequirement.VARIANT)
this.registerRequirementVariant(BlocksTraveledRequirement.VARIANT)
this.registerRequirementVariant(DamageTakenRequirement.VARIANT)
this.registerRequirementVariant(DefeatRequirement.VARIANT)
this.registerRequirementVariant(FriendshipRequirement.VARIANT)
this.registerRequirementVariant(HeldItemRequirement.VARIANT)
this.registerRequirementVariant(LevelRequirement.VARIANT)
this.registerRequirementVariant(MoonPhaseRequirement.VARIANT)
this.registerRequirementVariant(MoveSetRequirement.VARIANT)
this.registerRequirementVariant(MoveTypeRequirement.VARIANT)
this.registerRequirementVariant(NoneOfRequirement.VARIANT)
this.registerRequirementVariant(NotRequirement.VARIANT)
this.registerRequirementVariant(PartyMemberRequirement.VARIANT)
this.registerRequirementVariant(PokemonPropertiesRequirement.VARIANT)
this.registerRequirementVariant(RecoilRequirement.VARIANT)
this.registerRequirementVariant(TimeRangeRequirement.VARIANT)
this.registerRequirementVariant(UseMoveRequirement.VARIANT)
this.registerRequirementVariant(WeatherRequirement.VARIANT)
this.registerRequirementVariant(WorldRequirement.VARIANT)
}
}
@@ -1,35 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.pokemon.evolution.adapters
import com.cobblemon.mod.common.api.pokemon.evolution.requirement.EvolutionRequirement
import com.cobblemon.mod.common.pokemon.evolution.adapters.CobblemonRequirementAdapter
import com.google.gson.JsonDeserializer
import com.google.gson.JsonSerializer
import kotlin.reflect.KClass
/**
* Saves and loads [EvolutionRequirement]s with JSON.
* For the default implementation see [CobblemonRequirementAdapter].
*
* @author Licious
* @since March 21st, 2022
*/
interface RequirementAdapter : JsonDeserializer<EvolutionRequirement>, JsonSerializer<EvolutionRequirement> {
/**
* Registers the given type of [EvolutionRequirement] to it's associated ID for deserialization.
*
* @param T The type of [EvolutionRequirement].
* @param id The id of the evolution event.
* @param type The [KClass] of the type.
*/
fun <T : EvolutionRequirement> registerType(id: String, type: KClass<T>)
}
@@ -6,10 +6,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.pokemon
package com.cobblemon.mod.common.api.pokemon.evolution.adapters
enum class Gender(val showdownName: String) {
MALE("M"),
FEMALE("F"),
GENDERLESS("N")
}
import com.mojang.serialization.Codec
import net.minecraft.util.Identifier
data class Variant<T>(
val identifier: Identifier,
val codec: Codec<out T>
)
@@ -10,7 +10,10 @@ package com.cobblemon.mod.common.api.pokemon.evolution.requirement
import com.cobblemon.mod.common.api.pokemon.evolution.ContextEvolution
import com.cobblemon.mod.common.api.pokemon.evolution.Evolution
import com.cobblemon.mod.common.api.pokemon.evolution.adapters.EvolutionRegistry
import com.cobblemon.mod.common.api.pokemon.evolution.adapters.Variant
import com.cobblemon.mod.common.pokemon.Pokemon
import com.mojang.serialization.Codec
/**
* Represents a requirement for an evolution.
@@ -22,7 +25,12 @@ import com.cobblemon.mod.common.pokemon.Pokemon
* @author Licious
* @since March 19th, 2022
*/
fun interface EvolutionRequirement {
interface EvolutionRequirement {
/**
*
*/
val variant: Variant<EvolutionRequirement>
/**
* Checks if the given [Pokemon] satisfies the requirement.
@@ -32,4 +40,17 @@ fun interface EvolutionRequirement {
*/
fun check(pokemon: Pokemon): Boolean
/**
* TODO
*
* @return
*/
fun codec(): Codec<out EvolutionRequirement> = this.variant.codec
companion object {
val CODEC: Codec<EvolutionRequirement> = EvolutionRegistry.REQUIREMENT_CODEC
}
}
@@ -18,6 +18,7 @@ import com.google.gson.JsonElement
import com.google.gson.JsonPrimitive
import com.google.gson.JsonSerializationContext
import com.google.gson.JsonSerializer
import com.mojang.serialization.Codec
import java.lang.reflect.Type
import kotlin.math.max
import net.minecraft.text.MutableText
@@ -74,6 +75,10 @@ interface ExperienceGroup : LevelCurve {
override fun getExperience(level: Int) = 0
override fun getLevel(experience: Int) = 1
}
@JvmField
val CODEC: Codec<ExperienceGroup> = Codec.STRING.xmap(ExperienceGroups::findByName, ExperienceGroup::name)
}
}
@@ -0,0 +1,54 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.pokemon.gender
import com.cobblemon.mod.common.api.data.ShowdownIdentifiable
import com.cobblemon.mod.common.api.pokemon.species.Species
import com.cobblemon.mod.common.pokemon.Pokemon
import java.util.*
/**
* Represents the [Gender] of a [Pokemon].
* This is taken into account by [Species] when generating the [Pokemon].
*
* @property showdownId The ID of the [Gender] in Showdown.
*
* @see Species.genderSelector
* @see Pokemon.gender
* @see GenderSelector
*/
enum class Gender(private val showdownId: String) : ShowdownIdentifiable {
MALE("M"),
FEMALE("F"),
GENDERLESS("N");
override fun showdownId(): String = this.showdownId
companion object {
/**
* The [Gender]s when a ratio is attached to a [GenderSelector].
*
* @see GenderSelector.maleRatio
*/
@JvmField
val RATIO_BASED_GENDERS: Set<Gender> = EnumSet.of(MALE, FEMALE)
/**
* The [Gender]s when no ratio is attached to a [GenderSelector].
*
* @see GenderSelector.maleRatio
*/
@JvmField
val NO_RATIO_GENDERS: Set<Gender> = EnumSet.of(GENDERLESS)
}
}
@@ -0,0 +1,72 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.pokemon.gender
import com.cobblemon.mod.common.api.pokemon.species.Species
import com.cobblemon.mod.common.pokemon.Pokemon
import com.mojang.serialization.Codec
import kotlin.random.Random
/**
* Class responsible for querying possible [Gender]s of [Species] and assigning them randomly to generated [Pokemon].
*
* @property maleRatio The raw ratio for the [Gender.MALE] despite the naming this is able to cover all possible genders.
*
* @see Species.genderSelector
*
* @throws IllegalArgumentException If male ratio is greater than 1.
*/
@Suppress("MemberVisibilityCanBePrivate")
class GenderSelector internal constructor(private val maleRatio: Float) {
init {
if (this.maleRatio < 1F) {
throw IllegalArgumentException("Male ratio cannot be greater than 1.0")
}
}
/**
* Collects all the possible [Gender]s from [generate].
*
* @return The possible [Gender]s.
*/
fun possibleGenders(): Set<Gender> = if (this.maleRatio < 0F) Gender.NO_RATIO_GENDERS else Gender.RATIO_BASED_GENDERS
/**
* Randomly picks a [Gender] using the [maleRatio].
*
* @return The generated [Gender].
*/
fun generate(): Gender = when {
this.maleRatio < 0F -> Gender.GENDERLESS
this.maleRatio == 1F || Random.nextFloat() < this.maleRatio -> Gender.MALE
else -> Gender.FEMALE
}
/**
* Checks if the given [gender] is a possible selection of [generate].
*
* @param gender The [Gender] being checked.
* @return If the [gender] is possible with the context in this [GenderSelector].
*/
fun isValid(gender: Gender): Boolean = this.possibleGenders().contains(gender)
companion object {
/**
* A [Codec] for [GenderSelector].
* This will (de)serialize from a primitive float.
* It will error if the value is not between [Float.MIN_VALUE] and 1F.
*/
@JvmField
val CODEC: Codec<GenderSelector> = Codec.floatRange(Float.MIN_VALUE, 1F).xmap(::GenderSelector, GenderSelector::maleRatio)
}
}
@@ -0,0 +1,55 @@
/*
* 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.pokemon.species
import com.cobblemon.mod.common.api.data.ShowdownIdentifiable
import com.cobblemon.mod.common.api.registry.CobblemonRegistries
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.util.Identifier
/**
* Additional data only present in species that are a variation of an existing species.
* This is commonly referred to as a Pokémon form.
* In the context of Cobblemon aspects are used when a form is purely cosmetic.
* This is only present if a [Species] has actual stat related differences from the "base".
*
* @see <a href="https://bulbapedia.bulbagarden.net/wiki/Variant_Pok%C3%A9mon">Bulbapedias entry on variant Pokémon</a>
*/
class FormData internal constructor(
private var baseSpeciesIdentifier: Identifier,
private var battleOnly: Boolean
) {
/**
* Resolves the base species of this form.
*
* @return The [Species] that is the base of this form.
*/
fun baseSpecies(): Species = CobblemonRegistries.SPECIES.get(this.baseSpeciesIdentifier)!!
/**
* Checks if this [FormData] can only exist in battles.
*
* @return True if this [FormData] can only exist in battles.
*/
fun isBattleOnly(): Boolean = this.battleOnly
companion object {
val CODEC: Codec<FormData> = RecordCodecBuilder.create { builder ->
builder.group(
Identifier.CODEC.fieldOf("baseSpecies").forGetter(FormData::baseSpeciesIdentifier),
Codec.BOOL.fieldOf("battleOnly").forGetter(FormData::battleOnly)
).apply(builder, ::FormData)
}
}
}
@@ -0,0 +1,198 @@
/*
* 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.pokemon.species
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.abilities.AbilityPool
import com.cobblemon.mod.common.api.data.ShowdownIdentifiable
import com.cobblemon.mod.common.api.pokemon.egg.EggGroup
import com.cobblemon.mod.common.api.pokemon.evolution.Evolution
import com.cobblemon.mod.common.api.pokemon.evolution.PreEvolution
import com.cobblemon.mod.common.api.pokemon.experience.ExperienceGroup
import com.cobblemon.mod.common.api.pokemon.gender.Gender
import com.cobblemon.mod.common.api.pokemon.gender.GenderSelector
import com.cobblemon.mod.common.api.pokemon.moves.Learnset
import com.cobblemon.mod.common.api.pokemon.species.internal.*
import com.cobblemon.mod.common.api.pokemon.stats.StatMap
import com.cobblemon.mod.common.api.registry.CobblemonRegistryElement
import com.cobblemon.mod.common.api.registry.CobblemonRegistryKeys
import com.cobblemon.mod.common.api.types.ElementalType
import com.cobblemon.mod.common.pokemon.Pokemon
import com.cobblemon.mod.common.pokemon.ai.PokemonBehaviour
import com.cobblemon.mod.common.util.codec.ExtraCodecs
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.entity.EntityDimensions
import net.minecraft.registry.Registry
import net.minecraft.registry.entry.RegistryEntry
import net.minecraft.text.MutableText
import net.minecraft.text.Text
import net.minecraft.util.Identifier
import java.util.*
@Suppress("unused")
class Species internal constructor(
nationalPokedexNumber: Int,
types: Pair<ElementalType, Optional<ElementalType>>,
abilities: AbilityPool,
baseStats: StatMap,
catchRate: Int,
genderSelector: GenderSelector,
private val experienceData: ExperienceData,
private val eggData: EggData,
learnset: Learnset,
private val behaviourData: BehaviourData,
private val evolutionData: EvolutionData,
baseFriendship: Int,
evYield: StatMap,
private val cosmeticData: CosmeticData,
formData: Optional<FormData>
): CobblemonRegistryElement<Species>, ShowdownIdentifiable {
companion object {
private val TYPES_CODEC = ExtraCodecs.ENTITY_DIMENSIONS
val codec = RecordCodecBuilder.create { builder ->
builder.group(
Codec.INT.fieldOf("nationalPokedexNumber").forGetter(Species::nationalPokedexNumber),
ExtraCodecs.DUAL_TYPE_CODEC.fieldOf("types").forGetter(Species::types),
// ToDo: abilities
StatMap.BASE_STATS_CODEC.fieldOf("baseStats").forGetter(Species::baseStats),
Codec.INT.fieldOf("catchRate").forGetter(Species::catchRate),
GenderSelector.CODEC.fieldOf("genderSelector").forGetter(Species::genderSelector),
ExperienceData.MAP_CODEC.forGetter(Species::experienceData),
EggData.MAP_CODEC.fieldOf("eggData").forGetter(Species::eggData),
// ToDo: learnset
BehaviourData.MAP_CODEC.forGetter(Species::behaviourData),
EvolutionData.MAP_CODEC.forGetter(Species::evolutionData),
Codec.INT.fieldOf("baseFriendship").forGetter(Species::baseFriendship),
StatMap.BASE_STATS_CODEC.fieldOf("evYield").forGetter(Species::evYield),
CosmeticData.MAP_CODEC.forGetter(Species::cosmeticData),
FormData.CODEC.optionalFieldOf("formData").forGetter(Species::formData)
).apply(builder, ::Species)
}
}
val displayName: MutableText by lazy { Text.translatable("${this.id().namespace}.species.${this.id().path.replace("/", ".")}.name") }
var nationalPokedexNumber: Int = nationalPokedexNumber
private set
var types: Pair<ElementalType, Optional<ElementalType>> = types
private set
val primaryType: ElementalType get() = this.types.first
val secondaryType: Optional<ElementalType> get() = this.types.second
var abilities: AbilityPool = abilities
private set
var baseStats: StatMap = baseStats
private set
var catchRate: Int = catchRate
private set
/**
* Responsible for picking a [Gender] for this [Species] on [create].
*/
var genderSelector: GenderSelector = genderSelector
private set
val shoulderMountable: Boolean get() = this.behaviourData.shoulderMountable
val baseExperienceYield: Int get() = this.experienceData.baseExperienceYield
val experienceGroup: ExperienceGroup get() = this.experienceData.experienceGroup
val eggCycles: Int get() = this.eggData.eggCycles
val eggGroups: Set<EggGroup> get() = this.eggData.eggGroups
var learnset: Learnset = learnset
private set
val behaviour: PokemonBehaviour get() = this.behaviourData.pokemonBehaviour
val evolutions: Set<Evolution> get() = this.evolutionData.evolutions
val preEvolution: Optional<PreEvolution> get() = this.evolutionData.preEvolution
val baseScale: Float get() = this.cosmeticData.baseScale
val hitbox: EntityDimensions get() = this.cosmeticData.hitbox
var baseFriendship: Int = baseFriendship
private set
var evYield: StatMap = evYield
private set
val weight: Float get() = this.cosmeticData.weight
val height: Float get() = this.cosmeticData.height
val aspects: Set<String> get() = this.cosmeticData.aspects
val features: Set<String> get() = this.behaviourData.features
val standingEyeHeight: Float get() = this.cosmeticData.standingEyeHeight
val swimmingEyeHeight: Float get() = this.cosmeticData.swimmingEyeHeight
val flyingEyeHeight: Float get() = this.cosmeticData.flyingEyeHeight
var formData: Optional<FormData> = formData
private set
/**
* TODO
*
* @param level
* @return
*/
fun create(level: Int): Pokemon {
TODO("Not yet implemented")
}
/**
* Picks a randomly generated [Gender] using the [genderSelector].
*
* @return The picked [Gender].
*/
fun pickGender(): Gender = this.genderSelector.generate()
/**
* Checks if this [Species] can be of the given [gender].
* This is checked against the [genderSelector].
*
* @param gender The [Gender] being checked.
* @return If the given [gender] is possible for this [Species].
*/
fun canBeOfGender(gender: Gender): Boolean = this.genderSelector.isValid(gender)
override fun showdownId(): String {
val id = this.id()
val showdownId = ShowdownIdentifiable.REGEX.replace(id.path, "")
if (id.namespace == Cobblemon.MODID) {
return showdownId
}
return id.namespace + showdownId
}
override fun id(): Identifier = this.registry().getId(this)!!
override fun registryEntry(): RegistryEntry<Species> = this.registry().getEntry(this)
override fun registry(): Registry<Species> = Cobblemon.implementation.getRegistry(CobblemonRegistryKeys.SPECIES)
}
@@ -0,0 +1,43 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.pokemon.species.internal
import com.cobblemon.mod.common.api.pokemon.species.Species
import com.cobblemon.mod.common.pokemon.ai.PokemonBehaviour
import com.cobblemon.mod.common.util.codec.setCodec
import com.mojang.serialization.Codec
import com.mojang.serialization.MapCodec
import com.mojang.serialization.codecs.RecordCodecBuilder
/**
* Intermediate for [Species] data.
*/
internal data class BehaviourData(
var pokemonBehaviour: PokemonBehaviour,
var shoulderMountable: Boolean,
var features: Set<String>,
var dynamaxBlocked: Boolean,
) {
companion object {
val MAP_CODEC: MapCodec<BehaviourData> = RecordCodecBuilder.mapCodec { builder ->
builder.group(
PokemonBehaviour.CODEC.fieldOf("pokemonBehaviour").forGetter(BehaviourData::pokemonBehaviour),
Codec.BOOL.fieldOf("shoulderMountable").forGetter(BehaviourData::shoulderMountable),
setCodec(Codec.STRING).fieldOf("features").forGetter(BehaviourData::features),
Codec.BOOL.optionalFieldOf("dynamaxBlocked", false).forGetter(BehaviourData::dynamaxBlocked)
).apply(builder, ::BehaviourData)
}
val CODEC: Codec<BehaviourData> = MAP_CODEC.codec()
}
}
@@ -0,0 +1,54 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.pokemon.species.internal
import com.cobblemon.mod.common.api.pokemon.species.Species
import com.cobblemon.mod.common.util.codec.ExtraCodecs
import com.cobblemon.mod.common.util.codec.setCodec
import com.mojang.serialization.Codec
import com.mojang.serialization.MapCodec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.entity.EntityDimensions
/**
* Intermediate for [Species] data.
*/
internal data class CosmeticData(
var baseScale: Float,
var hitbox: EntityDimensions,
var weight: Float,
var height: Float,
var aspects: Set<String>,
var standingEyeHeight: Float,
var swimmingEyeHeight: Float,
var flyingEyeHeight: Float,
) {
companion object {
val MAP_CODEC: MapCodec<CosmeticData> = RecordCodecBuilder.mapCodec { builder ->
builder.group(
Codec.FLOAT.fieldOf("baseScale").forGetter(CosmeticData::baseScale),
ExtraCodecs.ENTITY_DIMENSIONS.fieldOf("hitbox").forGetter(CosmeticData::hitbox),
Codec.FLOAT.fieldOf("weight").forGetter(CosmeticData::weight),
Codec.FLOAT.fieldOf("height").forGetter(CosmeticData::height),
setCodec(Codec.STRING).fieldOf("aspects").forGetter(CosmeticData::aspects),
Codec.FLOAT.optionalFieldOf("standingEyeHeight", VANILLA_DEFAULT_EYE_HEIGHT).forGetter(CosmeticData::standingEyeHeight),
Codec.FLOAT.optionalFieldOf("swimmingEyeHeight", VANILLA_DEFAULT_EYE_HEIGHT).forGetter(CosmeticData::swimmingEyeHeight),
Codec.FLOAT.optionalFieldOf("flyingEyeHeight", VANILLA_DEFAULT_EYE_HEIGHT).forGetter(CosmeticData::flyingEyeHeight),
).apply(builder, ::CosmeticData)
}
val CODEC: Codec<CosmeticData> = MAP_CODEC.codec()
private const val VANILLA_DEFAULT_EYE_HEIGHT = 0.85F
}
}
@@ -0,0 +1,40 @@
/*
* 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.pokemon.species.internal
import com.cobblemon.mod.common.api.pokemon.egg.EggGroup
import com.cobblemon.mod.common.api.pokemon.species.Species
import com.cobblemon.mod.common.util.codec.setCodec
import com.mojang.serialization.Codec
import com.mojang.serialization.MapCodec
import com.mojang.serialization.codecs.RecordCodecBuilder
import java.util.EnumSet
/**
* Intermediate for [Species] data.
*/
internal data class EggData(
var eggCycles: Int,
var eggGroups: EnumSet<EggGroup>,
) {
companion object {
val MAP_CODEC: MapCodec<EggData> = RecordCodecBuilder.mapCodec { builder ->
builder.group(
Codec.INT.fieldOf("eggCycles").forGetter(EggData::eggCycles),
setCodec(EggGroup.CODEC).fieldOf("eggGroups").xmap({ set -> EnumSet.copyOf(set) }, { enumSet -> enumSet }).forGetter { eggData -> eggData.eggGroups }
).apply(builder, ::EggData)
}
val CODEC: Codec<EggData> = MAP_CODEC.codec()
}
}
@@ -0,0 +1,42 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.pokemon.species.internal
import com.cobblemon.mod.common.api.pokemon.evolution.Evolution
import com.cobblemon.mod.common.api.pokemon.evolution.PreEvolution
import com.cobblemon.mod.common.api.pokemon.evolution.adapters.EvolutionRegistry
import com.cobblemon.mod.common.api.pokemon.species.Species
import com.cobblemon.mod.common.util.codec.setCodec
import com.mojang.serialization.Codec
import com.mojang.serialization.MapCodec
import com.mojang.serialization.codecs.RecordCodecBuilder
import java.util.*
/**
* Intermediate for [Species] data.
*/
internal data class EvolutionData(
var evolutions: Set<Evolution>,
var preEvolution: Optional<PreEvolution>,
) {
companion object {
val MAP_CODEC: MapCodec<EvolutionData> = RecordCodecBuilder.mapCodec { builder ->
builder.group(
setCodec(EvolutionRegistry.EVOLUTION_CODEC).optionalFieldOf("evolutions", emptySet()).forGetter(EvolutionData::evolutions),
PreEvolution.CODEC.optionalFieldOf("preEvolution").forGetter(EvolutionData::preEvolution)
).apply(builder, ::EvolutionData)
}
val CODEC: Codec<EvolutionData> = MAP_CODEC.codec()
}
}
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.pokemon.species.internal
import com.cobblemon.mod.common.api.pokemon.experience.ExperienceGroup
import com.cobblemon.mod.common.api.pokemon.species.Species
import com.mojang.serialization.Codec
import com.mojang.serialization.MapCodec
import com.mojang.serialization.codecs.RecordCodecBuilder
/**
* Intermediate for [Species] data.
*/
internal data class ExperienceData(
var baseExperienceYield: Int,
var experienceGroup: ExperienceGroup
) {
companion object {
val MAP_CODEC: MapCodec<ExperienceData> = RecordCodecBuilder.mapCodec { builder ->
builder.group(
Codec.INT.fieldOf("baseExperienceYield").forGetter(ExperienceData::baseExperienceYield),
ExperienceGroup.CODEC.fieldOf("experienceGroup").forGetter(ExperienceData::experienceGroup),
).apply(builder, ::ExperienceData)
}
}
}
@@ -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.api.pokemon.stats
import com.mojang.serialization.Codec
import kotlin.math.absoluteValue
import kotlin.math.min
/**
* An implementation of [StatMap] aimed solely at the EV data structure.
* This exists due to a few extra constraints present in EVs regarding the total value of the structure.
*
* @see <a href="https://bulbapedia.bulbagarden.net/wiki/Effort_values">Effort values Bulbapedia entry</a>
*/
@Suppress("MemberVisibilityCanBePrivate")
class EvMap internal constructor(stats: HashMap<Stat, Int>) : StatMap(Variant.EV, stats) {
init {
if (this.values.sum() > MAX_TOTAL) {
throw IllegalArgumentException("Cannot instance ${this::class.simpleName} with values total exceeding $MAX_TOTAL")
}
}
/**
* Inherits the logic of [StatMap.validateValue].
* This has the added constraint of the maximum possible total value being [MAX_TOTAL].
*
* @see StatMap.validateValue
*/
override fun validateValue(key: Stat, value: Int) {
super.validateValue(key, value)
val existing = this[key]
val current = this.values.sum() - existing
if (current + value > MAX_TOTAL) {
throw IllegalArgumentException("The total of the values of an ${this::class.simpleName} cannot exceed $MAX_TOTAL")
}
}
/**
* Adds to the given [stat].
*
* @param stat The [Stat] being added to.
* @param amount The amount being added. This value will be sanitized with [Int.absoluteValue].
* @param coerceSafe Should the value be coerced to be safe to add?
* @return The new resulting value of [stat].
*
* @throws IllegalArgumentException if [validateValue] fails.
*
* @see subtract
* @see mutate
*/
fun add(stat: Stat, amount: Int, coerceSafe: Boolean): Int = this.mutate(stat, amount.absoluteValue, coerceSafe)
/**
* Subtracts from the given [stat].
*
* @param stat The [Stat] being subtracted from.
* @param amount The amount being subtracted. This value will be sanitized with [Int.absoluteValue].
* @param coerceSafe Should the value be coerced to be safe to subtract?
* @return The new resulting value of [stat].
*
* @throws IllegalArgumentException if [validateValue] fails.
*
* @see add
* @see mutate
*/
fun subtract(stat: Stat, amount: Int, coerceSafe: Boolean): Int = this.mutate(stat, amount.absoluteValue, coerceSafe)
/**
* Mutates the given [stat].
*
* @param stat The [Stat] being mutated.
* @param amount The amount being used in the mutation operation.
* @param coerceSafe Should the value be coerced to be safe to operate with?
* @return The new resulting value of [stat].
*
* @throws IllegalArgumentException if [validateValue] fails.
*
* @see add
* @see subtract
*/
fun mutate(stat: Stat, amount: Int, coerceSafe: Boolean): Int {
var result = this[stat] + amount
if (coerceSafe) {
result = result.coerceIn(this.variant.minValue, min(this.variant.maxValue, this.remaining()))
}
this.put(stat, result)
return result
}
/**
* Resolves how many EVs can still be allocated to this structure.
*
* @return How many EVs can still be allocated.
*/
fun remaining(): Int = MAX_TOTAL - this.values.sum()
companion object {
/**
* A [Codec] for a [EvMap].
*/
@JvmField
val EV_STATS_CODEC: Codec<EvMap> = Codec.unboundedMap(Stat.CODEC, Codec.intRange(Variant.EV.minValue, Variant.EV.maxValue))
.xmap({ map -> EvMap(HashMap(map)) }, { evMap -> evMap })
/**
* The maximum total EV values.
*/
const val MAX_TOTAL = 510
/**
* Creates a [EvMap] with the given params.
*
* @param map The base map to take values from.
* @return The generated [EvMap].
*
* @throws IllegalArgumentException If the constraints seen in [StatMap.create] are not fulfilled or if the total of the values exceeds [MAX_TOTAL].
*/
fun create(map: Map<Stat, Int>): EvMap = EvMap(HashMap(map))
}
}
@@ -8,6 +8,8 @@
package com.cobblemon.mod.common.api.pokemon.stats
import com.cobblemon.mod.common.Cobblemon
import com.mojang.serialization.Codec
import net.minecraft.text.Text
import net.minecraft.util.Identifier
@@ -61,4 +63,10 @@ interface Stat {
}
companion object {
val CODEC: Codec<Stat> = Identifier.CODEC.xmap(Cobblemon.statProvider::fromIdentifierOrThrow, Stat::identifier)
}
}
@@ -0,0 +1,287 @@
/*
* 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.pokemon.stats
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.serialization.BufferSerializer
import com.cobblemon.mod.common.api.serialization.DataSerializer
import com.cobblemon.mod.common.pokemon.EVs
import com.cobblemon.mod.common.pokemon.IVs
import com.google.gson.JsonObject
import com.mojang.serialization.Codec
import com.mojang.serialization.JsonOps
import net.minecraft.nbt.NbtCompound
import net.minecraft.nbt.NbtOps
import net.minecraft.network.PacketByteBuf
import kotlin.jvm.optionals.getOrDefault
/**
* Represents a map-like structure that is used solely for the purpose of various stat-like Pokémon data structures.
*
* @property variant The [Variant] of this map.
* @property stats The base map used for this map.
*
* @see <a href="https://bulbapedia.bulbagarden.net/wiki/Base_stats">Base stats Bulbapedia entry</a>
* @see <a href="https://bulbapedia.bulbagarden.net/wiki/Effort_values">Effort values Bulbapedia entry</a>
* @see <a href="https://bulbapedia.bulbagarden.net/wiki/Individual_values">Individual values Bulbapedia entry</a>
*
*/
@Suppress("unused", "MemberVisibilityCanBePrivate")
open class StatMap internal constructor(
val variant: Variant,
protected val stats: HashMap<Stat, Int>
) : Map<Stat, Int>, DataSerializer<NbtCompound, JsonObject>, BufferSerializer {
init {
if (!Cobblemon.statProvider.ofType(Stat.Type.PERMANENT).all(this.stats::containsKey)) {
throw IllegalArgumentException("Cannot instance ${this::class.simpleName} without all ${Stat.Type.PERMANENT.name} ${Stat::class.simpleName}")
}
if (!this.stats.values.any { value -> this.variant.fits(value) }) {
throw IllegalArgumentException("Cannot instance ${this::class.simpleName} with values not in range [${this.variant.minValue}-${this.variant.maxValue}]")
}
}
override val entries: Set<Map.Entry<Stat, Int>>
get() = this.stats.entries
override val keys: Set<Stat>
get() = this.stats.keys
override val size: Int
get() = this.stats.size
override val values: Collection<Int>
get() = this.stats.values
/**
* A constraint of implementing [Map].
* This is impossible to be false.
*
* @return Always true.
*/
override fun isEmpty(): Boolean = false
/**
* Returns the value corresponding to the given [key].
* Due to implementation details unlike a typical [Map.get] this will never return null.
*
* @param key The [Stat] being checked.
* @return The value attached to the [key].
*/
override fun get(key: Stat): Int = this.stats[key]!!
override fun containsValue(value: Int): Boolean = this.stats.containsValue(value)
override fun containsKey(key: Stat): Boolean = this.stats.containsKey(key)
override fun loadFromNBT(nbt: NbtCompound) {
this.codec().decode(NbtOps.INSTANCE, nbt)
.result()
.ifPresent { pair -> this.putAll(pair.first) }
}
override fun saveToNBT(): NbtCompound {
val result = this.codec().encodeStart(NbtOps.INSTANCE, this)
.result()
.getOrDefault(NbtCompound())
// It's safe to cast it will always result in a NbtCompound
return result as NbtCompound
}
override fun loadFromJson(json: JsonObject) {
this.codec().decode(JsonOps.INSTANCE, json)
.result()
.ifPresent { pair -> this.putAll(pair.first) }
}
override fun saveToJson(): JsonObject {
val result = this.codec().encodeStart(JsonOps.INSTANCE, this)
.result()
.getOrDefault(JsonObject())
// It's safe to cast it will always result in a JsonObject
return result as JsonObject
}
override fun saveToBuffer(buffer: PacketByteBuf, toClient: Boolean) {
buffer.writeMap(this.stats, { pb, stat -> pb.writeIdentifier(stat.identifier) }, PacketByteBuf::writeInt)
}
override fun loadFromBuffer(buffer: PacketByteBuf) {
// This is safe to do as the server will have sanitized the values.
this.stats.clear()
this.stats.putAll(buffer.readMap({ pb -> Cobblemon.statProvider.decode(pb) }, PacketByteBuf::readInt))
}
/**
* Resets the value for the given [key] to the [Variant.minValue] of [variant].
*
* @param key The [Stat] being reset.
* @return The previous attached value.
*
* @throws IllegalArgumentException If the [key] fails [validateKey].
*/
fun reset(key: Stat): Int {
this.validateKey(key)
val existing = this.stats[key]!!
this.stats[key] = this.variant.minValue
return existing
}
/**
* Resets all values of this map to the [Variant.minValue] of [variant].
*/
fun reset() {
Cobblemon.statProvider.ofType(Stat.Type.PERMANENT).forEach(this::reset)
}
/**
* Merges key-value pairs from a map into this [StatMap].
*
* @param from The map being merged.
*
* @throws IllegalArgumentException If any value of [from] fails [validateValue].
*/
fun putAll(from: Map<out Stat, Int>) {
from.forEach(this::put)
}
/**
* Puts the given [value] on the given [key] [Stat] of this [StatMap].
*
* @param key The [Stat] being set.
* @param value The value being set to the [key].
* @return The previously attached value.
*
* @throws IllegalArgumentException If the [value] fails [validateValue].
*/
fun put(key: Stat, value: Int): Int {
this.validateValue(key, value)
val existing = this.stats[key]!!
this.stats[key] = value
return existing
}
/**
* Resolves the [Codec] for this instance.
* This is done based on the [variant].
*
* @return The [Codec] for this specific [StatMap] setup.
*
* @see StatMap.BASE_STATS_CODEC
* @see StatMap.EV_STATS_CODEC
* @see StatMap.IV_STATS_CODEC
*/
fun codec(): Codec<StatMap> = when (this.variant) {
Variant.BASE_STATS -> BASE_STATS_CODEC
Variant.IV -> IV_STATS_CODEC
Variant.EV -> EV_STATS_CODEC
}
/**
* Checks if a [Stat.Type] is [Stat.Type.PERMANENT].
*
* @param stat The [Stat] being checked.
*
* @throws IllegalArgumentException If the [Stat.Type] is not [Stat.Type.PERMANENT].
*/
protected open fun validateKey(stat: Stat) {
if (stat.type != Stat.Type.PERMANENT) {
throw IllegalArgumentException("Unsupported stat type of ${stat.type.name} for ${stat.identifier}")
}
}
/**
* Checks if a value is possible for this map.
*
* @param key The key having the [value] assigned.
* @param value The value being assigned.
*
* @throws IllegalArgumentException If the [value] doesn't fulfill [Variant.fits] of the [variant].
*/
protected open fun validateValue(key: Stat, value: Int) {
if (!this.variant.fits(value)) {
throw IllegalArgumentException("Cannot accept $value, a value must be in range [${this.variant.minValue}-${this.variant.maxValue}]")
}
}
/**
* Represents a type of data collected inside [StatMap].
*
* @property minValue The minimum possible value for a value of a [StatMap].
* @property maxValue The maximum possible value for a value of a [StatMap].
*/
enum class Variant(val minValue: Int, val maxValue: Int) {
/**
* Used to represent [base stats](https://bulbapedia.bulbagarden.net/wiki/Base_stats).
*/
BASE_STATS(1, Int.MAX_VALUE),
/**
* Used to represent [effort values](https://bulbapedia.bulbagarden.net/wiki/Effort_values).
*/
EV(0, EVs.MAX_STAT_VALUE),
/**
* Used to represent [individual values](https://bulbapedia.bulbagarden.net/wiki/Individual_values).
*/
IV(0, IVs.MAX_VALUE);
/**
* Checks if the given [value] fits within the range created by [minValue] & [maxValue].
*
* @param value The value being checked.
* @return If the value can fit in this variant.
*/
fun fits(value: Int): Boolean = value >= this.minValue && value <= this.maxValue
}
companion object {
/**
* A [Codec] for a [StatMap] of the [Variant.BASE_STATS] variant.
*/
@JvmField
val BASE_STATS_CODEC: Codec<StatMap> = this.createCodec(Variant.BASE_STATS)
/**
* A [Codec] for a [StatMap] of the [Variant.EV] variant.
* For the [EvMap] typed Codec see [EvMap.EV_STATS_CODEC].
* The result as far as instance types go is the same this is just a constraint of [Codec].
*
* @see EvMap.EV_STATS_CODEC
*/
@JvmField
val EV_STATS_CODEC: Codec<StatMap> = EvMap.EV_STATS_CODEC.xmap({ evMap -> this.create(Variant.EV, evMap) }, EvMap::create)
/**
* A [Codec] for a [StatMap] of the [Variant.IV] variant.
*/
@JvmField
val IV_STATS_CODEC: Codec<StatMap> = this.createCodec(Variant.IV)
/**
* Creates a [StatMap] with the given params.
*
* @param variant The [StatMap] [Variant].
* @param map The base map to take values from.
* @return The generated [StatMap].
*
* @throws IllegalArgumentException If map doesn't contain every possible key with type [Stat.Type.PERMANENT] or if any value doesn't respect [Variant.fits] for the given [variant].
*/
fun create(variant: Variant, map: Map<Stat, Int>): StatMap = when (variant) {
Variant.BASE_STATS -> StatMap(variant, HashMap(map))
Variant.EV -> EvMap(HashMap(map))
Variant.IV -> StatMap(variant, HashMap(map))
}
private fun createCodec(variant: Variant): Codec<StatMap> = Codec.unboundedMap(Stat.CODEC, Codec.intRange(variant.minValue, variant.maxValue))
.xmap({ map -> StatMap(variant, HashMap(map)) }, { statMap -> statMap })
}
}
@@ -9,11 +9,7 @@
package com.cobblemon.mod.common.api.pokemon.stats
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.pokemon.EVs
import com.cobblemon.mod.common.pokemon.FormData
import com.cobblemon.mod.common.pokemon.IVs
import com.cobblemon.mod.common.pokemon.Pokemon
import com.cobblemon.mod.common.pokemon.Species
import com.cobblemon.mod.common.pokemon.*
import com.cobblemon.mod.common.pokemon.stat.CobblemonStatProvider
import net.minecraft.network.PacketByteBuf
import net.minecraft.util.Identifier
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.registry
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.pokemon.species.Species
import com.cobblemon.mod.common.api.types.ElementalType
import net.minecraft.registry.Registry
import net.minecraft.registry.RegistryKey
object CobblemonRegistries {
val ELEMENTAL_TYPE: Registry<ElementalType> get() = this.get(CobblemonRegistryKeys.ELEMENTAL_TYPE)
val SPECIES: Registry<Species> get() = this.get(CobblemonRegistryKeys.SPECIES)
private fun <T> get(key: RegistryKey<Registry<T>>): Registry<T> = Cobblemon.implementation.getRegistry(key)
}
@@ -0,0 +1,26 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.registry
import net.minecraft.registry.Registry
import net.minecraft.registry.entry.RegistryEntry
import net.minecraft.registry.tag.TagKey
import net.minecraft.util.Identifier
interface CobblemonRegistryElement<T : CobblemonRegistryElement<T>> {
fun isIn(tag: TagKey<T>): Boolean = this.registryEntry().isIn(tag)
fun id(): Identifier
fun registryEntry(): RegistryEntry<T>
fun registry(): Registry<T>
}
@@ -0,0 +1,29 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.registry
import com.cobblemon.mod.common.api.moves.MoveTemplate
import com.cobblemon.mod.common.api.pokemon.species.Species
import com.cobblemon.mod.common.api.types.ElementalType
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.registry.Registry
import net.minecraft.registry.RegistryKey
/**
* Contains the various [RegistryKey]s for Cobblemon.
*/
object CobblemonRegistryKeys {
val ELEMENTAL_TYPE: RegistryKey<Registry<ElementalType>> = this.create("elemental_types")
val SPECIES: RegistryKey<Registry<Species>> = this.create("species")
private fun <T> create(key: String): RegistryKey<Registry<T>> = RegistryKey.ofRegistry(cobblemonResource(key))
}
@@ -90,7 +90,7 @@ object CobblemonSpawningProspector : SpawningProspector {
val state = query.getBlockState(pos.set(x, y, z))
blocks[x - area.baseX][y - baseY][z - area.baseZ] = WorldSlice.BlockData(
state = state,
light = state.getOpacity(world, pos)
light = world.getLightLevel(pos)
)
if (canSeeSky) {
@@ -19,12 +19,15 @@ import com.cobblemon.mod.common.api.spawning.detail.PossibleHeldItem
import com.cobblemon.mod.common.api.spawning.preset.SpawnDetailPreset
import com.cobblemon.mod.common.util.adapters.*
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.codec.toTypeAdapter
import com.cobblemon.mod.common.util.server
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import com.mojang.datafixers.util.Either
import net.minecraft.block.Block
import net.minecraft.fluid.Fluid
import net.minecraft.registry.Registries
import net.minecraft.registry.RegistryKeys
import net.minecraft.registry.tag.TagKey
import net.minecraft.resource.ResourceType
@@ -48,9 +51,9 @@ object SpawnDetailPresets : JsonDataRegistry<SpawnDetailPreset> {
.disableHtmlEscaping()
.registerTypeAdapter(SpawnBucket::class.java, SpawnBucketAdapter)
.registerTypeAdapter(RegisteredSpawningContext::class.java, RegisteredSpawningContextAdapter)
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Biome::class.java).type, BiomeLikeConditionAdapter)
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Block::class.java).type, BlockLikeConditionAdapter)
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Fluid::class.java).type, FluidLikeConditionAdapter)
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Biome::class.java).type, RegistryLikeCondition.createCodec { server()!!.registryManager.get(RegistryKeys.BIOME) }.toTypeAdapter())
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Block::class.java).type, RegistryLikeCondition.createCodec { Registries.BLOCK }.toTypeAdapter())
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Fluid::class.java).type, RegistryLikeCondition.createCodec { Registries.FLUID }.toTypeAdapter())
.registerTypeAdapter(
TypeToken.getParameterized(
Either::class.java,
@@ -17,12 +17,15 @@ import com.cobblemon.mod.common.api.spawning.context.RegisteredSpawningContext
import com.cobblemon.mod.common.api.spawning.detail.PossibleHeldItem
import com.cobblemon.mod.common.api.spawning.detail.SpawnDetail
import com.cobblemon.mod.common.util.adapters.*
import com.cobblemon.mod.common.util.codec.toTypeAdapter
import com.cobblemon.mod.common.util.server
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import com.mojang.datafixers.util.Either
import net.minecraft.block.Block
import net.minecraft.fluid.Fluid
import net.minecraft.nbt.NbtCompound
import net.minecraft.registry.Registries
import net.minecraft.registry.RegistryKeys
import net.minecraft.registry.tag.TagKey
import net.minecraft.util.Identifier
@@ -41,9 +44,9 @@ object SpawnLoader {
.setPrettyPrinting()
.disableHtmlEscaping()
.setLenient()
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Biome::class.java).type, BiomeLikeConditionAdapter)
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Block::class.java).type, BlockLikeConditionAdapter)
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Fluid::class.java).type, FluidLikeConditionAdapter)
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Biome::class.java).type, RegistryLikeCondition.createCodec { server()!!.registryManager.get(RegistryKeys.BIOME) }.toTypeAdapter())
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Block::class.java).type, RegistryLikeCondition.createCodec { Registries.BLOCK }.toTypeAdapter())
.registerTypeAdapter(TypeToken.getParameterized(RegistryLikeCondition::class.java, Fluid::class.java).type, RegistryLikeCondition.createCodec { Registries.FLUID }.toTypeAdapter())
.registerTypeAdapter(
TypeToken.getParameterized(
Either::class.java,
@@ -10,6 +10,8 @@ package com.cobblemon.mod.common.api.spawning
import com.cobblemon.mod.common.api.spawning.TimeRange.Companion.timeRanges
import com.cobblemon.mod.common.api.spawning.condition.SpawningCondition
import com.mojang.serialization.Codec
import com.mojang.serialization.DataResult
/**
* A range of time ticks for a world mainly to be used in [SpawningCondition]s. A time range
@@ -41,6 +43,12 @@ class TimeRange : IntRanges {
"morning" to TimeRange(0..4999),
"afternoon" to TimeRange(7000..12039)
)
val CODEC: Codec<TimeRange> = Codec.STRING.flatXmap(
{ string -> timeRanges[string]?.let { DataResult.success(it) } ?: DataResult.error { "Can't find a time range with ID $string" } },
{ timeRange -> timeRanges.entries.firstOrNull { (_, range) -> range == timeRange }?.let { DataResult.success(it.key) } ?: DataResult.error { "Couldn't resolve a time range ID for $timeRange" } }
)
}
constructor() : super()
@@ -8,6 +8,7 @@
package com.cobblemon.mod.common.api.spawning.condition
import net.minecraft.util.StringIdentifiable
import net.minecraft.world.World
/**
@@ -17,7 +18,7 @@ import net.minecraft.world.World
* @author Licious
* @since January 25th, 2023
*/
enum class MoonPhase {
enum class MoonPhase : StringIdentifiable {
FULL_MOON,
WANING_GIBBOUS,
@@ -28,6 +29,8 @@ enum class MoonPhase {
FIRST_QUARTER,
WAXING_GIBBOUS;
override fun asString(): String = this.name
companion object {
private val VALUES = values()
@@ -74,8 +74,8 @@ class PokemonSpawnDetail : SpawnDetail() {
val species = PokemonSpecies.getByIdentifier(pokemon.species!!.asIdentifierDefaultingNamespace())
if (species != null) {
labels.addAll(
species.secondaryType?.let { listOf(species.primaryType.name.lowercase(), it.name.lowercase()) }
?: listOf(species.primaryType.name.lowercase())
species.secondaryType?.let { listOf(species.primaryType.id().toString(), it.id().toString()) }
?: listOf(species.primaryType.id().toString())
)
if (height == -1) {
@@ -32,12 +32,12 @@ open class BottomlessStore(override val uuid: UUID) : PokemonStore<BottomlessPos
override fun iterator() = pokemon.iterator()
override fun get(position: BottomlessPosition) = position.currentIndex
.takeIf { it < pokemon.size && it >= 0 }
.takeIf { it in pokemon.indices }
?.let { pokemon[it] }
override fun getFirstAvailablePosition() = BottomlessPosition(pokemon.size)
override fun isValidPosition(position: BottomlessPosition) = position.currentIndex >= 0
operator fun get(index: Int) = index.takeIf { it >= 0 && it < pokemon.size }?.let { pokemon[it] }
operator fun get(index: Int) = index.takeIf { it in pokemon.indices }?.let { pokemon[it] }
override fun getObservingPlayers() = emptySet<ServerPlayerEntity>()
override fun sendTo(player: ServerPlayerEntity) {}
@@ -58,7 +58,12 @@ open class BottomlessStore(override val uuid: UUID) : PokemonStore<BottomlessPos
override fun loadFromNBT(nbt: NbtCompound): BottomlessStore {
var i = -1
while (nbt.contains(DataKeys.STORE_SLOT + ++i)) {
pokemon.add(Pokemon().loadFromNBT(nbt.getCompound(DataKeys.STORE_SLOT + i)))
val pokemonNBT = nbt.getCompound(DataKeys.STORE_SLOT + i)
try {
pokemon.add(Pokemon().loadFromNBT(pokemonNBT))
} catch(_: InvalidSpeciesException) {
handleInvalidSpeciesNBT(pokemonNBT)
}
}
return this
}
@@ -71,7 +76,12 @@ open class BottomlessStore(override val uuid: UUID) : PokemonStore<BottomlessPos
override fun loadFromJSON(json: JsonObject): BottomlessStore {
var i = -1
while (json.has(DataKeys.STORE_SLOT + ++i)) {
pokemon.add(Pokemon().loadFromJSON(json.getAsJsonObject(DataKeys.STORE_SLOT + i)))
val pokemonJSON = json.getAsJsonObject(DataKeys.STORE_SLOT + i)
try {
pokemon.add(Pokemon().loadFromJSON(pokemonJSON))
} catch (_: InvalidSpeciesException) {
handleInvalidSpeciesJSON(pokemonJSON)
}
}
return this
}
@@ -92,11 +102,16 @@ open class BottomlessStore(override val uuid: UUID) : PokemonStore<BottomlessPos
this.pokemon.add(pokemon)
storeChangeObservable.emit(Unit)
} else if (position.currentIndex in 0 until this.pokemon.size) {
var startIndex = position.currentIndex;
if (pokemon != null) {
this.pokemon.add(position.currentIndex, pokemon)
startIndex += 1;
} else {
this.pokemon.removeAt(position.currentIndex)
}
for(i in startIndex until this.pokemon.size) {
this.pokemon[i].storeCoordinates.set(StoreCoordinates(this, BottomlessPosition(i)))
}
storeChangeObservable.emit(Unit)
}
}
@@ -0,0 +1,19 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.storage
import net.minecraft.util.Identifier
/**
* An exception when trying to deserialize a Pokemon instance with an identifier that doesn't seem to be in the registry.
*
* @author Hiroku
* @since October 9th, 2023
*/
class InvalidSpeciesException(val identifier: Identifier) : IllegalStateException("Invalid species: $identifier")
@@ -146,8 +146,10 @@ abstract class PokemonStore<T : StorePosition> : Iterable<Pokemon> {
operator fun get(uuid: UUID) = find { it.uuid == uuid }
open fun handleInvalidSpeciesNBT(nbt: NbtCompound) {}
abstract fun saveToNBT(nbt: NbtCompound): NbtCompound
abstract fun loadFromNBT(nbt: NbtCompound): PokemonStore<T>
open fun handleInvalidSpeciesJSON(json: JsonObject) {}
abstract fun saveToJSON(json: JsonObject): JsonObject
abstract fun loadFromJSON(json: JsonObject): PokemonStore<T>
abstract fun savePositionToNBT(position: T, nbt: NbtCompound)
@@ -20,7 +20,7 @@ import com.cobblemon.mod.common.api.storage.StorePosition
import com.cobblemon.mod.common.api.storage.party.PlayerPartyStore
import com.cobblemon.mod.common.api.storage.pc.PCStore
import com.cobblemon.mod.common.pokemon.EVs
import com.cobblemon.mod.common.pokemon.Gender
import com.cobblemon.mod.common.api.pokemon.gender.Gender
import com.cobblemon.mod.common.pokemon.IVs
import com.cobblemon.mod.common.pokemon.Pokemon
import java.nio.file.Path
@@ -0,0 +1,101 @@
/*
* 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.storage.adapter.database
import com.cobblemon.mod.common.api.storage.PokemonStore
import com.cobblemon.mod.common.api.storage.StorePosition
import com.cobblemon.mod.common.api.storage.adapter.CobblemonAdapterParent
import com.cobblemon.mod.common.api.storage.adapter.flatfile.FileStoreAdapter
import com.cobblemon.mod.common.api.storage.adapter.flatfile.JSONStoreAdapter
import com.cobblemon.mod.common.api.storage.adapter.flatfile.NBTStoreAdapter
import com.cobblemon.mod.common.api.storage.party.PlayerPartyStore
import com.cobblemon.mod.common.api.storage.pc.PCStore
import com.cobblemon.mod.common.util.server
import com.google.gson.Gson
import com.google.gson.JsonObject
import com.mongodb.client.MongoClient
import com.mongodb.client.MongoCollection
import com.mongodb.client.model.ReplaceOptions
import net.minecraft.util.WorldSavePath
import org.bson.Document
import java.util.UUID
/**
* A [FileStoreAdapter] for MongoDB. This allows a [PokemonStore] to be serialized to a MongoDB database.
*
* @author Pebbles
* @since August 23rd, 2023
*/
open class MongoDBStoreAdapter(
private val mongoClient: MongoClient,
private val databaseName: String,
) : CobblemonAdapterParent<JsonObject>(), FileStoreAdapter<JsonObject> {
private fun getCollection(storeClass: Class<out PokemonStore<*>>): MongoCollection<Document> {
val collectionName = when (storeClass) {
PlayerPartyStore::class.java -> "PlayerPartyCollection"
PCStore::class.java -> "PCCollection"
else -> "OtherCollection"
}
return mongoClient.getDatabase(databaseName).getCollection(collectionName)
}
private val gson: Gson = Gson()
override fun <E : StorePosition, T : PokemonStore<E>> serialize(store: T): JsonObject {
return store.saveToJSON(JsonObject())
}
override fun save(storeClass: Class<out PokemonStore<*>>, uuid: UUID, serialized: JsonObject) {
val document = Document.parse(gson.toJson(serialized))
document.put("uuid", uuid.toString())
val collection = getCollection(storeClass)
val filter = Document("uuid", uuid.toString())
collection.replaceOne(filter, document, ReplaceOptions().upsert(true))
}
override fun <E : StorePosition, T : PokemonStore<E>> provide(storeClass: Class<T>, uuid: UUID): T? {
val server = server()!!
val pokemonStoreRoot = server.getSavePath(WorldSavePath.ROOT).resolve("pokemon").toFile()
val jsonAdapter = JSONStoreAdapter(
pokemonStoreRoot.absolutePath,
useNestedFolders = true,
folderPerClass = true
)
val nbtAdapter = NBTStoreAdapter(pokemonStoreRoot.absolutePath, useNestedFolders = true, folderPerClass = true)
// 1. Check if data exists in MongoDB
val collection = getCollection(storeClass)
val filter = Document("uuid", uuid.toString())
val document = collection.find(filter).first()
if (document != null) {
val json = gson.fromJson(document.toJson(), JsonObject::class.java)
val store = storeClass.getConstructor(UUID::class.java).newInstance(uuid)
store.loadFromJSON(json)
return store
}
// 2. Fallback to checking JSON and NBT
val nbtStore = nbtAdapter.provide(storeClass, uuid)
if (nbtStore != null) {
save(storeClass, uuid, serialize(nbtStore))
return nbtStore
}
val jsonStore = jsonAdapter.provide(storeClass, uuid)
if (jsonStore != null) {
save(storeClass, uuid, serialize(jsonStore))
return jsonStore
}
return null
}
}
@@ -6,7 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.storage.adapter.flatifle
package com.cobblemon.mod.common.api.storage.adapter.flatfile
import com.cobblemon.mod.common.api.storage.PokemonStore
import com.cobblemon.mod.common.api.storage.StorePosition
@@ -6,7 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.storage.adapter.flatifle
package com.cobblemon.mod.common.api.storage.adapter.flatfile
import com.cobblemon.mod.common.api.storage.PokemonStore
import com.cobblemon.mod.common.api.storage.StorePosition
@@ -6,7 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.storage.adapter.flatifle
package com.cobblemon.mod.common.api.storage.adapter.flatfile
import com.cobblemon.mod.common.api.storage.PokemonStore
import com.cobblemon.mod.common.api.storage.StorePosition
@@ -6,7 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.storage.adapter.flatifle
package com.cobblemon.mod.common.api.storage.adapter.flatfile
import com.cobblemon.mod.common.Cobblemon.LOGGER
import com.cobblemon.mod.common.api.storage.PokemonStore
@@ -14,7 +14,7 @@ import com.cobblemon.mod.common.api.reactive.Observable.Companion.emitWhile
import com.cobblemon.mod.common.api.storage.PokemonStore
import com.cobblemon.mod.common.api.storage.StorePosition
import com.cobblemon.mod.common.api.storage.adapter.SerializedStore
import com.cobblemon.mod.common.api.storage.adapter.flatifle.FileStoreAdapter
import com.cobblemon.mod.common.api.storage.adapter.flatfile.FileStoreAdapter
import com.cobblemon.mod.common.api.storage.party.PlayerPartyStore
import com.cobblemon.mod.common.api.storage.pc.PCStore
import com.cobblemon.mod.common.platform.events.PlatformEvents
@@ -123,7 +123,7 @@ open class FileBackedPokemonStoreFactory<S>(
}
override fun onPlayerDisconnect(playerID: UUID) {
dirtyStores.find { it.uuid == playerID }?.let { save(it) }
dirtyStores.filter { it.uuid == playerID }.forEach(::save)
storeCaches.forEach { (_, cache) -> cache.cacheMap.remove(playerID) }
}
@@ -12,6 +12,7 @@ import com.cobblemon.mod.common.CobblemonNetwork.sendPacket
import com.cobblemon.mod.common.api.reactive.Observable
import com.cobblemon.mod.common.api.reactive.Observable.Companion.stopAfter
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.api.storage.InvalidSpeciesException
import com.cobblemon.mod.common.api.storage.PokemonStore
import com.cobblemon.mod.common.api.storage.StoreCoordinates
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
@@ -168,8 +169,12 @@ open class PartyStore(override val uuid: UUID) : PokemonStore<PartyPosition>() {
while (slotCount < slots.size) { slots.add(null) }
for (slot in slots.indices) {
val pokemonNBT = nbt.getCompound(DataKeys.STORE_SLOT + slot)
if (!pokemonNBT.isEmpty) {
slots[slot] = Pokemon().loadFromNBT(pokemonNBT)
try {
if (!pokemonNBT.isEmpty) {
slots[slot] = Pokemon().loadFromNBT(pokemonNBT)
}
} catch (_: InvalidSpeciesException) {
handleInvalidSpeciesNBT(pokemonNBT)
}
}
@@ -196,7 +201,12 @@ open class PartyStore(override val uuid: UUID) : PokemonStore<PartyPosition>() {
for (slot in slots.indices) {
val key = DataKeys.STORE_SLOT + slot
if (json.has(key)) {
slots[slot] = Pokemon().loadFromJSON(json.get(key).asJsonObject)
val pokemonJSON = json.get(key).asJsonObject
try {
slots[slot] = Pokemon().loadFromJSON(pokemonJSON)
} catch (_: InvalidSpeciesException) {
handleInvalidSpeciesJSON(pokemonJSON)
}
}
}
@@ -10,6 +10,7 @@ package com.cobblemon.mod.common.api.storage.pc
import com.cobblemon.mod.common.api.reactive.Observable.Companion.stopAfter
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.api.storage.InvalidSpeciesException
import com.cobblemon.mod.common.api.storage.StoreCoordinates
import com.cobblemon.mod.common.net.messages.client.storage.pc.SetPCBoxPokemonPacket
import com.cobblemon.mod.common.pokemon.Pokemon
@@ -120,7 +121,12 @@ open class PCBox(val pc: PCStore) : Iterable<Pokemon> {
open fun loadFromJSON(json: JsonObject): PCBox {
for (slot in 0 until POKEMON_PER_BOX) {
if (json.has(DataKeys.STORE_SLOT + slot)) {
pokemon[slot] = Pokemon().loadFromJSON(json.getAsJsonObject(DataKeys.STORE_SLOT + slot))
val pokemonJson = json.getAsJsonObject(DataKeys.STORE_SLOT + slot)
try {
pokemon[slot] = Pokemon().loadFromJSON(pokemonJson)
} catch (_: InvalidSpeciesException) {
pc.handleInvalidSpeciesJSON(pokemonJson)
}
}
}
return this
@@ -129,7 +135,12 @@ open class PCBox(val pc: PCStore) : Iterable<Pokemon> {
open fun loadFromNBT(nbt: NbtCompound): PCBox {
for (slot in 0 until POKEMON_PER_BOX) {
if (nbt.contains(DataKeys.STORE_SLOT + slot)) {
pokemon[slot] = Pokemon().loadFromNBT(nbt.getCompound(DataKeys.STORE_SLOT + slot))
val pokemonNBT = nbt.getCompound(DataKeys.STORE_SLOT + slot)
try {
pokemon[slot] = Pokemon().loadFromNBT(pokemonNBT)
} catch (_: InvalidSpeciesException) {
pc.handleInvalidSpeciesNBT(pokemonNBT)
}
}
}
return this
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.storage.player
import com.google.gson.JsonObject
/**
* A dummy implementation of the [PlayerDataExtension] interface.
* Used for when a previous [PlayerDataExtension] is no longer registered.
*
* @author Deltric
* @since 2023-10-01
*/
class DummyPlayerDataExtension(
val json: JsonObject
): PlayerDataExtension {
override fun name(): String {
return this.json.get(PlayerDataExtension.NAME_KEY).asString
}
override fun serialize(): JsonObject {
return this.json
}
override fun deserialize(json: JsonObject): PlayerDataExtension {
return DummyPlayerDataExtension(json)
}
}
@@ -14,6 +14,7 @@ import com.cobblemon.mod.common.pokemon.Pokemon
import net.minecraft.server.network.ServerPlayerEntity
import net.minecraft.util.Identifier
@Suppress("unused")
class PlayerAdvancementData {
var totalCaptureCount: Int = 0
@@ -35,7 +36,7 @@ class PlayerAdvancementData {
var totalTradedCount: Int = 0
private set
private var totalTypeCaptureCounts = mutableMapOf<String, Int>()
private var totalTypeCaptureCounts = mutableMapOf<Identifier, Int>()
private var totalDefeatedCounts = mutableMapOf<Identifier, Int>()
var aspectsCollected = mutableMapOf<Identifier, MutableSet<String>>()
private set
@@ -77,18 +78,18 @@ class PlayerAdvancementData {
}
fun getTotalTypeCaptureCount(type: ElementalType): Int {
if (!totalTypeCaptureCounts.containsKey(key = type.name)) {
totalTypeCaptureCounts[type.name] = 0
if (!totalTypeCaptureCounts.containsKey(type.id())) {
totalTypeCaptureCounts[type.id()] = 0
}
return totalTypeCaptureCounts.get(key = type.name) ?: 0
return totalTypeCaptureCounts[type.id()] ?: 0
}
fun updateTotalTypeCaptureCount(type: ElementalType) {
val count = totalTypeCaptureCounts[type.name] ?: 0
val count = totalTypeCaptureCounts[type.id()] ?: 0
if (count == 0) {
totalTypeCaptureCounts[type.name] = 1
totalTypeCaptureCounts[type.id()] = 1
} else {
totalTypeCaptureCounts.replace(type.name, count + 1)
totalTypeCaptureCounts.replace(type.id(), count + 1)
}
}
@@ -0,0 +1,66 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.storage.player.adapter
import com.cobblemon.mod.common.api.storage.player.PlayerAdvancementData
import com.cobblemon.mod.common.api.storage.player.PlayerData
import com.cobblemon.mod.common.api.storage.player.PlayerDataExtension
import com.cobblemon.mod.common.util.adapters.IdentifierAdapter
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.mongodb.client.MongoClient
import com.mongodb.client.model.ReplaceOptions
import net.minecraft.util.Identifier
import org.bson.Document
import java.util.UUID
import kotlin.reflect.KMutableProperty
import kotlin.reflect.full.memberProperties
class MongoPlayerDataAdapter(
mongoClient: MongoClient,
databaseName: String
) : PlayerDataStoreAdapter {
companion object {
val gson = GsonBuilder()
.disableHtmlEscaping()
.registerTypeAdapter(PlayerDataExtension::class.java, PlayerDataExtensionAdapter)
.registerTypeAdapter(Identifier::class.java, IdentifierAdapter)
.create()
}
private val collection = mongoClient.getDatabase(databaseName).getCollection("PlayerDataCollection")
override fun load(uuid: UUID): PlayerData {
val filter = Document("uuid", uuid.toString())
val document = collection.find(filter).first()
return if (document != null) {
val jsonStr = document.toJson()
gson.fromJson(jsonStr, PlayerData::class.java).also {
val newProps = it::class.memberProperties.filterIsInstance<KMutableProperty<*>>().filter { member -> member.getter.call(it) == null }
if (newProps.isNotEmpty()) {
val defaultData = PlayerData.defaultData(uuid)
newProps.forEach { member -> member.setter.call(it, member.getter.call(defaultData)) }
}
}
} else {
PlayerData.defaultData(uuid).also(::save)
}
}
override fun save(playerData: PlayerData) {
val jsonStr = gson.toJson(playerData)
val document = Document.parse(jsonStr)
document.put("uuid", playerData.uuid.toString())
val filter = Document("uuid", playerData.uuid.toString())
collection.replaceOne(filter, document, ReplaceOptions().upsert(true))
}
}
@@ -8,6 +8,8 @@
package com.cobblemon.mod.common.api.storage.player.adapter
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.storage.player.DummyPlayerDataExtension
import com.cobblemon.mod.common.api.storage.player.PlayerDataExtension
import com.cobblemon.mod.common.api.storage.player.PlayerDataExtensionRegistry
import com.google.gson.JsonDeserializationContext
@@ -34,7 +36,13 @@ object PlayerDataExtensionAdapter: JsonSerializer<PlayerDataExtension>, JsonDese
val jObject = json.asJsonObject
val name = jObject.get(PlayerDataExtension.NAME_KEY)
?: throw IllegalStateException("PlayerDataExtension without name")
val extension = PlayerDataExtensionRegistry.getOrException(name.asString)
return extension.getDeclaredConstructor().newInstance().deserialize(jObject)
val extension = PlayerDataExtensionRegistry.get(name.asString)
return if (extension != null) {
extension.getDeclaredConstructor().newInstance().deserialize(jObject)
} else {
Cobblemon.LOGGER.info("No PlayerDataExtension registered with name ${name.asString}, loading data with a dummy extension.")
DummyPlayerDataExtension(jObject)
}
}
}
@@ -26,7 +26,7 @@ class JsonPlayerDataStoreFactory : PlayerDataStoreFactory {
}
override fun load(uuid: UUID): PlayerData {
return if(cache.contains(uuid))
return if (cache.contains(uuid))
cache[uuid]!!;
else {
val data = adapter.load(uuid);
@@ -40,7 +40,7 @@ class JsonPlayerDataStoreFactory : PlayerDataStoreFactory {
}
override fun saveAll() {
cache.forEach { (_, pd) -> adapter.save(pd)}
cache.forEach { (_, pd) -> adapter.save(pd) }
cache.removeIf { (uuid, _) -> uuid.getPlayer() == null }
}
@@ -0,0 +1,45 @@
/*
* 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.storage.player.factory
import com.cobblemon.mod.common.api.storage.player.PlayerData
import com.cobblemon.mod.common.api.storage.player.adapter.MongoPlayerDataAdapter
import com.cobblemon.mod.common.util.getPlayer
import com.cobblemon.mod.common.util.removeIf
import com.mongodb.client.MongoClient
import java.util.UUID
class MongoPlayerDataStoreFactory(mongoClient: MongoClient, databaseName: String) : PlayerDataStoreFactory {
private val cache = mutableMapOf<UUID, PlayerData>()
private val adapter = MongoPlayerDataAdapter(mongoClient, databaseName)
override fun load(uuid: UUID): PlayerData {
return if (cache.contains(uuid))
cache[uuid]!!;
else {
val data = adapter.load(uuid);
cache[uuid] = data
data
}
}
override fun save(data: PlayerData) {
adapter.save(data)
}
override fun saveAll() {
cache.forEach { (_, pd) -> adapter.save(pd) }
cache.removeIf { (uuid, _) -> uuid.getPlayer() == null }
}
override fun onPlayerDisconnect(uuid: UUID) {
cache.remove(uuid)
}
}
@@ -22,7 +22,7 @@ import net.minecraft.registry.tag.TagKey
object CobblemonBiomeTags {
@JvmField
val IS_ABYSS = create("is_abyss")
val IS_DEEP_DARK = create("is_deep_dark")
@JvmField
val IS_ARID = create("is_arid")
@JvmField
@@ -38,7 +38,7 @@ object CobblemonBiomeTags {
@JvmField
val IS_COLD = create("is_cold")
@JvmField
val IS_DEEP = create("is_deep")
val IS_DEEP_OCEAN = create("is_deep_ocean")
@JvmField
val IS_DESERT = create("is_desert")
@JvmField
@@ -52,9 +52,9 @@ object CobblemonBiomeTags {
@JvmField
val IS_FRESHWATER = create("is_freshwater")
@JvmField
val IS_FRIGID = create("is_frigid")
val IS_COLD_OCEAN = create("is_cold_ocean")
@JvmField
val IS_FROZEN = create("is_frozen")
val IS_FROZEN_OCEAN = create("is_frozen_ocean")
@JvmField
val IS_GLACIAL = create("is_glacial")
@JvmField
@@ -68,7 +68,7 @@ object CobblemonBiomeTags {
@JvmField
val IS_JUNGLE = create("is_jungle")
@JvmField
val IS_LUKEWARM = create("is_lukewarm")
val IS_LUKEWARM_OCEAN = create("is_lukewarm_ocean")
@JvmField
val IS_LUSH = create("is_lush")
@JvmField
@@ -86,7 +86,7 @@ object CobblemonBiomeTags {
@JvmField
val IS_PLATEAU = create("is_plateau")
@JvmField
val IS_REEF = create("is_reef")
val IS_WARM_OCEAN = create("is_warm_ocean")
@JvmField
val IS_RIVER = create("is_river")
@JvmField
@@ -96,7 +96,7 @@ object CobblemonBiomeTags {
@JvmField
val IS_SKY = create("is_sky")
@JvmField
val IS_SNOWY = create("is_snowy")
val IS_SNOWY_FOREST = create("is_snowy_forest")
@JvmField
val IS_SPOOKY = create("is_spooky")
@JvmField
@@ -0,0 +1,28 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.types
import com.cobblemon.mod.common.api.registry.CobblemonRegistryKeys
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.registry.tag.TagKey
/**
* Contains all the Cobblemon default elemental type related tags.
*/
object CobblemonElementalTypeTags {
val FIRE_IMMUNE: TagKey<ElementalType> = TagKey.of(CobblemonRegistryKeys.ELEMENTAL_TYPE, cobblemonResource("fire_immune"))
val FALL_DAMAGE_IMMUNE: TagKey<ElementalType> = TagKey.of(CobblemonRegistryKeys.ELEMENTAL_TYPE, cobblemonResource("fall_damage_immune"))
val LURE_BALL_BOOSTING: TagKey<ElementalType> = TagKey.of(CobblemonRegistryKeys.ELEMENTAL_TYPE, cobblemonResource("lure_ball_boosting"))
val NET_BALL_BOOSTING: TagKey<ElementalType> = TagKey.of(CobblemonRegistryKeys.ELEMENTAL_TYPE, cobblemonResource("net_ball_boosting"))
}
@@ -0,0 +1,78 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.types
import com.cobblemon.mod.common.api.registry.CobblemonRegistries
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.util.Identifier
import java.util.Optional
/**
* The official [ElementalType]s and the ones the Cobblemon mod ships with.
* These are not guaranteed to be present in a game instance as we can't control what datapacks may remove them.
* It's also not safe to assume they function the exact same as they would in the official games, please check the various properties of [ElementalType].
*/
@Suppress("MemberVisibilityCanBePrivate", "unused")
object CobblemonElementalTypes {
val BUG_KEY: Identifier = cobblemonResource("bug")
val BUG: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(BUG_KEY))
val DARK_KEY: Identifier = cobblemonResource("dark")
val DARK: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(DARK_KEY))
val DRAGON_KEY: Identifier = cobblemonResource("dragon")
val DRAGON: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(DRAGON_KEY))
val ELECTRIC_KEY: Identifier = cobblemonResource("electric")
val ELECTRIC: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(ELECTRIC_KEY))
val FAIRY_KEY: Identifier = cobblemonResource("fairy")
val FAIRY: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(FAIRY_KEY))
val FIGHTING_KEY: Identifier = cobblemonResource("fighting")
val FIGHTING: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(FIGHTING_KEY))
val FIRE_KEY: Identifier = cobblemonResource("fire")
val FIRE: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(FIRE_KEY))
val FLYING_KEY: Identifier = cobblemonResource("flying")
val FLYING: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(FLYING_KEY))
val GHOST_KEY: Identifier = cobblemonResource("ghost")
val GHOST: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(GHOST_KEY))
val GRASS_KEY: Identifier = cobblemonResource("grass")
val GRASS: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(GRASS_KEY))
val GROUND_KEY: Identifier = cobblemonResource("ground")
val GROUND: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(GROUND_KEY))
val ICE_KEY: Identifier = cobblemonResource("ice")
val ICE: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(ICE_KEY))
val NORMAL_KEY: Identifier = cobblemonResource("normal")
val NORMAL: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(NORMAL_KEY))
val POISON_KEY: Identifier = cobblemonResource("poison")
val POISON: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(POISON_KEY))
val PSYCHIC_KEY: Identifier = cobblemonResource("psychic")
val PSYCHIC: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(PSYCHIC_KEY))
val ROCK_KEY: Identifier = cobblemonResource("rock")
val ROCK: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(ROCK_KEY))
val STEEL_KEY: Identifier = cobblemonResource("steel")
val STEEL: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(STEEL_KEY))
val WATER_KEY: Identifier = cobblemonResource("water")
val WATER: Optional<ElementalType> get() = Optional.ofNullable(CobblemonRegistries.ELEMENTAL_TYPE.get(WATER_KEY))
}
@@ -9,21 +9,119 @@
package com.cobblemon.mod.common.api.types
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.data.ShowdownIdentifiable
import com.cobblemon.mod.common.api.registry.CobblemonRegistries
import com.cobblemon.mod.common.api.registry.CobblemonRegistryElement
import com.cobblemon.mod.common.api.types.client.ClientData
import com.cobblemon.mod.common.api.types.hiddenpower.HiddenPowerRequirement
import com.cobblemon.mod.common.api.types.resistance.*
import com.cobblemon.mod.common.util.codec.setCodec
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.registry.Registry
import net.minecraft.registry.entry.RegistryEntry
import net.minecraft.text.MutableText
import net.minecraft.text.Text
import net.minecraft.util.Identifier
import java.util.Optional
/**
* Class representing a type of a Pokemon or Move
* Class representing the elemental type of Pokémon or Move.
*
* @param name: The English name used to load / find it (spaces -> _)
* @param displayName: A Component used to display the name, normally a TranslatableText
* @param textureXMultiplier: The multiplier by which the TypeWidget shall move the display
* @param resourceLocation: The location of the resource used in the TypeWidget
* @param damageTaken The [RawResistanceInformation] that will be converted into [ResistanceInformation] for this type.
* @param hiddenPowerRequirement The [HiddenPowerRequirement] for this elemental type. If not present that means the type doesn't support hidden power.
* @param clientData The [ClientData] of this type.
*/
@Suppress("MemberVisibilityCanBePrivate", "unused")
class ElementalType(
val name: String,
val displayName: MutableText,
val hue: Int,
val textureXMultiplier: Int,
val resourceLocation: Identifier = Identifier(Cobblemon.MODID, "ui/types.png")
)
private val damageTaken: Set<RawResistanceInformation>,
val hiddenPowerRequirement: Optional<HiddenPowerRequirement>,
val clientData: ClientData
): CobblemonRegistryElement<ElementalType>, ShowdownIdentifiable {
/**
* The translatable component responsible for showing this
*/
val displayName: MutableText by lazy { Text.translatable("${this.id().namespace}.type.${this.id().path.replace("/", ".")}") }
/**
* The resolved [ResistanceInformation]s.
* This is done by lazily invoking [RawResistanceInformation.toImplementation].
*/
private val resistanceInformation: HashSet<ResistanceInformation> by lazy {
val resulting = this.damageTaken.map(RawResistanceInformation::toImplementation).toHashSet()
this.populateMissingTypes(resulting)
return@lazy resulting
}
/**
* TODO
*
* @return
*/
fun resistanceInformation(): Set<ResistanceInformation> = this.resistanceInformation
/**
* TODO
*
* @param other
* @return
*/
fun resistanceAgainst(other: ElementalType): Resistance {
return this.resistanceInformation().firstOrNull { it is ElementalTypeResistanceInformation && it.elementalType == other }?.resistance
?: throw IllegalArgumentException("Cannot find type resistance for ${other.id()} this should be impossible.")
}
override fun registryEntry(): RegistryEntry<ElementalType> = this.registry().getEntry(this)
override fun id(): Identifier = this.registry().getId(this)!!
override fun registry(): Registry<ElementalType> = CobblemonRegistries.ELEMENTAL_TYPE
override fun showdownId(): String {
val showdownId = ShowdownIdentifiable.REGEX.replace(this.id().path.lowercase(), "")
if (this.id().namespace == Cobblemon.MODID) {
return showdownId
}
return this.id().namespace + showdownId
}
override fun equals(other: Any?): Boolean = other is ElementalType && other.id() == this.id()
override fun hashCode(): Int = this.id().hashCode()
/**
* Adds in any missing [ResistanceInformation] for other loaded [ElementalType]s.
*
* @param current The currently loaded [ResistanceInformation].
*/
private fun populateMissingTypes(current: HashSet<ResistanceInformation>) {
CobblemonRegistries.ELEMENTAL_TYPE.forEach { type ->
if (current.none { it is ElementalTypeResistanceInformation && it.elementalType == type }) {
val information = ElementalTypeResistanceInformation(type, Resistance.NEUTRAL)
current.add(information)
Cobblemon.LOGGER.info("{} elemental type was missing resistance information against {}, defaulting to neutral, it is recommended to validate if this is intended or if you should add additional data for the missing type", this.id(), type.id())
}
}
}
companion object {
val CODEC: Codec<ElementalType> = RecordCodecBuilder.create { builder ->
builder.group(
setCodec(RawResistanceInformation.CODEC).fieldOf("damageTaken").forGetter(ElementalType::damageTaken),
HiddenPowerRequirement.CODEC.optionalFieldOf("hiddenPowerRequirement").forGetter(ElementalType::hiddenPowerRequirement),
ClientData.CODEC.fieldOf("clientData").forGetter(ElementalType::clientData)
).apply(builder, ::ElementalType)
}
val NETWORK_CODEC: Codec<ElementalType> = RecordCodecBuilder.create { builder ->
builder.group(
setCodec(RawResistanceInformation.CODEC).fieldOf("damageTaken").forGetter(ElementalType::damageTaken),
ClientData.CODEC.fieldOf("clientData").forGetter(ElementalType::clientData)
).apply(builder) { damageTaken, clientData -> ElementalType(damageTaken, Optional.empty(), clientData) }
}
}
}
@@ -6,169 +6,3 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.types
import net.minecraft.text.MutableText
import net.minecraft.text.Text
/**
* Registry for all known ElementalTypes
*/
object ElementalTypes {
private val allTypes = mutableListOf<ElementalType>()
val NORMAL = register(
name = "normal",
displayName = Text.translatable("cobblemon.type.normal"),
hue = 0xDDDDCF,
textureXMultiplier = 0
)
val FIRE = register(
name = "fire",
displayName = Text.translatable("cobblemon.type.fire"),
hue = 0xE55C32,
textureXMultiplier = 1
)
val WATER = register(
name = "water",
displayName = Text.translatable("cobblemon.type.water"),
hue = 0x4A9BE8,
textureXMultiplier = 2
)
val GRASS = register(
name = "grass",
displayName = Text.translatable("cobblemon.type.grass"),
hue = 0x4DBC3C,
textureXMultiplier = 3
)
val ELECTRIC = register(
name = "electric",
displayName = Text.translatable("cobblemon.type.electric"),
hue = 0xEFD128,
textureXMultiplier = 4
)
val ICE = register(
name = "ice",
displayName = Text.translatable("cobblemon.type.ice"),
hue = 0x6BC3EF,
textureXMultiplier = 5
)
val FIGHTING = register(
name = "fighting",
displayName = Text.translatable("cobblemon.type.fighting"),
hue = 0xC44C5C,
textureXMultiplier = 6
)
val POISON = register(
name = "poison",
displayName = Text.translatable("cobblemon.type.poison"),
hue = 0xA24BD8,
textureXMultiplier = 7
)
val GROUND = register(
name = "ground",
displayName = Text.translatable("cobblemon.type.ground"),
hue = 0xD89950,
textureXMultiplier = 8
)
val FLYING = register(
name = "flying",
displayName = Text.translatable("cobblemon.type.flying"),
hue = 0xBCC1FF,
textureXMultiplier = 9
)
val PSYCHIC = register(
name = "psychic",
displayName = Text.translatable("cobblemon.type.psychic"),
hue = 0xD86AD6,
textureXMultiplier = 10
)
val BUG = register(
name = "bug",
displayName = Text.translatable("cobblemon.type.bug"),
hue = 0xA2C831,
textureXMultiplier = 11
)
val ROCK = register(
name = "rock",
displayName = Text.translatable("cobblemon.type.rock"),
hue = 0xAA9666,
textureXMultiplier = 12
)
val GHOST = register(
name = "ghost",
displayName = Text.translatable("cobblemon.type.ghost"),
hue = 0x9572E5,
textureXMultiplier = 13
)
val DRAGON = register(
name = "dragon",
displayName = Text.translatable("cobblemon.type.dragon"),
hue = 0x535DE8,
textureXMultiplier = 14
)
val DARK = register(
name = "dark",
displayName = Text.translatable("cobblemon.type.dark"),
hue = 0x5C6CB2,
textureXMultiplier = 15
)
val STEEL = register(
name = "steel",
displayName = Text.translatable("cobblemon.type.steel"),
hue = 0xC3CCE0,
textureXMultiplier = 16
)
val FAIRY = register(
name = "fairy",
displayName = Text.translatable("cobblemon.type.fairy"),
hue = 0xEA727E,
textureXMultiplier = 17
)
fun register(name: String, displayName: MutableText, hue: Int, textureXMultiplier: Int): ElementalType {
return ElementalType(
name = name,
displayName = displayName,
hue = hue,
textureXMultiplier = textureXMultiplier
).also {
allTypes.add(it)
}
}
fun register(elementalType: ElementalType): ElementalType {
allTypes.add(elementalType)
return elementalType
}
fun get(name: String): ElementalType? {
return allTypes.firstOrNull { type -> type.name.equals(name, ignoreCase = true) }
}
fun getOrException(name: String): ElementalType {
return allTypes.first { type -> type.name.equals(name, ignoreCase = true) }
}
fun count() = allTypes.size
fun all() = this.allTypes.toList()
}
@@ -8,22 +8,21 @@
package com.cobblemon.mod.common.api.types.adapters
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.registry.CobblemonRegistries
import com.cobblemon.mod.common.api.types.ElementalType
import com.cobblemon.mod.common.api.types.ElementalTypes
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
import com.google.gson.JsonPrimitive
import com.google.gson.JsonSerializationContext
import com.google.gson.JsonSerializer
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import com.google.gson.*
import java.lang.reflect.Type
object ElementalTypeAdapter: JsonSerializer<ElementalType>, JsonDeserializer<ElementalType> {
override fun serialize(src: ElementalType, typeOfSrc: Type, context: JsonSerializationContext): JsonElement {
return JsonPrimitive(src.name)
return JsonPrimitive(if (src.id().namespace == Cobblemon.MODID) src.id().path else src.id().toString())
}
override fun deserialize(json: JsonElement, typeOfT: Type, context: JsonDeserializationContext): ElementalType {
return ElementalTypes.getOrException(json.asString)
return CobblemonRegistries.ELEMENTAL_TYPE.get(json.asString.asIdentifierDefaultingNamespace())!!
}
}
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.types.client
import com.cobblemon.mod.common.util.math.toRGB
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.util.Identifier
/**
* Represents various properties used in UIs.
* This data is present on the server and synchronized to clients.
*
* @property hue The RGB tint applied in a few UIs.
* @property primaryTexture The primary texture for the type icon.
* @property secondaryTexture The secondary texture used when a miniature icon is wanted.
* @property uOffset The uOffset on the blitk.
* @property vOffset The vOffset on the blitk.
*/
data class ClientData(
val hue: Int,
val primaryTexture: Identifier,
val secondaryTexture: Identifier,
val uOffset: Float,
val vOffset: Float
) {
val something = 0xA2C831
companion object {
val CODEC: Codec<ClientData> = RecordCodecBuilder.create { builder ->
builder.group(
Codec.STRING.xmap(Integer::decode, Integer::toHexString).fieldOf("hue").forGetter(ClientData::hue),
Identifier.CODEC.fieldOf("primaryTexture").forGetter(ClientData::primaryTexture),
Identifier.CODEC.fieldOf("secondaryTexture").forGetter(ClientData::secondaryTexture),
Codec.FLOAT.optionalFieldOf("uOffset", 0F).forGetter(ClientData::uOffset),
Codec.FLOAT.optionalFieldOf("vOffset", 0F).forGetter(ClientData::vOffset)
).apply(builder, ::ClientData)
}
}
}
@@ -0,0 +1,49 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.types.hiddenpower
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.Environment
import com.cobblemon.mod.common.api.pokemon.stats.Stat
import com.cobblemon.mod.common.api.types.ElementalType
import com.cobblemon.mod.common.pokemon.Pokemon
import com.mojang.serialization.Codec
/**
* Responsible for determining if a [Pokemon] can use the hidden power of a given type.
* This will be attached to a [ElementalType.hiddenPowerRequirement].
*
* @property statMap The stat map that checks [IvCondition]s for each IV value of a [Pokemon].
*
* @throws IllegalArgumentException if not every stat of type [Stat.Type.PERMANENT] is present.
*/
class HiddenPowerRequirement(internal val statMap: Map<Stat, IvCondition>) {
init {
if (Cobblemon.implementation.environment() == Environment.SERVER && !this.statMap.keys.containsAll(Cobblemon.statProvider.ofType(Stat.Type.PERMANENT))) {
throw IllegalArgumentException("Cannot create a ${this::class.simpleName} when missing permanent stats")
}
}
/**
* Checks if the given [Pokemon] passes this requirement.
*
* @param pokemon The [Pokemon] being checked.
* @return If this requirement is passed against the [pokemon].
*/
fun isValid(pokemon: Pokemon): Boolean = pokemon.ivs.all { (stat, value) -> this.statMap[stat]!!.fits(value) }
companion object {
val CODEC: Codec<HiddenPowerRequirement> = Codec.unboundedMap(Stat.CODEC, IvCondition.CODEC)
.xmap(::HiddenPowerRequirement, HiddenPowerRequirement::statMap)
}
}
Loaded 100 of 2393 files, more files were not shown because too many files have changed in this diff. Show more