From eb120ac5f2ed53f57f42ee7fad50b9f627b3fb7f Mon Sep 17 00:00:00 2001 From: Adubbz Date: Sat, 14 Mar 2015 11:55:07 +1100 Subject: [PATCH] Initial implementation of the Alps biome - This is what happens when certain people say certain things :) --- .../biomesoplenty/api/biome/BOPBiome.java | 11 +++++-- .../common/biome/overworld/BiomeGenAlps.java | 28 ++++++++++++++++ .../biomesoplenty/common/init/ModBiomes.java | 32 +++++++++++++++++++ 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 src/main/java/biomesoplenty/common/biome/overworld/BiomeGenAlps.java diff --git a/src/main/java/biomesoplenty/api/biome/BOPBiome.java b/src/main/java/biomesoplenty/api/biome/BOPBiome.java index 171819898..38f2d1801 100644 --- a/src/main/java/biomesoplenty/api/biome/BOPBiome.java +++ b/src/main/java/biomesoplenty/api/biome/BOPBiome.java @@ -15,9 +15,16 @@ public class BOPBiome extends BiomeGenBase implements IExtendedBiome { private GenerationManager generationManager = new GenerationManager(); - public BOPBiome(int id) + public BOPBiome() { - super(id, false); + super(-1, false); + + this.theBiomeDecorator.treesPerChunk = -999; + this.theBiomeDecorator.flowersPerChunk = -999; + this.theBiomeDecorator.grassPerChunk = -999; + this.theBiomeDecorator.sandPerChunk = -999; + this.theBiomeDecorator.sandPerChunk2 = -999; + this.theBiomeDecorator.clayPerChunk = -999; } @Override diff --git a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenAlps.java b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenAlps.java new file mode 100644 index 000000000..8845f4761 --- /dev/null +++ b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenAlps.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright 2015, the Biomes O' Plenty Team + * + * This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License. + * + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. + ******************************************************************************/ + +package biomesoplenty.common.biome.overworld; + +import net.minecraft.init.Blocks; +import biomesoplenty.api.biome.BOPBiome; + +public class BiomeGenAlps extends BOPBiome +{ + private static final Height biomeHeight = new Height(8.0F, 0.025F); + + public BiomeGenAlps() + { + this.setHeight(biomeHeight); + this.setColor(13421772); + this.setEnableSnow(); + this.setTemperatureRainfall(0.0F, 0.5F); + + this.topBlock = Blocks.snow.getDefaultState(); + this.fillerBlock = Blocks.snow.getDefaultState(); + } +} diff --git a/src/main/java/biomesoplenty/common/init/ModBiomes.java b/src/main/java/biomesoplenty/common/init/ModBiomes.java index 258476e8a..adf398edb 100644 --- a/src/main/java/biomesoplenty/common/init/ModBiomes.java +++ b/src/main/java/biomesoplenty/common/init/ModBiomes.java @@ -8,14 +8,21 @@ package biomesoplenty.common.init; +import static biomesoplenty.api.biome.BOPBiomes.alps; import net.minecraft.world.biome.BiomeGenBase; +import net.minecraftforge.common.BiomeManager; +import net.minecraftforge.common.BiomeManager.BiomeEntry; +import net.minecraftforge.common.BiomeManager.BiomeType; import biomesoplenty.common.biome.ExtendedBiomeRegistry; +import biomesoplenty.common.biome.overworld.BiomeGenAlps; import biomesoplenty.common.config.BiomeConfigurationHandler; import biomesoplenty.common.world.WorldTypeBOP; public class ModBiomes { public static WorldTypeBOP worldTypeBOP; + + private static int nextBiomeId = 40; public static void init() { @@ -27,6 +34,12 @@ public class ModBiomes private static void registerBiomes() { + alps = registerBiome(new BiomeGenAlps().setBiomeName("Alps"), "alps"); + + BiomeManager.addBiome(BiomeType.DESERT, new BiomeEntry(alps, 100)); + BiomeManager.addBiome(BiomeType.WARM, new BiomeEntry(alps, 100)); + BiomeManager.addBiome(BiomeType.COOL, new BiomeEntry(alps, 100)); + BiomeManager.addBiome(BiomeType.ICY, new BiomeEntry(alps, 100)); } private static void registerExternalBiomes() @@ -75,6 +88,7 @@ public class ModBiomes private static BiomeGenBase registerBiome(BiomeGenBase biome, String id) { + biome.biomeID = getNextFreeBiomeId(); BiomeConfigurationHandler.getConfigFileMap().put(biome, id); return biome; @@ -87,4 +101,22 @@ public class ModBiomes BiomeConfigurationHandler.getConfigFileMap().put(biome, id); } + public static int getNextFreeBiomeId() + { + for (int i = nextBiomeId; i < 256; i++) + { + if (BiomeGenBase.getBiomeGenArray()[i] != null) + { + if (i == 255) throw new IllegalArgumentException("There are no more biome ids avaliable!"); + continue; + } + else + { + nextBiomeId = i + 1; + return i; + } + } + + return -1; + } }