Made hives look nicer

This commit is contained in:
Matt Caughey 2013-10-27 16:03:05 -04:00
parent ddbf1c7017
commit 3de8fa21fb
2 changed files with 35 additions and 6 deletions

View file

@ -15,19 +15,19 @@ 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, var5) != Block.netherrack.blockID) if (var1.getBlockId(var3, var4 + 9, var5) != Block.netherrack.blockID)
{ {
if (!var1.isAirBlock(var3, var4 - 1, var5)) if (!var1.isAirBlock(var3, var4 + 8, var5))
{ {
return false; return false;
} }
} }
int x = var3; int x = var3;
int y = var4 + 6; int y = var4 + 9;
int z = var5; int z = var5;
int baseWidth = 3 + var1.rand.nextInt(2); int baseWidth = 4 + var1.rand.nextInt(2);
int baseHeight = 8 + 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.5F; chance = 0.25F;
break; break;
case 1: case 1:
@ -45,11 +45,25 @@ public class WorldGenHive extends WorldGenerator
break; break;
case 2: case 2:
chance = 0.5F; chance = 0.75F;
break; break;
} }
//Top
generateHiveCubeSmall(var1, x, (y + 2) + cubeno, z, (baseHeight - 8) + (cubeno * 2), (baseWidth - 1) + cubeno, cubeno, chance);
//Middle
generateHiveCube(var1, x, y + cubeno, z, baseHeight + (cubeno * 2), baseWidth + cubeno, cubeno, chance); generateHiveCube(var1, x, y + cubeno, z, baseHeight + (cubeno * 2), baseWidth + cubeno, cubeno, chance);
//Bottom
generateHiveCubeSmall(var1, x, (y - (baseHeight + 2)) + cubeno, z, (baseHeight - 8) + (cubeno * 2), (baseWidth - 1) + cubeno, cubeno, chance);
//Bottom 2
generateHiveCubeSmall(var1, x, (y - (baseHeight + 3)) + cubeno, z, (baseHeight - 7) + (cubeno * 2), (baseWidth - 2) + cubeno, cubeno, chance);
//Bottom 3
generateHiveCubeSmall(var1, x, (y - (baseHeight + 5)) + cubeno, z, (baseHeight - 7) + (cubeno * 2), (baseWidth - 4) + cubeno, cubeno, chance);
} }
return true; return true;
@ -71,4 +85,19 @@ public class WorldGenHive extends WorldGenerator
} }
} }
} }
public void generateHiveCubeSmall(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);
}
}
}
}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 888 B

After

Width:  |  Height:  |  Size: 890 B