Skip to content

Commit

Permalink
Fix crash on load, addresses issue #7.
Browse files Browse the repository at this point in the history
Cloth Config does not like having the spawn group enum when initialising
the config, so the name string is used instead.
  • Loading branch information
b3spectacled committed Jul 17, 2022
1 parent 5154d20 commit e4b1f41
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.12.12

# Mod Properties
mod_version = 0.6
mod_version = 0.6.1
maven_group = com.bespectacled
archives_base_name = custom-spawns

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.fabricmc.fabric.api.biome.v1.ModificationPhase;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
Expand All @@ -28,7 +29,7 @@ public static void modifySpawns() {
CustomSpawn.log(Level.INFO, String.format("Adding mob '%s' to biome '%s'", addition.mobId, addition.biomeId));

context.getSpawnSettings().addSpawn(
addition.spawnGroup,
SpawnGroup.byName(addition.spawnGroup.toLowerCase()),
new SpawnSettings.SpawnEntry(
Registry.ENTITY_TYPE.get(entityKey(addition.mobId)),
addition.weight,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ public CustomSpawnGroup(
public static class CustomSpawnAddition {
public String biomeId;
public String mobId;
public SpawnGroup spawnGroup;
public String spawnGroup;
public int weight;
public int minCount;
public int maxCount;

public CustomSpawnAddition() {
this.biomeId = "minecraft:plains";
this.mobId = "minecraft:pig";
this.spawnGroup = SpawnGroup.CREATURE;
this.spawnGroup = SpawnGroup.CREATURE.getName();
this.weight = 10;
this.minCount = 4;
this.maxCount = 4;
Expand Down

0 comments on commit e4b1f41

Please sign in to comment.