Make foothills on the edges of the mountains
This commit is contained in:
parent
24e668e943
commit
bc93ad2bd8
4 changed files with 97 additions and 46 deletions
|
@ -14,6 +14,7 @@ import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
|
||||||
public class BOPBiomes
|
public class BOPBiomes
|
||||||
{
|
{
|
||||||
|
// normal biomes which have weights
|
||||||
public static Optional<BiomeGenBase> alps = Optional.absent();
|
public static Optional<BiomeGenBase> alps = Optional.absent();
|
||||||
public static Optional<BiomeGenBase> arctic = Optional.absent();
|
public static Optional<BiomeGenBase> arctic = Optional.absent();
|
||||||
public static Optional<BiomeGenBase> crag = Optional.absent();
|
public static Optional<BiomeGenBase> crag = Optional.absent();
|
||||||
|
@ -35,7 +36,7 @@ public class BOPBiomes
|
||||||
public static Optional<BiomeGenBase> tundra = Optional.absent();
|
public static Optional<BiomeGenBase> tundra = Optional.absent();
|
||||||
public static Optional<BiomeGenBase> woodland = Optional.absent();
|
public static Optional<BiomeGenBase> woodland = Optional.absent();
|
||||||
|
|
||||||
|
// edge-biomes, sub-biomes and mutated-biomes
|
||||||
// sub biomes
|
|
||||||
public static Optional<BiomeGenBase> glacier = Optional.absent();
|
public static Optional<BiomeGenBase> glacier = Optional.absent();
|
||||||
|
public static Optional<BiomeGenBase> mountainFoothills = Optional.absent();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,11 @@ import net.minecraft.block.BlockDirt;
|
||||||
import net.minecraft.block.BlockTallGrass;
|
import net.minecraft.block.BlockTallGrass;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.passive.EntitySheep;
|
||||||
|
import net.minecraft.entity.passive.EntityWolf;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
import net.minecraft.world.chunk.ChunkPrimer;
|
import net.minecraft.world.chunk.ChunkPrimer;
|
||||||
import net.minecraftforge.common.BiomeManager.BiomeType;
|
import net.minecraftforge.common.BiomeManager.BiomeType;
|
||||||
import biomesoplenty.api.biome.BOPBiome;
|
import biomesoplenty.api.biome.BOPBiome;
|
||||||
|
@ -41,6 +44,9 @@ import biomesoplenty.common.world.feature.tree.GeneratorPineTree;
|
||||||
public class BiomeGenMountain extends BOPBiome
|
public class BiomeGenMountain extends BOPBiome
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public static enum MountainType {PEAKS, FOOTHILLS}
|
||||||
|
|
||||||
|
public MountainType type;
|
||||||
public IBlockState grassBlock;
|
public IBlockState grassBlock;
|
||||||
public IBlockState dirtBlock;
|
public IBlockState dirtBlock;
|
||||||
public IBlockState coarseDirtBlock;
|
public IBlockState coarseDirtBlock;
|
||||||
|
@ -48,19 +54,39 @@ public class BiomeGenMountain extends BOPBiome
|
||||||
public IBlockState snowBlock;
|
public IBlockState snowBlock;
|
||||||
public IBlockState packedSnowBlock;
|
public IBlockState packedSnowBlock;
|
||||||
|
|
||||||
public BiomeGenMountain()
|
public BiomeGenMountain(MountainType type)
|
||||||
{
|
{
|
||||||
|
this.type = type;
|
||||||
|
|
||||||
// terrain
|
// terrain
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case PEAKS:
|
||||||
|
this.bopMinHeight = 90;
|
||||||
|
this.bopMaxHeight = 230;
|
||||||
|
break;
|
||||||
|
case FOOTHILLS:
|
||||||
this.bopMinHeight = 30;
|
this.bopMinHeight = 30;
|
||||||
this.bopMaxHeight = 240;
|
this.bopMaxHeight = 160;
|
||||||
|
break;
|
||||||
|
}
|
||||||
this.sidewaysNoiseAmount = 0.22F;
|
this.sidewaysNoiseAmount = 0.22F;
|
||||||
this.setOctaveWeights(1, 1, 2, 2, 3, 2);
|
this.setOctaveWeights(1, 1, 2, 2, 3, 2);
|
||||||
|
|
||||||
this.setColor(0x80A355);
|
this.setColor(0x80A355);
|
||||||
this.setTemperatureRainfall(0.25F, 0.1F);
|
this.setTemperatureRainfall(0.25F, 0.1F);
|
||||||
|
|
||||||
|
if (type == MountainType.PEAKS)
|
||||||
|
{
|
||||||
|
// peaks are created in the biome gen layer, foothills don't have a weight - they only appear later around the peaks (in the biome edge layer)
|
||||||
this.addWeight(BiomeType.COOL, 10);
|
this.addWeight(BiomeType.COOL, 10);
|
||||||
|
|
||||||
|
// only sheep and wolves on the peaks
|
||||||
|
this.spawnableCreatureList.clear();
|
||||||
|
this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 6));
|
||||||
|
this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 4, 4, 4));
|
||||||
|
}
|
||||||
|
|
||||||
this.topBlock = Blocks.grass.getDefaultState();
|
this.topBlock = Blocks.grass.getDefaultState();
|
||||||
this.fillerBlock = Blocks.dirt.getDefaultState();
|
this.fillerBlock = Blocks.dirt.getDefaultState();
|
||||||
this.grassBlock = this.topBlock;
|
this.grassBlock = this.topBlock;
|
||||||
|
@ -78,7 +104,7 @@ public class BiomeGenMountain extends BOPBiome
|
||||||
this.addGenerator("lakes", GeneratorStage.SAND, (new GeneratorLakes.Builder()).amountPerChunk(0.8F).waterLakeForBiome(this).create());
|
this.addGenerator("lakes", GeneratorStage.SAND, (new GeneratorLakes.Builder()).amountPerChunk(0.8F).waterLakeForBiome(this).create());
|
||||||
|
|
||||||
// trees
|
// trees
|
||||||
IBlockPosQuery suitableTreePosition = new BlockPosQueryAnd(new BlockPosQueryAltitude(40, 150), new BlockPosQueryOr(new BlockQueryMaterial(Material.ground), new BlockQueryMaterial(Material.grass)));
|
IBlockPosQuery suitableTreePosition = new BlockPosQueryAnd(new BlockPosQueryAltitude(40, 140), new BlockPosQueryOr(new BlockQueryMaterial(Material.ground), new BlockQueryMaterial(Material.grass)));
|
||||||
GeneratorWeighted treeGenerator = new GeneratorWeighted(6);
|
GeneratorWeighted treeGenerator = new GeneratorWeighted(6);
|
||||||
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
|
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator);
|
||||||
treeGenerator.add("pine", 1, (new GeneratorPineTree.Builder()).minHeight(6).maxHeight(18).placeOn(suitableTreePosition).create());
|
treeGenerator.add("pine", 1, (new GeneratorPineTree.Builder()).minHeight(6).maxHeight(18).placeOn(suitableTreePosition).create());
|
||||||
|
@ -159,7 +185,7 @@ public class BiomeGenMountain extends BOPBiome
|
||||||
this.topBlock = this.coarseDirtBlock;
|
this.topBlock = this.coarseDirtBlock;
|
||||||
this.fillerBlock = this.coarseDirtBlock;
|
this.fillerBlock = this.coarseDirtBlock;
|
||||||
}
|
}
|
||||||
else if (noise > 1.7D)
|
else if (this.type == MountainType.PEAKS && noise > 1.7D)
|
||||||
{
|
{
|
||||||
this.topBlock = this.stoneBlock;
|
this.topBlock = this.stoneBlock;
|
||||||
this.fillerBlock = this.stoneBlock;
|
this.fillerBlock = this.stoneBlock;
|
||||||
|
|
|
@ -138,6 +138,8 @@ public class ModBiomes
|
||||||
|
|
||||||
private static void registerBiomes()
|
private static void registerBiomes()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// normal biomes which have weights
|
||||||
alps = registerBOPBiome(new BiomeGenAlps(), "Alps");
|
alps = registerBOPBiome(new BiomeGenAlps(), "Alps");
|
||||||
arctic = registerBOPBiome(new BiomeGenArctic(), "Arctic");
|
arctic = registerBOPBiome(new BiomeGenArctic(), "Arctic");
|
||||||
crag = registerBOPBiome(new BiomeGenCrag(), "Crag");
|
crag = registerBOPBiome(new BiomeGenCrag(), "Crag");
|
||||||
|
@ -150,7 +152,7 @@ public class ModBiomes
|
||||||
lavenderFields = registerBOPBiome(new BiomeGenLavenderFields(), "Lavender Fields");
|
lavenderFields = registerBOPBiome(new BiomeGenLavenderFields(), "Lavender Fields");
|
||||||
marsh = registerBOPBiome(new BiomeGenMarsh(), "Marsh");
|
marsh = registerBOPBiome(new BiomeGenMarsh(), "Marsh");
|
||||||
moor = registerBOPBiome(new BiomeGenMoor(), "Moor");
|
moor = registerBOPBiome(new BiomeGenMoor(), "Moor");
|
||||||
mountain = registerBOPBiome(new BiomeGenMountain(), "Mountain");
|
mountain = registerBOPBiome(new BiomeGenMountain(BiomeGenMountain.MountainType.PEAKS), "Mountain");
|
||||||
originValley = registerBOPBiome(new BiomeGenOriginValley(), "Origin Valley");
|
originValley = registerBOPBiome(new BiomeGenOriginValley(), "Origin Valley");
|
||||||
outback = registerBOPBiome(new BiomeGenOutback(), "Outback");
|
outback = registerBOPBiome(new BiomeGenOutback(), "Outback");
|
||||||
shrubland = registerBOPBiome(new BiomeGenShrubland(), "Shrubland");
|
shrubland = registerBOPBiome(new BiomeGenShrubland(), "Shrubland");
|
||||||
|
@ -159,8 +161,9 @@ public class ModBiomes
|
||||||
tundra = registerBOPBiome(new BiomeGenTundra(), "Tundra");
|
tundra = registerBOPBiome(new BiomeGenTundra(), "Tundra");
|
||||||
woodland = registerBOPBiome(new BiomeGenWoodland(), "Woodland");
|
woodland = registerBOPBiome(new BiomeGenWoodland(), "Woodland");
|
||||||
|
|
||||||
// sub biomes
|
// edge-biomes, sub-biomes and mutated-biomes
|
||||||
|
|
||||||
|
mountainFoothills = registerBOPBiome(new BiomeGenMountain(BiomeGenMountain.MountainType.FOOTHILLS), "Mountain Foothills");
|
||||||
glacier = registerBOPBiome(new BiomeGenGlacier(), "Glacier"); // TODO: implement glacier
|
glacier = registerBOPBiome(new BiomeGenGlacier(), "Glacier"); // TODO: implement glacier
|
||||||
|
|
||||||
setSubBiome(Optional.of(BiomeGenBase.frozenOcean), arctic); // add some arctic regions in frozen oceans
|
setSubBiome(Optional.of(BiomeGenBase.frozenOcean), arctic); // add some arctic regions in frozen oceans
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
|
|
||||||
package biomesoplenty.common.world.layer;
|
package biomesoplenty.common.world.layer;
|
||||||
|
|
||||||
|
import com.google.common.base.Optional;
|
||||||
|
|
||||||
|
import biomesoplenty.api.biome.BOPBiomes;
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
import net.minecraft.world.gen.layer.GenLayer;
|
import net.minecraft.world.gen.layer.GenLayer;
|
||||||
import net.minecraft.world.gen.layer.IntCache;
|
import net.minecraft.world.gen.layer.IntCache;
|
||||||
|
@ -34,8 +37,19 @@ public class GenLayerBiomeEdgeBOP extends GenLayer
|
||||||
this.initChunkSeed((long)(x + areaX), (long)(y + areaY));
|
this.initChunkSeed((long)(x + areaX), (long)(y + areaY));
|
||||||
int biomeId = parentVals[x + 1 + (y + 1) * (areaWidth + 2)];
|
int biomeId = parentVals[x + 1 + (y + 1) * (areaWidth + 2)];
|
||||||
|
|
||||||
if (!this.replaceBiomeEdgeIfNecessary(parentVals, out, x, y, areaWidth, biomeId, BiomeGenBase.extremeHills.biomeID, BiomeGenBase.extremeHillsEdge.biomeID) && !this.replaceBiomeEdge(parentVals, out, x, y, areaWidth, biomeId, BiomeGenBase.mesaPlateau_F.biomeID, BiomeGenBase.mesa.biomeID) && !this.replaceBiomeEdge(parentVals, out, x, y, areaWidth, biomeId, BiomeGenBase.mesaPlateau.biomeID, BiomeGenBase.mesa.biomeID) && !this.replaceBiomeEdge(parentVals, out, x, y, areaWidth, biomeId, BiomeGenBase.megaTaiga.biomeID, BiomeGenBase.taiga.biomeID))
|
// line BOP mountain peaks with BOP mountain foothills
|
||||||
{
|
if (this.replaceBiomeEdge(parentVals, out, x, y, areaWidth, biomeId, BOPBiomes.mountain, BOPBiomes.mountainFoothills)) {continue;}
|
||||||
|
|
||||||
|
// line extreme hills with extreme hills edge
|
||||||
|
if (this.replaceBiomeEdgeIfNecessary(parentVals, out, x, y, areaWidth, biomeId, BiomeGenBase.extremeHills.biomeID, BiomeGenBase.extremeHillsEdge.biomeID)) {continue;}
|
||||||
|
|
||||||
|
// line mesa plateau with mesa
|
||||||
|
if (this.replaceBiomeEdge(parentVals, out, x, y, areaWidth, biomeId, BiomeGenBase.mesaPlateau_F.biomeID, BiomeGenBase.mesa.biomeID)) {continue;}
|
||||||
|
if (this.replaceBiomeEdge(parentVals, out, x, y, areaWidth, biomeId, BiomeGenBase.mesaPlateau.biomeID, BiomeGenBase.mesa.biomeID)) {continue;}
|
||||||
|
|
||||||
|
// line mega taiga with ordinary taiga
|
||||||
|
if (this.replaceBiomeEdge(parentVals, out, x, y, areaWidth, biomeId, BiomeGenBase.megaTaiga.biomeID, BiomeGenBase.taiga.biomeID)) {continue;}
|
||||||
|
|
||||||
int northBiomeId;
|
int northBiomeId;
|
||||||
int eastBiomeId;
|
int eastBiomeId;
|
||||||
int westBiomeId;
|
int westBiomeId;
|
||||||
|
@ -43,6 +57,7 @@ public class GenLayerBiomeEdgeBOP extends GenLayer
|
||||||
|
|
||||||
if (biomeId == BiomeGenBase.desert.biomeID)
|
if (biomeId == BiomeGenBase.desert.biomeID)
|
||||||
{
|
{
|
||||||
|
// if desert is next to ice plains turn it into extremeGillsPlus (separate the ice and desert with a big mountain)
|
||||||
northBiomeId = parentVals[x + 1 + (y + 1 - 1) * (areaWidth + 2)];
|
northBiomeId = parentVals[x + 1 + (y + 1 - 1) * (areaWidth + 2)];
|
||||||
eastBiomeId = parentVals[x + 1 + 1 + (y + 1) * (areaWidth + 2)];
|
eastBiomeId = parentVals[x + 1 + 1 + (y + 1) * (areaWidth + 2)];
|
||||||
westBiomeId = parentVals[x + 1 - 1 + (y + 1) * (areaWidth + 2)];
|
westBiomeId = parentVals[x + 1 - 1 + (y + 1) * (areaWidth + 2)];
|
||||||
|
@ -59,6 +74,8 @@ public class GenLayerBiomeEdgeBOP extends GenLayer
|
||||||
}
|
}
|
||||||
else if (biomeId == BiomeGenBase.swampland.biomeID)
|
else if (biomeId == BiomeGenBase.swampland.biomeID)
|
||||||
{
|
{
|
||||||
|
// if swamp is next to desert, cold taiga or ice planes, turn it into plains
|
||||||
|
// if swamp is next to jungle, turn it into jungle edge
|
||||||
northBiomeId = parentVals[x + 1 + (y + 1 - 1) * (areaWidth + 2)];
|
northBiomeId = parentVals[x + 1 + (y + 1 - 1) * (areaWidth + 2)];
|
||||||
eastBiomeId = parentVals[x + 1 + 1 + (y + 1) * (areaWidth + 2)];
|
eastBiomeId = parentVals[x + 1 + 1 + (y + 1) * (areaWidth + 2)];
|
||||||
westBiomeId = parentVals[x + 1 - 1 + (y + 1) * (areaWidth + 2)];
|
westBiomeId = parentVals[x + 1 - 1 + (y + 1) * (areaWidth + 2)];
|
||||||
|
@ -86,7 +103,6 @@ public class GenLayerBiomeEdgeBOP extends GenLayer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -117,6 +133,11 @@ public class GenLayerBiomeEdgeBOP extends GenLayer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean replaceBiomeEdge(int[] parentVals, int[] out, int x, int y, int areaWidth, int biomeId, Optional<BiomeGenBase> fromBiome, Optional<BiomeGenBase> toBiome)
|
||||||
|
{
|
||||||
|
return fromBiome.isPresent() && toBiome.isPresent() && this.replaceBiomeEdge(parentVals, out, x, y, areaWidth, biomeId, fromBiome.get().biomeID, toBiome.get().biomeID);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean replaceBiomeEdge(int[] parentVals, int[] out, int x, int y, int areaWidth, int biomeId, int fromBiomeId, int toBiomeId)
|
private boolean replaceBiomeEdge(int[] parentVals, int[] out, int x, int y, int areaWidth, int biomeId, int fromBiomeId, int toBiomeId)
|
||||||
{
|
{
|
||||||
if (biomeId != fromBiomeId)
|
if (biomeId != fromBiomeId)
|
||||||
|
|
Loading…
Reference in a new issue