/// <summary> /// Spawns a number of villagers in this component. Parameters: world, component bounding box, x offset, y offset, z /// offset, number of villagers /// </summary> protected virtual void SpawnVillagers(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6) { if (VillagersSpawned >= par6) { return; } int i = VillagersSpawned; do { if (i >= par6) { break; } int j = GetXWithOffset(par3 + i, par5); int k = GetYWithOffset(par4); int l = GetZWithOffset(par3 + i, par5); if (!par2StructureBoundingBox.IsVecInside(j, k, l)) { break; } VillagersSpawned++; EntityVillager entityvillager = new EntityVillager(par1World, GetVillagerType(i)); entityvillager.SetLocationAndAngles(j + 0.5F, k, l + 0.5F, 0.0F, 0.0F); par1World.SpawnEntityInWorld(entityvillager); i++; }while (true); }
private void GiveBirth() { EntityVillager entityvillager = new EntityVillager(WorldObj); Mate.SetGrowingAge(6000); VillagerObj.SetGrowingAge(6000); entityvillager.SetGrowingAge(-24000); entityvillager.SetProfession(VillagerObj.GetRNG().Next(5)); entityvillager.SetLocationAndAngles(VillagerObj.PosX, VillagerObj.PosY, VillagerObj.PosZ, 0.0F, 0.0F); WorldObj.SpawnEntityInWorld(entityvillager); SpawnHeartParticles(entityvillager); }