Added "The Hive" biome to the Nether

This commit is contained in:
Matt Caughey 2013-10-27 14:21:13 -04:00
parent 7d69249fcb
commit 398cfdc310
9 changed files with 141 additions and 58 deletions

View File

@ -70,6 +70,7 @@ public class Biomes
public static Optional<? extends BiomeGenBase> netherLava = Optional.absent();
public static Optional<? extends BiomeGenBase> netherBone = Optional.absent();
public static Optional<? extends BiomeGenBase> netherBlood = Optional.absent();
public static Optional<? extends BiomeGenBase> netherHive = Optional.absent();
public static Optional<? extends BiomeGenBase> oasis = Optional.absent();

View File

@ -0,0 +1,49 @@
package biomesoplenty.biomes.nether;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.monster.EntityMagmaCube;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.SpawnListEntry;
import biomesoplenty.api.Blocks;
import biomesoplenty.biomes.BiomeDecoratorBOP;
import biomesoplenty.worldgen.WorldGenHive;
public class BiomeGenNetherHive extends BiomeGenBase
{
private BiomeDecoratorBOP customBiomeDecorator;
public BiomeGenNetherHive(int par1)
{
super(par1);
theBiomeDecorator = new BiomeDecoratorBOP(this);
customBiomeDecorator = (BiomeDecoratorBOP)theBiomeDecorator;
topBlock = (byte)Block.netherrack.blockID;
fillerBlock = (byte)Block.netherrack.blockID;
spawnableMonsterList.clear();
spawnableCreatureList.clear();
spawnableWaterCreatureList.clear();
spawnableCaveCreatureList.clear();
spawnableMonsterList.add(new SpawnListEntry(EntityGhast.class, 50, 4, 4));
spawnableMonsterList.add(new SpawnListEntry(EntityPigZombie.class, 100, 4, 4));
spawnableMonsterList.add(new SpawnListEntry(EntityMagmaCube.class, 1, 4, 4));
}
@Override
public void decorate(World par1World, Random par2Random, int par3, int par4)
{
super.decorate(par1World, par2Random, par3, par4);
if (par2Random.nextInt(10) == 0)
{
int var5 = par3 + par2Random.nextInt(16) + 8;
int var6 = par4 + par2Random.nextInt(16) + 8;
WorldGenHive var7 = new WorldGenHive();
var7.generate(par1World, par2Random, var5, par1World.getHeightValue(var5, var6) - 1, var6);
}
}
}

View File

@ -108,6 +108,7 @@ import biomesoplenty.biomes.nether.BiomeGenNetherBlood;
import biomesoplenty.biomes.nether.BiomeGenNetherBone;
import biomesoplenty.biomes.nether.BiomeGenNetherDesert;
import biomesoplenty.biomes.nether.BiomeGenNetherGarden;
import biomesoplenty.biomes.nether.BiomeGenNetherHive;
import biomesoplenty.biomes.nether.BiomeGenNetherLava;
import biomesoplenty.biomes.ocean.BiomeGenOceanAbyss;
import biomesoplenty.biomes.ocean.BiomeGenOceanCoral;
@ -241,6 +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.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.netherHive = Optional.of((new BiomeGenNetherHive(BOPConfigurationIDs.netherHiveID)).setColor(16711680).setBiomeName("The 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));
@ -378,11 +380,12 @@ public class BOPBiomes {
BiomeDictionary.registerBiomeType(Biomes.mysticGrove.get(), Type.MAGICAL, Type.FOREST);
BiomeDictionary.registerBiomeType(Biomes.netherBase.get(), Type.NETHER);
BiomeDictionary.registerBiomeType(Biomes.netherGarden.get(), Type.NETHER, Type.FOREST);
BiomeDictionary.registerBiomeType(Biomes.netherGarden.get(), Type.NETHER, Type.JUNGLE);
BiomeDictionary.registerBiomeType(Biomes.netherDesert.get(), Type.NETHER, Type.DESERT);
BiomeDictionary.registerBiomeType(Biomes.netherLava.get(), Type.NETHER);
BiomeDictionary.registerBiomeType(Biomes.netherBone.get(), Type.NETHER, Type.WASTELAND);
BiomeDictionary.registerBiomeType(Biomes.netherBone.get(), Type.NETHER);
BiomeDictionary.registerBiomeType(Biomes.netherBlood.get(), Type.NETHER);
BiomeDictionary.registerBiomeType(Biomes.netherHive.get(), Type.NETHER);
BiomeDictionary.registerBiomeType(Biomes.oasis.get(), Type.DESERT, Type.JUNGLE);

View File

@ -107,6 +107,7 @@ public class BOPConfigurationBiomeGen
public static boolean phantasmagoricInfernoGen;
public static boolean boneyardGen;
public static boolean bloodyHeapGen;
public static boolean theHiveGen;
// Beach variations
public static boolean gravelBeachGen;
@ -222,6 +223,7 @@ public class BOPConfigurationBiomeGen
phantasmagoricInfernoGen = config.get("Nether Biomes To Generate", "PhantasmagoricInferno", 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);
theHiveGen = config.get("Nether Biomes To Generate", "TheHive", true).getBoolean(true);
// Beach variations
gravelBeachGen = config.get("Beach Variations To Generate", "Gravel Beach", true).getBoolean(true);

View File

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

View File

@ -28,61 +28,6 @@ public class ItemDart extends Item
setHasSubtypes(true);
setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
}
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player)
{
MovingObjectPosition pos = this.getMovingObjectPositionFromPlayer(world, player, true);
if (pos == null) return itemstack;
int x = pos.blockX;
int y = pos.blockY;
int z = pos.blockZ;
int baseWidth = 2 + world.rand.nextInt(2);
int baseHeight = 7 + world.rand.nextInt(2);
for (int cubeno = 0; cubeno < 3; cubeno++)
{
float chance = 0.0F;
switch (cubeno)
{
case 0:
chance = 0.25F;
break;
case 1:
chance = 1.0F;
break;
case 2:
chance = 0.25F;
break;
}
generateHiveCube(world, x, y + cubeno, z, baseHeight + (cubeno * 2), baseWidth + cubeno, cubeno, chance);
}
return itemstack;
}
public void generateHiveCube(World world, int origx, int origy, int origz, int height, int width, int cubeno, float chance)
{
for (int hLayer = 0; hLayer < height; hLayer++)
{
for (int i = -width; i < width; i++)
{
for (int j = -width; j < width; j++)
{
if ((hLayer == 0 || hLayer == (height - 1)) && (world.rand.nextFloat() <= chance)) world.setBlock(origx + i, origy - hLayer, origz + j, Blocks.hive.get().blockID);
else if ((i == -width || i == (width - 1) || j == -width || j == (width - 1)) && (world.rand.nextFloat() <= chance)) world.setBlock(origx + i, origy - hLayer, origz + j, Blocks.hive.get().blockID);
if (cubeno < 2 && world.getBlockId(origx + i, origy - hLayer, origz + j) != Blocks.hive.get().blockID) world.setBlockToAir(origx + i, origy - hLayer, origz + j);
}
}
}
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override

View File

@ -10,7 +10,7 @@ public class WorldProviderBOPhell extends WorldProviderHell
@Override
public void registerWorldChunkManager()
{
if (Biomes.netherGarden.isPresent() || Biomes.netherDesert.isPresent() || Biomes.netherLava.isPresent() || Biomes.netherBone.isPresent() || Biomes.netherBlood.isPresent())
if (Biomes.netherGarden.isPresent() || Biomes.netherDesert.isPresent() || Biomes.netherLava.isPresent() || Biomes.netherBone.isPresent() || Biomes.netherBlood.isPresent() || Biomes.netherHive.isPresent())
{
this.worldChunkMgr = new WorldChunkManagerBOPhell(worldObj);
}

View File

@ -90,6 +90,13 @@ public class BiomeLayerBiomes extends BiomeLayer
netherBiomes.add(Biomes.netherBlood.get());
}
}
if (Biomes.netherHive.isPresent())
{
if (BOPConfigurationBiomeGen.theHiveGen)
{
netherBiomes.add(Biomes.netherHive.get());
}
}
if (Biomes.netherBiomes.size() > 0)
{
netherBiomes.addAll(Biomes.netherBiomes);

View File

@ -0,0 +1,74 @@
package biomesoplenty.worldgen;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import biomesoplenty.api.Blocks;
public class WorldGenHive extends WorldGenerator
{
@Override
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.getBlockMetadata(var3, var4, var5) != 0)
{
return false;
}
}
int x = var3;
int y = var4;
int z = var5;
int baseWidth = 2 + var1.rand.nextInt(2);
int baseHeight = 7 + var1.rand.nextInt(2);
for (int cubeno = 0; cubeno < 3; cubeno++)
{
float chance = 0.0F;
switch (cubeno)
{
case 0:
chance = 0.25F;
break;
case 1:
chance = 1.0F;
break;
case 2:
chance = 0.25F;
break;
}
generateHiveCube(var1, x, y + cubeno, z, baseHeight + (cubeno * 2), baseWidth + cubeno, cubeno, chance);
}
return true;
}
public void generateHiveCube(World world, int origx, int origy, int origz, int height, int width, int cubeno, float chance)
{
for (int hLayer = 0; hLayer < height; hLayer++)
{
for (int i = -width; i < width; i++)
{
for (int j = -width; j < width; j++)
{
if ((hLayer == 0 || hLayer == (height - 1)) && (world.rand.nextFloat() <= chance)) world.setBlock(origx + i, origy - hLayer, origz + j, Blocks.hive.get().blockID);
else if ((i == -width || i == (width - 1) || j == -width || j == (width - 1)) && (world.rand.nextFloat() <= chance)) world.setBlock(origx + i, origy - hLayer, origz + j, Blocks.hive.get().blockID);
if (cubeno < 2 && world.getBlockId(origx + i, origy - hLayer, origz + j) != Blocks.hive.get().blockID) world.setBlockToAir(origx + i, origy - hLayer, origz + j);
}
}
}
}
}