Skip to content

Commit 9f199f8

Browse files
committed
make it so a collectibles spawn bucket is add if external config doesn't include.
1 parent 3aa37c7 commit 9f199f8

3 files changed

Lines changed: 23 additions & 14 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package generations.gg.generations.core.generationscore.common.mixin;
2+
3+
import com.cobblemon.mod.common.api.spawning.SpawnBucket;
4+
import com.cobblemon.mod.common.api.spawning.preset.BestSpawnerConfig;
5+
import org.spongepowered.asm.mixin.Mixin;
6+
import org.spongepowered.asm.mixin.injection.At;
7+
import org.spongepowered.asm.mixin.injection.Inject;
8+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
9+
10+
@Mixin(BestSpawnerConfig.Companion.class)
11+
public class BestSpawnConfigMixin {
12+
@Inject(method = "load", at = @At("RETURN"))
13+
public void appendLoad(CallbackInfoReturnable<BestSpawnerConfig> cir) {
14+
var buckets = cir.getReturnValue().getBuckets();
15+
16+
if(buckets.stream().noneMatch(a -> a.name.equals("collectibles"))) {
17+
buckets.add(new SpawnBucket("collectibles", 0.2f));
18+
}
19+
}
20+
}

common/src/main/resources/GenerationsCore-common.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"AbilityChangerMixin",
88
"AbstractCauldronBlockMixin",
99
"AbstractFurnaceBlockEntityMixin",
10+
"BestSpawnConfigMixin",
1011
"FishingHookMixin",
1112
"PokemonBattleMixin",
1213
"RecordItemMixin",

common/src/main/resources/data/generations_core/spawn_pool_world/zygrade_cell.json

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,15 @@
33
"neededInstalledMods": [],
44
"neededUninstalledMods": [],
55
"spawns": [
6-
{
7-
"id": "zygardecell-1",
8-
"type": "zygarde",
9-
"context": "grounded",
10-
"bucket": "rare",
11-
"weight": 3.5
12-
},
136
{
147
"id": "zygardecell-2",
158
"presets": [
169
"natural"
1710
],
1811
"type": "zygarde",
1912
"context": "grounded",
20-
"bucket": "common",
21-
"weight": 10.0,
22-
"condition": {
23-
"biomes": [
24-
"#cobblemon:is_plains"
25-
]
26-
}
13+
"bucket": "collectibles",
14+
"weight": 1.0
2715
}
2816
]
2917
}

0 commit comments

Comments
 (0)