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


Java EntityZombie.copyLocationAndAnglesFrom方法代码示例

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


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

示例1: onLivingDeath

import net.minecraft.entity.monster.EntityZombie; //导入方法依赖的package包/类
@SubscribeEvent
public void onLivingDeath(LivingDeathEvent event) {
    if (event.getSource().getSourceOfDamage() != null && event.getSource().getSourceOfDamage() instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.getSource().getSourceOfDamage();
        if (this.isActive(player) && event.getEntityLiving() instanceof EntityVillager) {
            EntityVillager villager = (EntityVillager) event.getEntityLiving();
            EntityZombie zombieVillager = new EntityZombie(player.worldObj);
            zombieVillager.copyLocationAndAnglesFrom(villager);
            player.worldObj.removeEntity(villager);
            zombieVillager.onInitialSpawn(player.worldObj.getDifficultyForLocation(new BlockPos(zombieVillager)), null);
            zombieVillager.setVillagerType(villager.getProfessionForge());
            zombieVillager.setChild(villager.isChild());
            zombieVillager.setNoAI(villager.isAIDisabled());
            if (villager.hasCustomName()) {
                zombieVillager.setCustomNameTag(villager.getCustomNameTag());
                zombieVillager.setAlwaysRenderNameTag(villager.getAlwaysRenderNameTag());
            }
            player.worldObj.spawnEntityInWorld(zombieVillager);
            player.worldObj.playEvent(null, 1026, zombieVillager.getPosition(), 0);
        }
    }
}
 
开发者ID:Fararise,项目名称:Possessed,代码行数:23,代码来源:ZombieHandler.java

示例2: onKillEntity

import net.minecraft.entity.monster.EntityZombie; //导入方法依赖的package包/类
/**
 * This method gets called when the entity kills another one.
 */
public void onKillEntity(EntityLivingBase p_70074_1_)
{
    super.onKillEntity(p_70074_1_);

    if ((this.worldObj.difficultySetting == EnumDifficulty.NORMAL || this.worldObj.difficultySetting == EnumDifficulty.HARD) && p_70074_1_ instanceof EntityVillager)
    {
        if (this.worldObj.difficultySetting != EnumDifficulty.HARD && this.rand.nextBoolean())
        {
            return;
        }

        EntityZombie entityzombie = new EntityZombie(this.worldObj);
        entityzombie.copyLocationAndAnglesFrom(p_70074_1_);
        this.worldObj.removeEntity(p_70074_1_);
        entityzombie.onSpawnWithEgg((IEntityLivingData)null);
        entityzombie.setVillager(true);

        if (p_70074_1_.isChild())
        {
            entityzombie.setChild(true);
        }

        this.worldObj.spawnEntityInWorld(entityzombie);
        this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1016, (int)this.posX, (int)this.posY, (int)this.posZ, 0);
    }
}
 
开发者ID:jtrent238,项目名称:PopularMMOS-EpicProportions-Mod,代码行数:30,代码来源:EntityFred2_0.java

示例3: impactInfection

import net.minecraft.entity.monster.EntityZombie; //导入方法依赖的package包/类
private void impactInfection(MovingObjectPosition mop, boolean enhanced) {
   if(mop.typeOfHit == MovingObjectType.BLOCK) {
      Block itemEntity = super.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ);
      int newBrewStack = super.worldObj.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ);
      if((itemEntity == Blocks.stone || itemEntity == Blocks.cobblestone || itemEntity == Blocks.stonebrick && newBrewStack == 0) && BlockProtect.canBreak(mop.blockX, mop.blockZ, mop.blockY, super.worldObj)) {
         if(itemEntity == Blocks.stone) {
            super.worldObj.setBlock(mop.blockX, mop.blockY, mop.blockZ, Blocks.monster_egg, 0, 3);
         } else if(itemEntity == Blocks.cobblestone) {
            super.worldObj.setBlock(mop.blockX, mop.blockY, mop.blockZ, Blocks.monster_egg, 1, 3);
         } else if(itemEntity == Blocks.stonebrick) {
            super.worldObj.setBlock(mop.blockX, mop.blockY, mop.blockZ, Blocks.monster_egg, 2, 3);
         }

         return;
      }
   } else if(mop.typeOfHit == MovingObjectType.ENTITY && mop.entityHit instanceof EntityLivingBase) {
      EntityLivingBase itemEntity2 = (EntityLivingBase)mop.entityHit;
      if(itemEntity2 instanceof EntityVillager) {
         EntityZombie newBrewStack2 = new EntityZombie(super.worldObj);
         newBrewStack2.copyLocationAndAnglesFrom(itemEntity2);
         super.worldObj.removeEntity(itemEntity2);
         newBrewStack2.onSpawnWithEgg((IEntityLivingData)null);
         newBrewStack2.setVillager(true);
         if(itemEntity2.isChild()) {
            newBrewStack2.setChild(true);
         }

         super.worldObj.spawnEntityInWorld(newBrewStack2);
         super.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1016, (int)newBrewStack2.posX, (int)newBrewStack2.posY, (int)newBrewStack2.posZ, 0);
      } else {
         float newBrewStack3 = enhanced?4.0F:1.0F;
         itemEntity2.attackEntityFrom(DamageSource.causeThrownDamage(itemEntity2, this.getThrower()), newBrewStack3);
         itemEntity2.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 8));
      }

      return;
   }

   EntityItem itemEntity1 = null;
   if(mop != null) {
      ItemStack newBrewStack1 = Witchery.Items.GENERIC.itemBrewOfInfection.createStack();
      switch(EntityWitchProjectile.NamelessClass2036201851.$SwitchMap$net$minecraft$util$MovingObjectPosition$MovingObjectType[mop.typeOfHit.ordinal()]) {
      case 1:
         itemEntity1 = new EntityItem(super.worldObj, (double)mop.blockX + 0.5D, (double)(mop.blockY + (mop.sideHit == 0?-1:1)) + 0.5D, (double)mop.blockZ + 0.5D, newBrewStack1);
         break;
      case 2:
         itemEntity1 = new EntityItem(super.worldObj, mop.entityHit.posX, mop.entityHit.posY, mop.entityHit.posZ, newBrewStack1);
      }
   }

   this.skipFX = true;
   if(itemEntity1 != null) {
      super.worldObj.spawnEntityInWorld(itemEntity1);
   }

}
 
开发者ID:lerion13,项目名称:witchery,代码行数:57,代码来源:EntityWitchProjectile.java


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