From e4654425cf59c4f0e4c0086dad94e47f90c587ed Mon Sep 17 00:00:00 2001 From: Adubbz Date: Sat, 27 Feb 2016 22:42:04 +1100 Subject: [PATCH] Fixed biome decoration in non-BoP worldtypes, added an exclusions list to disable decoration if desired --- src/main/java/biomesoplenty/api/biome/BOPBiomes.java | 7 +++++++ .../handler/decoration/DecorateBiomeEventHandler.java | 10 +++++----- src/main/java/biomesoplenty/common/init/ModBiomes.java | 10 ++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/main/java/biomesoplenty/api/biome/BOPBiomes.java b/src/main/java/biomesoplenty/api/biome/BOPBiomes.java index 30e8ad412..af9cfa7ee 100644 --- a/src/main/java/biomesoplenty/api/biome/BOPBiomes.java +++ b/src/main/java/biomesoplenty/api/biome/BOPBiomes.java @@ -8,15 +8,22 @@ package biomesoplenty.api.biome; +import java.util.List; + import com.google.common.base.Optional; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeGenBase; public class BOPBiomes { public static final IBiomeRegistry REG_INSTANCE = createRegistry(); + /**A list of world types where BoP biome decoration does not occur**/ + public static List excludedDecoratedWorldTypes = Lists.newArrayList(); + // normal biomes which have weights public static Optional alps = Optional.absent(); public static Optional bamboo_forest = Optional.absent(); diff --git a/src/main/java/biomesoplenty/common/handler/decoration/DecorateBiomeEventHandler.java b/src/main/java/biomesoplenty/common/handler/decoration/DecorateBiomeEventHandler.java index b21848242..affb3965c 100644 --- a/src/main/java/biomesoplenty/common/handler/decoration/DecorateBiomeEventHandler.java +++ b/src/main/java/biomesoplenty/common/handler/decoration/DecorateBiomeEventHandler.java @@ -31,7 +31,7 @@ public class DecorateBiomeEventHandler @SubscribeEvent public void onPreBiomeDecorate(DecorateBiomeEvent.Pre event) { - if (event.world.getWorldType() != ModBiomes.worldTypeBOP) + if (BOPBiomes.excludedDecoratedWorldTypes.contains(event.world.getWorldType())) return; runGeneratorStage(event.world, event.rand, event.pos, GeneratorStage.PRE); @@ -40,7 +40,7 @@ public class DecorateBiomeEventHandler @SubscribeEvent public void onBiomeDecorate(DecorateBiomeEvent.Decorate event) { - if (event.world.getWorldType() != ModBiomes.worldTypeBOP) + if (BOPBiomes.excludedDecoratedWorldTypes.contains(event.world.getWorldType())) return; if (event.type != Decorate.EventType.CUSTOM) @@ -54,7 +54,7 @@ public class DecorateBiomeEventHandler @SubscribeEvent public void onPostBiomeDecorate(DecorateBiomeEvent.Post event) { - if (event.world.getWorldType() != ModBiomes.worldTypeBOP) + if (BOPBiomes.excludedDecoratedWorldTypes.contains(event.world.getWorldType())) return; runGeneratorStage(event.world, event.rand, event.pos, GeneratorStage.POST); @@ -63,7 +63,7 @@ public class DecorateBiomeEventHandler @SubscribeEvent public void onPreGenerateOres(OreGenEvent.Pre event) { - if (event.world.getWorldType() != ModBiomes.worldTypeBOP) + if (BOPBiomes.excludedDecoratedWorldTypes.contains(event.world.getWorldType())) return; runGeneratorStage(event.world, event.rand, event.pos, GeneratorStage.ORE_PRE); @@ -72,7 +72,7 @@ public class DecorateBiomeEventHandler @SubscribeEvent public void onPostGenerateOres(OreGenEvent.Post event) { - if (event.world.getWorldType() != ModBiomes.worldTypeBOP) + if (BOPBiomes.excludedDecoratedWorldTypes.contains(event.world.getWorldType())) return; runGeneratorStage(event.world, event.rand, event.pos, GeneratorStage.ORE_POST); diff --git a/src/main/java/biomesoplenty/common/init/ModBiomes.java b/src/main/java/biomesoplenty/common/init/ModBiomes.java index 1a03f726b..d0069f09d 100644 --- a/src/main/java/biomesoplenty/common/init/ModBiomes.java +++ b/src/main/java/biomesoplenty/common/init/ModBiomes.java @@ -8,6 +8,8 @@ package biomesoplenty.common.init; +import static biomesoplenty.api.biome.BOPBiomes.excludedDecoratedWorldTypes; + import static biomesoplenty.api.biome.BOPBiomes.alps; import static biomesoplenty.api.biome.BOPBiomes.bamboo_forest; import static biomesoplenty.api.biome.BOPBiomes.bayou; @@ -109,6 +111,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.common.BiomeDictionary.Type; @@ -282,6 +285,13 @@ public class ModBiomes implements BOPBiomes.IBiomeRegistry // save the biome ids to the config file (creating it if it doesn't exist) BOPConfig.writeFile(biomeIdMapFile, biomeIdMap); + //Exclude biome decoration from certain worldtypes + excludedDecoratedWorldTypes.add(WorldType.AMPLIFIED); + excludedDecoratedWorldTypes.add(WorldType.CUSTOMIZED); + excludedDecoratedWorldTypes.add(WorldType.DEFAULT); + excludedDecoratedWorldTypes.add(WorldType.DEFAULT_1_1); + excludedDecoratedWorldTypes.add(WorldType.FLAT); + excludedDecoratedWorldTypes.add(WorldType.LARGE_BIOMES); } public static void initSubBiomes()