Added honey generation to the hives (Using water for now)
This commit is contained in:
parent
b67c290d11
commit
95c9ccefac
1 changed files with 29 additions and 6 deletions
|
@ -41,11 +41,13 @@ public class WorldGenHive extends WorldGenerator
|
|||
break;
|
||||
}
|
||||
|
||||
int honeychance = rand.nextInt(2);
|
||||
|
||||
//Top
|
||||
generateHiveCubeSmall(world, x, y + cubeno, z, (baseHeight - 8) + (cubeno * 2), (baseWidth - 1) + cubeno, cubeno, chance);
|
||||
|
||||
//Middle
|
||||
generateHiveCube(world, x, (y - 2) + cubeno, z, baseHeight + (cubeno * 2), baseWidth + cubeno, cubeno, chance);
|
||||
generateHiveCube(world, x, (y - 2) + cubeno, z, baseHeight + (cubeno * 2), baseWidth + cubeno, cubeno, chance, honeychance);
|
||||
|
||||
//Bottom
|
||||
generateHiveCubeSmall(world, x, (y - (baseHeight + 4)) + cubeno, z, (baseHeight - 8) + (cubeno * 2), (baseWidth - 1) + cubeno, cubeno, chance);
|
||||
|
@ -56,13 +58,20 @@ public class WorldGenHive extends WorldGenerator
|
|||
//Bottom 3
|
||||
generateHiveCubeSmall(world, x, (y - (baseHeight + 7)) + cubeno, z, (baseHeight - 7) + (cubeno * 2), (baseWidth - 4) + cubeno, cubeno, chance);
|
||||
|
||||
spawnWasps(world, rand, x, y, z);
|
||||
if (honeychance != 0)
|
||||
{
|
||||
spawnWasps(world, rand, x, y, z, 15);
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnWasps(world, rand, x, y, z, 7);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void generateHiveCube(World world, int origx, int origy, int origz, int height, int width, int cubeno, float chance)
|
||||
public void generateHiveCube(World world, int origx, int origy, int origz, int height, int width, int cubeno, float chance, int honeychance)
|
||||
{
|
||||
for (int hLayer = 0; hLayer < height; hLayer++)
|
||||
{
|
||||
|
@ -73,9 +82,23 @@ public class WorldGenHive extends WorldGenerator
|
|||
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 (honeychance == 0)
|
||||
{
|
||||
if (hLayer > (height / 2))
|
||||
{
|
||||
if (cubeno < 2 && world.getBlockId(origx + i, origy - hLayer, origz + j) != Blocks.hive.get().blockID) world.setBlock(origx + i, origy - hLayer, origz + j, Block.waterMoving.blockID);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cubeno < 2 && world.getBlockId(origx + i, origy - hLayer, origz + j) != Blocks.hive.get().blockID) world.setBlockToAir(origx + i, origy - hLayer, origz + j);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cubeno < 2 && world.getBlockId(origx + i, origy - hLayer, origz + j) != Blocks.hive.get().blockID) world.setBlockToAir(origx + i, origy - hLayer, origz + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,9 +117,9 @@ public class WorldGenHive extends WorldGenerator
|
|||
}
|
||||
}
|
||||
|
||||
public void spawnWasps(World world, Random rand, int x, int y, int z)
|
||||
public void spawnWasps(World world, Random rand, int x, int y, int z, int amount)
|
||||
{
|
||||
for (int spawn = 0; spawn < 15; spawn++)
|
||||
for (int spawn = 0; spawn < amount; spawn++)
|
||||
{
|
||||
int spawnx = (x - 4) + rand.nextInt(8);
|
||||
int spawny = (y - 6) - rand.nextInt(4);
|
||||
|
|
Loading…
Reference in a new issue