Skip to content

Commit 5be6c09

Browse files
committed
feat: more layout work
1 parent cfbbc96 commit 5be6c09

22 files changed

+3921
-3477
lines changed

.prettierrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
"singleQuote": true,
44
"trailingComma": "none",
55
"printWidth": 100,
6-
"plugins": ["prettier-plugin-svelte"],
6+
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
77
"overrides": [
88
{
99
"files": "*.svelte",
1010
"options": {
1111
"parser": "svelte"
1212
}
1313
}
14-
]
14+
],
15+
"tailwindStylesheet": "./src/routes/layout.css"
1516
}

content/notes/2026-01-07-cobblemon-shiny-rates.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ slug: cobblemon-shiny-rates
99
date: 2026-01-07
1010
---
1111

12+
1213
Sometimes you want to modify the ✨*shiny*✨ rate of the species you are working with.
1314

1415
Use cases may vary. The typical scenario is when you are trying to give a player a species via methods other than natural spawning.
1516

16-
The code in this note is **Kotlin**. Your experience with **Java** may vary. Don't be afraid to ask questions in the Cobblemon Discord's #programming channel.
17+
The code in this note is **Kotlin**. Your experience with **Java** may vary. Don't be afraid to ask questions in the Cobblemon Discord's `#programming` channel.
1718

1819
Let's instantiate `ShinyChanceCalculationEvent`:
1920

@@ -46,6 +47,9 @@ event.addModificationFunction(function: (Float, ServerPlayer?, Pokemon) -> Float
4647
```
4748

4849
These handy helpers are our bread and butter.
50+
51+
52+
4953
For example, if I want to apply a flat bonus, I would do it this way:
5054

5155
```kotlin
@@ -77,6 +81,7 @@ event.addModificationFunction { chance, player, pokemon ->
7781
> [!hint] Kotlin specific
7882
> The `return@addModificationFunction` is *specific to Kotlin* because we can explicitly tell Kotlin which function we want to return from.
7983
84+
8085
Now that we are done modifying our chances, let's assemble it all together:
8186

8287
```kotlin
@@ -95,6 +100,9 @@ fun calculateShiny(player: ServerPlayer): Pokemon {
95100

96101
You may notice something: I check for ✨shiny✨ in the `post` handler of the event.
97102
This is because there are other mods that can influence the shiny rate.
98-
Checking it at that particular place ensures your mod will properly pick up other chance influences.
103+
104+
Checking it at that particular place ensures your mod will properly pick up other chance influences and in general is better for interop between different mods.
105+
106+
You can also ponder upon usage in this [example](https://github.com/gitoido-mc/rad-gyms/blob/1.7.1%2F0.4.x-main/common/src/main/kotlin/lol/gito/radgyms/common/util/CobblemonExtensions.kt#L16)
99107

100108
That is all. Happy modding!

0 commit comments

Comments
 (0)