當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityZombie.setPosition方法代碼示例

本文整理匯總了Java中net.minecraft.entity.monster.EntityZombie.setPosition方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityZombie.setPosition方法的具體用法?Java EntityZombie.setPosition怎麽用?Java EntityZombie.setPosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.entity.monster.EntityZombie的用法示例。


在下文中一共展示了EntityZombie.setPosition方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: apply

import net.minecraft.entity.monster.EntityZombie; //導入方法依賴的package包/類
@Override
public boolean apply(EntityPlayer player) {
	for (int i = 0; i < 10; i++) {
		BlockPos pos = new BlockPos(player.posX + player.getRNG().nextGaussian() * 4, player.posY, player.posZ + player.getRNG().nextGaussian() * 4);
		EntityZombie zombie = new EntityZombie(player.world);
		if (player.world.isAirBlock(pos) && player.world.isAirBlock(pos.up()) && player.world.getBlockState(pos.down()).canEntitySpawn(zombie)) {
			zombie.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
			zombie.onInitialSpawn(player.world.getDifficultyForLocation(pos), null);
			player.world.spawnEntity(zombie);
			if (player.getRNG().nextBoolean() && player.getRNG().nextBoolean())
				zombie.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 900, 1));
			if (player.getRNG().nextBoolean() && player.getRNG().nextBoolean())
				zombie.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 900, 1));
			if (player.getRNG().nextBoolean() && player.getRNG().nextBoolean())
				zombie.addPotionEffect(new PotionEffect(MobEffects.SPEED, 900, 1));
			if (player.getRNG().nextBoolean() && player.getRNG().nextBoolean())
				zombie.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 900, 1));
			return true;
		}
	}
	return false;
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:23,代碼來源:FortuneMeetZombie.java

示例2: unearthMe

import net.minecraft.entity.monster.EntityZombie; //導入方法依賴的package包/類
private EntityZombie unearthMe()
{
	EntityZombie zombie = (this.getZombieType() == ZombieType.NORMAL ? new EntityZombie(this.world) : new EntityHusk(this.world));
	zombie.renderYawOffset = this.renderYawOffset;
	zombie.prevRotationPitch = zombie.rotationPitch = this.rotationPitch;
	zombie.prevRotationYaw = zombie.rotationYaw = this.rotationYaw;
	zombie.setPosition(this.posX, this.posY, this.posZ);
	zombie.setHealth(this.getHealth());
	zombie.setFire((Integer)ReflectionUtils.getFieldValue(entityFire, this));
	zombie.setAttackTarget(this.getAttackTarget());

	this.springEffect();
	this.setDead();

	this.world.spawnEntity(zombie);
	return zombie;
}
 
開發者ID:crazysnailboy,項目名稱:Halloween,代碼行數:18,代碼來源:EntityZombieHands.java

示例3: attackEntityFrom

import net.minecraft.entity.monster.EntityZombie; //導入方法依賴的package包/類
@Override
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
{
	super.attackEntityFrom(par1DamageSource, par2);
	if (!this.isDead && !this.worldObj.isRemote)
	{
		this.health -= par2;
		if (this.health <= 0)
		{
			this.setDead();
			this.worldObj.createExplosion((Entity) null, this.posX, this.posY, this.posZ, 6.0F, true);
			worldObj.spawnEntityInWorld(new EntityB2Frag(worldObj, this, 0));
			worldObj.spawnEntityInWorld(new EntityB2Frag(worldObj, this, 1));
			EntityZombie pz = new EntityZombie(worldObj);
			pz.setPosition(posX, posY, posZ);
			worldObj.spawnEntityInWorld(pz);
			RivalRebelsSoundPlayer.playSound(this, 0, 0, 30, 1);
		}
	}
	
	return true;
}
 
開發者ID:rodolphito,項目名稱:Rival-Rebels-Mod,代碼行數:23,代碼來源:EntityB2Spirit.java

示例4: onWornTick

import net.minecraft.entity.monster.EntityZombie; //導入方法依賴的package包/類
@Override
public void onWornTick(World world, EntityPlayer player, ItemStack stack) {
	int damage = stack.getItemDamage();
	if(damage<DustRegistry.getInscriptionFromStack(stack).getMaxDurability()){
		if(world.getTotalWorldTime()%(2*Refs.TPS)==0&&!player.capabilities.isCreativeMode){
			stack.setItemDamage(damage+1);
		}
	}else{
		return;
	}
	if(world.isRemote){
		int skysub=world.calculateSkylightSubtracted(1.0f);
		int rad = Config.foresightRadius;
		EntityZombie dummy = new EntityZombie(world);
		for(int i=-rad;i<rad;i++){
			for(int j=-rad;j<rad;j++){
				for(int k=-rad;k<rad;k++){
					BlockPos pos = player.getPosition().add(i, j, k);
					dummy.setPosition(pos.getX(),pos.getY(),pos.getZ());
					boolean test2 = dummy.getCanSpawnHere()&&!world.isAirBlock(pos)&&world.isAirBlock(pos.up());
					if(test2&& Math.random() < 0.2){
						int blockLight = world.getLightFor(EnumSkyBlock.BLOCK, pos.up());
						int skyLight = world.getLightFor(EnumSkyBlock.SKY, pos.up())-skysub;
						//RunesofWizardry_Classics.log().info(blockLight+" "+skyLight);
						if(blockLight<8){
							if(skyLight<8){//can spawn now
								world.spawnParticle(EnumParticleTypes.SPELL, false, pos.getX()+0.5, pos.getY()+1, pos.getZ()+0.5, 0d, 0d, 0d);
							}else{//can spawn at night
								world.spawnParticle(EnumParticleTypes.SPELL_MOB, false, pos.getX()+0.5, pos.getY()+1, pos.getZ()+0.5, 0d, 0d, 0d);
							}
						}
					}
				}
			}
		}
	}

}
 
開發者ID:Xilef11,項目名稱:runesofwizardry-classics,代碼行數:39,代碼來源:InscriptionForesight.java

示例5: spawnZombieHordeOn

import net.minecraft.entity.monster.EntityZombie; //導入方法依賴的package包/類
private void spawnZombieHordeOn(EntityZombie target, World targetWorld)
{
	int numToSpawn = 0;
	if (ZOMBIE_HORDE_MAX - ZOMBIE_HORDE_MIN + 1 > 0)
	{
		numToSpawn = ZOMBIE_HORDE_MIN + rand.nextInt(ZOMBIE_HORDE_MAX - ZOMBIE_HORDE_MIN + 1);
	}

	for(int i = 0; i < numToSpawn; i++)
	{
		EntityZombie curr = new EntityZombie(targetWorld);
		curr.setPosition(target.posX, target.posY, target.posZ);
		targetWorld.spawnEntityInWorld(curr);
	}
}
 
開發者ID:MinecraftModArchive,項目名稱:Herdcraft,代碼行數:16,代碼來源:HerdCraft.java

示例6: impactLove

import net.minecraft.entity.monster.EntityZombie; //導入方法依賴的package包/類
private void impactLove(MovingObjectPosition mop, boolean enhanced) {
   double RADIUS = enhanced?5.0D:4.0D;
   AxisAlignedBB axisalignedbb = super.boundingBox.expand(RADIUS, 2.0D, RADIUS);
   List list1 = super.worldObj.getEntitiesWithinAABB(EntityLiving.class, axisalignedbb);
   if(list1 != null && !list1.isEmpty() && !super.worldObj.isRemote) {
      EntityLivingBase entityThrower = this.getThrower();
      EntityPlayer thrower = entityThrower != null && entityThrower instanceof EntityPlayer?(EntityPlayer)entityThrower:null;
      Iterator iterator = list1.iterator();
      ArrayList villagers = new ArrayList();
      ArrayList zombies = new ArrayList();

      while(iterator.hasNext()) {
         EntityLiving limit = (EntityLiving)iterator.next();
         double zombie = limit.getDistanceSq(super.posX, super.posY, super.posZ);
         if(zombie < RADIUS * RADIUS) {
            double baby = 1.0D - Math.sqrt(zombie) / RADIUS;
            if(limit == mop.entityHit) {
               baby = 1.0D;
            }

            int j = (int)(baby * 400.0D + 0.5D);
            if(limit instanceof EntityAnimal) {
               EntityAnimal zombie1 = (EntityAnimal)limit;
               if(zombie1.getGrowingAge() >= 0) {
                  zombie1.setGrowingAge(0);
                  zombie1.func_146082_f((EntityPlayer)null);
               }
            } else if(limit instanceof EntityVillager) {
               EntityVillager var26 = (EntityVillager)limit;
               if(var26.getGrowingAge() >= 0) {
                  villagers.add(var26);
               }
            } else if(limit instanceof EntityZombie) {
               EntityZombie var25 = (EntityZombie)limit;
               if(!var25.isChild() && thrower != null) {
                  NBTTagCompound nbt = var25.getEntityData();
                  if(PotionEnslaved.isMobEnslavedBy(var25, thrower)) {
                     zombies.add(var25);
                  }
               }
            }
         }
      }

      int var20 = 10;

      while(villagers.size() > 1 && var20-- > 0) {
         EntityVillager var22 = (EntityVillager)villagers.get(0);
         EntityVillager mate = (EntityVillager)villagers.get(1);
         var22.setPosition(mate.posX, mate.posY, mate.posZ);
         ParticleEffect.HEART.send(SoundEffect.NONE, mate, 1.0D, 2.0D, 8);
         this.giveBirth(var22, mate);
         villagers.remove(0);
         villagers.remove(0);
      }

      var20 = 10;

      while(zombies.size() > 1 && var20-- > 0) {
         EntityZombie var21 = (EntityZombie)zombies.get(0);
         EntityZombie var23 = (EntityZombie)zombies.get(1);
         var21.setPosition(var23.posX, var23.posY, var23.posZ);
         ParticleEffect.HEART.send(SoundEffect.NONE, var23, 1.0D, 2.0D, 8);
         var21.setVillager(true);
         var23.setVillager(true);
         EntityZombie var24 = new EntityZombie(super.worldObj);
         var24.setLocationAndAngles(var23.posX, var23.posY, var23.posZ, 0.0F, 0.0F);
         var24.setChild(true);
         super.worldObj.spawnEntityInWorld(var24);
         zombies.remove(0);
         zombies.remove(0);
      }
   }

}
 
開發者ID:lerion13,項目名稱:witchery,代碼行數:76,代碼來源:EntityWitchProjectile.java

示例7: createDummyEntity

import net.minecraft.entity.monster.EntityZombie; //導入方法依賴的package包/類
/**
 * A little hack needed here; in 1.8 players were a subclass of EntityLiving and could be used as entities for
 * pathfinding purposes.  But now they extend EntityLivingBase, and pathfinder methods only work for subclasses of
 * EntityLiving.  So create a temporary living entity at the player's location and pathfind from that.
 *
 * @param player the player to mimic
 * @return a dummy player-sized living entity
 */
public static EntityLiving createDummyEntity(EntityPlayer player) {
    EntityZombie zombie = new EntityZombie(player.world);
    zombie.setPosition(player.posX, player.posY, player.posZ);
    return zombie;
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:14,代碼來源:PneumaticCraftUtils.java


注:本文中的net.minecraft.entity.monster.EntityZombie.setPosition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。