Added wasp spawning

This commit is contained in:
Matt Caughey 2013-10-27 21:32:18 -04:00
parent a8deba13b0
commit b67c290d11
1 changed files with 20 additions and 3 deletions

View File

@ -3,12 +3,10 @@ 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;
import biomesoplenty.entities.EntityWasp;
public class WorldGenHive extends WorldGenerator
{
@ -57,6 +55,8 @@ 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);
}
return true;
@ -93,4 +93,21 @@ public class WorldGenHive extends WorldGenerator
}
}
}
public void spawnWasps(World world, Random rand, int x, int y, int z)
{
for (int spawn = 0; spawn < 15; spawn++)
{
int spawnx = (x - 4) + rand.nextInt(8);
int spawny = (y - 6) - rand.nextInt(4);
int spawnz = (z - 4) + rand.nextInt(8);
if (world.isAirBlock(spawnx, spawny, spawnz))
{
EntityWasp wasp = new EntityWasp(world);
wasp.setLocationAndAngles((double)spawnx, (double)spawny, (double)spawnz, 0.0F, 0.0F);
world.spawnEntityInWorld(wasp);
}
}
}
}