Package net.minecraft.entity

Examples of net.minecraft.entity.EntityLiving


            }

            d2 = getSpawnerX() + (getSpawnerWorld().rand.nextDouble() - getSpawnerWorld().rand.nextDouble()) * spawnRange;
            double d3 = getSpawnerY() + getSpawnerWorld().rand.nextInt(3) - 1;
            double d4 = getSpawnerZ() + (getSpawnerWorld().rand.nextDouble() - getSpawnerWorld().rand.nextDouble()) * spawnRange;
            EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving) entity : null;
            entity.setLocationAndAngles(d2, d3, d4, getSpawnerWorld().rand.nextFloat() * 360.0F, 0.0F);

            if(entityliving != null && canSpawnEntity(entityliving)) {
              func_98265_a(entity);
              getSpawnerWorld().playAuxSFX(2004, getSpawnerX(), getSpawnerY(), getSpawnerZ(), 0);

              if(entityliving != null)
              {
                entityliving.spawnExplosionParticle();
              }

              doTimerReset = true;
            }
          }
View Full Code Here


            entity.motionZ *= 0.25f;
        }

        if (entity instanceof EntityLiving)
        {
            EntityLiving living = (EntityLiving) entity;
            living.addPotionEffect(new PotionEffect(Potion.confusion.id, 100, 0));
        }
    }
View Full Code Here

    {
        EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
        double d0 = par1IBlockSource.getX() + enumfacing.getFrontOffsetX();
        double d1 = par1IBlockSource.getYInt() + 0.2F;
        double d2 = par1IBlockSource.getZ() + enumfacing.getFrontOffsetZ();
        EntityLiving entity = SpawnEgg.activateSpawnEgg(par2ItemStack, par1IBlockSource.getWorld(), d0, d1, d2, 0);

        if (par2ItemStack.hasDisplayName())
        {
            entity.setCustomNameTag(par2ItemStack.getDisplayName());
        }

        par2ItemStack.splitStack(1);
        return par2ItemStack;
    }
View Full Code Here

   
    List<?> entities = worldObj.getEntitiesWithinAABB(EntityLiving.class, _areaManager.getHarvestArea().toAxisAlignedBB());
   
    for(Object o : entities)
    {
      EntityLiving e = (EntityLiving)o;
      if(MFRRegistry.getRanchables().containsKey(e.getClass()))
      {
        IFactoryRanchable r = MFRRegistry.getRanchables().get(e.getClass());
        List<ItemStack> drops = r.ranch(worldObj, e, this);
        if(drops != null)
        {
          for(ItemStack s : drops)
          {
View Full Code Here

    _grindingWorld.cleanReferences();
    List<?> entities = worldObj.getEntitiesWithinAABB(EntityLiving.class, _areaManager.getHarvestArea().toAxisAlignedBB());
   
    entityList: for(Object o : entities)
    {
      EntityLiving e = (EntityLiving)o;
      for(Class<?> t : MFRRegistry.getSlaughterhouseBlacklist())
      {
        if(t.isInstance(e))
        {
          continue entityList;
        }
      }
      if((e instanceof EntityAgeable && ((EntityAgeable)e).getGrowingAge() < 0) || e.isEntityInvulnerable() || e.getHealth() <= 0
          || !_grindingWorld.addEntityForGrinding(e))
      {
        continue;
      }
      double massFound = Math.pow(e.boundingBox.getAverageEdgeLength(), 2);
      damageEntity(e);
      if(e.getHealth() <= 0)
      {
        _tank.fill(LiquidDictionary.getLiquid(_rand.nextInt(8) == 0 ? "pinkslime" : "meat", (int)(100 * massFound)), true);
        setIdleTicks(10);
      }
      else
View Full Code Here

    {
      if(!(o instanceof EntityLiving) || o instanceof EntityPlayer || o instanceof EntityMob)
      {
        continue;
      }
      EntityLiving e = (EntityLiving)o;
     
      for(int i = 0; i < getSizeInventory(); i++)
      {
        ItemStack s = getStackInSlot(i);
        if(s != null && s.getItem() instanceof ISyringe)
View Full Code Here

      if(!(spawnedEntity instanceof EntityLiving))
      {
        return false;
      }
     
      EntityLiving spawnedLiving = (EntityLiving)spawnedEntity;
     
      if(_spawnExact)
      {
        NBTTagCompound tag = (NBTTagCompound)itemTag.copy();
        spawnedLiving.readEntityFromNBT(tag);
        for (int i = 0; i < 5; ++i)
        {
          spawnedLiving.func_96120_a(i, 0);
        }
      }
     
      double x = xCoord + (worldObj.rand.nextDouble() - worldObj.rand.nextDouble()) * _spawnRange;
      double y = yCoord + worldObj.rand.nextInt(3) - 1;
      double z = zCoord + (worldObj.rand.nextDouble() - worldObj.rand.nextDouble()) * _spawnRange;
     
      spawnedLiving.setLocationAndAngles(x, y, z, worldObj.rand.nextFloat() * 360.0F, 0.0F);
     
      if(!worldObj.checkNoEntityCollision(spawnedLiving.boundingBox) ||
          !worldObj.getCollidingBoundingBoxes(spawnedLiving, spawnedLiving.boundingBox).isEmpty() ||
          (worldObj.isAnyLiquid(spawnedLiving.boundingBox) != (spawnedLiving instanceof EntityWaterMob)))
      {
        return false;
      }
     
      if (!_spawnExact)
      {
        spawnedLiving.initCreature();
      }
     
      worldObj.spawnEntityInWorld(spawnedLiving);
      worldObj.playAuxSFX(2004, this.xCoord, this.yCoord, this.zCoord, 0);
     
      spawnedLiving.spawnExplosionParticle();
      setWorkDone(0);
      return true;
    }
  }
View Full Code Here

  }
 
  @Override
    public String getDeathMessage(EntityLiving par1EntityLiving)
    {
        EntityLiving entityliving1 = par1EntityLiving.func_94060_bK();
        String s = "death.attack." + this.damageType;
        if (_msgCount > 0)
        {
          int msg = _rand.nextInt(_msgCount);
          if (msg != 0)
          {
            s += "." + msg;
          }
        }
        String s1 = s + ".player";
        return entityliving1 != null && StatCollector.func_94522_b(s1) ? StatCollector.translateToLocalFormatted(s1, new Object[] {par1EntityLiving.getTranslatedEntityName(), entityliving1.getTranslatedEntityName()}): StatCollector.translateToLocalFormatted(s, new Object[] {par1EntityLiving.getTranslatedEntityName()});
    }
View Full Code Here

      return;
    }
   
    if(entity instanceof EntityPlayer || entity instanceof EntityMob && !((EntityLiving)entity).isEntityUndead())
    {
      EntityLiving ent = (EntityLiving)entity;
      if(blockID == MineFactoryReloadedCore.sludgeLiquid.blockID)
      {
        ent.addPotionEffect(new PotionEffect(Potion.poison.id, 12 * 20, 0));
        ent.addPotionEffect(new PotionEffect(Potion.weakness.id, 12 * 20, 0));
        ent.addPotionEffect(new PotionEffect(Potion.confusion.id, 12 * 20, 0));
      }
      else if(blockID == MineFactoryReloadedCore.sewageLiquid.blockID)
      {
        ent.addPotionEffect(new PotionEffect(Potion.hunger.id, 12 * 20, 0));
        ent.addPotionEffect(new PotionEffect(Potion.poison.id, 12 * 20, 0));
        ent.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 12 * 20, 0));
      }
      else if(blockID == MineFactoryReloadedCore.essenceLiquid.blockID)
      {
        ent.addPotionEffect(new PotionEffect(Potion.nightVision.id, 60 * 20, 0));
      }
      else if(blockID == MineFactoryReloadedCore.milkLiquid.blockID)
      {
        ent.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 6 * 20, 0));
      }
      else if(blockID == MineFactoryReloadedCore.biofuelLiquid.blockID)
      {
        ent.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 12 * 20, 0));
      }
    }
    super.onEntityCollidedWithBlock(world, x, y, z, entity);
  }
View Full Code Here

    _grindingWorld.cleanReferences();
    List<?> entities = worldObj.getEntitiesWithinAABB(EntityLiving.class, _areaManager.getHarvestArea().toAxisAlignedBB());
   
    entityList: for(Object o : entities)
    {
      EntityLiving e = (EntityLiving)o;
      if(e instanceof EntityAgeable && ((EntityAgeable)e).getGrowingAge() < 0 || e.isEntityInvulnerable() || e.getHealth() <= 0)
      {
        continue;
      }
      boolean processMob = false;
      processEntity:
      {
        if(MFRRegistry.getGrindables27().containsKey(e.getClass()))
        {
          IFactoryGrindable2 r = MFRRegistry.getGrindables27().get(e.getClass());
          List<MobDrop> drops = r.grind(e.worldObj, e, getRandom());
          if(drops != null && drops.size() > 0 && WeightedRandom.getTotalWeight(drops) > 0)
          {
            ItemStack drop = ((MobDrop)WeightedRandom.getRandomItem(_rand, drops)).getStack();
            doDrop(drop);
          }
          if(r instanceof IFactoryGrindable2)
          {
            if(((IFactoryGrindable2)r).processEntity(e))
            {
              processMob = true;
              if(e.getHealth() <= 0)
              {
                continue entityList;
              }
              break processEntity;
            }
          }
          else
          {
            processMob = true;
            break processEntity;
          }
        }
        for(Class<?> t : MFRRegistry.getGrinderBlacklist())
        {
          if(t.isInstance(e))
          {
            continue entityList;
          }
        }
        if(!_grindingWorld.addEntityForGrinding(e))
        {
          continue entityList;
        }
      }
      if(processMob && e.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot"))
      {
        try
        {
          e.worldObj.getGameRules().setOrCreateGameRule("doMobLoot", "false");
          damageEntity(e);
          if(e.getHealth() <= 0)
          {
            _tank.fill(LiquidDictionary.getLiquid("mobEssence", 100), true);
          }
        }
        finally
        {
          e.worldObj.getGameRules().setOrCreateGameRule("doMobLoot", "true");
          setIdleTicks(20);
        }
        return true;
      }
      damageEntity(e);
      if(e.getHealth() <= 0)
      {
        _tank.fill(LiquidDictionary.getLiquid("mobEssence", 100), true);
        setIdleTicks(20);
      }
      else
View Full Code Here

TOP

Related Classes of net.minecraft.entity.EntityLiving

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.