From 9a35bb4915330fbddc93130351c7aaba4202e47c Mon Sep 17 00:00:00 2001 From: Adubbz Date: Wed, 1 Jan 2020 19:46:05 +1100 Subject: [PATCH] Fixed villager types. Closes #1519 --- .../java/biomesoplenty/init/ModBiomes.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/main/java/biomesoplenty/init/ModBiomes.java b/src/main/java/biomesoplenty/init/ModBiomes.java index ce0032692..5fcd6db8b 100644 --- a/src/main/java/biomesoplenty/init/ModBiomes.java +++ b/src/main/java/biomesoplenty/init/ModBiomes.java @@ -15,6 +15,7 @@ import biomesoplenty.common.world.WorldTypeBOP; import com.google.common.collect.HashMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Multimap; +import net.minecraft.entity.villager.IVillagerType; import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biomes; @@ -44,6 +45,7 @@ public class ModBiomes { worldType = new WorldTypeBOP(); registerBiomeDictionaryTags(); + registerVillagerTypes(); } @SubscribeEvent @@ -225,6 +227,25 @@ public class ModBiomes registerBiomeToDictionary(undergarden, Type.NETHER, Type.HOT); registerBiomeToDictionary(visceral_heap, Type.NETHER, Type.HOT); } + + private static void registerVillagerTypes() + { + registerVillagerType(brushland, IVillagerType.SAVANNA); + registerVillagerType(cold_desert, IVillagerType.SNOW); + registerVillagerType(coniferous_forest, IVillagerType.TAIGA); + registerVillagerType(grassland, IVillagerType.PLAINS); + registerVillagerType(grove, IVillagerType.PLAINS); + registerVillagerType(maple_woods, IVillagerType.TAIGA); + registerVillagerType(meadow, IVillagerType.TAIGA); + registerVillagerType(outback, IVillagerType.SAVANNA); + registerVillagerType(prairie, IVillagerType.PLAINS); + registerVillagerType(scrubland, IVillagerType.SAVANNA); + registerVillagerType(shrubland, IVillagerType.PLAINS); + registerVillagerType(snowy_forest, IVillagerType.SNOW); + registerVillagerType(tundra, IVillagerType.TAIGA); + registerVillagerType(woodland, IVillagerType.PLAINS); + registerVillagerType(xeric_shrubland, IVillagerType.DESERT); + } private static void registerBiomeToDictionary(Optional biome, Type...types) { @@ -234,6 +255,14 @@ public class ModBiomes } } + private static void registerVillagerType(Optional biome, IVillagerType type) + { + if (biome.isPresent()) + { + IVillagerType.BY_BIOME.put(biome.get(), type); + } + } + public static Optional registerBiome(BiomeBOP biome, String name) { biome.setRegistryName(name);