Moved block replacing code to BOPHellBiome, fixed a bug with inverted z and x args for chunkprimer, added the Polar Chasm
This commit is contained in:
parent
99f9ae7a2c
commit
177de1610e
9 changed files with 216 additions and 512 deletions
|
@ -91,6 +91,9 @@ public class BOPBiomes
|
||||||
public static Optional<Biome> flower_island = Optional.absent();
|
public static Optional<Biome> flower_island = Optional.absent();
|
||||||
public static Optional<Biome> gravel_beach = Optional.absent();
|
public static Optional<Biome> gravel_beach = Optional.absent();
|
||||||
|
|
||||||
|
// nether biomes
|
||||||
|
public static Optional<Biome> polar_chasm = Optional.absent();
|
||||||
|
|
||||||
//Biome extensions
|
//Biome extensions
|
||||||
public static IExtendedBiome end_extension;
|
public static IExtendedBiome end_extension;
|
||||||
public static IExtendedBiome mushroom_island_extension;
|
public static IExtendedBiome mushroom_island_extension;
|
||||||
|
|
|
@ -93,6 +93,7 @@ public enum BOPClimates {
|
||||||
BOPClimates.SAVANNA.addBiome(20, Biomes.SAVANNA);
|
BOPClimates.SAVANNA.addBiome(20, Biomes.SAVANNA);
|
||||||
BOPClimates.HOT_DESERT.addBiome(30, Biomes.DESERT).addBiome(10, Biomes.MESA_CLEAR_ROCK);
|
BOPClimates.HOT_DESERT.addBiome(30, Biomes.DESERT).addBiome(10, Biomes.MESA_CLEAR_ROCK);
|
||||||
BOPClimates.WASTELAND.addBiome(1, Biomes.DESERT);
|
BOPClimates.WASTELAND.addBiome(1, Biomes.DESERT);
|
||||||
|
BOPClimates.HELL.addBiome(20, Biomes.HELL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BOPClimates[] values = BOPClimates.values();
|
private static BOPClimates[] values = BOPClimates.values();
|
||||||
|
|
|
@ -9,6 +9,7 @@ package biomesoplenty.common.biome;
|
||||||
|
|
||||||
import biomesoplenty.api.biome.BiomeOwner;
|
import biomesoplenty.api.biome.BiomeOwner;
|
||||||
import biomesoplenty.api.biome.IExtendedBiome;
|
import biomesoplenty.api.biome.IExtendedBiome;
|
||||||
|
import biomesoplenty.api.config.IBOPWorldSettings;
|
||||||
import biomesoplenty.api.config.IConfigObj;
|
import biomesoplenty.api.config.IConfigObj;
|
||||||
import biomesoplenty.api.enums.BOPClimates;
|
import biomesoplenty.api.enums.BOPClimates;
|
||||||
import biomesoplenty.api.generation.GeneratorStage;
|
import biomesoplenty.api.generation.GeneratorStage;
|
||||||
|
@ -88,6 +89,9 @@ public abstract class BOPBiome extends Biome implements IExtendedBiome
|
||||||
return defaultBuilder.build();
|
return defaultBuilder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applySettings(IBOPWorldSettings settings) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configure(IConfigObj conf)
|
public void configure(IConfigObj conf)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,71 +9,143 @@ package biomesoplenty.common.biome.nether;
|
||||||
|
|
||||||
import biomesoplenty.api.biome.BiomeOwner;
|
import biomesoplenty.api.biome.BiomeOwner;
|
||||||
import biomesoplenty.api.biome.IExtendedBiome;
|
import biomesoplenty.api.biome.IExtendedBiome;
|
||||||
|
import biomesoplenty.api.block.BOPBlocks;
|
||||||
import biomesoplenty.api.config.IBOPWorldSettings;
|
import biomesoplenty.api.config.IBOPWorldSettings;
|
||||||
import biomesoplenty.api.config.IConfigObj;
|
import biomesoplenty.api.config.IConfigObj;
|
||||||
import biomesoplenty.api.enums.BOPClimates;
|
import biomesoplenty.api.enums.BOPClimates;
|
||||||
import biomesoplenty.api.generation.GeneratorStage;
|
import biomesoplenty.api.generation.GeneratorStage;
|
||||||
import biomesoplenty.api.generation.IGenerationManager;
|
import biomesoplenty.api.generation.IGenerationManager;
|
||||||
import biomesoplenty.api.generation.IGenerator;
|
import biomesoplenty.api.generation.IGenerator;
|
||||||
|
import biomesoplenty.common.biome.BOPBiome;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.monster.EntityEnderman;
|
||||||
|
import net.minecraft.entity.monster.EntityGhast;
|
||||||
|
import net.minecraft.entity.monster.EntityMagmaCube;
|
||||||
|
import net.minecraft.entity.monster.EntityPigZombie;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.chunk.ChunkPrimer;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class BOPHellBiome implements IExtendedBiome
|
public class BOPHellBiome extends BOPBiome
|
||||||
{
|
{
|
||||||
@Override
|
public IBlockState wallBlock = Blocks.NETHERRACK.getDefaultState();
|
||||||
public void applySettings(IBOPWorldSettings settings) {
|
public IBlockState roofTopBlock = Blocks.NETHERRACK.getDefaultState();
|
||||||
|
public IBlockState roofFillerBlock = Blocks.NETHERRACK.getDefaultState();
|
||||||
|
|
||||||
|
public BOPHellBiome(String idName, PropsBuilder defaultBuilder)
|
||||||
|
{
|
||||||
|
super(idName, defaultBuilder);
|
||||||
|
|
||||||
|
this.spawnableCaveCreatureList.clear();
|
||||||
|
this.spawnableCreatureList.clear();
|
||||||
|
this.spawnableMonsterList.clear();
|
||||||
|
this.spawnableWaterCreatureList.clear();
|
||||||
|
|
||||||
|
this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityGhast.class, 50, 4, 4));
|
||||||
|
this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityPigZombie.class, 100, 4, 4));
|
||||||
|
this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityMagmaCube.class, 2, 4, 4));
|
||||||
|
this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityEnderman.class, 1, 4, 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configure(IConfigObj conf) {
|
public void configure(IConfigObj conf)
|
||||||
|
{
|
||||||
|
super.configure(conf);
|
||||||
|
|
||||||
|
// Allow basic properties to be overridden
|
||||||
|
this.wallBlock = conf.getBlockState("wallBlock", this.wallBlock);
|
||||||
|
this.roofTopBlock = conf.getBlockState("roofTopBlock", this.roofTopBlock);
|
||||||
|
this.roofFillerBlock = conf.getBlockState("roofFillerBlock", this.roofFillerBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeOwner getBiomeOwner() {
|
public void genTerrainBlocks(World world, Random rand, ChunkPrimer primer, int x, int z, double stoneNoiseVal)
|
||||||
return null;
|
{
|
||||||
|
IBlockState roof = this.roofTopBlock;
|
||||||
|
IBlockState roofFiller = this.roofFillerBlock;
|
||||||
|
IBlockState wall = this.wallBlock;
|
||||||
|
IBlockState floor = this.topBlock;
|
||||||
|
IBlockState floorFiller = this.fillerBlock;
|
||||||
|
|
||||||
|
int roofDepth = 4;
|
||||||
|
int floorDepth = 4;
|
||||||
|
|
||||||
|
int localX = x & 15;
|
||||||
|
int localZ = z & 15;
|
||||||
|
int localY = 127;
|
||||||
|
boolean lastSolid = true;
|
||||||
|
|
||||||
|
while (localY >= 0)
|
||||||
|
{
|
||||||
|
int blockSkip = 1;
|
||||||
|
IBlockState currentState = primer.getBlockState(localZ, localY, localX);
|
||||||
|
|
||||||
|
if (currentState.getBlock() == Blocks.NETHERRACK)
|
||||||
|
{
|
||||||
|
// initially set to the wall material. this may be replaced later by a roof
|
||||||
|
primer.setBlockState(localZ, localY, localX, wall);
|
||||||
|
|
||||||
|
// this must be a floor
|
||||||
|
if (!lastSolid)
|
||||||
|
{
|
||||||
|
primer.setBlockState(localZ, localY, localX, floor);
|
||||||
|
|
||||||
|
// iterate over the next few blocks and replace them with the floor material. skip those
|
||||||
|
// blocks too as we've already checked and modified them
|
||||||
|
for (int floorOffset = 1; floorOffset <= floorDepth - 1 && localY - floorOffset >= 0; floorOffset++)
|
||||||
|
{
|
||||||
|
IBlockState state = primer.getBlockState(localZ, localY - floorOffset, localX);
|
||||||
|
blockSkip = floorOffset + 1;
|
||||||
|
|
||||||
|
if (state.getBlock() == Blocks.NETHERRACK)
|
||||||
|
{
|
||||||
|
primer.setBlockState(localZ, localY - floorOffset, localX, floorFiller);
|
||||||
|
}
|
||||||
|
else break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// update lastSolid for next time
|
||||||
|
lastSolid = true;
|
||||||
|
}
|
||||||
|
else if (currentState.getMaterial() == Material.AIR)
|
||||||
|
{
|
||||||
|
// previous blocks must be a roof
|
||||||
|
if (lastSolid)
|
||||||
|
{
|
||||||
|
primer.setBlockState(localZ, localY + 1, localX, roof);
|
||||||
|
|
||||||
|
// iterate over the previous few blocks to replace them with the roof material
|
||||||
|
for (int roofOffset = 2; roofOffset <= roofDepth && localY + roofOffset <= 127; roofOffset++)
|
||||||
|
{
|
||||||
|
IBlockState state = primer.getBlockState(localZ, localY + roofOffset, localX);
|
||||||
|
|
||||||
|
// onllocalY replace netherrack or walls, if it's air or anything else then don't continue
|
||||||
|
if (state.getBlock() == Blocks.NETHERRACK || state == wall)
|
||||||
|
{
|
||||||
|
primer.setBlockState(localZ, localY + roofOffset, localX, roofFiller);
|
||||||
|
}
|
||||||
|
else break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// update lastSolid for next time
|
||||||
|
lastSolid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
localY -= blockSkip;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addGenerator(String name, GeneratorStage stage, IGenerator generator) {
|
public ResourceLocation getBeachLocation()
|
||||||
|
{
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IGenerationManager getGenerationManager() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<BOPClimates, Integer> getWeightMap() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clearWeights() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addWeight(BOPClimates climate, int weight) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getBeachLocation() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Biome getBaseBiome() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getResourceLocation() {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright 2014-2017, 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.nether;
|
||||||
|
|
||||||
|
import biomesoplenty.api.block.BOPBlocks;
|
||||||
|
import biomesoplenty.api.enums.BOPClimates;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
|
||||||
|
public class BiomePolarChasm extends BOPHellBiome
|
||||||
|
{
|
||||||
|
public BiomePolarChasm()
|
||||||
|
{
|
||||||
|
super("polar_chasm", new PropsBuilder("Polar Chasm").withGuiColour(0xA93C3E));
|
||||||
|
|
||||||
|
this.addWeight(BOPClimates.HELL, 1);
|
||||||
|
|
||||||
|
this.fogColor = 0x6989AD;
|
||||||
|
this.fogDensity = 0.99F;
|
||||||
|
|
||||||
|
this.topBlock = Blocks.SNOW.getDefaultState();
|
||||||
|
this.fillerBlock = Blocks.PACKED_ICE.getDefaultState();
|
||||||
|
this.roofTopBlock = Blocks.SNOW.getDefaultState();
|
||||||
|
this.roofFillerBlock = Blocks.PACKED_ICE.getDefaultState();
|
||||||
|
this.wallBlock = BOPBlocks.hard_ice.getDefaultState();
|
||||||
|
}
|
||||||
|
}
|
|
@ -28,6 +28,7 @@ import biomesoplenty.api.enums.BOPFlowers;
|
||||||
import biomesoplenty.api.enums.BOPPlants;
|
import biomesoplenty.api.enums.BOPPlants;
|
||||||
import biomesoplenty.api.generation.GeneratorStage;
|
import biomesoplenty.api.generation.GeneratorStage;
|
||||||
import biomesoplenty.api.generation.IGenerator;
|
import biomesoplenty.api.generation.IGenerator;
|
||||||
|
import biomesoplenty.common.biome.BOPBiome;
|
||||||
import biomesoplenty.common.block.BlockBOPMushroom;
|
import biomesoplenty.common.block.BlockBOPMushroom;
|
||||||
import biomesoplenty.common.init.ModBiomes;
|
import biomesoplenty.common.init.ModBiomes;
|
||||||
import biomesoplenty.common.util.biome.BiomeUtils;
|
import biomesoplenty.common.util.biome.BiomeUtils;
|
||||||
|
@ -54,21 +55,8 @@ import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraft.world.chunk.ChunkPrimer;
|
import net.minecraft.world.chunk.ChunkPrimer;
|
||||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||||
|
|
||||||
public class BOPOverworldBiome extends Biome implements IExtendedBiome
|
public class BOPOverworldBiome extends BOPBiome
|
||||||
{
|
{
|
||||||
private GenerationManager generationManager = new GenerationManager();
|
|
||||||
private Map<BOPClimates, Integer> weightMap = new HashMap<BOPClimates, Integer>();
|
|
||||||
|
|
||||||
// defaults
|
|
||||||
|
|
||||||
// -1 indicates the defaults as set by Vanilla will be used for the below fields
|
|
||||||
public int skyColor = -1;
|
|
||||||
public int fogColor = -1;
|
|
||||||
|
|
||||||
/** 1.0 is the lowest possible amount of fog. 0.0 is the greatest.*/
|
|
||||||
public float fogDensity = 1.0F;
|
|
||||||
|
|
||||||
public boolean hasBiomeEssence = true;
|
|
||||||
public IBlockState seaFloorBlock = Blocks.DIRT.getDefaultState();
|
public IBlockState seaFloorBlock = Blocks.DIRT.getDefaultState();
|
||||||
|
|
||||||
public boolean canSpawnInBiome = true;
|
public boolean canSpawnInBiome = true;
|
||||||
|
@ -80,61 +68,29 @@ public class BOPOverworldBiome extends Biome implements IExtendedBiome
|
||||||
public TerrainSettings terrainSettings = new TerrainSettings();
|
public TerrainSettings terrainSettings = new TerrainSettings();
|
||||||
public boolean noNeighborTerrainInfuence = false;
|
public boolean noNeighborTerrainInfuence = false;
|
||||||
public int avgDirtDepth = 3;
|
public int avgDirtDepth = 3;
|
||||||
|
|
||||||
public final ResourceLocation location;
|
|
||||||
public IConfigObj conf;
|
|
||||||
|
|
||||||
private BOPOverworldBiome(ResourceLocation idLoc, PropsBuilder defaultBuilder, IConfigObj conf)
|
|
||||||
{
|
|
||||||
super(configureBiomeProps(idLoc, defaultBuilder, conf));
|
|
||||||
|
|
||||||
this.location = idLoc;
|
public BOPOverworldBiome(String idName, PropsBuilder defaultBuilder)
|
||||||
this.conf = conf;
|
{
|
||||||
|
super(idName, defaultBuilder);
|
||||||
|
|
||||||
this.terrainSettings.setDefaults();
|
this.terrainSettings.setDefaults();
|
||||||
|
|
||||||
this.theBiomeDecorator.treesPerChunk = -999;
|
this.theBiomeDecorator.treesPerChunk = -999;
|
||||||
this.theBiomeDecorator.flowersPerChunk = -999;
|
this.theBiomeDecorator.flowersPerChunk = -999;
|
||||||
this.theBiomeDecorator.grassPerChunk = -999;
|
this.theBiomeDecorator.grassPerChunk = -999;
|
||||||
this.theBiomeDecorator.sandPerChunk = -999;
|
this.theBiomeDecorator.sandPerChunk = -999;
|
||||||
this.theBiomeDecorator.sandPerChunk2 = -999;
|
this.theBiomeDecorator.sandPerChunk2 = -999;
|
||||||
//this.theBiomeDecorator.generateLakes = false;
|
//this.theBiomeDecorator.generateLakes = false;
|
||||||
|
|
||||||
// roots
|
// roots
|
||||||
this.addGenerator("roots", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(4.0F).with(BOPPlants.ROOT).create());
|
this.addGenerator("roots", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(4.0F).with(BOPPlants.ROOT).create());
|
||||||
|
|
||||||
IBlockPosQuery suitableStonePosition = BlockQuery.buildAnd().withAltitudeBetween(0, 55).blocks(Blocks.STONE).create();
|
IBlockPosQuery suitableStonePosition = BlockQuery.buildAnd().withAltitudeBetween(0, 55).blocks(Blocks.STONE).create();
|
||||||
this.addGenerator("miners_delight", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.25F).generationAttempts(64).with(BOPFlowers.MINERS_DELIGHT).placeOn(suitableStonePosition).scatterYMethod(ScatterYMethod.BELOW_GROUND).create());
|
this.addGenerator("miners_delight", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(0.25F).generationAttempts(64).with(BOPFlowers.MINERS_DELIGHT).placeOn(suitableStonePosition).scatterYMethod(ScatterYMethod.BELOW_GROUND).create());
|
||||||
this.addGenerator("glowshrooms", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(1.5F).generationAttempts(64).placeOn(suitableStonePosition).with(BOPBlocks.mushroom.getDefaultState().withProperty(BlockBOPMushroom.VARIANT, BlockBOPMushroom.MushroomType.GLOWSHROOM)).scatterYMethod(ScatterYMethod.BELOW_GROUND).create());
|
this.addGenerator("glowshrooms", GeneratorStage.FLOWERS,(new GeneratorFlora.Builder()).amountPerChunk(1.5F).generationAttempts(64).placeOn(suitableStonePosition).with(BOPBlocks.mushroom.getDefaultState().withProperty(BlockBOPMushroom.VARIANT, BlockBOPMushroom.MushroomType.GLOWSHROOM)).scatterYMethod(ScatterYMethod.BELOW_GROUND).create());
|
||||||
this.addGenerator("stone_formations", GeneratorStage.FLOWERS,(new GeneratorColumns.Builder()).amountPerChunk(30.0F).generationAttempts(32).placeOn(suitableStonePosition).with(BOPBlocks.stone_formations.getDefaultState()).minHeight(1).maxHeight(5).randomDirection(true).scatterYMethod(ScatterYMethod.BELOW_GROUND).create());
|
this.addGenerator("stone_formations", GeneratorStage.FLOWERS,(new GeneratorColumns.Builder()).amountPerChunk(30.0F).generationAttempts(32).placeOn(suitableStonePosition).with(BOPBlocks.stone_formations.getDefaultState()).minHeight(1).maxHeight(5).randomDirection(true).scatterYMethod(ScatterYMethod.BELOW_GROUND).create());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BOPOverworldBiome(String idName, PropsBuilder defaultBuilder)
|
|
||||||
{
|
|
||||||
this(new ResourceLocation(BiomesOPlenty.MOD_ID, idName), defaultBuilder, ModBiomes.readConfigFile(idName));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BiomeProps configureBiomeProps(ResourceLocation idLoc, PropsBuilder defaultBuilder, IConfigObj conf)
|
|
||||||
{
|
|
||||||
// If there isn't a valid config file, don't use it to configure the biome
|
|
||||||
if (conf.isEmpty())
|
|
||||||
return defaultBuilder.build();
|
|
||||||
|
|
||||||
defaultBuilder.withTemperature(conf.getFloat("temperature"));
|
|
||||||
defaultBuilder.withRainfall(conf.getFloat("rainfall"));
|
|
||||||
defaultBuilder.withWaterColor(conf.getInt("waterColor"));
|
|
||||||
|
|
||||||
Boolean enableRain = conf.getBool("enableRain");
|
|
||||||
if (enableRain != null && !enableRain) defaultBuilder.withRainDisabled();
|
|
||||||
|
|
||||||
Boolean enableSnow = conf.getBool("enableSnow");
|
|
||||||
if (enableSnow != null && enableSnow) defaultBuilder.withSnowEnabled();
|
|
||||||
|
|
||||||
defaultBuilder.withBaseBiome(conf.getString("baseBiome"));
|
|
||||||
defaultBuilder.withGuiColour(conf.getInt("guiColour"));
|
|
||||||
|
|
||||||
return defaultBuilder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applySettings(IBOPWorldSettings settings)
|
public void applySettings(IBOPWorldSettings settings)
|
||||||
{
|
{
|
||||||
|
@ -147,190 +103,20 @@ public class BOPOverworldBiome extends Biome implements IExtendedBiome
|
||||||
@Override
|
@Override
|
||||||
public void configure(IConfigObj conf)
|
public void configure(IConfigObj conf)
|
||||||
{
|
{
|
||||||
|
super.configure(conf);
|
||||||
// Allow basic properties to be overridden
|
// Allow basic properties to be overridden
|
||||||
this.topBlock = conf.getBlockState("topBlock", this.topBlock);
|
|
||||||
this.fillerBlock = conf.getBlockState("fillerBlock", this.fillerBlock);
|
|
||||||
this.seaFloorBlock = conf.getBlockState("seaFloorBlock", this.seaFloorBlock);
|
this.seaFloorBlock = conf.getBlockState("seaFloorBlock", this.seaFloorBlock);
|
||||||
|
|
||||||
this.terrainSettings.avgHeight = conf.getFloat("averageHeight", (float)this.terrainSettings.avgHeight);
|
this.terrainSettings.avgHeight = conf.getFloat("averageHeight", (float)this.terrainSettings.avgHeight);
|
||||||
this.terrainSettings.variationBelow = conf.getFloat("variationBelow", (float)this.terrainSettings.variationBelow);
|
this.terrainSettings.variationBelow = conf.getFloat("variationBelow", (float)this.terrainSettings.variationBelow);
|
||||||
this.terrainSettings.variationAbove = conf.getFloat("variationAbove", (float)this.terrainSettings.variationAbove);
|
this.terrainSettings.variationAbove = conf.getFloat("variationAbove", (float)this.terrainSettings.variationAbove);
|
||||||
|
|
||||||
this.skyColor = conf.getInt("skyColor", this.skyColor);
|
|
||||||
this.fogColor = conf.getInt("fogColor", this.fogColor);
|
|
||||||
this.fogDensity = conf.getFloat("fogDensity", this.fogDensity);
|
|
||||||
this.hasBiomeEssence = conf.getBool("hasBiomeEssence", this.hasBiomeEssence);
|
|
||||||
|
|
||||||
this.canSpawnInBiome = conf.getBool("canSpawnInBiome", this.canSpawnInBiome);
|
this.canSpawnInBiome = conf.getBool("canSpawnInBiome", this.canSpawnInBiome);
|
||||||
this.canGenerateVillages = conf.getBool("canGenerateVillages", this.canGenerateVillages);
|
this.canGenerateVillages = conf.getBool("canGenerateVillages", this.canGenerateVillages);
|
||||||
this.canGenerateRivers = conf.getBool("canGenerateRivers", this.canGenerateRivers);
|
this.canGenerateRivers = conf.getBool("canGenerateRivers", this.canGenerateRivers);
|
||||||
|
|
||||||
this.beachBiomeLocation = conf.getResourceLocation("beachBiomeLocation", this.beachBiomeLocation);
|
this.beachBiomeLocation = conf.getResourceLocation("beachBiomeLocation", this.beachBiomeLocation);
|
||||||
|
|
||||||
// Allow weights to be overridden
|
|
||||||
IConfigObj confWeights = conf.getObject("weights");
|
|
||||||
if (confWeights != null)
|
|
||||||
{
|
|
||||||
for (BOPClimates climate : BOPClimates.values())
|
|
||||||
{
|
|
||||||
Integer weight = confWeights.getInt(climate.name().toLowerCase(), null);
|
|
||||||
if (weight == null) {continue;}
|
|
||||||
if (weight.intValue() < 1)
|
|
||||||
{
|
|
||||||
this.weightMap.remove(climate);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.weightMap.put(climate, weight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allow generators to be configured
|
|
||||||
IConfigObj confGenerators = conf.getObject("generators");
|
|
||||||
if (confGenerators != null)
|
|
||||||
{
|
|
||||||
for (String name : confGenerators.getKeys())
|
|
||||||
{
|
|
||||||
this.generationManager.configureWith(name, confGenerators.getObject(name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allow spawnable entites to be configured
|
|
||||||
ArrayList<IConfigObj> confEntities = conf.getObjectArray("entities");
|
|
||||||
if (confEntities != null)
|
|
||||||
{
|
|
||||||
for (IConfigObj confEntity : confEntities)
|
|
||||||
{
|
|
||||||
String entityName = confEntity.getString("name");
|
|
||||||
EnumCreatureType creatureType = confEntity.getEnum("creatureType", EnumCreatureType.class);
|
|
||||||
if (entityName == null || creatureType == null) {continue;}
|
|
||||||
|
|
||||||
// Look for an entity class matching this name
|
|
||||||
// case insensitive, dot used as mod delimiter, no spaces or underscores
|
|
||||||
// eg 'villager', 'Zombie', 'SQUID', 'enderdragon', 'biomesoplenty.wasp' all ok
|
|
||||||
Class <? extends Entity> entityClazz = ForgeRegistries.ENTITIES.getValue(new ResourceLocation(entityName)).getEntityClass();
|
|
||||||
Class <? extends EntityLiving> livingClazz = null;
|
|
||||||
if (!(entityClazz.isAssignableFrom(EntityLiving.class))) {
|
|
||||||
confEntity.addMessage("Entity " + entityName + " is not of type EntityLiving");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
livingClazz = (Class <? extends EntityLiving>)entityClazz;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (livingClazz == null)
|
|
||||||
{
|
|
||||||
confEntity.addMessage("No entity registered called " + entityName);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!creatureType.getCreatureClass().isAssignableFrom(livingClazz))
|
|
||||||
{
|
|
||||||
confEntity.addMessage("Entity " + entityName + " is not of type " + creatureType);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<SpawnListEntry> spawns = this.getSpawnableList(creatureType);
|
|
||||||
Integer weight = confEntity.getInt("weight");
|
|
||||||
if (weight != null && weight < 1)
|
|
||||||
{
|
|
||||||
// weight was set to zero (or negative) so find and remove this spawn
|
|
||||||
Iterator<SpawnListEntry> spawnIterator = spawns.iterator();
|
|
||||||
while (spawnIterator.hasNext())
|
|
||||||
{
|
|
||||||
SpawnListEntry entry = spawnIterator.next();
|
|
||||||
if (entry.entityClass == livingClazz)
|
|
||||||
{
|
|
||||||
spawnIterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// weight was positive, or omitted, so update an existing spawn or add a new spawn
|
|
||||||
boolean foundIt = false;
|
|
||||||
for (SpawnListEntry entry : spawns)
|
|
||||||
{
|
|
||||||
if (entry.entityClass == entityClazz)
|
|
||||||
{
|
|
||||||
// the entry already exists - adjust the params
|
|
||||||
entry.itemWeight = confEntity.getInt("weight", entry.itemWeight);
|
|
||||||
entry.minGroupCount = confEntity.getInt("minGroupCount", entry.minGroupCount);
|
|
||||||
entry.maxGroupCount = confEntity.getInt("maxGroupCount", entry.maxGroupCount);
|
|
||||||
foundIt = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!foundIt)
|
|
||||||
{
|
|
||||||
// the entry does not exist - add it
|
|
||||||
SpawnListEntry entry = new SpawnListEntry(livingClazz, confEntity.getInt("weight", 10), confEntity.getInt("minGroupCount", 4), confEntity.getInt("maxGroupCount", 4));
|
|
||||||
spawns.add(entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BiomeOwner getBiomeOwner()
|
|
||||||
{
|
|
||||||
return BiomeOwner.BIOMESOPLENTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addGenerator(String name, GeneratorStage stage, IGenerator generator)
|
|
||||||
{
|
|
||||||
this.generationManager.addGenerator(name, stage, generator);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IGenerator getGenerator(String name)
|
|
||||||
{
|
|
||||||
return this.generationManager.getGenerator(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeGenerator(String name)
|
|
||||||
{
|
|
||||||
this.generationManager.removeGenerator(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GenerationManager getGenerationManager()
|
|
||||||
{
|
|
||||||
return this.generationManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<BOPClimates, Integer> getWeightMap()
|
|
||||||
{
|
|
||||||
return this.weightMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addWeight(BOPClimates climate, int weight)
|
|
||||||
{
|
|
||||||
this.weightMap.put(climate, weight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clearWeights()
|
|
||||||
{
|
|
||||||
this.weightMap.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// whether or not a biome essence item corresponding to this biome should be able to drop from biome blocks
|
|
||||||
public boolean hasBiomeEssence()
|
|
||||||
{
|
|
||||||
return this.hasBiomeEssence;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFogColor(BlockPos pos) { return this.fogColor; }
|
|
||||||
|
|
||||||
public float getFogDensity(BlockPos pos) { return this.fogDensity; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSkyColorByTemp(float temperature)
|
|
||||||
{
|
|
||||||
return (this.skyColor == -1) ? super.getSkyColorByTemp(temperature) : this.skyColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -423,71 +209,4 @@ public class BOPOverworldBiome extends Biome implements IExtendedBiome
|
||||||
{
|
{
|
||||||
return this.beachBiomeLocation;
|
return this.beachBiomeLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Biome getBaseBiome()
|
|
||||||
{
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getResourceLocation()
|
|
||||||
{
|
|
||||||
return this.location;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static class PropsBuilder
|
|
||||||
{
|
|
||||||
private final String biomeName;
|
|
||||||
|
|
||||||
/**The colour of this biome as seen in guis**/
|
|
||||||
private int guiColour = 0xffffff;
|
|
||||||
private float baseHeight = 0.1F;
|
|
||||||
private float heightVariation = 0.2F;
|
|
||||||
private float temperature = 0.5F;
|
|
||||||
private float rainfall = 0.5F;
|
|
||||||
private int waterColor = 16777215;
|
|
||||||
private boolean enableSnow = false;
|
|
||||||
private boolean enableRain = true;
|
|
||||||
private String baseBiomeRegName;
|
|
||||||
|
|
||||||
public PropsBuilder(String name) { this.biomeName = name; }
|
|
||||||
|
|
||||||
public PropsBuilder withGuiColour(Integer colour) { if (colour != null) this.guiColour = colour; return this; }
|
|
||||||
public PropsBuilder withTemperature(Float temperature) { if (temperature != null) this.temperature = temperature; return this; }
|
|
||||||
public PropsBuilder withRainfall(Float rainfall) { if (rainfall != null) this.rainfall = rainfall; return this; }
|
|
||||||
public PropsBuilder withBaseHeight(Float baseHeight) { if (baseHeight != null) this.baseHeight = baseHeight; return this; }
|
|
||||||
public PropsBuilder withHeightVariation(Float heightVariation) { if (heightVariation != null) this.heightVariation = heightVariation; return this; }
|
|
||||||
public PropsBuilder withRainDisabled() { this.enableRain = false; return this; }
|
|
||||||
public PropsBuilder withSnowEnabled() { this.enableSnow = true; return this; }
|
|
||||||
public PropsBuilder withWaterColor(Integer waterColor) { if (waterColor != null) this.waterColor = waterColor; return this; }
|
|
||||||
public PropsBuilder withBaseBiome(String name) { if (name != null) this.baseBiomeRegName = name; return this; }
|
|
||||||
|
|
||||||
public BiomeProps build()
|
|
||||||
{
|
|
||||||
return new BiomeProps(this.biomeName, this.temperature, this.rainfall, this.baseHeight, this.heightVariation, this.enableRain, this.enableSnow, this.waterColor, this.baseBiomeRegName, this.guiColour);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class BiomeProps extends Biome.BiomeProperties
|
|
||||||
{
|
|
||||||
/**The colour of this biome as seen in guis**/
|
|
||||||
private int guiColour = 0xffffff;
|
|
||||||
|
|
||||||
private BiomeProps(String name, float temperature, float rainfall, float baseHeight, float heightVariation, boolean enableRain, boolean enableSnow, int waterColor, String baseBiomeRegName, int guiColour)
|
|
||||||
{
|
|
||||||
super(name);
|
|
||||||
|
|
||||||
this.setTemperature(temperature);
|
|
||||||
this.setRainfall(rainfall);
|
|
||||||
this.setBaseHeight(baseHeight);
|
|
||||||
this.setHeightVariation(heightVariation);
|
|
||||||
if (!enableRain) this.setRainDisabled();
|
|
||||||
if (enableSnow) this.setSnowEnabled();
|
|
||||||
this.setWaterColor(waterColor);
|
|
||||||
this.setBaseBiome(baseBiomeRegName);
|
|
||||||
|
|
||||||
this.guiColour = guiColour;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,98 +8,7 @@
|
||||||
|
|
||||||
package biomesoplenty.common.init;
|
package biomesoplenty.common.init;
|
||||||
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.alps;
|
import static biomesoplenty.api.biome.BOPBiomes.*;
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.bamboo_forest;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.bayou;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.birch_forest_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.birch_forest_hills_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.bog;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.boreal_forest;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.brushland;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.chaparral;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.cherry_blossom_grove;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.cold_desert;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.cold_taiga_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.cold_taiga_hills_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.coniferous_forest;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.coral_reef;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.crag;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.dead_forest;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.dead_swamp;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.desert_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.desert_hills_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.end_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.eucalyptus_forest;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.excludedDecoratedWorldTypes;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.extreme_hills_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.extreme_hills_plus_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.fen;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.flower_field;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.flower_island;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.forest_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.forest_hills_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.glacier;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.grassland;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.gravel_beach;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.grove;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.heathland;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.highland;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.ice_mountains_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.ice_plains_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.jungle_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.jungle_hills_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.kelp_forest;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.land_of_lakes;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.lavender_fields;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.lush_desert;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.lush_swamp;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.mangrove;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.maple_woods;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.marsh;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.meadow;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.mega_taiga_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.mega_taiga_hills_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.mesa_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.mesa_plateau_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.moor;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.mountain;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.mountain_foothills;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.mushroom_island_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.mystic_grove;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.oasis;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.ocean_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.ominous_woods;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.orchard;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.origin_island;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.outback;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.overgrown_cliffs;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.plains_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.prairie;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.quagmire;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.rainforest;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.redwood_forest;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.roofed_forest_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.sacred_springs;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.savanna_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.savanna_plateau_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.seasonal_forest;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.shield;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.shrubland;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.snowy_coniferous_forest;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.snowy_forest;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.steppe;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.swampland_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.taiga_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.taiga_hills_extension;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.temperate_rainforest;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.tropical_island;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.tropical_rainforest;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.tundra;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.volcanic_island;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.wasteland;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.wetland;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.woodland;
|
|
||||||
import static biomesoplenty.api.biome.BOPBiomes.xeric_shrubland;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -111,6 +20,8 @@ import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import biomesoplenty.common.biome.nether.BOPHellBiome;
|
||||||
|
import biomesoplenty.common.biome.nether.BiomePolarChasm;
|
||||||
import biomesoplenty.common.biome.overworld.*;
|
import biomesoplenty.common.biome.overworld.*;
|
||||||
import biomesoplenty.common.world.WorldProviderBOPHell;
|
import biomesoplenty.common.world.WorldProviderBOPHell;
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
|
@ -349,6 +260,9 @@ public class ModBiomes implements BOPBiomes.IBiomeRegistry
|
||||||
addIslandBiome(volcanic_island, 5);
|
addIslandBiome(volcanic_island, 5);
|
||||||
addIslandBiome(flower_island, 7);
|
addIslandBiome(flower_island, 7);
|
||||||
addIslandBiome(mangrove, 10);
|
addIslandBiome(mangrove, 10);
|
||||||
|
|
||||||
|
// nether biomes
|
||||||
|
polar_chasm = registerNetherBiome(new BiomePolarChasm());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initExtendedBiomes()
|
public static void initExtendedBiomes()
|
||||||
|
@ -612,6 +526,27 @@ public class ModBiomes implements BOPBiomes.IBiomeRegistry
|
||||||
return Optional.absent();
|
return Optional.absent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Optional<Biome> registerNetherBiome(BOPHellBiome biome)
|
||||||
|
{
|
||||||
|
String idName = biome.getResourceLocation().getResourcePath();
|
||||||
|
Integer id = biomeIdMapConf.getInt(idName, null);
|
||||||
|
if (id == null) {id = new Integer(getNextFreeBiomeId());}
|
||||||
|
biomeIdMap.put(idName, id);
|
||||||
|
|
||||||
|
if (id > -1) {
|
||||||
|
biome.configure(biome.conf);
|
||||||
|
BOPCommand.biomeCount++;
|
||||||
|
|
||||||
|
BOPBiomes.REG_INSTANCE.registerBiome(biome, idName);
|
||||||
|
Biome.registerBiome(id, biome.getResourceLocation().toString(), biome);
|
||||||
|
|
||||||
|
return Optional.of((Biome)biome);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return Optional.absent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void registerBiomeToDictionary(Optional<Biome> biome, Type...types)
|
private static void registerBiomeToDictionary(Optional<Biome> biome, Type...types)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,9 +31,9 @@ public class BiomeProviderBOPHell extends BiomeProvider
|
||||||
BOPWorldSettings settings = new BOPWorldSettings(chunkProviderSettings);
|
BOPWorldSettings settings = new BOPWorldSettings(chunkProviderSettings);
|
||||||
|
|
||||||
// set up all the gen layers
|
// set up all the gen layers
|
||||||
GenLayer genlayer = setupBOPGenLayers(seed, settings);
|
GenLayer[] genlayers = setupBOPGenLayers(seed, settings);
|
||||||
this.genBiomes = genlayer;
|
this.genBiomes = genlayers[0];
|
||||||
this.biomeIndexLayer = genlayer;
|
this.biomeIndexLayer = genlayers[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public BiomeProviderBOPHell(World world)
|
public BiomeProviderBOPHell(World world)
|
||||||
|
@ -61,7 +61,7 @@ public class BiomeProviderBOPHell extends BiomeProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static GenLayer setupBOPGenLayers(long worldSeed, BOPWorldSettings settings)
|
public static GenLayer[] setupBOPGenLayers(long worldSeed, BOPWorldSettings settings)
|
||||||
{
|
{
|
||||||
int biomeSize = settings.biomeSize.getValue();
|
int biomeSize = settings.biomeSize.getValue();
|
||||||
|
|
||||||
|
@ -85,7 +85,8 @@ public class BiomeProviderBOPHell extends BiomeProvider
|
||||||
// finish biomes with Voronoi zoom
|
// finish biomes with Voronoi zoom
|
||||||
GenLayer biomesFinal = new GenLayerVoronoiZoom(10L, mainBranch);
|
GenLayer biomesFinal = new GenLayerVoronoiZoom(10L, mainBranch);
|
||||||
|
|
||||||
|
mainBranch.initWorldGenSeed(worldSeed);
|
||||||
biomesFinal.initWorldGenSeed(worldSeed);
|
biomesFinal.initWorldGenSeed(worldSeed);
|
||||||
return biomesFinal;
|
return new GenLayer[] {mainBranch, biomesFinal};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import net.minecraft.world.chunk.IChunkGenerator;
|
||||||
import net.minecraft.world.gen.MapGenBase;
|
import net.minecraft.world.gen.MapGenBase;
|
||||||
import net.minecraft.world.gen.MapGenCavesHell;
|
import net.minecraft.world.gen.MapGenCavesHell;
|
||||||
import net.minecraft.world.gen.NoiseGeneratorOctaves;
|
import net.minecraft.world.gen.NoiseGeneratorOctaves;
|
||||||
|
import net.minecraft.world.gen.NoiseGeneratorPerlin;
|
||||||
import net.minecraft.world.gen.feature.*;
|
import net.minecraft.world.gen.feature.*;
|
||||||
import net.minecraft.world.gen.structure.MapGenNetherBridge;
|
import net.minecraft.world.gen.structure.MapGenNetherBridge;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
@ -58,6 +59,8 @@ public class ChunkProviderGenerateBOPHell implements IChunkGenerator
|
||||||
private NoiseGeneratorOctaves netherrackExculsivityNoiseGen;
|
private NoiseGeneratorOctaves netherrackExculsivityNoiseGen;
|
||||||
public NoiseGeneratorOctaves scaleNoise;
|
public NoiseGeneratorOctaves scaleNoise;
|
||||||
public NoiseGeneratorOctaves depthNoise;
|
public NoiseGeneratorOctaves depthNoise;
|
||||||
|
private NoiseGeneratorPerlin stoneNoiseGen;
|
||||||
|
|
||||||
private final WorldGenFire fireFeature = new WorldGenFire();
|
private final WorldGenFire fireFeature = new WorldGenFire();
|
||||||
private final WorldGenGlowStone1 lightGemGen = new WorldGenGlowStone1();
|
private final WorldGenGlowStone1 lightGemGen = new WorldGenGlowStone1();
|
||||||
private final WorldGenGlowStone2 hellPortalGen = new WorldGenGlowStone2();
|
private final WorldGenGlowStone2 hellPortalGen = new WorldGenGlowStone2();
|
||||||
|
@ -67,13 +70,15 @@ public class ChunkProviderGenerateBOPHell implements IChunkGenerator
|
||||||
private final WorldGenHellLava hellSpringGen = new WorldGenHellLava(Blocks.FLOWING_LAVA, false);
|
private final WorldGenHellLava hellSpringGen = new WorldGenHellLava(Blocks.FLOWING_LAVA, false);
|
||||||
private final WorldGenBush brownMushroomFeature = new WorldGenBush(Blocks.BROWN_MUSHROOM);
|
private final WorldGenBush brownMushroomFeature = new WorldGenBush(Blocks.BROWN_MUSHROOM);
|
||||||
private final WorldGenBush redMushroomFeature = new WorldGenBush(Blocks.RED_MUSHROOM);
|
private final WorldGenBush redMushroomFeature = new WorldGenBush(Blocks.RED_MUSHROOM);
|
||||||
|
|
||||||
private MapGenNetherBridge genNetherBridge = new MapGenNetherBridge();
|
private MapGenNetherBridge genNetherBridge = new MapGenNetherBridge();
|
||||||
private MapGenBase genNetherCaves = new MapGenCavesHell();
|
private MapGenBase genNetherCaves = new MapGenCavesHell();
|
||||||
double[] xyzBalanceNoiseArray;
|
private double[] xyzBalanceNoiseArray;
|
||||||
double[] xyzNoiseArrayA;
|
private double[] xyzNoiseArrayA;
|
||||||
double[] xyzNoiseArrayB;
|
private double[] xyzNoiseArrayB;
|
||||||
double[] noiseData4;
|
private double[] noiseData4;
|
||||||
double[] depthRegion;
|
private double[] depthRegion;
|
||||||
|
private double[] stoneNoiseArray;
|
||||||
|
|
||||||
public ChunkProviderGenerateBOPHell(World worldIn, boolean p_i45637_2_, long seed)
|
public ChunkProviderGenerateBOPHell(World worldIn, boolean p_i45637_2_, long seed)
|
||||||
{
|
{
|
||||||
|
@ -87,6 +92,7 @@ public class ChunkProviderGenerateBOPHell implements IChunkGenerator
|
||||||
this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.rand, 4);
|
this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.rand, 4);
|
||||||
this.scaleNoise = new NoiseGeneratorOctaves(this.rand, 10);
|
this.scaleNoise = new NoiseGeneratorOctaves(this.rand, 10);
|
||||||
this.depthNoise = new NoiseGeneratorOctaves(this.rand, 16);
|
this.depthNoise = new NoiseGeneratorOctaves(this.rand, 16);
|
||||||
|
this.stoneNoiseGen = new NoiseGeneratorPerlin(this.rand, 4);
|
||||||
worldIn.setSeaLevel(63);
|
worldIn.setSeaLevel(63);
|
||||||
|
|
||||||
net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextHell ctx =
|
net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextHell ctx =
|
||||||
|
@ -99,6 +105,9 @@ public class ChunkProviderGenerateBOPHell implements IChunkGenerator
|
||||||
this.netherrackExculsivityNoiseGen = ctx.getPerlin3();
|
this.netherrackExculsivityNoiseGen = ctx.getPerlin3();
|
||||||
this.scaleNoise = ctx.getScale();
|
this.scaleNoise = ctx.getScale();
|
||||||
this.depthNoise = ctx.getDepth();
|
this.depthNoise = ctx.getDepth();
|
||||||
|
|
||||||
|
this.stoneNoiseArray = new double[256];
|
||||||
|
|
||||||
this.genNetherBridge = (MapGenNetherBridge)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(genNetherBridge, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_BRIDGE);
|
this.genNetherBridge = (MapGenNetherBridge)net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(genNetherBridge, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_BRIDGE);
|
||||||
this.genNetherCaves = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(genNetherCaves, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_CAVE);
|
this.genNetherCaves = net.minecraftforge.event.terraingen.TerrainGen.getModdedMapGen(genNetherCaves, net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.NETHER_CAVE);
|
||||||
}
|
}
|
||||||
|
@ -206,91 +215,19 @@ public class ChunkProviderGenerateBOPHell implements IChunkGenerator
|
||||||
// Biomes add their top blocks and filler blocks to the primer here
|
// Biomes add their top blocks and filler blocks to the primer here
|
||||||
public void replaceBlocksForBiome(int chunkX, int chunkZ, ChunkPrimer primer, Biome[] biomes)
|
public void replaceBlocksForBiome(int chunkX, int chunkZ, ChunkPrimer primer, Biome[] biomes)
|
||||||
{
|
{
|
||||||
IBlockState roof = Blocks.SNOW.getDefaultState();
|
if (!ForgeEventFactory.onReplaceBiomeBlocks(this, chunkX, chunkZ, primer, this.world)) return;
|
||||||
IBlockState roofFiller = Blocks.PACKED_ICE.getDefaultState();
|
|
||||||
IBlockState wall = BOPBlocks.hard_ice.getDefaultState();
|
|
||||||
IBlockState floor = Blocks.GRASS.getDefaultState();
|
|
||||||
IBlockState floorFiller = Blocks.PACKED_ICE.getDefaultState();
|
|
||||||
|
|
||||||
int roofDepth = 4;
|
double d0 = 0.03125D;
|
||||||
int floorDepth = 4;
|
this.stoneNoiseArray = this.stoneNoiseGen.getRegion(this.stoneNoiseArray, (double)(chunkX * 16), (double)(chunkZ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);
|
||||||
|
|
||||||
//TODO: Migrate to soul sand and shit surface
|
|
||||||
for (int localX = 0; localX < 16; ++localX)
|
for (int localX = 0; localX < 16; ++localX)
|
||||||
{
|
{
|
||||||
for (int localZ = 0; localZ < 16; ++localZ)
|
for (int localZ = 0; localZ < 16; ++localZ)
|
||||||
{
|
{
|
||||||
int x = (chunkX * 16 + localX) & 15;
|
|
||||||
int z = (chunkZ * 16 + localZ) & 15;
|
|
||||||
int localY = 127;
|
|
||||||
Biome biome = biomes[localZ + localX * 16];
|
Biome biome = biomes[localZ + localX * 16];
|
||||||
boolean lastSolid = true;
|
biome.genTerrainBlocks(this.world, this.rand, primer, chunkX * 16 + localX, chunkZ * 16 + localZ, this.stoneNoiseArray[localZ + localX * 16]);
|
||||||
|
|
||||||
while (localY >= 0)
|
|
||||||
{
|
|
||||||
int y = localY;
|
|
||||||
int blockSkip = 1;
|
|
||||||
IBlockState currentState = primer.getBlockState(x, y, z);
|
|
||||||
|
|
||||||
if (currentState.getBlock() == Blocks.NETHERRACK)
|
|
||||||
{
|
|
||||||
// initially set to the wall material. this may be replaced later by a roof
|
|
||||||
primer.setBlockState(x, y, z, wall);
|
|
||||||
|
|
||||||
// this must be a floor
|
|
||||||
if (!lastSolid)
|
|
||||||
{
|
|
||||||
primer.setBlockState(x, y, z, floor);
|
|
||||||
|
|
||||||
// iterate over the next few blocks and replace them with the floor material. skip those
|
|
||||||
// blocks too as we've already checked and modified them
|
|
||||||
for (int floorOffset = 1; floorOffset <= floorDepth - 1 && y - floorOffset >= 0; floorOffset++)
|
|
||||||
{
|
|
||||||
IBlockState state = primer.getBlockState(x, y - floorOffset, z);
|
|
||||||
blockSkip = floorOffset + 1;
|
|
||||||
|
|
||||||
// only replace netherrack, if it's air or anything else then don't continue
|
|
||||||
if (state.getBlock() == Blocks.NETHERRACK)
|
|
||||||
{
|
|
||||||
primer.setBlockState(x, y - floorOffset, z, floorFiller);
|
|
||||||
}
|
|
||||||
else break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// update lastSolid for next time
|
|
||||||
lastSolid = true;
|
|
||||||
}
|
|
||||||
else if (currentState.getMaterial() == Material.AIR)
|
|
||||||
{
|
|
||||||
// previous blocks must be a roof
|
|
||||||
if (lastSolid)
|
|
||||||
{
|
|
||||||
primer.setBlockState(x, y + 1, z, roof);
|
|
||||||
|
|
||||||
// iterate over the previous few blocks to replace them with the roof material
|
|
||||||
for (int roofOffset = 2; roofOffset <= roofDepth && y + roofOffset <= 127; roofOffset++)
|
|
||||||
{
|
|
||||||
IBlockState state = primer.getBlockState(x, y + roofOffset, z);
|
|
||||||
|
|
||||||
// only replace netherrack or walls, if it's air or anything else then don't continue
|
|
||||||
if (state.getBlock() == Blocks.NETHERRACK || state == wall)
|
|
||||||
{
|
|
||||||
primer.setBlockState(x, y + roofOffset, z, roofFiller);
|
|
||||||
}
|
|
||||||
else break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// update lastSolid for next time
|
|
||||||
lastSolid = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
localY -= blockSkip;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildSurfaces(int chunkX, int chunkZ, ChunkPrimer primer)
|
public void buildSurfaces(int chunkX, int chunkZ, ChunkPrimer primer)
|
||||||
|
|
Loading…
Reference in a new issue