Compare commits

..
Author SHA1 Message Date
Kiritiop 7303023218 Fix boat style mounts sprinting on their own after landing in water from jet flight 2026-10-19 10:34:00 -04:00
Polymeta f9dd1448e5 Merge branch 'item-2072' into 'main'
Added tab completion for the alpha property and three missing property aliases

Closes #2072

See merge request cable-mc/cobblemon!2388
2026-10-18 22:33:30 +00:00
Gitoido ecf5d57ad2 chore: resolve conflicts
# Conflicts:
#   common/src/main/kotlin/com/cobblemon/mod/common/pokemon/properties/PropertiesCompletionProvider.kt
2026-10-18 22:16:27 +00:00
Polymeta 8663888abc Merge branch 'item-2013' into 'main'
Fixed GUI Pokémon cries playing on the Master category instead of Friendly Creatures

Closes #2013

See merge request cable-mc/cobblemon!2389
2026-10-18 22:14:04 +00:00
Polymeta f452cd9a05 Merge branch 'fix/ride-interact-checks' into 'main'
fix: stricter riding checks on server side

Closes #2124

See merge request cable-mc/cobblemon!2499
2026-10-18 22:12:19 +00:00
Kiritiop 4fe9cd7fd6 Fixed GUI pokemon cries using the Master volume slider instead of Friendly Creatures, added a new file to prevent code duplication. Credit to Gitoido 2026-10-18 13:19:07 -04:00
Gitoido Okaski 2c1d11ed11 chore: remove duplicate check that was accounted for earlier 2026-10-18 15:29:35 +03:00
Gitoido Okaski b88adf0479 fix: stricter riding checks on server side 2026-10-18 15:21:09 +03:00
Polymeta b1066671f5 Merge branch 'quick-fix' into 'main'
Flowerbed Clearning jigsaw fix, dripstone oasis jigsaw removal

See merge request cable-mc/cobblemon!2497
2026-10-18 12:09:48 +00:00
Polymeta 387e85d4ad Merge branch 'fix/preset-conditions-mergers' into 'main'
fix: Some spawn conditions merge minHeight/Depth data into max instead

Closes #2111

See merge request cable-mc/cobblemon!2498
2026-10-18 12:07:55 +00:00
Gitoido Okaski 77ab58d823 fix: spawn condition mergers writing minHeight/depth into maxHeight/depth instead 2026-10-18 14:14:28 +03:00
Slippy 1a9e736d8b Flowerbed Clearning jigsaw fix, dripstone oasis jigsaw removal 2026-10-18 00:11:56 -05:00
Hiroku aa39c1906e Merge branch 'implement_pokemon' into 'main'
implement_pokemon

See merge request cable-mc/cobblemon!2495
2026-10-17 23:48:54 +00:00
ewwww 2e460e2ca2 fixed floating frogadier 2026-10-17 19:43:44 -04:00
Polymeta a07ff7f442 Merge branch 'implement_pokemon' into 'main'
implement_pokemon

See merge request cable-mc/cobblemon!2494
2026-10-17 23:37:18 +00:00
Polymeta 5374569ea1 [skip-ci] tidy up changelog
Signed-off-by: Polymeta <4726322-polymeta@users.noreply.gitlab.com>
2026-10-18 00:15:37 +01:00
Polymeta af9c1196bf youre meant to be looking the other way
Signed-off-by: Polymeta <4726322-polymeta@users.noreply.gitlab.com>
2026-10-18 00:08:51 +01:00
Polymeta 09d5543469 Merge branch 'fix/haters-gonna-hate-properly' into 'main'
fix: Anger should be directed at proper target

Closes #2112

See merge request cable-mc/cobblemon!2492
2026-10-17 23:03:41 +00:00
ewwww 49e4dd0298 helioptile & heliolisk cries 2026-10-17 19:01:46 -04:00
Polymeta c8e408c50a actually copy components when building up evolution displays
Signed-off-by: Polymeta <4726322-polymeta@users.noreply.gitlab.com>
2026-10-17 23:57:05 +01:00
Gitoido Okaski e8a0467643 chore: move coercion at class variable level 2026-10-18 01:17:07 +03:00
Gitoido Okaski 2dd0b66b83 chore: remove duplicate i18n key 2026-10-18 01:04:29 +03:00
Gitoido Okaski 68374017e1 chore: changelog 2026-10-18 01:04:29 +03:00
ewwww 120520f51d vikavolt animations + cries for grubbin, charjabug, & vikavolt 2026-10-17 18:01:25 -04:00
Gitoido Okaski e8dea9773a feat: make sure zangoose and zeviper 100% hate each other 2026-10-18 00:59:40 +03:00
Gitoido Okaski 7b31e6bcc4 feat: make sure hate task uses new values from config and gamerule 2026-10-18 00:59:10 +03:00
Gitoido Okaski c6ffca639f feat: pokemon predation chance config i18n 2026-10-18 00:58:40 +03:00
Gitoido Okaski c491a1f7ca feat: introduce pokemon predation chance config 2026-10-18 00:56:06 +03:00
Gitoido Okaski 0b333b743d feat: introduce pokemon predation gamerule 2026-10-18 00:55:54 +03:00
ewwww 95e79865e5 updated posers for fennekin & braixen 2026-10-17 16:24:40 -04:00
Gitoido Okaski 0e2860cd90 chore: import cleanup skip_ci 2026-10-17 23:14:08 +03:00
Gitoido Okaski 3259bf032c chore: changelog skip_ci 2026-10-17 23:10:15 +03:00
Gitoido OkaskiandGitoido 116205cdf1 fix: Anger should be directed at proper target 2026-10-17 20:07:18 +00:00
ewwww 43277d18dc Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2026-10-17 13:37:05 -04:00
Polymeta 86153419ee Merge branch 'implement_pokemon' into 'main'
implement_pokemon

See merge request cable-mc/cobblemon!2480
2026-10-17 17:36:00 +00:00
Gitoido Okaski 2b4d9c451c fix: Various poser/animation fixes (Wave 3.4.1) 2026-10-17 20:07:17 +03:00
Gitoido Okaski 7f0e2fa9d8 fix: Various poser/animation fixes (Wave 3.3) 2026-10-17 19:43:00 +03:00
Gitoido Okaski e165095bd5 fix: Various poser/animation fixes (Wave 3.2.1) 2026-10-17 19:38:06 +03:00
Gitoido Okaski b8708d6e10 fix: Various poser/animation fixes (Wave 3.2) 2026-10-17 19:36:25 +03:00
Kenji_64 ef536390ca Various poser/animation fixes (Wave 3.1). The rats make me crazy. 2026-10-17 18:27:28 +02:00
ewwww 28befab173 cries for combee & vespiquen 2026-10-17 12:22:20 -04:00
ewwww c142439d5b cries for wurmple, silcoon, cascoon. beautifly, & dustox 2026-10-17 12:21:49 -04:00
Jerzykv 1ca7335654 Various poser/animation fixes (Wave 3) 2026-10-17 18:18:39 +02:00
ewwww 9197d9cdcd cries for runerigus 2026-10-17 11:52:04 -04:00
ewwww f75813e64d cries for dusknoir 2026-10-17 11:45:44 -04:00
ewwww 1f617c76a4 cries for torkoal 2026-10-17 11:45:20 -04:00
ewwww ebf573aa7a cries for surskit & masquerain 2026-10-17 11:44:29 -04:00
Kenji_64 75363da470 Various poser/animation fixes (Wave 2.5) 2026-10-17 17:42:04 +02:00
ewwww cce4b932cc cries for hoppip, skiploom, & jumpluff 2026-10-17 11:41:45 -04:00
Kenji_64 0973e1ced0 Various poser/animation fixes (Wave 2) 2026-10-17 17:31:30 +02:00
Kenji_64 e7b5c84024 Various poser/animation fixes 2026-10-17 13:43:58 +02:00
ewwww 4001cc2a89 vikavolt animations + cries for grubbin, charjabug, & vikavolt 2026-10-17 06:08:31 -04:00
Polymeta 6e57d77d10 Merge branch 'More-Structure-Fixes' into 'main'
More structure fixes

See merge request cable-mc/cobblemon!2491
2026-10-16 22:54:46 +00:00
Slippy 2206d96a6e Lots of fixing 2026-10-16 14:26:55 -05:00
Slippy 33f05858f1 structure fixes for .3 2026-10-16 13:34:04 -05:00
ewwww a4f204a5a3 changelog 2026-10-16 06:06:11 -04:00
ewwww 31b6be2164 applin & flapple cry updates + cries for appletun & dipplin 2026-10-16 06:06:00 -04:00
ewwww 0dbf73067b houndour & houndoom cries 2026-10-16 06:03:48 -04:00
ewwww 775703e1f5 starly, staravia, and staraptor cries 2026-10-16 06:03:20 -04:00
Polymeta bcdfef4886 Merge branch 'lights-out' into 'main'
Bye Bye Magmarizer Glow

See merge request cable-mc/cobblemon!2490
2026-10-16 06:49:58 +00:00
dhi_holo a19adb463b Bye Bye Magmarizer Glow
- Removed Dynamic Lights data from the Magmarizer item for consistency with the block
2026-10-16 16:32:05 +10:00
ewwww 9beee548d4 Merge branch 'main' into implement_pokemon 2026-10-15 01:30:50 -04:00
RedGenesectNinja 546f10eca7 Gave Audino its alpha eyes back 2026-10-12 19:19:05 -05:00
Kiritiop fb4aaed220 Edit CHANGELOG.md 2026-10-11 08:57:22 +00:00
Kiritiop c5e1b37ead Manual rebase 2026-10-11 08:53:30 +00:00
Kiritiop 2be9d303ea Added tab completion for the alpha property and three missing property aliases
Closes #2072
2026-10-11 08:53:30 +00:00
Kiritiop 99ac6d213a Added tab completion for the alpha property and three missing property aliases
Closes #2072
2026-10-11 08:53:30 +00:00
ewwww 6f4aae8b7d grubbin, charjabug, and vikavolt are marked as implemented 2026-10-10 23:33:06 -04:00
ewwww 01e5e74e64 snover and abomasnow are marked as implemented 2026-10-10 23:32:49 -04:00
ewwww b6565a5dee greavard and houndstone are marked as implemented 2026-10-10 23:29:38 -04:00
214 changed files with 6629 additions and 1926 deletions
+49 -15
View File
@@ -3,43 +3,76 @@
### Additions
### Pokémon Added
#### Generation 4
#### Generation 5
#### Generation 6
#### Generation 7
#### Generation 8
#### Generation 9
### Cries added/updated for the following Pokémon
- Hoppip
- Skiploom
- Jumpluff
- Houndour
- Houndoom
- Wurmple
- Silcoon
- Beautifly
- Cascoon
- Dustox
- Surskit
- Masquerain
- Torkoal
- Starly
- Staravia
- Staraptor
- Combee
- Vespiquen
- Dusknoir
- Helioptile
- Heliolisk
- Grubbin
- Charjabug
- Vikavolt
- Applin (updated)
- Flapple (updated)
- Appletun
- Runerigus
- Dipplin
### Model updates for the following Pokémon
### Animation updates for the following Pokémon
- Vikavolt
### Changes
- Changed the Misc icon in the Campfire Pot Recipe Book to Health Candy
- Moved EXP Candies from the Medicine recipe book category to the Misc category
- Removed Dynamic Lights data from the Magmarizer item for consistency with the block
- Added `doPokemonPredation` gamerule, which controls aggressiveness of Pokémon with `hate_entity` brain task defined
- Added `predation_chance` server config value, which controls the possibility of attacking the hated entity found by `hate_entity` brain task
- Prehistoric Eroded Pillar generates slightly more frequently
### Fixes
- Fixed datapacks with item interaction evolutions that don't specify an item crashing the world on load.
- Fixed the Pokédex evolution tree crashing when a datapack's dex entry is missing an evolution's form.
- Fixed the Pokédex evolution tree crashing with a stack overflow on evolutions that loop back on themselves.
- Fixed the Pokédex evolution tree crashing when looking at a dex that is not part of the "National Dex" aggregate.
- Fixed evolution trees not building properly when a pokemon has several pokedex entries for different regions.
- Fixed evolution trees not building properly when a Pokémon has several Pokédex entries for different regions.
- Fixed form-changing evolutions sometimes resolving to the source form in the Pokédex evolution tree.
- Broken datapack evolutions are now logged and skipped in the Pokédex evolution tree instead of crashing.
- Fixed the `alpha` property having no tab completion in commands such as `/pokespawn`, `/pokegive` and `/pokeedit`, and added the missing `dmax_level`, `gmax_factor` and `tradable` aliases to tab completion
- Fixed friendship booster items not being recognised as such
- Fixed conflicts with other mods that would make use of recipe books in certain ways (Farmer's Delight Cooking Pot)
- Fixed Pokémon battles stalling when a sidemod cancels the `THROWN_POKEBALL_HIT` hit event
- Fixed choice feature tab completion in `spawnpokemon/pokegive/pokeedit` commands
- Fixed MoLang that's targeting players intermittedly failing when they have died, needing them to relog
- Fixed all pots of mod on NeoForge
- Fixed party overlay not hiding when player opens the pokedex scanner
- Fixed a NeoForge bug where none of the Cobblemon plants/berries could be placed into pots
- Fixed party overlay not hiding when the player opens the Pokédex scanner
- Added compat for AppleSkin
- Fixed some display names having unintended font colours
- Fixed `hate_entity` task focusing on its own entity
- Thus enabled deadly warfare between Zangoose and Seviper
- Prehistoric Frozen Pond, Prehistoric Frozen Spike, and Prehistoric Lush Den now generate
- Fixed Frogadier floating in its battle_idle animation
- Fixed absence or incorrect mergers in spawning conditions, making max height/depth of conditions to use the min value instead
- Added stricter riding checks on server side to prevent possible packet forgery when player tries to ride pokemon
- Fixed Pokémon cries and animation sounds played from GUIs, such as the starter selection screen and the Pokédex, being tied to the Master volume slider instead of Friendly Creatures
- Fixed boat style mounts sprinting on their own after landing in water from jet flight
### Developer
- Bumped NeoForge to `21.1.195` to get access to MixinExtras `0.5` and the expressions annotation
@@ -50,6 +83,7 @@
### Molang & Datapacks
- Fixed `q.pokemon.nature` returning class instance instead of proper string value (`cobblemon:adamant`)
- Fixed `q.entity.is_looking_at` result being always `1` for whatever entity passed as target
- Added hate chance optional parameter to `hate_entity` task. `1.0` will make an entity always attack the target
### Localization
- Updated translations for:
@@ -60,8 +60,6 @@ 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.PlayerInstancedDataStoreManager
import com.cobblemon.mod.common.api.storage.player.PlayerInstancedDataStoreTypes
import com.cobblemon.mod.common.api.storage.player.adapter.BadgeMongoBackend
import com.cobblemon.mod.common.api.storage.player.adapter.BadgeNbtBackend
import com.cobblemon.mod.common.api.storage.player.adapter.DexDataMongoBackend
import com.cobblemon.mod.common.api.storage.player.adapter.DexDataNbtBackend
import com.cobblemon.mod.common.api.storage.player.adapter.PlayerDataJsonBackend
@@ -393,13 +391,10 @@ object Cobblemon {
val tmMoveFactory = CachedPlayerDataStoreFactory(TMMoveNbtBackend())
tmMoveFactory.setup(server)
val badgeFactory = CachedPlayerDataStoreFactory(BadgeNbtBackend())
badgeFactory.setup(server)
playerDataManager.setFactory(generalJsonFactory, PlayerInstancedDataStoreTypes.GENERAL)
playerDataManager.setFactory(pokedexNbtFactory, PlayerInstancedDataStoreTypes.POKEDEX)
playerDataManager.setFactory(tmMoveFactory, PlayerInstancedDataStoreTypes.TM_MOVES)
playerDataManager.setFactory(badgeFactory, PlayerInstancedDataStoreTypes.BADGES)
if (config.storageFormat == "nbt") {
NBTStoreAdapter(pokemonStoreRoot.absolutePath, useNestedFolders = true, folderPerClass = true)
@@ -430,15 +425,10 @@ object Cobblemon {
TMMoveMongoBackend(mongoClient, config.mongoDBDatabaseName, "TMMovesCollection")
)
tmMovesMongoFactory.setup(server)
val badgesMongoFactory = CachedPlayerDataStoreFactory(
BadgeMongoBackend(mongoClient, config.mongoDBDatabaseName, "BadgesCollection")
)
badgesMongoFactory.setup(server)
playerDataManager.setFactory(generalMongoFactory, PlayerInstancedDataStoreTypes.GENERAL)
playerDataManager.setFactory(pokedexMongoFactory, PlayerInstancedDataStoreTypes.POKEDEX)
playerDataManager.setFactory(tmMovesMongoFactory, PlayerInstancedDataStoreTypes.TM_MOVES)
playerDataManager.setFactory(badgesMongoFactory, PlayerInstancedDataStoreTypes.BADGES)
MongoDBStoreAdapter(mongoClient, config.mongoDBDatabaseName)
} catch (e: ClassNotFoundException) {
LOGGER.error("MongoDB driver not found.")
@@ -623,7 +613,6 @@ object Cobblemon {
this.implementation.registerCommandArgument(cobblemonResource("transform_type"), TransformTypeArgumentType::class, SingletonArgumentInfo.contextFree(TransformTypeArgumentType::transformType))
this.implementation.registerCommandArgument(cobblemonResource("model_part"), ModelPartArgumentType::class, SingletonArgumentInfo.contextFree(ModelPartArgumentType::modelPart))
this.implementation.registerCommandArgument(cobblemonResource("tm"), TmArgumentType::class, SingletonArgumentInfo.contextFree(TmArgumentType::tm))
this.implementation.registerCommandArgument(cobblemonResource("badge"), BadgeArgumentType::class, SingletonArgumentInfo.contextFree(BadgeArgumentType::badge))
}
}
@@ -73,7 +73,6 @@ object CobblemonCommands {
PcTakeCommand.register(dispatcher)
GiveTmCommand.register(dispatcher)
TmCommand.register(dispatcher)
BadgeCommand.register(dispatcher)
// Possibly lock down registration if and only if under dev environment or running in an environment
// with a certain system environment variable set
@@ -432,7 +432,6 @@ object CobblemonNetwork {
list.add(PacketRegisterInfo(SpeciesFeatureAssignmentSyncPacket.ID, SpeciesFeatureAssignmentSyncPacket::decode, DataRegistrySyncPacketHandler()))
list.add(PacketRegisterInfo(NaturalMaterialRegistrySyncPacket.ID, NaturalMaterialRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
list.add(PacketRegisterInfo(FossilRegistrySyncPacket.ID, FossilRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
list.add(PacketRegisterInfo(BadgeRegistrySyncPacket.ID, BadgeRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
list.add(PacketRegisterInfo(NPCRegistrySyncPacket.ID, NPCRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
list.add(PacketRegisterInfo(PokeRodRegistrySyncPacket.ID, PokeRodRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
list.add(PacketRegisterInfo(ScriptRegistrySyncPacket.ID, ScriptRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
@@ -9,6 +9,7 @@
package com.cobblemon.mod.common.api.ai.config.task
import com.bedrockk.molang.Expression
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
@@ -17,6 +18,7 @@ import com.cobblemon.mod.common.util.asExpression
import com.cobblemon.mod.common.util.mainThreadRuntime
import com.cobblemon.mod.common.util.resolveBoolean
import com.cobblemon.mod.common.util.withQueryValue
import com.cobblemon.mod.common.world.gamerules.CobblemonGameRules
import com.mojang.datafixers.util.Either
import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.ai.behavior.BehaviorControl
@@ -34,6 +36,8 @@ import net.minecraft.world.entity.ai.sensing.SensorType
class HateEntityTaskConfig : SingleTaskConfig {
val entityCondition: Expression = "true".asExpression()
val range: ExpressionOrEntityVariable = Either.left("24".asExpression())
val chance: Float = Cobblemon.config.predationChance
private val coercedChance = chance.coerceIn(0f, 1f)
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = emptyList<MoLangConfigVariable>()
override fun createTask(
@@ -43,24 +47,44 @@ class HateEntityTaskConfig : SingleTaskConfig {
val range = range.resolveFloat(behaviourConfigurationContext.runtime)
behaviourConfigurationContext.addMemories(
MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES,
MemoryModuleType.ANGRY_AT
MemoryModuleType.ANGRY_AT,
MemoryModuleType.ATTACK_TARGET
)
behaviourConfigurationContext.addSensors(SensorType.NEAREST_LIVING_ENTITIES)
return BehaviorBuilder.create { instance ->
instance.group(
instance.present(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES),
instance.registered(MemoryModuleType.ANGRY_AT)
).apply(instance) { entities, angryAt ->
instance.registered(MemoryModuleType.ANGRY_AT),
instance.registered(MemoryModuleType.ATTACK_TARGET),
).apply(instance) { entities, angryAt, attackTarget ->
Trigger { world, entity, _ ->
val target = instance.get(entities).findClosest {
mainThreadRuntime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
// bail if gamerule is disabled
if (!world.gameRules.getBoolean(CobblemonGameRules.DO_POKEMON_PREDATION)) return@Trigger false
val target = instance.get(entities).findClosest { hated ->
mainThreadRuntime.withQueryValue("entity", hated.asMostSpecificMoLangValue())
return@findClosest mainThreadRuntime.resolveBoolean(entityCondition)
}.orElse(null)
var shouldTrigger = false
if (target != null && target.distanceTo(entity) <= range) {
angryAt.set(target.uuid)
shouldTrigger = when {
// set always attacking if activity chance is equal to 1.0
coercedChance == 1f -> {
angryAt.set(target.uuid)
attackTarget.set(target)
true
}
// roll the dice in other way
coercedChance != 1f && world.random.nextFloat() < coercedChance -> {
angryAt.set(target.uuid)
attackTarget.set(target)
true
}
// fallback to peaceful behavior in unattended cases
else -> false
}
}
return@Trigger true
return@Trigger shouldTrigger
}
}
}
@@ -1,20 +0,0 @@
package com.cobblemon.mod.common.api.badges
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.StringRepresentable
class Badge(
identifier: ResourceLocation,
val name: String,
val texture: ResourceLocation,
val order: Int
): StringRepresentable {
@Transient
var identifier: ResourceLocation = identifier
internal set
override fun getSerializedName(): String {
return identifier.toString()
}
}
@@ -1,54 +0,0 @@
package com.cobblemon.mod.common.api.badges
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.CobblemonNetwork.sendPacket
import com.cobblemon.mod.common.api.storage.player.InstancedPlayerData
import com.cobblemon.mod.common.api.storage.player.PlayerInstancedDataStoreTypes
import com.cobblemon.mod.common.api.storage.player.client.ClientBadgeManager
import com.cobblemon.mod.common.net.messages.client.SetClientPlayerDataPacket
import com.cobblemon.mod.common.util.getPlayer
import com.mojang.serialization.Codec
import com.mojang.serialization.codecs.RecordCodecBuilder
import net.minecraft.resources.ResourceLocation
import java.util.UUID
class BadgeManager(
override val uuid: UUID,
val obtainedBadges: MutableSet<ResourceLocation> = mutableSetOf()
) : InstancedPlayerData {
val storeType = PlayerInstancedDataStoreTypes.BADGES
override fun toClientData() = ClientBadgeManager(obtainedBadges.toMutableSet())
fun give(badge: Badge): Boolean {
if (!obtainedBadges.add(badge.identifier)) return false
syncAndSave()
return true
}
fun remove(badge: Badge): Boolean {
if (!obtainedBadges.remove(badge.identifier)) return false
syncAndSave()
return true
}
private fun syncAndSave() {
uuid.getPlayer()?.sendPacket(SetClientPlayerDataPacket(storeType, toClientData()))
Cobblemon.playerDataManager.saveSingle(this, storeType)
}
companion object {
val CODEC: Codec<BadgeManager> = RecordCodecBuilder.create { instance ->
instance.group(
Codec.STRING.xmap(UUID::fromString, UUID::toString)
.fieldOf("uuid")
.forGetter { it.uuid },
Codec.list(ResourceLocation.CODEC)
.xmap({ it.toMutableSet() }, { it.toList() })
.fieldOf("obtainedBadges")
.forGetter { it.obtainedBadges }
).apply(instance, ::BadgeManager)
}
}
}
@@ -1,64 +0,0 @@
package com.cobblemon.mod.common.api.badges
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.data.JsonDataRegistry
import com.cobblemon.mod.common.api.reactive.SimpleObservable
import com.cobblemon.mod.common.net.messages.client.data.BadgeRegistrySyncPacket
import com.cobblemon.mod.common.util.adapters.IdentifierAdapter
import com.cobblemon.mod.common.util.cobblemonResource
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import net.minecraft.resources.ResourceLocation
import net.minecraft.server.level.ServerPlayer
import net.minecraft.server.packs.PackType
object Badges : JsonDataRegistry<Badge> {
override val id: ResourceLocation = cobblemonResource("badges")
override val type: PackType = PackType.SERVER_DATA
override val observable = SimpleObservable<Badges>()
override val gson: Gson = GsonBuilder()
.disableHtmlEscaping()
.setPrettyPrinting()
.registerTypeAdapter(ResourceLocation::class.java, IdentifierAdapter)
.create()
override val typeToken: TypeToken<Badge> = TypeToken.get(Badge::class.java)
override val resourcePath: String = "badges"
private val badges = hashMapOf<ResourceLocation, Badge>()
override fun reload(data: Map<ResourceLocation, Badge>) {
this.badges.clear()
data.forEach { (id, badge) ->
try {
badge.identifier = id
this.badges[id] = badge
} catch (e: Exception) {
Cobblemon.LOGGER.error("Skipped loading the {} badge", id, e)
}
}
Cobblemon.LOGGER.info("Loaded {} badges", this.badges.size)
this.observable.emit(this)
}
override fun sync(player: ServerPlayer) {
BadgeRegistrySyncPacket(this.all()).sendToPlayer(player)
}
/**
* Get all loaded [Badge]s.
*/
@JvmStatic
fun all() = this.badges.values.toList()
/**
* Gets a [Badge] by its [ResourceLocation].
* @param identifier The identifier of the badge.
* @return The [Badge], if loaded, otherwise null.
*/
@JvmStatic
fun getByIdentifier(identifier: ResourceLocation): Badge? = this.badges[identifier]
}
@@ -145,8 +145,6 @@ object CobblemonPermissions {
val SPECTATE_BATTLE = this.create("${COMMAND_PREFIX}spectatebattle", PermissionLevel.ALL_COMMANDS)
@JvmStatic
val TECHNICAL_MACHINE = this.create("${COMMAND_PREFIX}technicalmachine", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
@JvmStatic
val BADGE = this.create("${COMMAND_PREFIX}badge", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
@JvmStatic
val SEE_HIDDEN_NPCS = this.create("seehiddennpcs", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
@@ -88,7 +88,7 @@ fun getToolTipHeaderIcon(tradeEvolution: TradeEvolution): CobblemonDexEvolutionR
lang("ui.pokedex.evolution.trade.tooltip.with_any_species")
} else {
PokemonSpecies.getByIdentifier(species.asIdentifierDefaultingNamespace())
?.let { lang("ui.pokedex.evolution.trade.tooltip.with_species", it.translatedName.green()) }
?.let { lang("ui.pokedex.evolution.trade.tooltip.with_species", it.translatedName.plainCopy().green()) }
?: lang("ui.pokedex.evolution.trade.tooltip.with_any_species")
}
return CobblemonDexEvolutionRequirementDisplay(CobblemonItems.LINK_CABLE, tooltip)
@@ -282,7 +282,7 @@ fun buildLevelRequirement(levelRequirement: LevelRequirement): DexEvolutionRequi
fun buildMoonPhaseRequirement(moonPhaseRequirement: MoonPhaseRequirement): DexEvolutionRequirementDisplay {
val icon = Items.CLOCK
val moonPhaseComponent = moonPhaseRequirement.moonPhase.displayName().green()
val moonPhaseComponent = moonPhaseRequirement.moonPhase.displayName().plainCopy().green()
val tooltip = lang("ui.pokedex.requirement.moon_phase.tooltip", moonPhaseComponent)
return CobblemonDexEvolutionRequirementDisplay(icon, tooltip)
@@ -290,7 +290,7 @@ fun buildMoonPhaseRequirement(moonPhaseRequirement: MoonPhaseRequirement): DexEv
fun buildMoveSetRequirement(moveSetRequirement: MoveSetRequirement): DexEvolutionRequirementDisplay {
val icon = CobblemonItems.TECHNICAL_MACHINE
val tooltip = lang("ui.pokedex.requirement.has_move.tooltip", moveSetRequirement.move.displayName.green())
val tooltip = lang("ui.pokedex.requirement.has_move.tooltip", moveSetRequirement.move.displayName.plainCopy().green())
return CobblemonDexEvolutionRequirementDisplay(icon, tooltip)
}
@@ -319,7 +319,7 @@ fun buildMoveTypeRequirement(moveTypeRequirement: MoveTypeRequirement): DexEvolu
else -> CobblemonItems.NORMAL_GEM
}
val tooltip = lang("ui.pokedex.requirement.has_move_type.tooltip", moveTypeRequirement.type.displayName.green())
val tooltip = lang("ui.pokedex.requirement.has_move_type.tooltip", moveTypeRequirement.type.displayName.plainCopy().green())
return CobblemonDexEvolutionRequirementDisplay(icon, tooltip)
}
@@ -437,7 +437,7 @@ fun buildStructureRequirement(structureRequirement: StructureRequirement, negate
fun buildTimeRangeRequirement(timeRangeRequirement: TimeRangeRequirement): DexEvolutionRequirementDisplay? {
val icon = Items.CLOCK
val timeRangeComponent = timeRangeRequirement.range.displayName() ?: return null
val timeRangeComponent = timeRangeRequirement.range.displayName()?.plainCopy() ?: return null
val tooltip = lang("ui.pokedex.requirement.time_range.tooltip", timeRangeComponent.green())
return CobblemonDexEvolutionRequirementDisplay(icon, tooltip)
@@ -445,7 +445,7 @@ fun buildTimeRangeRequirement(timeRangeRequirement: TimeRangeRequirement): DexEv
fun buildUseMoveRequirement(useMoveRequirement: UseMoveRequirement): DexEvolutionRequirementDisplay {
val icon = CobblemonItems.CHOICE_BAND
val tooltip = lang("ui.pokedex.requirement.use_move.tooltip", useMoveRequirement.move.displayName.green())
val tooltip = lang("ui.pokedex.requirement.use_move.tooltip", useMoveRequirement.move.displayName.plainCopy().green())
return CobblemonDexEvolutionRequirementDisplay(icon, tooltip)
}
@@ -37,6 +37,7 @@ import com.cobblemon.mod.common.util.writeRidingStats
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min
import net.minecraft.client.Minecraft
import net.minecraft.core.BlockPos
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.util.Mth
@@ -94,12 +95,16 @@ class BoatBehaviour : RidingBehaviour<BoatSettings, BoatState> {
state.jumpBuffer.set(state.jumpBuffer.get() + 1)
}
// Only start sprinting on vehicle if the state has changed and the pokemon has atleast 1/3 stamina
if (driver.isSprinting && !state.isVehicleSprinting.get()) {
state.isVehicleSprinting.set(state.stamina.get() > 0.33f)
}
else if (!driver.isSprinting) {
state.isVehicleSprinting.set(false)
if (vehicle.level().isClientSide) {
// Check the keys instead of driver.isSprinting since that can still be true from a previous ride style
val tryingToSprint = Minecraft.getInstance().options.keySprint.isDown() && Minecraft.getInstance().options.keyUp.isDown()
// Only start sprinting on vehicle if the state has changed and the pokemon has atleast 1/3 stamina
if (tryingToSprint && !state.isVehicleSprinting.get()) {
state.isVehicleSprinting.set(state.stamina.get() > 0.33f)
}
else if (!tryingToSprint) {
state.isVehicleSprinting.set(false)
}
}
if (!state.isVehicleSprinting.get()) {
@@ -42,8 +42,8 @@ abstract class AreaTypeSpawningCondition<T : AreaSpawnablePosition> : SpawningCo
override fun copyFrom(other: SpawningCondition<*>, merger: Merger) {
super.copyFrom(other, merger)
if (other is AreaTypeSpawningCondition) {
merger.mergeSingle(minHeight, other.minHeight)
merger.mergeSingle(maxHeight, other.maxHeight)
minHeight = merger.mergeSingle(minHeight, other.minHeight)
maxHeight = merger.mergeSingle(maxHeight, other.maxHeight)
neededNearbyBlocks = merger.merge(neededNearbyBlocks, other.neededNearbyBlocks)?.toMutableList()
}
}
@@ -46,7 +46,7 @@ abstract class SubmergedTypeSpawningCondition<T : SubmergedSpawnablePosition> :
super.copyFrom(other, merger)
if (other is SubmergedTypeSpawningCondition) {
minDepth = merger.mergeSingle(minDepth, other.minDepth)
maxDepth = merger.mergeSingle(minDepth, other.minDepth)
maxDepth = merger.mergeSingle(maxDepth, other.maxDepth)
fluidIsSource = merger.mergeSingle(fluidIsSource, other.fluidIsSource)
fluid = merger.mergeSingle(fluid, other.fluid)
}
@@ -39,7 +39,7 @@ abstract class SurfaceTypeSpawningCondition<T : SurfaceSpawnablePosition> : Area
super.copyFrom(other, merger)
if (other is SurfaceTypeSpawningCondition) {
minDepth = merger.mergeSingle(minDepth, other.minDepth)
maxDepth = merger.mergeSingle(minDepth, other.minDepth)
maxDepth = merger.mergeSingle(maxDepth, other.maxDepth)
fluid = merger.mergeSingle(fluid, other.fluid)
}
}
@@ -29,12 +29,8 @@ object CobblemonStats {
@JvmField
val BATTLES_WON: CobblemonStat = CobblemonStat("battles_won")
@JvmField
val PVP_BATTLES_WON: CobblemonStat = CobblemonStat("pvp_battles_won")
@JvmField
val BATTLES_LOST: CobblemonStat = CobblemonStat("battles_lost")
@JvmField
val PVP_BATTLES_LOST: CobblemonStat = CobblemonStat("pvp_battles_lost")
@JvmField
val BATTLES_FLED: CobblemonStat = CobblemonStat("battles_fled")
@JvmField
val BATTLES_TOTAL: CobblemonStat = CobblemonStat("battles_total")
@@ -72,9 +68,7 @@ object CobblemonStats {
stats["evolved"] = EVOLVED
stats["level_up"] = LEVEL_UP
stats["battles_won"] = BATTLES_WON
stats["pvp_battles_won"] = PVP_BATTLES_WON
stats["battles_lost"] = BATTLES_LOST
stats["pvp_battles_lost"] = PVP_BATTLES_LOST
stats["battles_fled"] = BATTLES_FLED
stats["battles_total"] = BATTLES_TOTAL
stats["dex_entries"] = DEX_ENTRIES
@@ -10,7 +10,6 @@ package com.cobblemon.mod.common.api.storage.player
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.Cobblemon.MODID
import com.cobblemon.mod.common.api.badges.BadgeManager
import com.cobblemon.mod.common.api.pokedex.PokedexManager
import com.cobblemon.mod.common.api.scheduling.ScheduledTask
import com.cobblemon.mod.common.api.scheduling.ServerTaskTracker
@@ -77,14 +76,6 @@ open class PlayerInstancedDataStoreManager {
.infiniteIterations()
.tracker(ServerTaskTracker)
.build()
saveTasks[PlayerInstancedDataStoreTypes.BADGES] = ScheduledTask.Builder()
.execute { saveAllOfOneType(PlayerInstancedDataStoreTypes.BADGES) }
.delay(30F)
.interval(120F)
.infiniteIterations()
.tracker(ServerTaskTracker)
.build()
}
open fun get(playerId: UUID, dataType: PlayerInstancedDataStoreType): InstancedPlayerData {
@@ -157,9 +148,4 @@ open class PlayerInstancedDataStoreManager {
}
return data as TMMoveManager
}
fun getBadgeData(player: ServerPlayer): BadgeManager = getBadgeData(player.uuid)
fun getBadgeData(playerId: UUID): BadgeManager =
get(playerId, PlayerInstancedDataStoreTypes.BADGES) as BadgeManager
}
@@ -9,7 +9,6 @@
package com.cobblemon.mod.common.api.storage.player
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.storage.player.client.ClientBadgeManager
import com.cobblemon.mod.common.api.storage.player.client.ClientPokedexManager
import com.cobblemon.mod.common.api.storage.player.client.ClientGeneralPlayerData
import com.cobblemon.mod.common.api.storage.player.client.ClientTMMoveManager
@@ -36,12 +35,6 @@ object PlayerInstancedDataStoreTypes {
ClientTMMoveManager::runAction,
ClientTMMoveManager::runIncremental
))
val BADGES = register(PlayerInstancedDataStoreType(
cobblemonResource("badge_collection"),
ClientBadgeManager::decode,
ClientBadgeManager::runAction,
ClientBadgeManager::runIncremental
))
fun register(type: PlayerInstancedDataStoreType): PlayerInstancedDataStoreType {
Cobblemon.LOGGER.debug("Registering PlayerInstancedDataStoreType: {}", type.id)
@@ -1,38 +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.storage.player.adapter
import com.cobblemon.mod.common.api.badges.BadgeManager
import com.cobblemon.mod.common.api.storage.player.PlayerInstancedDataStoreTypes
import com.cobblemon.mod.common.util.adapters.CodecBackedAdapter
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import com.mongodb.client.MongoClient
import java.util.UUID
class BadgeMongoBackend(
mongoClient: MongoClient,
databaseName: String,
collectionName: String
) : MongoBackedPlayerDataStoreBackend<BadgeManager>(
mongoClient,
databaseName,
collectionName,
PlayerInstancedDataStoreTypes.BADGES
) {
override val gson = GsonBuilder()
.registerTypeAdapter(BadgeManager::class.java, CodecBackedAdapter(BadgeManager.CODEC))
.create()
override val classToken = TypeToken.get(BadgeManager::class.java)
override val defaultData = defaultDataFunc
companion object {
val defaultDataFunc = { uuid: UUID -> BadgeManager(uuid) }
}
}
@@ -1,22 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.storage.player.adapter
import com.cobblemon.mod.common.api.badges.BadgeManager
import com.cobblemon.mod.common.api.storage.player.PlayerInstancedDataStoreTypes
import java.util.UUID
class BadgeNbtBackend : NbtBackedPlayerData<BadgeManager>("badges", PlayerInstancedDataStoreTypes.BADGES) {
override val codec = BadgeManager.CODEC
override val defaultData = defaultDataFunc
companion object {
val defaultDataFunc = { uuid: UUID -> BadgeManager(uuid) }
}
}
@@ -52,7 +52,7 @@ abstract class FileBasedPlayerDataStoreBackend<T : InstancedPlayerData>(
val playerFile = filePath(uuid)
val playerFileOld = filePath(uuid, OLD_FILE_EXTENSION)
playerFile.parentFile.mkdirs()
val loadFallback: (Boolean) -> T = { primaryFileCorrupt ->
val loadFallback: () -> T = {
playerFile.delete()
if (playerFileOld.exists() && playerFileOld.length() > 0L) {
try {
@@ -68,9 +68,7 @@ abstract class FileBasedPlayerDataStoreBackend<T : InstancedPlayerData>(
}
}
else {
if (primaryFileCorrupt) {
Cobblemon.LOGGER.error(".old File $subfolder for $uuid is corrupt or missing. Data is lost")
}
Cobblemon.LOGGER.error(".old File $subfolder for $uuid is corrupt or missing. Data is lost")
playerFileOld.delete()
defaultData.invoke(uuid).also(::save)
}
@@ -82,10 +80,10 @@ abstract class FileBasedPlayerDataStoreBackend<T : InstancedPlayerData>(
catch (e: Exception) {
Cobblemon.LOGGER.warn("Failed to load $subfolder for $uuid due to ${e.message}")
Cobblemon.LOGGER.warn(e)
loadFallback(true)
loadFallback()
}
} else {
loadFallback(false)
loadFallback()
}.also { it.initialize() }
}
@@ -1,42 +0,0 @@
package com.cobblemon.mod.common.api.storage.player.client
import com.cobblemon.mod.common.api.storage.player.PlayerInstancedDataStoreTypes
import com.cobblemon.mod.common.client.CobblemonClient
import com.cobblemon.mod.common.net.messages.client.SetClientPlayerDataPacket
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.resources.ResourceLocation
class ClientBadgeManager(
val obtainedBadges: MutableSet<ResourceLocation>
) : ClientInstancedPlayerData {
override fun encode(buf: RegistryFriendlyByteBuf) {
buf.writeCollection(obtainedBadges) { _, id, -> buf.writeString(id.toString()) }
}
companion object {
fun decode(buf: RegistryFriendlyByteBuf): SetClientPlayerDataPacket {
val badges = buf.readCollection(
{ mutableSetOf<ResourceLocation>() },
{ buf.readString().let(ResourceLocation::tryParse) ?: ResourceLocation("minecraft", "empty") }
)
return SetClientPlayerDataPacket(
PlayerInstancedDataStoreTypes.BADGES,
ClientBadgeManager(badges)
)
}
fun runAction(data: ClientInstancedPlayerData) {
if (data !is ClientBadgeManager) return
CobblemonClient.clientBadgeData = data
}
fun runIncremental(data: ClientInstancedPlayerData) {
if (data !is ClientBadgeManager) return
CobblemonClient.clientBadgeData.obtainedBadges.addAll(data.obtainedBadges)
}
}
}
@@ -17,12 +17,12 @@ import com.cobblemon.mod.common.CobblemonItems
import com.cobblemon.mod.common.CobblemonMenuType
import com.cobblemon.mod.common.api.berry.Berries
import com.cobblemon.mod.common.api.scheduling.ClientTaskTracker
import com.cobblemon.mod.common.api.storage.player.client.ClientBadgeManager
import com.cobblemon.mod.common.api.storage.player.client.ClientGeneralPlayerData
import com.cobblemon.mod.common.api.storage.player.client.ClientPokedexManager
import com.cobblemon.mod.common.api.storage.player.client.ClientTMMoveManager
import com.cobblemon.mod.common.api.tags.CobblemonItemTags
import com.cobblemon.mod.common.block.entity.TintBlockEntity
import com.cobblemon.mod.common.block.sign.CobblemonSignBlock
import com.cobblemon.mod.common.client.battle.ClientBattle
import com.cobblemon.mod.common.client.gui.PartyOverlay
import com.cobblemon.mod.common.client.gui.PartyOverlayDataControl
@@ -101,7 +101,6 @@ object CobblemonClient {
var clientPlayerData = ClientGeneralPlayerData()
var clientPokedexData = ClientPokedexManager(mutableMapOf())
var clientTMMoveData = ClientTMMoveManager(mutableSetOf())
var clientBadgeData = ClientBadgeManager(mutableSetOf())
/** If true then we won't bother them anymore about choosing a starter even if it's a thing they can do. */
var checkedStarterScreen = false
@@ -119,7 +118,6 @@ object CobblemonClient {
teamData = ClientPlayerTeamData()
clientPokedexData = ClientPokedexManager(mutableMapOf())
clientTMMoveData = ClientTMMoveManager(mutableSetOf())
clientBadgeData = ClientBadgeManager(mutableSetOf())
storage.onLogin()
// CobblemonDataProvider.canReload = false
}
@@ -1,167 +0,0 @@
package com.cobblemon.mod.common.client.gui.trainercard
import com.cobblemon.mod.common.api.badges.Badge
import com.cobblemon.mod.common.api.gui.blitk
import com.cobblemon.mod.common.client.CobblemonClient
import com.cobblemon.mod.common.client.gui.ScrollingWidget
import com.cobblemon.mod.common.client.gui.pokedex.renderTooltip
import com.cobblemon.mod.common.util.lang
import net.minecraft.client.gui.GuiGraphics
import net.minecraft.network.chat.Component
import net.minecraft.network.chat.MutableComponent
import net.minecraft.util.FastColor
import net.minecraft.util.Mth
class BadgesScrollingWidget(
x: Int,
y: Int,
width: Int,
height: Int,
private val columns: Int
) : ScrollingWidget<BadgesScrollingWidget.BadgeRow>(
width = width,
height = height,
left = x,
top = y - height,
slotHeight = SLOT_SIZE + SLOT_SPACING
) {
private var tooltip: MutableComponent? = null
private var tooltipX = 0
private var tooltipY = 0
companion object {
const val SLOT_SIZE = 16
const val SLOT_SPACING = 3
const val MAX_VISIBLE_ROWS = 2
}
fun createEntries(badges: List<Badge>) {
val obtainedBadgeList = badges.filter { CobblemonClient.clientBadgeData.obtainedBadges.contains(it.identifier) }
.sortedBy { it.order }
val unobtainedBadgesList = badges.filter { !obtainedBadgeList.contains(it) }
.sortedBy { it.order }
val sortedBadgeList = obtainedBadgeList.plus(unobtainedBadgesList)
sortedBadgeList.chunked(columns).forEach { listChunk ->
addEntry(BadgeRow(this, listChunk))
}
}
private val visibleRows: Int
get() = (height / itemHeight).coerceAtLeast(1)
private fun hasScrollbar(): Boolean = children().size > visibleRows
override fun getRowLeft(): Int = if (hasScrollbar()) left + 1 else left
override fun getScrollbarPosition(): Int = rowLeft + width - 3
override fun renderWidget(context: GuiGraphics, mouseX: Int, mouseY: Int, delta: Float) {
tooltip = null
super.renderWidget(context, mouseX, mouseY, delta)
tooltip?.let { renderTooltip(context, it, tooltipX, tooltipY, delta) }
}
fun setTooltip(text: MutableComponent, mouseX: Int, mouseY: Int) {
if (mouseX in left until left + width && mouseY in this.y until bottom) {
tooltip = text
tooltipX = mouseX + 20
tooltipY = mouseY - 10
}
}
override fun renderScrollbar(context: GuiGraphics, mouseX: Int, mouseY: Int, delta: Float) {
if (hasScrollbar()) {
val xLeft = this.scrollbarPosition
val xRight = xLeft + 3
val barHeight = this.bottom - this.y
var yBottom = ((barHeight * barHeight).toFloat() / this.maxPosition.toFloat()).toInt()
yBottom = Mth.clamp(yBottom, minOf(32, barHeight), maxOf(minOf(32, barHeight), barHeight - 8))
var yTop = scrollAmount.toInt() * (barHeight - yBottom) / this.maxScroll + this.y
if (yTop < this.y) {
yTop = this.y
}
context.fill(xLeft, this.y, xRight, this.bottom, FastColor.ARGB32.color(255, 75, 75, 75))
context.fill(xLeft, yTop, xRight, yTop + yBottom, FastColor.ARGB32.color(255, 141, 141, 141))
}
}
private fun renderEntry(context: GuiGraphics, mouseX: Int, mouseY: Int, index: Int, x: Int, y: Int) {
getEntry(index).renderRow(context, y, x, mouseX, mouseY)
}
override fun renderListItems(context: GuiGraphics, mouseX: Int, mouseY: Int, delta: Float) {
val rowX = rowLeft
for (index in 0 until this.itemCount) {
val rowY = this.getRowTop(index)
val o = this.getRowBottom(index)
if (o >= this.y && rowY <= this.bottom) {
this.renderEntry(context, mouseX, mouseY, index, rowX, rowY)
}
}
}
override fun mouseDragged(mouseX: Double, mouseY: Double, button: Int, dragX: Double, dragY: Double): Boolean =
if (hasScrollbar()) super.mouseDragged(mouseX, mouseY, button, dragX, dragY) else true
override fun mouseScrolled(mouseX: Double, mouseY: Double, scrollX: Double, scrollY: Double): Boolean =
if (hasScrollbar()) super.mouseScrolled(mouseX, mouseY, scrollX, scrollY) else true
class BadgeRow(
val parent: BadgesScrollingWidget,
val badgeList: List<Badge?>
) : Slot<BadgeRow>() {
fun renderRow(context: GuiGraphics, y: Int, x: Int, mouseX: Int, mouseY: Int) {
badgeList.forEachIndexed { index, badge ->
val startPosX = x + ((SLOT_SPACING + SLOT_SIZE) * index)
val startPosY = y + SLOT_SPACING
if (badge != null) {
val obtained = CobblemonClient.clientBadgeData.obtainedBadges.contains(badge.identifier)
blitk(
matrixStack = context.pose(),
texture = badge.texture,
x = startPosX,
y = startPosY,
width = SLOT_SIZE,
height = SLOT_SIZE,
red = if (obtained) 1 else 0,
green = if (obtained) 1 else 0,
blue = if (obtained) 1 else 0
)
if (mouseX in startPosX until startPosX + SLOT_SIZE &&
mouseY in startPosY until startPosY + SLOT_SIZE
) {
parent.setTooltip(
if (obtained) Component.translatable(badge.name) else lang("badge.unobtained"),
mouseX, mouseY
)
}
}
}
}
override fun getNarration(): Component? {
return badgeList.firstOrNull()?.let { Component.translatable(it.name) }
}
override fun render(
guiGraphics: GuiGraphics,
index: Int,
top: Int,
left: Int,
width: Int,
height: Int,
mouseX: Int,
mouseY: Int,
hovering: Boolean,
partialTick: Float
) {}
}
}
@@ -1,221 +0,0 @@
package com.cobblemon.mod.common.client.gui.trainercard
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.badges.Badges
import com.cobblemon.mod.common.api.pokedex.CaughtCount
import com.cobblemon.mod.common.api.stats.CobblemonStats.getStat
import com.cobblemon.mod.common.api.text.text
import com.cobblemon.mod.common.client.CobblemonClient
import com.cobblemon.mod.common.client.gui.CobblemonRenderable
import com.cobblemon.mod.common.client.render.drawScaledText
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.lang
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.GuiGraphics
import net.minecraft.client.gui.components.Button
import net.minecraft.client.gui.screens.Screen
import net.minecraft.client.gui.screens.inventory.InventoryScreen
import net.minecraft.client.sounds.SoundManager
import net.minecraft.network.chat.Component
import net.minecraft.network.protocol.game.ServerboundClientCommandPacket
import net.minecraft.stats.Stats
import net.minecraft.util.CommonColors
import kotlin.math.ceil
class TrainerCardMenu : Screen(
Component.translatable("cobblemon.ui.trainercard.title")
), CobblemonRenderable {
private var elapsedTicks = 0
private var lastSyncedTimePlayed = 0
private var panelLeft = 0
private var panelTop = 0
private lateinit var badgeScrollList: BadgesScrollingWidget
private lateinit var leftPageArrow: TrainerCardPageArrow
private lateinit var rightPageArrow: TrainerCardPageArrow
private var currentPage = 0
private val maxPages = 3
override fun isPauseScreen(): Boolean = false
override fun init() {
super.init()
elapsedTicks = 0
lastSyncedTimePlayed = getTimePlayed()
// stats need to update when we open the menu, otherwise time played only updates when stats menu is opened
Minecraft.getInstance().connection?.send(
ServerboundClientCommandPacket(ServerboundClientCommandPacket.Action.REQUEST_STATS)
)
val badges = Badges.all().sortedBy { it.order }
val panelWidth = minOf(220, (width - 16).coerceAtLeast(1))
panelLeft = (width - panelWidth) / 2
val leftColumnWidth = panelWidth / 2
val badgeAreaWidth = panelWidth - leftColumnWidth - 8
val columns = ((badgeAreaWidth + BadgesScrollingWidget.SLOT_SPACING) /
(BadgesScrollingWidget.SLOT_SIZE + BadgesScrollingWidget.SLOT_SPACING)).coerceIn(1, 4)
val badgeWidth = columns * BadgesScrollingWidget.SLOT_SIZE +
(columns - 1) * BadgesScrollingWidget.SLOT_SPACING + 4
val rowCount = ceil(badges.size.toDouble() / columns).toInt().coerceAtLeast(1)
val rowHeight = BadgesScrollingWidget.SLOT_SIZE + BadgesScrollingWidget.SLOT_SPACING
val badgeHeight = minOf(rowCount, BadgesScrollingWidget.MAX_VISIBLE_ROWS) * rowHeight
val panelHeight = maxOf(92, badgeHeight + 20)
panelTop = ((height - panelHeight) / 2).coerceAtLeast(8)
badgeScrollList = BadgesScrollingWidget(
x = panelLeft + panelWidth - badgeWidth,
y = panelTop + 10,
width = badgeWidth,
height = badgeHeight,
columns = columns
)
badgeScrollList.createEntries(badges)
addRenderableWidget(badgeScrollList)
leftPageArrow = TrainerCardPageArrow(
buttonX = panelLeft - 10,
buttonY = panelTop,
width = 16,
height = 16,
onPress = {},
parent = this,
isRight = false
)
rightPageArrow = TrainerCardPageArrow(
buttonX = panelLeft + panelWidth + 10,
buttonY = panelTop,
width = 16,
height = 16,
onPress = {},
parent = this,
isRight = true
)
addRenderableWidget(leftPageArrow)
addRenderableWidget(rightPageArrow)
}
override fun tick() {
super.tick()
// make our own live playtime update, otherwise we have to send a packet a second to retrieve the playtime stat
val timePlayed = getTimePlayed()
if (timePlayed != lastSyncedTimePlayed) {
lastSyncedTimePlayed = timePlayed
elapsedTicks = 0
} else { elapsedTicks++ }
}
override fun render(context: GuiGraphics, mouseX: Int, mouseY: Int, partialTick: Float) {
when(currentPage) {
0 -> {
val portraitX = panelLeft
val portraitY = minOf(panelTop + 48, (height - 32).coerceAtLeast(0))
val portraitSize = 30
val statsTextWidth = (badgeScrollList.x - panelLeft - 8).coerceAtLeast(1)
val player = Minecraft.getInstance().player ?: return // unsure of why this would ever not return a player but if you're here maybe it's because it did
val entity = Minecraft.getInstance().level?.getPlayerByUUID(player.uuid) ?: return
context.enableScissor(portraitX, portraitY, portraitX + portraitSize, portraitY + portraitSize)
InventoryScreen.renderEntityInInventoryFollowsMouse(context,
portraitX, portraitY, portraitX + portraitSize, portraitY + portraitSize, 28, 0.5f, mouseX.toFloat(), mouseY.toFloat(),
entity
)
context.disableScissor()
val totalSeconds = (getTimePlayed() + elapsedTicks) / 20
val timePlayed = "%d:%02d:%02d:%02d".format(
totalSeconds / 86_400, // days
totalSeconds % 86_400 / 3_600, // hours
totalSeconds % 3_600 / 60, // minutes
totalSeconds % 60 // seconds
)
drawScaledText(
context = context,
text = lang("ui.trainermenu.timeplayed", timePlayed),
x = panelLeft,
y = panelTop + 4,
maxCharacterWidth = statsTextWidth
)
drawScaledText(
context = context,
text = lang("ui.trainermenu.pokemon_registered",
CobblemonClient.clientPokedexData.getDexCalculatedValue(cobblemonResource("national"), CaughtCount)),
x = panelLeft,
y = panelTop + 14,
maxCharacterWidth = statsTextWidth
)
val playerBattlesWon = player.stats.getValue(Stats.CUSTOM.get(getStat(Cobblemon.statistics.PVP_BATTLES_WON)))
val playerBattlesLost = player.stats.getValue(Stats.CUSTOM.get(getStat(Cobblemon.statistics.PVP_BATTLES_LOST)))
if (playerBattlesWon > 0 || playerBattlesLost > 0) {
drawScaledText(
context = context,
text = lang("ui.trainermenu.battle_stats",
playerBattlesWon,
playerBattlesLost
),
x = panelLeft,
y = panelTop + 24,
maxCharacterWidth = statsTextWidth
)
}
badgeScrollList.render(context, mouseX, mouseY, partialTick)
}
}
drawScaledText(
context = context,
text = Component.literal("$currentPage"),
x = panelLeft - 30,
y = panelTop
)
if (leftPageArrow.shouldExist()) {
leftPageArrow.render(context, mouseX, mouseY, partialTick)
}
if (rightPageArrow.shouldExist()) {
rightPageArrow.render(context, mouseX, mouseY, partialTick)
}
}
private class TrainerCardPageArrow(
buttonX: Int,
buttonY: Int, width: Int, height: Int, onPress: OnPress,
val parent: TrainerCardMenu,
val isRight: Boolean
): Button(
buttonX, buttonY, width, height, "".text(), onPress, DEFAULT_NARRATION
) {
fun shouldExist(): Boolean {
if (isRight && parent.currentPage == parent.maxPages - 1) return false
if (!isRight && parent.currentPage == 0) return false
return true
}
override fun renderWidget(context: GuiGraphics, mouseX: Int, mouseY: Int, partialTick: Float) {
context.fill(x, y, x + width, y + height, CommonColors.WHITE)
}
override fun playDownSound(handler: SoundManager) {
if (shouldExist()) super.playDownSound(handler)
}
override fun onClick(mouseX: Double, mouseY: Double) {
if (!shouldExist()) return
parent.currentPage += if (isRight) 1 else -1
}
}
private fun getTimePlayed(): Int =
Minecraft.getInstance().player?.stats?.getValue(Stats.CUSTOM.get(Stats.PLAY_TIME)) ?: 0
}
@@ -39,7 +39,6 @@ object CobblemonKeyBinds {
val PARTY_OVERLAY_UP = this.queue(UpShiftPartyBinding)
val SEND_OUT_POKEMON = this.queue(PartySendBinding)
val RIDING_FREELOOK = this.queue(RidingFreelookBinding)
val TRAINER_MENU = this.queue(TrainerMenuBinding)
fun register(registrar: (KeyMapping) -> Unit) {
this.keyBinds.forEach(registrar::invoke)
@@ -1,29 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.client.keybind.keybinds
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.client.CobblemonClient
import com.cobblemon.mod.common.client.gui.summary.Summary
import com.cobblemon.mod.common.client.gui.trainercard.TrainerCardMenu
import com.cobblemon.mod.common.client.keybind.CobblemonPartyLockedKeyBinding
import com.cobblemon.mod.common.client.keybind.KeybindCategories
import com.mojang.blaze3d.platform.InputConstants
import net.minecraft.client.Minecraft
object TrainerMenuBinding : CobblemonPartyLockedKeyBinding(
"key.cobblemon.trainermenu",
InputConstants.Type.KEYSYM,
InputConstants.KEY_N,
KeybindCategories.COBBLEMON_CATEGORY
) {
override fun onPress() {
Minecraft.getInstance().setScreen(TrainerCardMenu())
}
}
@@ -34,6 +34,7 @@ import com.cobblemon.mod.common.client.render.models.blockbench.bedrock.animatio
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.client.render.models.blockbench.quirk.ModelQuirk
import com.cobblemon.mod.common.client.render.models.blockbench.quirk.QuirkData
import com.cobblemon.mod.common.client.sound.instances.UIEntitySoundInstance
import com.cobblemon.mod.common.entity.PosableEntity
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
@@ -44,7 +45,6 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException
import java.util.concurrent.ConcurrentLinkedQueue
import net.minecraft.client.Minecraft
import net.minecraft.client.multiplayer.ClientLevel
import net.minecraft.client.resources.sounds.SimpleSoundInstance
import net.minecraft.commands.arguments.item.ItemParser
import net.minecraft.sounds.SoundEvent
import net.minecraft.world.entity.Entity
@@ -289,7 +289,7 @@ abstract class PosableState : Schedulable {
entity.level().playLocalSound(entity, soundEvent, entity.soundSource, volume, pitch)
}
} else {
Minecraft.getInstance().soundManager.play(SimpleSoundInstance.forUI(soundEvent, volume, pitch))
Minecraft.getInstance().soundManager.play(UIEntitySoundInstance(soundEvent, volume, pitch))
}
}
}
@@ -19,6 +19,7 @@ import com.cobblemon.mod.common.client.render.models.blockbench.PosableState
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Bone
import com.cobblemon.mod.common.client.render.models.blockbench.repository.RenderContext
import com.cobblemon.mod.common.client.sound.instances.AlphaCrySoundInstance
import com.cobblemon.mod.common.client.sound.instances.UIEntitySoundInstance
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.util.effectiveName
import com.cobblemon.mod.common.util.genericRuntime
@@ -31,7 +32,6 @@ import net.minecraft.client.Minecraft
import net.minecraft.client.model.geom.ModelPart
import net.minecraft.client.multiplayer.ClientLevel
import net.minecraft.client.resources.sounds.EntityBoundSoundInstance
import net.minecraft.client.resources.sounds.SimpleSoundInstance
import net.minecraft.resources.ResourceLocation
import net.minecraft.sounds.SoundEvent
import net.minecraft.world.entity.Entity
@@ -121,7 +121,7 @@ class BedrockSoundKeyframe(
}
}
} else {
Minecraft.getInstance().soundManager.play(SimpleSoundInstance.forUI(soundEvent, 1F, 1F))
Minecraft.getInstance().soundManager.play(UIEntitySoundInstance(soundEvent))
}
}
}
@@ -12,6 +12,7 @@ import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonP
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.util.asExpressionLike
import net.minecraft.client.model.geom.ModelPart
import net.minecraft.world.phys.Vec3
@@ -28,6 +29,8 @@ class MasquerainModel(root: ModelPart) : PokemonPosableModel(root), HeadedFrame
lateinit var walk: Pose
lateinit var standing: Pose
override fun registerPoses() {
animations["cry"] = "q.bedrock_stateful('masquerain', 'cry')".asExpressionLike()
val blink = quirk { bedrockStateful("masquerain", "blink") }
standing = registerPose(
poseName = "standing",
@@ -14,6 +14,7 @@ import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonP
import com.cobblemon.mod.common.client.render.models.blockbench.pose.ModelPartTransformation
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.util.asExpressionLike
import com.cobblemon.mod.common.util.isInWater
import net.minecraft.client.model.geom.ModelPart
import net.minecraft.world.phys.Vec3
@@ -36,6 +37,8 @@ class SurskitModel(root: ModelPart) : PokemonPosableModel(root), HeadedFrame {
val wateroffset = -8
override fun registerPoses() {
animations["cry"] = "q.bedrock_stateful('surskit', 'cry')".asExpressionLike()
val blink = quirk { bedrockStateful("surskit", "blink") }
standing = registerPose(
poseName = "standing",
@@ -14,6 +14,7 @@ import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonP
import com.cobblemon.mod.common.client.render.models.blockbench.pose.ModelPartTransformation
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.util.asExpressionLike
import net.minecraft.client.model.geom.ModelPart
import net.minecraft.world.phys.Vec3
@@ -36,6 +37,8 @@ class CombeeModel (root: ModelPart) : PokemonPosableModel(root) {
val shoulderZOffset = 8
override fun registerPoses() {
animations["cry"] = "q.bedrock_stateful('combee', 'cry')".asExpressionLike()
val blink1 = quirk { bedrockStateful("combee", "blink_right") }
val blink2 = quirk { bedrockStateful("combee", "blink_gender") }
val blink3 = quirk { bedrockStateful("combee", "blink_left") }
@@ -12,6 +12,7 @@ import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonP
import com.cobblemon.mod.common.client.render.models.blockbench.PosableState
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType
import com.cobblemon.mod.common.util.asExpressionLike
import net.minecraft.client.model.geom.ModelPart
import net.minecraft.world.phys.Vec3
@@ -30,6 +31,8 @@ class VespiquenModel (root: ModelPart) : PokemonPosableModel(root) {
lateinit var standing: Pose
override fun registerPoses() {
animations["cry"] = "q.bedrock_stateful('vespiquen', 'cry')".asExpressionLike()
val blink1 = quirk { bedrockStateful("vespiquen", "blink") }
val wingsleep = quirk { bedrockStateful("vespiquen", "sleep_flap") }
@@ -1,62 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen5
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType
import net.minecraft.client.model.geom.ModelPart
import net.minecraft.world.phys.Vec3
class SerperiorModel (root: ModelPart) : PokemonPosableModel(root), HeadedFrame {
override val rootPart = root.registerChildWithAllChildren("serperior")
override val head = getPart("head_ai")
override var portraitScale = 2.5F
override var portraitTranslation = Vec3(-0.3, 1.25, 0.0)
override var profileScale = 0.6F
override var profileTranslation = Vec3(0.0, 0.8, 0.0)
lateinit var standing: Pose
lateinit var walk: Pose
lateinit var sleep: Pose
override val cryAnimation = CryProvider { bedrockStateful("serperior", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("serperior", "blink") }
sleep = registerPose(
poseType = PoseType.SLEEP,
animations = arrayOf(bedrock("serperior", "sleep"))
)
standing = registerPose(
poseName = "standing",
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES,
quirks = arrayOf(blink),
animations = arrayOf(
singleBoneLook(),
bedrock("serperior", "ground_idle")
)
)
walk = registerPose(
poseName = "walk",
poseTypes = PoseType.MOVING_POSES,
quirks = arrayOf(blink),
animations = arrayOf(
singleBoneLook(),
bedrock("serperior", "ground_walk")
)
)
}
}
@@ -1,70 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen5
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BimanualFrame
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BipedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType
import net.minecraft.client.model.geom.ModelPart
import net.minecraft.world.phys.Vec3
class ServineModel (root: ModelPart) : PokemonPosableModel(root), HeadedFrame, BipedFrame, BimanualFrame {
override val rootPart = root.registerChildWithAllChildren("servine")
override val head = getPart("head_ai")
override val rightArm = getPart("arm_right")
override val leftArm = getPart("arm_left")
override val rightLeg = getPart("leg_right")
override val leftLeg = getPart("leg_left")
override var portraitScale = 2.6F
override var portraitTranslation = Vec3(-0.15, 0.75, 0.0)
override var profileScale = 0.8F
override var profileTranslation = Vec3(0.0, 0.55, 0.0)
lateinit var sleep: Pose
lateinit var standing: Pose
lateinit var walk: Pose
override val cryAnimation = CryProvider { bedrockStateful("servine", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("servine", "blink") }
sleep = registerPose(
poseType = PoseType.SLEEP,
transformTicks = 10,
animations = arrayOf(bedrock("servine", "sleep"))
)
standing = registerPose(
poseName = "standing",
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES,
transformTicks = 10,
quirks = arrayOf(blink),
animations = arrayOf(
singleBoneLook(),
bedrock("servine", "ground_idle")
)
)
walk = registerPose(
poseName = "walking",
poseTypes = PoseType.MOVING_POSES,
transformTicks = 10,
quirks = arrayOf(blink),
animations = arrayOf(
singleBoneLook(),
bedrock("servine", "ground_walk")
)
)
}
}
@@ -1,70 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen5
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BimanualFrame
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BipedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType
import net.minecraft.client.model.geom.ModelPart
import net.minecraft.world.phys.Vec3
class SnivyModel (root: ModelPart) : PokemonPosableModel(root), HeadedFrame, BipedFrame, BimanualFrame {
override val rootPart = root.registerChildWithAllChildren("snivy")
override val head = getPart("head_ai")
override val rightArm = getPart("arm_right")
override val leftArm = getPart("arm_left")
override val rightLeg = getPart("leg_right")
override val leftLeg = getPart("leg_left")
override var portraitScale = 2.0F
override var portraitTranslation = Vec3(-0.15, 0.32, 0.0)
override var profileScale = 0.8F
override var profileTranslation = Vec3(0.0, 0.55, 0.0)
lateinit var sleep: Pose
lateinit var standing: Pose
lateinit var walk: Pose
override val cryAnimation = CryProvider { bedrockStateful("snivy", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("snivy", "blink") }
sleep = registerPose(
poseType = PoseType.SLEEP,
transformTicks = 10,
animations = arrayOf(bedrock("snivy", "sleep"))
)
standing = registerPose(
poseName = "standing",
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES,
transformTicks = 10,
quirks = arrayOf(blink),
animations = arrayOf(
singleBoneLook(),
bedrock("snivy", "ground_idle")
)
)
walk = registerPose(
poseName = "walking",
poseTypes = PoseType.MOVING_POSES,
transformTicks = 10,
quirks = arrayOf(blink),
animations = arrayOf(
singleBoneLook(),
bedrock("snivy", "ground_walk")
)
)
}
}
@@ -1,85 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen6
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
import com.cobblemon.mod.common.entity.PoseType
import net.minecraft.client.model.geom.ModelPart
import net.minecraft.world.phys.Vec3
class GourgeistModel (root: ModelPart) : PokemonPosableModel(root), HeadedFrame {
override val rootPart = root.registerChildWithAllChildren("gourgeist")
override val head = getPart("head")
override var portraitScale = 4.0F
override var portraitTranslation = Vec3(-0.1, 0.6, 0.0)
override var profileScale = 0.8F
override var profileTranslation = Vec3(0.0, 0.55, 0.0)
lateinit var standing: Pose
lateinit var walk: Pose
lateinit var hovering: Pose
lateinit var fly: Pose
lateinit var sleep: Pose
override val cryAnimation = CryProvider { bedrockStateful("gourgeist", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("gourgeist", "blink") }
standing = registerPose(
poseName = "standing",
poseTypes = PoseType.UI_POSES + PoseType.STAND,
quirks = arrayOf(blink),
animations = arrayOf(
singleBoneLook(),
bedrock("gourgeist", "ground_idle")
)
)
walk = registerPose(
poseName = "walk",
poseType = PoseType.WALK,
quirks = arrayOf(blink),
animations = arrayOf(
bedrock("gourgeist", "ground_walk")
)
)
hovering = registerPose(
poseName = "hovering",
poseType = PoseType.HOVER,
quirks = arrayOf(blink),
animations = arrayOf(
bedrock("gourgeist", "air_idle")
)
)
fly = registerPose(
poseName = "fly",
poseType = PoseType.FLY,
quirks = arrayOf(blink),
animations = arrayOf(
bedrock("gourgeist", "air_fly")
)
)
sleep = registerPose(
poseName = "sleep",
poseType = PoseType.SLEEP,
quirks = arrayOf(blink),
animations = arrayOf(
bedrock("gourgeist", "sleep")
)
)
}
}
@@ -1,77 +0,0 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen6
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
import com.cobblemon.mod.common.client.render.models.blockbench.pose.CobblemonPose
import com.cobblemon.mod.common.entity.PoseType
import net.minecraft.client.model.geom.ModelPart
import net.minecraft.world.phys.Vec3
class PumpkabooModel (root: ModelPart) : PokemonPosableModel(root), HeadedFrame {
override val rootPart = root.registerChildWithAllChildren("pumpkaboo")
override val head = getPart("head")
override var portraitScale = 3.5F
override var portraitTranslation = Vec3(0.0, -1.5, 0.0)
override var profileScale = 1.0F
override var profileTranslation = Vec3(0.0, 0.25, 0.0)
lateinit var standing: CobblemonPose
lateinit var walk: CobblemonPose
lateinit var battleidle: CobblemonPose
lateinit var sleep: CobblemonPose
override val cryAnimation = CryProvider { bedrockStateful("pumpkaboo", "cry") }
override fun registerPoses() {
val blink = quirk { bedrockStateful("pumpkaboo", "blink") }
val quirk = quirk { bedrockStateful("pumpkaboo", "quirk_idle") }
sleep = registerPose(
poseName = "sleep",
poseType = PoseType.SLEEP,
quirks = arrayOf(blink),
animations = arrayOf(
bedrock("pumpkaboo", "sleep")
)
)
standing = registerPose(
poseName = "standing",
poseTypes = PoseType.STATIONARY_POSES + PoseType.UI_POSES,
quirks = arrayOf(blink, quirk),
animations = arrayOf(
singleBoneLook(),
bedrock("pumpkaboo", "ground_idle")
)
)
walk = registerPose(
poseName = "walk",
poseTypes = PoseType.MOVING_POSES,
quirks = arrayOf(blink),
animations = arrayOf(
bedrock("pumpkaboo", "ground_walk")
)
)
battleidle = registerPose(
poseName = "battleidle",
poseTypes = PoseType.STATIONARY_POSES,
quirks = arrayOf(blink),
animations = arrayOf(
bedrock("pumpkaboo", "battle_idle")
)
)
}
}
@@ -322,8 +322,6 @@ object VaryingModelRepository {
inbuilt("loudred", :: LoudredModel)
inbuilt("exploud", :: ExploudModel)
inbuilt("cryogonal", :: CryogonalModel)
inbuilt("pumpkaboo", :: PumpkabooModel)
inbuilt("gourgeist", :: GourgeistModel)
inbuilt("eiscue", :: EiscueModel)
inbuilt("wooloo", :: WoolooModel)
inbuilt("dubwool", :: DubwoolModel)
@@ -340,9 +338,6 @@ object VaryingModelRepository {
inbuilt("thwackey", ::ThwackeyModel)
inbuilt("rillaboom", ::RillaboomModel)
inbuilt("samurott", ::SamurottModel)
inbuilt("snivy", ::SnivyModel)
inbuilt("servine", ::ServineModel)
inbuilt("serperior", ::SerperiorModel)
inbuilt("slugma", ::SlugmaModel)
inbuilt("magcargo", ::MagcargoModel)
inbuilt("slugma_shiny", ::SlugmaShinyModel)
@@ -0,0 +1,22 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.client.sound.instances
import net.minecraft.client.resources.sounds.SimpleSoundInstance
import net.minecraft.client.resources.sounds.SoundInstance
import net.minecraft.sounds.SoundEvent
import net.minecraft.sounds.SoundSource
/**
* Plays a sound for a Pokémon rendered in a GUI, where there is no entity to take the sound source from.
* Unlike [SimpleSoundInstance.forUI] this uses [SoundSource.NEUTRAL] so the Friendly Creatures slider applies.
*/
class UIEntitySoundInstance(sound: SoundEvent, volume: Float = 1F, pitch: Float = 1F) :
SimpleSoundInstance(sound.location, SoundSource.NEUTRAL, volume, pitch, SoundInstance.createUnseededRandom(),
false, 0, SoundInstance.Attenuation.NONE, 0.0, 0.0, 0.0, true)
@@ -1,69 +0,0 @@
package com.cobblemon.mod.common.command
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.permission.CobblemonPermissions
import com.cobblemon.mod.common.command.argument.BadgeArgumentType
import com.cobblemon.mod.common.util.permission
import com.mojang.brigadier.Command
import com.mojang.brigadier.CommandDispatcher
import com.mojang.brigadier.context.CommandContext
import net.minecraft.commands.CommandSourceStack
import net.minecraft.commands.Commands
import net.minecraft.commands.arguments.EntityArgument
import net.minecraft.network.chat.Component
import net.minecraft.server.level.ServerPlayer
object BadgeCommand {
private const val NAME = "badge"
private const val GIVE = "give"
private const val REMOVE = "remove"
private const val PLAYER = "player"
fun register(dispatcher: CommandDispatcher<CommandSourceStack>) {
val command =
Commands.literal(NAME)
.permission(CobblemonPermissions.BADGE)
.then(Commands.literal(GIVE)
.then(Commands.argument(PLAYER, EntityArgument.player())
.then(Commands.argument(BADGE, BadgeArgumentType.badge())
.executes { executeGive(it, EntityArgument.getPlayer(it, PLAYER)) }
)
)
)
.then(Commands.literal(REMOVE)
.then(Commands.argument(PLAYER, EntityArgument.player())
.then(Commands.argument(BADGE, BadgeArgumentType.badge())
.executes { executeRemove(it, EntityArgument.getPlayer(it, PLAYER)) }
)
)
)
dispatcher.register(command)
}
private fun executeGive(context: CommandContext<CommandSourceStack>, player: ServerPlayer): Int {
val badge = BadgeArgumentType.getBadge(context, BADGE)
val changed = Cobblemon.playerDataManager.getBadgeData(player).give(badge)
val message = if (changed) {
"Gave ${badge.name} to ${player.name.string}."
} else {
"${player.name.string} already has ${badge.name}."
}
context.source.sendSuccess({ Component.literal(message) }, true)
return Command.SINGLE_SUCCESS
}
private fun executeRemove(context: CommandContext<CommandSourceStack>, player: ServerPlayer): Int {
val badge = BadgeArgumentType.getBadge(context, BADGE)
val changed = Cobblemon.playerDataManager.getBadgeData(player).remove(badge)
val message = if (changed) {
"Removed ${badge} from ${player.name.string}." // TODO move this to lang
} else {
"${player.name.string} does not have ${badge.name}."
}
context.source.sendSuccess({ Component.literal(message) }, true)
return Command.SINGLE_SUCCESS
}
private const val BADGE = "badge"
}
@@ -1,51 +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.command.argument
import com.cobblemon.mod.common.api.badges.Badge
import com.cobblemon.mod.common.api.badges.Badges
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import com.mojang.brigadier.StringReader
import com.mojang.brigadier.arguments.ArgumentType
import com.mojang.brigadier.context.CommandContext
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType
import com.mojang.brigadier.suggestion.Suggestions
import com.mojang.brigadier.suggestion.SuggestionsBuilder
import net.minecraft.commands.SharedSuggestionProvider
import net.minecraft.network.chat.Component
import java.util.concurrent.CompletableFuture
class BadgeArgumentType : ArgumentType<Badge> {
override fun parse(reader: StringReader): Badge {
val identifier = try {
reader.asIdentifierDefaultingNamespace()
} catch (exception: Exception) {
throw SimpleCommandExceptionType(INVALID_BADGE).createWithContext(reader)
}
return Badges.getByIdentifier(identifier)
?: throw SimpleCommandExceptionType(INVALID_BADGE).createWithContext(reader)
}
override fun <S : Any> listSuggestions(
context: CommandContext<S>,
builder: SuggestionsBuilder
): CompletableFuture<Suggestions> {
return SharedSuggestionProvider.suggest(Badges.all().map { it.identifier.toString() }, builder)
}
companion object {
private val INVALID_BADGE = Component.translatable("cobblemon.command.badge.invalid")
fun badge() = BadgeArgumentType()
fun <S> getBadge(context: CommandContext<S>, name: String): Badge =
context.getArgument(name, Badge::class.java)
}
}
@@ -164,6 +164,9 @@ class CobblemonConfig {
@CobblemonConfigField(Category.Pokemon, lang = "experience_multiplier", SERVER)
var experienceMultiplier = 2F
@CobblemonConfigField(Category.Pokemon, lang = "predation_chance", SERVER)
var predationChance = 0.05F
@CobblemonConfigField(Category.Spawning, lang = "pokemon_per_chunk", SERVER)
var pokemonPerChunk = 1F
@@ -11,7 +11,6 @@ package com.cobblemon.mod.common.data
import com.cobblemon.mod.common.*
import com.cobblemon.mod.common.Cobblemon.LOGGER
import com.cobblemon.mod.common.api.abilities.Abilities
import com.cobblemon.mod.common.api.badges.Badges
import com.cobblemon.mod.common.api.berry.Berries
import com.cobblemon.mod.common.api.cooking.Seasonings
import com.cobblemon.mod.common.api.data.DataProvider
@@ -121,7 +120,6 @@ object CobblemonDataProvider : DataProvider {
this.register(SpawnBaitEffects, reloadable = false)
this.register(CobblemonRideSettings, reloadable = true)
this.register(TechnicalMachines, reloadable = false)
this.register(Badges, reloadable = true)
SpawnBait.Effects.setupEffects()
PlatformEvents.SERVER_PLAYER_LOGOUT.subscribe {
@@ -1294,16 +1294,7 @@ open class PokemonEntity(
}
private fun showInteractionWheel(player: ServerPlayer, itemStack: ItemStack) {
val canRide = ifRidingAvailableSupply(false) { behaviour, settings, state ->
if (platform != PlatformType.NONE) return@ifRidingAvailableSupply false
if (tethering != null) return@ifRidingAvailableSupply false;
if (seats.isEmpty()) return@ifRidingAvailableSupply false;
if ((owner as? ServerPlayer)?.isInBattle() == true) return@ifRidingAvailableSupply false;
if (this.owner != player && this.passengers.isEmpty()) return@ifRidingAvailableSupply false;
if(pokemon.effectiveScale < Cobblemon.config.minimumRidingScale) return@ifRidingAvailableSupply false;
if(beamMode == 3) return@ifRidingAvailableSupply false;
return@ifRidingAvailableSupply behaviour.isActive(settings, state, this);
}
val canRide = isRideableFor(player)
if (pokemon.getOwnerPlayer() == player) {
val cosmeticItemDefinition = CobblemonCosmeticItems.findValidCosmeticForPokemonAndItem(
player.level().registryAccess(),
@@ -1325,6 +1316,18 @@ open class PokemonEntity(
}
}
fun isRideableFor(player: ServerPlayer): Boolean = ifRidingAvailableSupply(false) canRide@{ behaviour, settings, state ->
if (!player.canInteractWithEntity(this, player.entityInteractionRange())) return@canRide false
if (platform != PlatformType.NONE) return@canRide false
if (tethering != null) return@canRide false
if (seats.isEmpty()) return@canRide false
if ((owner as? ServerPlayer)?.isInBattle() == true) return@canRide false
if (this.owner != player && this.passengers.isEmpty()) return@canRide false
if (pokemon.effectiveScale < Cobblemon.config.minimumRidingScale) return@canRide false
if (beamMode == 3) return@canRide false
return@canRide behaviour.isActive(settings, state, this)
}
override fun getDimensions(pose: Pose): EntityDimensions {
val scale = effects.mockEffect?.scale ?: (form.baseScale * pokemon.effectiveScale)
var result = this.exposedForm.hitbox.scale(scale)
@@ -1606,9 +1609,8 @@ open class PokemonEntity(
|| stack.`is`(CobblemonItemTags.WHITELISTED_ITEMS_TO_HOLD)
fun tryRidingPokemon(player: ServerPlayer): Boolean {
if (pokemon.effectiveScale < Cobblemon.config.minimumRidingScale) {
return false
}
if (!isRideableFor(player)) return false
val event = RidePokemonEvent.Pre(player, this)
CobblemonEvents.RIDE_EVENT_PRE.post(event)
if (!event.isCanceled) {
@@ -78,21 +78,10 @@ object StatHandler : EventHandler {
fun onWinBattle(event : BattleVictoryEvent) {
if (!event.wasWildCapture) {
if(event.battle.isPvP) {
event.winners
.flatMap { it.getPlayerUUIDs().mapNotNull(UUID::getPlayer) }
.forEach { player -> player.awardStat(getStat(Cobblemon.statistics.PVP_BATTLES_WON)) }
event.losers
.flatMap { it.getPlayerUUIDs().mapNotNull(UUID::getPlayer) }
.forEach { player -> player.awardStat(getStat(Cobblemon.statistics.PVP_BATTLES_LOST)) }
}
if (event.battle.isPvW) {
event.winners
.flatMap { it.getPlayerUUIDs().mapNotNull(UUID::getPlayer) }
.forEach { player -> player.awardStat(getStat(Cobblemon.statistics.BATTLES_WON)) }
event.losers
.flatMap { it.getPlayerUUIDs().mapNotNull(UUID::getPlayer) }
.forEach { player -> player.awardStat(getStat(Cobblemon.statistics.BATTLES_LOST)) }
}
}
}
@@ -1,47 +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.net.messages.client.data
import com.cobblemon.mod.common.api.badges.Badge
import com.cobblemon.mod.common.api.badges.Badges
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.readIdentifier
import com.cobblemon.mod.common.util.readString
import com.cobblemon.mod.common.util.writeIdentifier
import com.cobblemon.mod.common.util.writeString
import net.minecraft.network.RegistryFriendlyByteBuf
class BadgeRegistrySyncPacket(badges: List<Badge>) : DataRegistrySyncPacket<Badge, BadgeRegistrySyncPacket>(badges) {
companion object {
val ID = cobblemonResource("badges")
fun decode(buffer: RegistryFriendlyByteBuf) = BadgeRegistrySyncPacket(emptyList()).apply { decodeBuffer(buffer) }
}
override val id = ID
override fun encodeEntry(buffer: RegistryFriendlyByteBuf, entry: Badge) {
buffer.writeIdentifier(entry.identifier)
buffer.writeString(entry.name)
buffer.writeResourceLocation(entry.texture)
buffer.writeInt(entry.order)
}
override fun decodeEntry(buffer: RegistryFriendlyByteBuf): Badge {
return Badge(
order = buffer.readInt(),
texture = buffer.readResourceLocation(),
name = buffer.readString(),
identifier = buffer.readIdentifier()
)
}
override fun synchronizeDecoded(entries: Collection<Badge>) {
Badges.reload(entries.associateBy { it.identifier })
}
}
@@ -135,17 +135,18 @@ internal object PropertiesCompletionProvider : DataRegistry {
private fun addDefaults() {
this.inject(setOf("level", "lvl", "l"), setOf("1", "${Cobblemon.config.maxPokemonLevel}") )
this.inject(setOf("shiny", "s"), setOf("yes", "no"))
this.inject(setOf("alpha", "is_alpha"), setOf("yes", "no"))
this.inject(setOf("gender"), Gender.entries.map { it.name.lowercase() })
this.inject(setOf("friendship"), setOf("0", Cobblemon.config.maxPokemonFriendship.toString()))
this.inject(setOf("fullness"), setOf("0", "255"))
this.inject(setOf("pokeball"), PokeBalls.all().map { it.name.simplify() })
this.inject(setOf("nature"), Natures.all().map { it.name.simplify() })
this.inject(setOf("ability"), Abilities.all().map { if (it.name.asIdentifierDefaultingNamespace().namespace == Cobblemon.MODID) it.name.asIdentifierDefaultingNamespace().path else it.name })
this.inject(setOf("dmax"), setOf("0", Cobblemon.config.maxDynamaxLevel.toString()))
this.inject(setOf("gmax"), setOf("yes", "no"))
this.inject(setOf("dmax_level", "dmax"), setOf("0", Cobblemon.config.maxDynamaxLevel.toString()))
this.inject(setOf("gmax_factor", "gmax"), setOf("yes", "no"))
this.inject(setOf("type", "elemental_type"), ElementalTypes.all().map { it.name })
this.inject(setOf("tera_type", "tera"), TeraTypes.map { it.id.simplify() })
this.inject(setOf("tradeable"), setOf("yes", "no"))
this.inject(setOf("tradeable", "tradable"), setOf("yes", "no"))
this.inject(setOf("originaltrainer", "ot"), setOf(""))
this.inject(setOf("originaltrainertype", "ottype"), setOf("None", "Player", "NPC"))
this.inject(setOf("nickname", "nick"), setOf(""))
@@ -26,5 +26,6 @@ object CobblemonGameRules {
val SHINY_STARTERS: GameRules.Key<GameRules.BooleanValue> = Cobblemon.implementation.registerGameRule("doShinyStarters", GameRules.Category.MISC, BooleanRuleInvoker.`cobblemon$create`(false))
@JvmField
val HEALERS_HEAL_PC: GameRules.Key<GameRules.BooleanValue> = Cobblemon.implementation.registerGameRule("healersHealPC", GameRules.Category.MISC, BooleanRuleInvoker.`cobblemon$create`(false))
@JvmField
val DO_POKEMON_PREDATION: GameRules.Key<GameRules.BooleanValue> = Cobblemon.implementation.registerGameRule("doPokemonPredation", GameRules.Category.MOBS, BooleanRuleInvoker.`cobblemon$create`(true))
}
@@ -217,7 +217,7 @@
}
}
},
"animation.raichu_cap.water_swim": {
"animation.raichu_cap.water_surface_swim": {
"loop": true,
"animation_length": 1,
"bones": {
@@ -364,6 +364,14 @@
"rotation": [-22.5, 0, 0]
}
}
},
"animation.wurmple.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0": {
"effect": "pokemon.wurmple.cry"
}
}
}
}
}
@@ -212,6 +212,14 @@
"position": [0, 0, -0.1]
}
}
},
"animation.silcoon.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0": {
"effect": "pokemon.silcoon.cry"
}
}
}
}
}
@@ -361,6 +361,14 @@
"rotation": [0, 20, 0]
}
}
},
"animation.beautifly.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0": {
"effect": "pokemon.beautifly.cry"
}
}
}
}
}
@@ -194,6 +194,14 @@
"position": [0, 0, -0.1]
}
}
},
"animation.cascoon.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0": {
"effect": "pokemon.cascoon.cry"
}
}
}
}
}
@@ -255,6 +255,30 @@
"position": [0, 0, -0.1]
}
}
},
"animation.dustox.cry": {
"animation_length": 1,
"bones": {
"mouth_closed_smile": {
"position": {
"0.0": [0, 0, 0],
"0.0833": {"pre": [0, 0, 0], "post": [0, 0, 0.1]},
"0.625": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
}
},
"mouth_open": {
"position": {
"0.0": [0, 0, 0],
"0.0833": {"pre": [0, 0, 0], "post": [0, 0, -0.1]},
"0.625": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
}
}
},
"sound_effects": {
"0.0833": {
"effect": "pokemon.dustox.cry"
}
}
}
}
}
@@ -149,6 +149,14 @@
"rotation": [0, 0, 22.5]
}
}
},
"animation.surskit.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0": {
"effect": "pokemon.surskit.cry"
}
}
}
},
"geckolib_format_version": 2
@@ -158,6 +158,11 @@
"0.75": [0, 0, 0]
}
}
},
"sound_effects": {
"0.0": {
"effect": "pokemon.masquerain.cry"
}
}
}
},
@@ -447,6 +447,11 @@
"1.5": [0, 0, 0]
}
}
},
"sound_effects": {
"0.0": {
"effect": "pokemon.starly.cry"
}
}
}
}
@@ -331,6 +331,11 @@
"1.5": [0, 0, 0]
}
}
},
"sound_effects": {
"0.0": {
"effect": "pokemon.staravia.cry"
}
}
},
"animation.staravia.blink": {
@@ -464,6 +464,11 @@
"1.5": [0, 0, 0]
}
}
},
"sound_effects": {
"0.0": {
"effect": "pokemon.combee.cry"
}
}
}
}
@@ -824,6 +824,14 @@
}
}
}
},
"animation.vespiquen.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0": {
"effect": "pokemon.vespiquen.cry"
}
}
}
}
}
@@ -589,7 +589,7 @@
"animation.frogadier.battle_idle": {
"loop": true,
"bones": {
"frogadier": {
"body": {
"position": [0, -8, 0]
},
"torso": {
@@ -400,6 +400,30 @@
"position": [0, 0, -0.1]
}
}
},
"animation.helioptile.cry": {
"animation_length": 1.2083,
"bones": {
"mouth_closed": {
"position": {
"0.0": [0, 0, 0],
"0.0833": {"pre": [0, 0, 0], "post": [0, 0, 0.1]},
"1.1667": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
}
},
"mouth_open": {
"position": {
"0.0": [0, 0, 0],
"0.0833": {"pre": [0, 0, 0], "post": [0, 0, -0.1]},
"1.1667": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
}
}
},
"sound_effects": {
"0.0833": {
"effect": "pokemon.helioptile.cry"
}
}
}
}
}
@@ -563,6 +563,14 @@
"position": [0.1, 0, 0]
}
}
},
"animation.heliolisk.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0": {
"effect": "pokemon.heliolisk.cry"
}
}
}
}
}
@@ -125,6 +125,11 @@
"0.5417": {"pre": [0, 0, -0.1], "post": [0, 0, 0]}
}
}
},
"sound_effects": {
"0.0417": {
"effect": "pokemon.grubbin.cry"
}
}
},
"animation.grubbin.physical": {
@@ -38,6 +38,11 @@
"0.625": {"pre": [0, 0, 0.1], "post": [0, 0, 0]}
}
}
},
"sound_effects": {
"0.0833": {
"effect": "pokemon.charjabug.cry"
}
}
},
"animation.charjabug.ditto_face": {
@@ -326,6 +326,14 @@
"position": [0, 0, -0.1]
}
}
},
"animation.runerigus.cry": {
"animation_length": 1.25,
"sound_effects": {
"0.0": {
"effect": "pokemon.runerigus.cry"
}
}
}
}
}
@@ -68,7 +68,7 @@
"parent": "torso",
"pivot": [0, 13, 2],
"locators": {
"seat": [0, 13, 2]
"seat_1": [0, 13, 2]
}
},
{
@@ -7,7 +7,7 @@
"animations": {
"cry": "q.bedrock_stateful('pidgeot', 'cry')",
"recoil": "q.bedrock_stateful('pidgeot', 'recoil')",
"special": "q.bedrock_primary('pidgeot', 'special', q.curve('symmetrical'))"
"status": "q.bedrock_primary('pidgeot', 'status', q.curve('symmetrical_wide'))"
},
"firstPersonCameraOffset": {
"seat_1": [0, 0.45, 0]
@@ -64,7 +64,7 @@
"q.sine_wing_flap(0.9, 0.9, 25, 'z', 'wing_open_left', 'wing_open_right')",
"q.look('neck', 1, 1, 70, -10, 20, -20)",
"q.look('head')",
"q.bedrock('spearow', 'air_idle')"
"q.bedrock('spearow', 'ground_idle')"
],
"quirks": ["q.bedrock_quirk('spearow', 'blink')"],
"transformedParts": [
@@ -93,7 +93,7 @@
"q.sine_wing_flap(0.9, 0.9, 25, 'z', 'wing_open_left', 'wing_open_right')",
"q.look('neck', 1, 1, 70, -10, 20, -20)",
"q.look('head')",
"q.bedrock('spearow', 'air_idle')"
"q.bedrock('spearow', 'ground_idle')"
],
"quirks": ["q.bedrock_quirk('spearow', 'blink')"],
"transformedParts": [
@@ -16,9 +16,6 @@
"q.look('head_ai', 1, 1, 8, -18, 10, -10)",
"q.bedrock('oddish', 'battle_idle')"
],
"namedAnimations": {
"cry": "q.bedrock_stateful('oddish', 'battle_cry')"
},
"quirks": ["q.bedrock_quirk('oddish', 'blink')"]
},
"standing": {
@@ -16,9 +16,6 @@
"q.look('head_ai', 1, 1, 6, -18, 10, -10)",
"q.bedrock('gloom', 'battle_idle')"
],
"namedAnimations": {
"cry": "q.bedrock_stateful('gloom', 'battle_cry')"
},
"quirks": ["q.bedrock_quirk('gloom', 'blink')"]
},
"standing": {
@@ -16,9 +16,6 @@
"q.look('head_ai', 1, 1, 6, -18, 10, -10)",
"q.bedrock('vileplume', 'battle_idle')"
],
"namedAnimations": {
"cry": "q.bedrock_stateful('vileplume', 'battle_cry')"
},
"quirks": [
"q.bedrock_quirk('vileplume', 'blink')",
"q.bedrock_primary_quirk('vileplume', 'quirk', 20, 40, 1, q.curve('symmetrical_wide'))"
@@ -7,7 +7,6 @@
"animations": {
"faint": "q.bedrock_primary('diglett', 'faint', q.curve('one'))",
"cry": "q.bedrock_stateful('diglett', 'cry')",
"recoil": "q.bedrock_stateful('diglett', 'recoil')",
"physical": "q.bedrock_primary('diglett', 'physical', q.curve('symmetrical'))"
},
"poses": {
@@ -5,9 +5,9 @@
"profileTranslation": [0.0, 0.3, 0],
"rootBone": "diglett_alolan",
"animations": {
"faint": "q.bedrock_primary('diglett_alolan', 'faint', q.curve('one'))",
"cry": "q.bedrock_stateful('diglett_alolan', 'cry')",
"recoil": "q.bedrock_stateful('diglett_alolan', 'recoil')",
"physical": "q.bedrock_primary('diglett_alolan', 'physical', q.curve('symmetrical'))"
"physical": "q.bedrock_primary('diglett_alolan', 'physical', q.curve('symmetrical_wide'))"
},
"poses": {
"standing": {
@@ -7,7 +7,6 @@
"animations": {
"faint": "q.bedrock_primary('dugtrio', 'faint', q.curve('one'))",
"cry": "q.bedrock_stateful('dugtrio', 'cry')",
"recoil": "q.bedrock_stateful('dugtrio', 'recoil')",
"physical": "q.bedrock_primary('dugtrio', 'physical', q.curve('symmetrical'))"
},
"poses": {
@@ -5,9 +5,9 @@
"profileTranslation": [0.0, 0.29, 0],
"rootBone": "dugtrio_alolan",
"animations": {
"faint": "q.bedrock_primary('dugtrio_alolan', 'faint', q.curve('one'))",
"cry": "q.bedrock_stateful('dugtrio_alolan', 'cry')",
"recoil": "q.bedrock_stateful('dugtrio_alolan', 'recoil')",
"physical": "q.bedrock_primary('dugtrio_alolan', 'physical', q.curve('symmetrical'))"
"physical": "q.bedrock_primary('dugtrio_alolan', 'physical', q.curve('symmetrical_wide'))"
},
"poses": {
"standing": {
@@ -83,7 +83,7 @@
"namedAnimations": {
"cry": "q.bedrock_stateful('dummy', 'cry')"
},
"animations": ["q.bedrock('tentacool', 'ground_sleep')"]
"animations": ["q.bedrock('tentacool', 'sleep')"]
}
}
}
@@ -108,7 +108,7 @@
"namedAnimations": {
"cry": "q.bedrock_stateful('dummy', 'cry')"
},
"animations": ["q.bedrock('tentacruel', 'sleep')"]
"animations": ["q.bedrock('tentacruel', 'water_sleep')"]
},
"ground-sleep": {
"poseTypes": ["SLEEP"],
@@ -116,7 +116,7 @@
"namedAnimations": {
"cry": "q.bedrock_stateful('dummy', 'cry')"
},
"animations": ["q.bedrock('tentacruel', 'sleep')"]
"animations": ["q.bedrock('tentacruel', 'ground_sleep')"]
}
}
}
@@ -6,8 +6,7 @@
"rootBone": "golem",
"animations": {
"cry": "q.bedrock_stateful('golem', 'cry')",
"recoil": "q.bedrock_stateful('golem', 'recoil')",
"status": "q.bedrock_stateful('golem', 'status', q.curve('symmetrical_wide'))"
"recoil": "q.bedrock_stateful('golem', 'recoil')"
},
"poses": {
"battle-standing": {
@@ -6,8 +6,7 @@
"rootBone": "golem",
"animations": {
"cry": "q.bedrock_stateful('golem_alolan', 'cry')",
"recoil": "q.bedrock_stateful('golem_alolan', 'recoil')",
"status": "q.bedrock_stateful('golem_alolan', 'status', q.curve('symmetrical_wide'))"
"recoil": "q.bedrock_stateful('golem_alolan', 'recoil')"
},
"poses": {
"battle-standing": {
@@ -6,8 +6,7 @@
"rootBone": "grimer",
"animations": {
"cry": "q.bedrock_stateful('grimer', 'cry')",
"recoil": "q.bedrock_stateful('grimer', 'recoil')",
"status": "q.bedrock_stateful('grimer', 'status', q.curve('symmetrical_wide'))"
"recoil": "q.bedrock_stateful('grimer', 'recoil')"
},
"poses": {
"battle-standing": {
@@ -6,8 +6,7 @@
"rootBone": "grimer_alola",
"animations": {
"cry": "q.bedrock_stateful('grimer', 'cry')",
"recoil": "q.bedrock_stateful('grimer', 'recoil')",
"status": "q.bedrock_stateful('grimer', 'status', q.curve('symmetrical_wide'))"
"recoil": "q.bedrock_stateful('grimer', 'recoil')"
},
"poses": {
"battle-standing": {
@@ -1,6 +1,6 @@
{
"portraitScale": 1.82,
"portraitTranslation": [-0.01, 0.64, 0],
"portraitTranslation": [0.15, 0.52, 0],
"profileScale": 0.84,
"profileTranslation": [0, 0.51, 0],
"rootBone": "marowak_alolan",
@@ -36,7 +36,7 @@
},
"portrait": {
"poseTypes": ["PORTRAIT"],
"animations": ["q.bedrock('marowak_alolan', 'portrait')"]
"animations": ["q.bedrock('marowak_alolan', 'ground_idle')"]
}
}
}
@@ -5,7 +5,6 @@
"profileTranslation": [0, 0.46, 0],
"rootBone": "weezing",
"animations": {
"faint": "q.bedrock_primary('weezing', 'faint')",
"cry": "q.bedrock_stateful('weezing', 'cry')",
"recoil": "q.bedrock_stateful('weezing', 'recoil')",
"physical": "q.bedrock_primary('weezing', 'physical', q.curve('symmetrical_wide'))",
@@ -57,7 +56,7 @@
"namedAnimations": {
"cry": "q.bedrock_stateful('dummy', 'cry')"
},
"animations": ["q.bedrock('weezing', 'battle-sleep')"]
"animations": ["q.bedrock('weezing', 'battle_sleep')"]
},
"sleep": {
"poseTypes": ["SLEEP"],
@@ -39,10 +39,6 @@
"q.bedrock_quirk('weezing_galar', 'blink')",
"q.bedrock_quirk('weezing_galar', 'blink2')"
]
},
"sleeping": {
"poseTypes": ["SLEEP"],
"animations": ["q.bedrock('weezing_galar', 'sleep')"]
}
}
}
@@ -33,10 +33,7 @@
"quirks": [
"q.bedrock_quirk('rhydon', 'blink')",
"q.bedrock_quirk('rhydon', 'battle_quirk')"
],
"namedAnimations": {
"cry": "q.bedrock_primary('rhydon', 'battle_cry', q.curve('symmetrical_wide'))"
}
]
},
"jump": {
"poseTypes": ["STAND", "WALK"],
@@ -94,13 +94,6 @@
"q.bedrock('mr_mime', 'ground_run')"
],
"quirks": ["q.bedrock_quirk('mr_mime', 'blink')"]
},
"sleep": {
"poseTypes": ["SLEEP"],
"namedAnimations": {
"cry": "q.bedrock_stateful('dummy', 'cry')"
},
"animations": ["q.bedrock('mr_mime', 'sleep')"]
}
}
}
@@ -75,13 +75,6 @@
}
],
"quirks": ["q.bedrock_quirk('tauros', 'blink')"]
},
"sleep": {
"poseTypes": ["SLEEP"],
"namedAnimations": {
"cry": "q.bedrock_stateful('dummy', 'cry')"
},
"animations": ["q.bedrock('tauros', 'sleep')"]
}
}
}
@@ -120,13 +120,6 @@
}
],
"quirks": ["q.bedrock_quirk('tauros_paldean_aqua', 'blink')"]
},
"sleep": {
"poseTypes": ["SLEEP"],
"namedAnimations": {
"cry": "q.bedrock_stateful('dummy', 'cry')"
},
"animations": ["q.bedrock('tauros_paldean_aqua', 'sleep')"]
}
}
}
@@ -74,13 +74,6 @@
}
],
"quirks": ["q.bedrock_quirk('tauros_paldean_blaze', 'blink')"]
},
"sleep": {
"poseTypes": ["SLEEP"],
"namedAnimations": {
"cry": "q.bedrock_stateful('dummy', 'cry')"
},
"animations": ["q.bedrock('tauros_paldean_blaze', 'sleep')"]
}
}
}
@@ -5,7 +5,6 @@
"profileTranslation": [0, -0.02, 0],
"rootBone": "omanyte",
"animations": {
"faint": "q.bedrock_primary('omanyte', 'faint', q.curve('one'))",
"cry": "q.bedrock_stateful('omanyte', 'cry')"
},
"poses": {
@@ -5,7 +5,6 @@
"profileTranslation": [0, 0.066, 0],
"rootBone": "omastar",
"animations": {
"faint": "q.bedrock_primary('omastar', 'faint', q.curve('one'))",
"cry": "q.bedrock_stateful('omastar', 'cry')"
},
"poses": {
@@ -169,7 +169,7 @@
"q.look('neck', 1, 1, 25, -20, 20, -20)",
"q.look('head', 1, 1, 22.5, -10, 15, -15)",
"q.bedrock('aerodactyl', 'air_glide')",
"q.bedrock('aerodactyl', 'air_dive')",
"q.bedrock('aerodactyl', 'ride_dive')",
{
"condition": "q.is_ridden",
"animation": "q.bedrock('aerodactyl', 'ride_air_glide')"
@@ -5,8 +5,7 @@
"profileTranslation": [0, 0.84, -10],
"rootBone": "feraligatr",
"animations": {
"cry": "q.bedrock_stateful('feraligatr', 'cry')",
"recoil": "q.bedrock_stateful('feraligatr', 'recoil')"
"cry": "q.bedrock_stateful('feraligatr', 'cry')"
},
"poses": {
"standing": {
@@ -16,9 +16,6 @@
"q.look('head_ai')",
"q.bedrock('bellossom', 'battle_idle')"
],
"namedAnimations": {
"cry": "q.bedrock_stateful('bellossom', 'battle_cry')"
},
"quirks": [
"q.bedrock_quirk('bellossom', 'blink')"
]
@@ -4,6 +4,9 @@
"profileScale": 0.98,
"profileTranslation": [0.00, 0.24, 0],
"rootBone": "wurmple",
"animations": {
"cry": "q.bedrock_stateful('wurmple', 'cry')"
},
"poses": {
"battle-standing": {
"poseTypes": ["STAND"],
@@ -4,6 +4,9 @@
"profileScale": 0.80,
"profileTranslation": [0.00, 0.48, 0],
"rootBone": "silcoon",
"animations": {
"cry": "q.bedrock_stateful('silcoon', 'cry')"
},
"poses": {
"battle-standing": {
"poseTypes": ["STAND"],
@@ -4,6 +4,9 @@
"profileScale": 0.60,
"profileTranslation": [0, 0.90, 0],
"rootBone": "beautifly",
"animations": {
"cry": "q.bedrock_stateful('beautifly', 'cry')"
},
"poses": {
"battle-standing": {
"poseTypes": ["STAND"],
@@ -4,6 +4,9 @@
"profileScale": 0.74,
"profileTranslation": [0.00, 0.57, 0],
"rootBone": "cascoon",
"animations": {
"cry": "q.bedrock_stateful('cascoon', 'cry')"
},
"poses": {
"battle-standing": {
"poseTypes": ["STAND"],

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