Fixed biome decoration in non-BoP worldtypes, added an exclusions list to disable decoration if desired

This commit is contained in:
Adubbz 2016-02-27 22:42:04 +11:00
parent db3c06dcff
commit e4654425cf
3 changed files with 22 additions and 5 deletions

View file

@ -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<WorldType> excludedDecoratedWorldTypes = Lists.newArrayList();
// normal biomes which have weights
public static Optional<BiomeGenBase> alps = Optional.absent();
public static Optional<BiomeGenBase> bamboo_forest = Optional.absent();

View file

@ -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);

View file

@ -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()