当前位置: 首页>>代码示例>>Java>>正文


Java EntityLiving.setLocationAndAngles方法代码示例

本文整理汇总了Java中net.minecraft.entity.EntityLiving.setLocationAndAngles方法的典型用法代码示例。如果您正苦于以下问题:Java EntityLiving.setLocationAndAngles方法的具体用法?Java EntityLiving.setLocationAndAngles怎么用?Java EntityLiving.setLocationAndAngles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.EntityLiving的用法示例。


在下文中一共展示了EntityLiving.setLocationAndAngles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: performWorldGenSpawning

import net.minecraft.entity.EntityLiving; //导入方法依赖的package包/类
private void performWorldGenSpawning(World worldIn, EnumCreatureType type, BlockPos pos ,int p_77191_2_, int p_77191_3_, int p_77191_4_, int p_77191_5_, Random randomIn)
  {
  	float amount;
  	switch (type) {
case MONSTER:
	amount = 0.1f;
	break;
default:
	amount = 0.3f;
	break;
}
  	List<SpawnListEntry> enteries = world.getBiome(pos).getSpawnableList(type);
  	SpawnListEntry entry = enteries.get(rand.nextInt(enteries.size()));
  	while (randomIn.nextFloat() < amount)
      {
          int i = entry.minGroupCount + randomIn.nextInt(1 + entry.maxGroupCount - entry.minGroupCount);
          IEntityLivingData ientitylivingdata = null;
          int j = p_77191_2_ + randomIn.nextInt(p_77191_4_);
          int k = p_77191_3_ + randomIn.nextInt(p_77191_5_);
          int l = j;
          int i1 = k;

          for (int j1 = 0; j1 < i; ++j1)
          {
              boolean flag = false;

              for (int k1 = 0; !flag && k1 < 4; ++k1)
              {
                  BlockPos blockpos = worldIn.getTopSolidOrLiquidBlock(new BlockPos(j, 0, k));

                  if (WorldEntitySpawner.canCreatureTypeSpawnAtLocation(EntityLiving.SpawnPlacementType.ON_GROUND, worldIn, blockpos))
                  {
                      EntityLiving entityliving;

                      try
                      {
                          entityliving = entry.newInstance(worldIn);
                      }
                      catch (Exception exception)
                      {
                          exception.printStackTrace();
                          continue;
                      }

                      entityliving.setLocationAndAngles((double)((float)j + 0.5F), (double)blockpos.getY(), (double)((float)k + 0.5F), randomIn.nextFloat() * 360.0F, 0.0F);
                      worldIn.spawnEntity(entityliving);
                      ientitylivingdata = entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), ientitylivingdata);
                      flag = true;
                  }

                  j += randomIn.nextInt(5) - randomIn.nextInt(5);

                  for (k += randomIn.nextInt(5) - randomIn.nextInt(5); j < p_77191_2_ || j >= p_77191_2_ + p_77191_4_ || k < p_77191_3_ || k >= p_77191_3_ + p_77191_4_; k = i1 + randomIn.nextInt(5) - randomIn.nextInt(5))
                  {
                      j = l + randomIn.nextInt(5) - randomIn.nextInt(5);
                  }
              }
          }
      }
  }
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:61,代码来源:PontusChunkProvider.java

示例2: spawnCreature

import net.minecraft.entity.EntityLiving; //导入方法依赖的package包/类
/**
 * Spawns the creature specified by the egg's type in the location specified
 * by the last three parameters. Parameters: world, entityID, x, y, z.
 */
public static EntityLiving spawnCreature(World par0World, int par1, double par2, double par4, double par6,
		NBTTagCompound nbtdata) {
	EntityLiving entity = null;

	for (int j = 0; j < 1; ++j) {
		if (par1 / 2 == 0)
			entity = new EntityHeavy(par0World);
		else if (par1 / 2 == 1)
			entity = new EntityScout(par0World);
		else if (par1 / 2 == 2)
			entity = new EntitySniper(par0World);
		else if (par1 / 2 == 3)
			entity = new EntitySoldier(par0World);
		else if (par1 / 2 == 4)
			entity = new EntityPyro(par0World);
		else if (par1 / 2 == 5)
			entity = new EntityDemoman(par0World);
		else if (par1 / 2 == 6)
			entity = new EntityMedic(par0World);
		else if (par1 / 2 == 7)
			entity = new EntitySpy(par0World);
		else if (par1 / 2 == 8)
			entity = new EntityEngineer(par0World);
		else if (par1 / 2 == 9)
			entity = new EntitySentry(par0World);
		else if (par1 / 2 == 10)
			entity = new EntityDispenser(par0World);
		else if (par1 / 2 == 11)
			entity = new EntityTeleporter(par0World);
		else if (par1 / 2 == 12)
			entity = new EntityTeleporter(par0World);
		else if (par1 / 2 == 13)
			entity = new EntitySaxtonHale(par0World);
		else if (par1 == 28)
			entity = new EntityMonoculus(par0World);
		else if (par1 == 29)
			entity = new EntityHHH(par0World);
		else if (par1 == 30)
			entity = new EntityMerasmus(par0World);
		if (entity != null) {
			EntityLiving entityliving = entity;
			if (nbtdata != null)
				entityliving.readFromNBT(nbtdata);
			// System.out.println("read");
			entity.setLocationAndAngles(par2, par4, par6,
					MathHelper.wrapDegrees(par0World.rand.nextFloat() * 360.0F), 0.0F);
			entityliving.rotationYawHead = entityliving.rotationYaw;
			entityliving.renderYawOffset = entityliving.rotationYaw;
			TF2CharacterAdditionalData data = new TF2CharacterAdditionalData();
			data.team = par1 % 2;
			entityliving.onInitialSpawn(par0World.getDifficultyForLocation(new BlockPos(entityliving)), data);
			entityliving.playLivingSound();
			if (entity instanceof EntityBuilding)
				((EntityBuilding) entity).setEntTeam(par1 % 2);
			if (entity instanceof EntitySaxtonHale && par1 % 2 == 1)
				((EntitySaxtonHale) entity).setHostile();
			if (!par0World.getCollisionBoxes(entity, entity.getEntityBoundingBox()).isEmpty())
				return null;
			par0World.spawnEntity(entity);

		}

	}

	return entity;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:71,代码来源:ItemMonsterPlacerPlus.java


注:本文中的net.minecraft.entity.EntityLiving.setLocationAndAngles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。