Fixed up hive generation

This commit is contained in:
Matt Caughey 2013-10-27 14:54:35 -04:00
parent 398cfdc310
commit ddbf1c7017
8 changed files with 105 additions and 14 deletions

View file

@ -80,6 +80,7 @@ import biomesoplenty.worldgen.WorldGenMesa;
import biomesoplenty.worldgen.WorldGenMud; import biomesoplenty.worldgen.WorldGenMud;
import biomesoplenty.worldgen.WorldGenMycelium; import biomesoplenty.worldgen.WorldGenMycelium;
import biomesoplenty.worldgen.WorldGenNetherGrass; import biomesoplenty.worldgen.WorldGenNetherGrass;
import biomesoplenty.worldgen.WorldGenNetherHive;
import biomesoplenty.worldgen.WorldGenNetherLava; import biomesoplenty.worldgen.WorldGenNetherLava;
import biomesoplenty.worldgen.WorldGenNetherVines; import biomesoplenty.worldgen.WorldGenNetherVines;
import biomesoplenty.worldgen.WorldGenNetherWart; import biomesoplenty.worldgen.WorldGenNetherWart;
@ -150,6 +151,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator
public WorldGenerator clayInStone2Gen; public WorldGenerator clayInStone2Gen;
public WorldGenerator quagmireGen; public WorldGenerator quagmireGen;
public WorldGenerator quicksandGen; public WorldGenerator quicksandGen;
public WorldGenerator hiveGen;
public WorldGenerator spongeGen; public WorldGenerator spongeGen;
public WorldGenerator canyonGen; public WorldGenerator canyonGen;
public WorldGenerator cloudGen; public WorldGenerator cloudGen;
@ -429,6 +431,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator
public boolean generateClouds; public boolean generateClouds;
public boolean generateQuicksand; public boolean generateQuicksand;
public boolean generateSponge; public boolean generateSponge;
public boolean generateHive;
public BiomeDecoratorBOP(BiomeGenBase par1BiomeGenBase) public BiomeDecoratorBOP(BiomeGenBase par1BiomeGenBase)
{ {
@ -453,6 +456,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator
clayInStoneGen = new WorldGenBadlands3(Block.stainedClay.blockID, 32); clayInStoneGen = new WorldGenBadlands3(Block.stainedClay.blockID, 32);
clayInStone2Gen = new WorldGenBadlands(Block.stainedClay.blockID, 32); clayInStone2Gen = new WorldGenBadlands(Block.stainedClay.blockID, 32);
quagmireGen = new WorldGenQuagmire(Block.grass.blockID, 48); quagmireGen = new WorldGenQuagmire(Block.grass.blockID, 48);
hiveGen = new WorldGenNetherHive(Blocks.hive.get().blockID, 48);
quicksandGen = new WorldGenQuicksand(Blocks.mud.get().blockID, 24); quicksandGen = new WorldGenQuicksand(Blocks.mud.get().blockID, 24);
spongeGen = new WorldGenSponge(Block.sponge.blockID, 24); spongeGen = new WorldGenSponge(Block.sponge.blockID, 24);
canyonGen = new WorldGenCanyon(Blocks.redRock.get().blockID, 48); canyonGen = new WorldGenCanyon(Blocks.redRock.get().blockID, 48);
@ -657,6 +661,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator
generateClouds = false; generateClouds = false;
generateQuicksand = false; generateQuicksand = false;
generateSponge = false; generateSponge = false;
generateHive = false;
biome = par1BiomeGenBase; biome = par1BiomeGenBase;
} }
@ -849,6 +854,11 @@ public class BiomeDecoratorBOP extends BiomeDecorator
{ {
this.genStandardOre1(15, quagmireGen, 64, 128); this.genStandardOre1(15, quagmireGen, 64, 128);
} }
if (generateHive)
{
this.genStandardOre1(5, hiveGen, 0, 128);
}
if (generateCanyon) if (generateCanyon)
{ {

View file

@ -28,6 +28,7 @@ public class BiomeGenNetherHive extends BiomeGenBase
spawnableCreatureList.clear(); spawnableCreatureList.clear();
spawnableWaterCreatureList.clear(); spawnableWaterCreatureList.clear();
spawnableCaveCreatureList.clear(); spawnableCaveCreatureList.clear();
customBiomeDecorator.generateHive = true;
spawnableMonsterList.add(new SpawnListEntry(EntityGhast.class, 50, 4, 4)); spawnableMonsterList.add(new SpawnListEntry(EntityGhast.class, 50, 4, 4));
spawnableMonsterList.add(new SpawnListEntry(EntityPigZombie.class, 100, 4, 4)); spawnableMonsterList.add(new SpawnListEntry(EntityPigZombie.class, 100, 4, 4));
spawnableMonsterList.add(new SpawnListEntry(EntityMagmaCube.class, 1, 4, 4)); spawnableMonsterList.add(new SpawnListEntry(EntityMagmaCube.class, 1, 4, 4));
@ -38,12 +39,13 @@ public class BiomeGenNetherHive extends BiomeGenBase
{ {
super.decorate(par1World, par2Random, par3, par4); super.decorate(par1World, par2Random, par3, par4);
if (par2Random.nextInt(10) == 0) if (par2Random.nextInt(2) == 0)
{ {
int var5 = par3 + par2Random.nextInt(16) + 8; int var5 = par3 + par2Random.nextInt(16) + 8;
int var99 = par2Random.nextInt(128);
int var6 = par4 + par2Random.nextInt(16) + 8; int var6 = par4 + par2Random.nextInt(16) + 8;
WorldGenHive var7 = new WorldGenHive(); WorldGenHive var7 = new WorldGenHive();
var7.generate(par1World, par2Random, var5, par1World.getHeightValue(var5, var6) - 1, var6); var7.generate(par1World, par2Random, var5, var99, var6);
} }
} }
} }

View file

@ -242,7 +242,7 @@ public class BOPBiomes {
Biomes.netherLava = Optional.of((new BiomeGenNetherLava(BOPConfigurationIDs.netherLavaID)).setColor(16711680).setBiomeName("Phantasmagoric Inferno").setDisableRain().setTemperatureRainfall(2.0F, 0.0F)); Biomes.netherLava = Optional.of((new BiomeGenNetherLava(BOPConfigurationIDs.netherLavaID)).setColor(16711680).setBiomeName("Phantasmagoric Inferno").setDisableRain().setTemperatureRainfall(2.0F, 0.0F));
Biomes.netherBone = Optional.of((new BiomeGenNetherBone(BOPConfigurationIDs.netherBoneID)).setColor(16711680).setBiomeName("Boneyard").setDisableRain().setTemperatureRainfall(2.0F, 0.0F)); Biomes.netherBone = Optional.of((new BiomeGenNetherBone(BOPConfigurationIDs.netherBoneID)).setColor(16711680).setBiomeName("Boneyard").setDisableRain().setTemperatureRainfall(2.0F, 0.0F));
Biomes.netherBlood = Optional.of((new BiomeGenNetherBlood(BOPConfigurationIDs.netherBloodID)).setColor(16711680).setBiomeName("Bloody Heap").setDisableRain().setTemperatureRainfall(2.0F, 0.0F)); Biomes.netherBlood = Optional.of((new BiomeGenNetherBlood(BOPConfigurationIDs.netherBloodID)).setColor(16711680).setBiomeName("Bloody Heap").setDisableRain().setTemperatureRainfall(2.0F, 0.0F));
Biomes.netherHive = Optional.of((new BiomeGenNetherHive(BOPConfigurationIDs.netherHiveID)).setColor(16711680).setBiomeName("The Hive").setDisableRain().setTemperatureRainfall(2.0F, 0.0F)); Biomes.netherHive = Optional.of((new BiomeGenNetherHive(BOPConfigurationIDs.netherHiveID)).setColor(16711680).setBiomeName("Hellish Hive").setDisableRain().setTemperatureRainfall(2.0F, 0.0F));
Biomes.oasis = Optional.of((new BiomeGenOasis(BOPConfigurationIDs.oasisID)).setColor(16421912).setBiomeName("Oasis").setTemperatureRainfall(0.9F, 0.7F).setMinMaxHeight(0.3F, 0.4F)); Biomes.oasis = Optional.of((new BiomeGenOasis(BOPConfigurationIDs.oasisID)).setColor(16421912).setBiomeName("Oasis").setTemperatureRainfall(0.9F, 0.7F).setMinMaxHeight(0.3F, 0.4F));

View file

@ -107,7 +107,7 @@ public class BOPConfigurationBiomeGen
public static boolean phantasmagoricInfernoGen; public static boolean phantasmagoricInfernoGen;
public static boolean boneyardGen; public static boolean boneyardGen;
public static boolean bloodyHeapGen; public static boolean bloodyHeapGen;
public static boolean theHiveGen; public static boolean hellishHiveGen;
// Beach variations // Beach variations
public static boolean gravelBeachGen; public static boolean gravelBeachGen;
@ -223,7 +223,7 @@ public class BOPConfigurationBiomeGen
phantasmagoricInfernoGen = config.get("Nether Biomes To Generate", "PhantasmagoricInferno", true).getBoolean(true); phantasmagoricInfernoGen = config.get("Nether Biomes To Generate", "PhantasmagoricInferno", true).getBoolean(true);
boneyardGen = config.get("Nether Biomes To Generate", "Boneyard", true).getBoolean(true); boneyardGen = config.get("Nether Biomes To Generate", "Boneyard", true).getBoolean(true);
bloodyHeapGen = config.get("Nether Biomes To Generate", "BloodyHeap", true).getBoolean(true); bloodyHeapGen = config.get("Nether Biomes To Generate", "BloodyHeap", true).getBoolean(true);
theHiveGen = config.get("Nether Biomes To Generate", "TheHive", true).getBoolean(true); hellishHiveGen = config.get("Nether Biomes To Generate", "HellishHive", true).getBoolean(true);
// Beach variations // Beach variations
gravelBeachGen = config.get("Beach Variations To Generate", "Gravel Beach", true).getBoolean(true); gravelBeachGen = config.get("Beach Variations To Generate", "Gravel Beach", true).getBoolean(true);

View file

@ -481,7 +481,7 @@ public class BOPConfigurationIDs
//23-79 ExtraBiomesXL //23-79 ExtraBiomesXL
netherHiveID = config.get("Biome IDs", "The Hive (Nether) ID", 29).getInt(); netherHiveID = config.get("Biome IDs", "Hellish Hive (Nether) ID", 29).getInt();
netherBloodID = config.get("Biome IDs", "Bloody Heap (Nether) ID", 30).getInt(); netherBloodID = config.get("Biome IDs", "Bloody Heap (Nether) ID", 30).getInt();
lavenderFieldsID = config.get("Biome IDs", "Lavender Fields ID", 31).getInt(); lavenderFieldsID = config.get("Biome IDs", "Lavender Fields ID", 31).getInt();

View file

@ -92,7 +92,7 @@ public class BiomeLayerBiomes extends BiomeLayer
} }
if (Biomes.netherHive.isPresent()) if (Biomes.netherHive.isPresent())
{ {
if (BOPConfigurationBiomeGen.theHiveGen) if (BOPConfigurationBiomeGen.hellishHiveGen)
{ {
netherBiomes.add(Biomes.netherHive.get()); netherBiomes.add(Biomes.netherHive.get());
} }

View file

@ -15,20 +15,20 @@ public class WorldGenHive extends WorldGenerator
@Override @Override
public boolean generate(World var1, Random var2, int var3, int var4, int var5) public boolean generate(World var1, Random var2, int var3, int var4, int var5)
{ {
if (var1.getBlockId(var3, var4 + 1, var5) != Block.netherrack.blockID) if (var1.getBlockId(var3, var4, var5) != Block.netherrack.blockID)
{ {
if (var1.getBlockMetadata(var3, var4, var5) != 0) if (!var1.isAirBlock(var3, var4 - 1, var5))
{ {
return false; return false;
} }
} }
int x = var3; int x = var3;
int y = var4; int y = var4 + 6;
int z = var5; int z = var5;
int baseWidth = 2 + var1.rand.nextInt(2); int baseWidth = 3 + var1.rand.nextInt(2);
int baseHeight = 7 + var1.rand.nextInt(2); int baseHeight = 8 + var1.rand.nextInt(2);
for (int cubeno = 0; cubeno < 3; cubeno++) for (int cubeno = 0; cubeno < 3; cubeno++)
{ {
@ -37,7 +37,7 @@ public class WorldGenHive extends WorldGenerator
switch (cubeno) switch (cubeno)
{ {
case 0: case 0:
chance = 0.25F; chance = 0.5F;
break; break;
case 1: case 1:
@ -45,7 +45,7 @@ public class WorldGenHive extends WorldGenerator
break; break;
case 2: case 2:
chance = 0.25F; chance = 0.5F;
break; break;
} }

View file

@ -0,0 +1,79 @@
package biomesoplenty.worldgen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
public class WorldGenNetherHive extends WorldGenerator
{
/** The block ID of the ore to be placed using this generator. */
private int minableBlockId;
/** The number of blocks to generate. */
private int numberOfBlocks;
public WorldGenNetherHive(int par1, int par2)
{
minableBlockId = par1;
numberOfBlocks = par2;
}
@Override
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
{
float var6 = par2Random.nextFloat() * (float)Math.PI;
double var7 = par3 + 8 + MathHelper.sin(var6) * numberOfBlocks / 8.0F;
double var9 = par3 + 8 - MathHelper.sin(var6) * numberOfBlocks / 8.0F;
double var11 = par5 + 8 + MathHelper.cos(var6) * numberOfBlocks / 8.0F;
double var13 = par5 + 8 - MathHelper.cos(var6) * numberOfBlocks / 8.0F;
double var15 = par4 + par2Random.nextInt(3) - 2;
double var17 = par4 + par2Random.nextInt(3) - 2;
for (int var19 = 0; var19 <= numberOfBlocks; ++var19)
{
double var20 = var7 + (var9 - var7) * var19 / numberOfBlocks;
double var22 = var15 + (var17 - var15) * var19 / numberOfBlocks;
double var24 = var11 + (var13 - var11) * var19 / numberOfBlocks;
double var26 = par2Random.nextDouble() * numberOfBlocks / 16.0D;
double var28 = (MathHelper.sin(var19 * (float)Math.PI / numberOfBlocks) + 1.0F) * var26 + 1.0D;
double var30 = (MathHelper.sin(var19 * (float)Math.PI / numberOfBlocks) + 1.0F) * var26 + 1.0D;
int var32 = MathHelper.floor_double(var20 - var28 / 2.0D);
int var33 = MathHelper.floor_double(var22 - var30 / 2.0D);
int var34 = MathHelper.floor_double(var24 - var28 / 2.0D);
int var35 = MathHelper.floor_double(var20 + var28 / 2.0D);
int var36 = MathHelper.floor_double(var22 + var30 / 2.0D);
int var37 = MathHelper.floor_double(var24 + var28 / 2.0D);
for (int var38 = var32; var38 <= var35; ++var38)
{
double var39 = (var38 + 0.5D - var20) / (var28 / 2.0D);
if (var39 * var39 < 1.0D)
{
for (int var41 = var33; var41 <= var36; ++var41)
{
double var42 = (var41 + 0.5D - var22) / (var30 / 2.0D);
if (var39 * var39 + var42 * var42 < 1.0D)
{
for (int var44 = var34; var44 <= var37; ++var44)
{
double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D);
if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && par1World.getBlockId(var38, var41, var44) == Block.netherrack.blockID)
{
par1World.setBlock(var38, var41, var44, minableBlockId);
}
}
}
}
}
}
}
return true;
}
}