From fbd92d83d50df7901a1cd495ca8cf2848afea020 Mon Sep 17 00:00:00 2001 From: Forstride Date: Wed, 22 May 2019 02:46:35 -0400 Subject: [PATCH] Allowed the player to spawn in BOP biomes --- src/main/java/biomesoplenty/common/biome/BiomeBOP.java | 2 ++ .../common/biome/overworld/MysticGroveBiome.java | 1 + .../common/biome/overworld/OminousWoodsBiome.java | 1 + .../common/biome/overworld/OriginBeachBiome.java | 2 ++ .../common/biome/overworld/OriginHillsBiome.java | 2 ++ .../biomesoplenty/common/biome/overworld/TropicsBiome.java | 2 ++ .../biomesoplenty/common/biome/overworld/VolcanoBiome.java | 2 ++ .../common/biome/overworld/WastelandBiome.java | 1 + .../common/biome/overworld/WhiteBeachBiome.java | 2 ++ src/main/java/biomesoplenty/init/ModBiomes.java | 6 ++++++ 10 files changed, 21 insertions(+) diff --git a/src/main/java/biomesoplenty/common/biome/BiomeBOP.java b/src/main/java/biomesoplenty/common/biome/BiomeBOP.java index 021c5bdf7..9d8043c4f 100644 --- a/src/main/java/biomesoplenty/common/biome/BiomeBOP.java +++ b/src/main/java/biomesoplenty/common/biome/BiomeBOP.java @@ -16,10 +16,12 @@ import java.util.Map; public class BiomeBOP extends Biome { protected Map weightMap = new HashMap(); + public boolean canSpawnInBiome; public BiomeBOP(BiomeBuilder builder) { super(builder); + this.canSpawnInBiome = true; } public void addWeight(BOPClimates climate, int weight) diff --git a/src/main/java/biomesoplenty/common/biome/overworld/MysticGroveBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/MysticGroveBiome.java index dbd54e75e..7636bd030 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/MysticGroveBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/MysticGroveBiome.java @@ -110,6 +110,7 @@ public class MysticGroveBiome extends BiomeBOP this.addSpawn(EnumCreatureType.MONSTER, new Biome.SpawnListEntry(EntityType.WITCH, 5, 1, 1)); this.addWeight(BOPClimates.WET_TEMPERATE, 1); + this.canSpawnInBiome = false; } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/biomesoplenty/common/biome/overworld/OminousWoodsBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/OminousWoodsBiome.java index a5e227302..334ee9bd4 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/OminousWoodsBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/OminousWoodsBiome.java @@ -103,6 +103,7 @@ public class OminousWoodsBiome extends BiomeBOP this.addSpawn(EnumCreatureType.MONSTER, new Biome.SpawnListEntry(EntityType.WITCH, 5, 1, 1)); this.addWeight(BOPClimates.WET_BOREAL, 1); + this.canSpawnInBiome = false; } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/biomesoplenty/common/biome/overworld/OriginBeachBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/OriginBeachBiome.java index cd7bf01e5..4d1571738 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/OriginBeachBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/OriginBeachBiome.java @@ -77,6 +77,8 @@ public class OriginBeachBiome extends BiomeBOP this.addSpawn(EnumCreatureType.MONSTER, new Biome.SpawnListEntry(EntityType.SKELETON, 100, 4, 4)); this.addSpawn(EnumCreatureType.MONSTER, new Biome.SpawnListEntry(EntityType.CREEPER, 100, 4, 4)); this.addSpawn(EnumCreatureType.MONSTER, new Biome.SpawnListEntry(EntityType.SLIME, 100, 4, 4)); + + this.canSpawnInBiome = false; } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/biomesoplenty/common/biome/overworld/OriginHillsBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/OriginHillsBiome.java index 0197276a3..214e8c4cc 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/OriginHillsBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/OriginHillsBiome.java @@ -80,6 +80,8 @@ public class OriginHillsBiome extends BiomeBOP this.addSpawn(EnumCreatureType.MONSTER, new Biome.SpawnListEntry(EntityType.SKELETON, 100, 4, 4)); this.addSpawn(EnumCreatureType.MONSTER, new Biome.SpawnListEntry(EntityType.CREEPER, 100, 4, 4)); this.addSpawn(EnumCreatureType.MONSTER, new Biome.SpawnListEntry(EntityType.SLIME, 100, 4, 4)); + + this.canSpawnInBiome = false; } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/biomesoplenty/common/biome/overworld/TropicsBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/TropicsBiome.java index d1d39c307..8b107214f 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/TropicsBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/TropicsBiome.java @@ -90,6 +90,8 @@ public class TropicsBiome extends BiomeBOP // Entity spawning this.addSpawn(EnumCreatureType.CREATURE, new Biome.SpawnListEntry(EntityType.PIG, 10, 4, 4)); this.addSpawn(EnumCreatureType.CREATURE, new Biome.SpawnListEntry(EntityType.PARROT, 40, 1, 2)); + + this.canSpawnInBiome = false; } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/biomesoplenty/common/biome/overworld/VolcanoBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/VolcanoBiome.java index de84095fc..24221da81 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/VolcanoBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/VolcanoBiome.java @@ -89,5 +89,7 @@ public class VolcanoBiome extends BiomeBOP this.addSpawn(EnumCreatureType.MONSTER, new Biome.SpawnListEntry(EntityType.SLIME, 100, 4, 4)); this.addSpawn(EnumCreatureType.MONSTER, new Biome.SpawnListEntry(EntityType.ENDERMAN, 10, 1, 4)); this.addSpawn(EnumCreatureType.MONSTER, new Biome.SpawnListEntry(EntityType.WITCH, 5, 1, 1)); + + this.canSpawnInBiome = false; } } diff --git a/src/main/java/biomesoplenty/common/biome/overworld/WastelandBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/WastelandBiome.java index 6bc6bb669..dec67fb54 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/WastelandBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/WastelandBiome.java @@ -93,6 +93,7 @@ public class WastelandBiome extends BiomeBOP this.addSpawn(EnumCreatureType.MONSTER, new Biome.SpawnListEntry(EntityType.WITCH, 5, 1, 1)); this.addWeight(BOPClimates.HOT_DESERT, 1); + this.canSpawnInBiome = false; } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/biomesoplenty/common/biome/overworld/WhiteBeachBiome.java b/src/main/java/biomesoplenty/common/biome/overworld/WhiteBeachBiome.java index 156ba6e9f..1074c54aa 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/WhiteBeachBiome.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/WhiteBeachBiome.java @@ -86,5 +86,7 @@ public class WhiteBeachBiome extends BiomeBOP this.addSpawn(EnumCreatureType.MONSTER, new Biome.SpawnListEntry(EntityType.SLIME, 100, 4, 4)); this.addSpawn(EnumCreatureType.MONSTER, new Biome.SpawnListEntry(EntityType.ENDERMAN, 10, 1, 4)); this.addSpawn(EnumCreatureType.MONSTER, new Biome.SpawnListEntry(EntityType.WITCH, 5, 1, 1)); + + this.canSpawnInBiome = false; } } diff --git a/src/main/java/biomesoplenty/init/ModBiomes.java b/src/main/java/biomesoplenty/init/ModBiomes.java index 21b11035e..81dee33b0 100644 --- a/src/main/java/biomesoplenty/init/ModBiomes.java +++ b/src/main/java/biomesoplenty/init/ModBiomes.java @@ -76,6 +76,7 @@ import net.minecraft.util.registry.IRegistry; import net.minecraft.world.biome.Biome; import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.common.BiomeDictionary.Type; +import net.minecraftforge.common.BiomeManager; import net.minecraftforge.registries.ForgeRegistries; import java.util.Map; @@ -240,6 +241,11 @@ public class ModBiomes { biome.setRegistryName(name); ForgeRegistries.BIOMES.register(biome); + + if (biome.canSpawnInBiome) + { + BiomeManager.addSpawnBiome(biome); + } for (Map.Entry entry : biome.getWeightMap().entrySet()) {