Simplified hive generation
This commit is contained in:
parent
4dc5bc9587
commit
114e0664ce
1 changed files with 36 additions and 68 deletions
|
@ -40,81 +40,49 @@ public class ItemDart extends Item
|
|||
int z = pos.blockZ;
|
||||
|
||||
int baseWidth = 2 + world.rand.nextInt(2);
|
||||
int baseHeight = 10 + world.rand.nextInt(2);
|
||||
int baseHeight = 7 + world.rand.nextInt(2);
|
||||
|
||||
for (int wLayer = 0; wLayer < 3; wLayer ++)
|
||||
for (int cubeno = 0; cubeno < 3; cubeno++)
|
||||
{
|
||||
for (int hLayer = 0; hLayer < baseHeight; hLayer++)
|
||||
{
|
||||
int width = (baseWidth + wLayer);
|
||||
if (hLayer > 0 && hLayer < (baseHeight - 1)) width++;
|
||||
|
||||
for (int i = -width; i < width; i++)
|
||||
{
|
||||
for (int j = -width; j < width; j++)
|
||||
{
|
||||
if (hLayer == 0)
|
||||
{
|
||||
|
||||
switch (wLayer)
|
||||
{
|
||||
case 0:
|
||||
if (world.rand.nextInt(2) == 0) world.setBlock(x + i, y, z + j, Blocks.hive.get().blockID);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
world.setBlock(x + i, y, z + j, Blocks.hive.get().blockID);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (world.rand.nextInt(2) == 0) world.setBlock(x + i, y, z + j, Blocks.hive.get().blockID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (hLayer == baseHeight - 1)
|
||||
{
|
||||
switch (wLayer)
|
||||
{
|
||||
case 0:
|
||||
if (world.rand.nextInt(2) == 0) world.setBlock(x + i, y + (baseHeight - 1), z + j, Blocks.hive.get().blockID);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
world.setBlock(x + i, y + (baseHeight - 1), z + j, Blocks.hive.get().blockID);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (world.rand.nextInt(2) == 0) world.setBlock(x + i, y + (baseHeight - 1), z + j, Blocks.hive.get().blockID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i == -width || i == (width - 1) || j == -width || j == (width - 1))
|
||||
{
|
||||
switch (wLayer)
|
||||
{
|
||||
case 0:
|
||||
if (world.rand.nextInt(2) == 0) world.setBlock(x + i, y + hLayer, z + j, Blocks.hive.get().blockID);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
world.setBlock(x + i, y + hLayer, z + j, Blocks.hive.get().blockID);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (world.rand.nextInt(2) == 0) world.setBlock(x + i, y + hLayer, z + j, Blocks.hive.get().blockID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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, chance);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
public void generateHiveCube(World world, int origx, int origy, int origz, int height, int width, 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 (world.getBlockId(origx + i, origy - hLayer, origz + j) != Blocks.hive.get().blockID) world.setBlockToAir(origx + i, origy - hLayer, origz + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue