Examples of EntityLiving


Examples of net.minecraft.entity.EntityLiving

      return true;
    if(currentItem != null && currentItem.getItem() instanceof ItemLead)
    {
      if(riddenByEntity != null && riddenByEntity instanceof EntityLiving && !(riddenByEntity instanceof EntityPlayer))
      {
        EntityLiving mob = (EntityLiving)riddenByEntity;
        riddenByEntity.mountEntity(null);
        mob.setLeashedToEntity(entityplayer, true);
        return true;
      }
      double checkRange = 10;
      List nearbyMobs = worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox(posX - checkRange, posY - checkRange, posZ - checkRange, posX + checkRange, posY + checkRange, posZ + checkRange));
      for(Object obj : nearbyMobs)
      {
        EntityLiving entity = (EntityLiving)obj;
        if(entity.getLeashed() && entity.getLeashedToEntity() == entityplayer)
        {
          entity.mountEntity(this);
          looking.setAngles(-entity.rotationYaw, entity.rotationPitch, 0F);
          entity.clearLeashed(true, !entityplayer.capabilities.isCreativeMode);
        }
      }
      return true;
    }
    //Put them in the seat
View Full Code Here

Examples of net.minecraft.entity.EntityLiving

    Entity entity = EntityList.createEntityByName(id, world);
    Handler handler = getHandler(id);
   
    if ((entity != null) && (handler != null) &&
        (entity instanceof EntityLiving)) {
      EntityLiving slime = (EntityLiving)entity;
     
      float rotation = MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F);
      slime.setLocationAndAngles(x + 0.5, y, z + 0.5, rotation, 0.0F);
      slime.rotationYawHead = slime.renderYawOffset = rotation;
     
      if (name != null) slime.setCustomNameTag(name);
      handler.setSize(slime, 1);
     
      NBTTagList effectList = (NBTTagList)StackUtils.getTag(stack, "Effects");
      if (effectList != null)
        for (int i = 0; i < effectList.tagCount(); i++)
          slime.addPotionEffect(PotionEffect.readCustomPotionEffectFromNBT(
              effectList.getCompoundTagAt(i)));
     
      world.spawnEntityInWorld(slime);
      slime.playSound("mob.slime.big", 1.2F, 0.6F);
     
      player.setCurrentItemOrArmor(EquipmentSlot.HELD, new ItemStack(Items.bucket));
    }
   
    return true;
View Full Code Here

Examples of net.minecraft.entity.EntityLiving

  public static Entity spawnEntity(World world, Entity spawn, double x, double y, double z) {

    if (spawn != null && spawn instanceof EntityLiving) {

      EntityLiving living = (EntityLiving) spawn;
      spawn.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0f), 0.0f);
      living.rotationYawHead = living.rotationYaw;
      living.renderYawOffset = living.rotationYaw;
      living.onSpawnWithEgg((IEntityLivingData) null);
      world.spawnEntityInWorld(spawn);
      living.playLivingSound();
    }

    return spawn;
  }
View Full Code Here

Examples of net.minecraft.server.EntityLiving

   * Gets the current health level of this Living Entity
   *
   * @return health
   */
  public double getHealth() {
    EntityLiving handle = getHandle(EntityLiving.class);
    return MathUtil.clamp(handle.getHealth(), 0, handle.getMaxHealth());
  }
View Full Code Here

Examples of net.minecraft.server.EntityLiving

   * Sets the path finding radius.
   *
   * @param range of path finding
   */
  public void setPathfindingRange(double range) {
    EntityLiving nmsEntity = CommonNMS.getNative(entity);
    nmsEntity.getAttributeInstance(GenericAttributes.b).setValue(range);
  }
View Full Code Here

Examples of net.minecraft.server.EntityLiving

   * Gets the path finding range
   *
   * @return range of path finding
   */
  public double getPathfindingRange() {
    EntityLiving nmsEntity = CommonNMS.getNative(entity);
    return nmsEntity.getAttributeInstance(GenericAttributes.b).getValue();
  }
View Full Code Here

Examples of net.minecraft.server.EntityLiving

   *
   * @param location to move to
   * @param speed to move with
   */
  public void moveTo(Location location, double speed) {
    EntityLiving nmsEntity = CommonNMS.getNative(this.entity);
    if(nmsEntity instanceof EntityInsentient) {
      Navigation navigation = (Navigation) EntityLivingRef.getNavigation.invoke(nmsEntity);
      double x = location.getX();
      double y = location.getY();
      double z = location.getZ();
View Full Code Here

Examples of net.minecraft.server.EntityLiving

   *
   * @param entity to find
   * @param speed to move with
   */
  public void moveTo(Entity entity, double speed) {
    EntityLiving nmsEntity = CommonNMS.getNative(this.entity);
    net.minecraft.server.Entity nmsTargetEntity = CommonNMS.getNative(entity);
    if(nmsEntity instanceof EntityInsentient) {
      Navigation navigation = (Navigation) EntityLivingRef.getNavigation.invoke(nmsEntity);
      if(!navigation.a(nmsTargetEntity, speed)) {
        PathEntity path = nmsEntity.world.findPath(nmsEntity, nmsTargetEntity, (float) this.getPathfindingRange(), true, false, false, true);
View Full Code Here

Examples of net.minecraft.server.EntityLiving

      }
    }
  }
 
  private void moveWithPath(PathEntity path, double speed) {
    EntityLiving nmsEntity = CommonNMS.getNative(entity);
    if(nmsEntity instanceof EntityInsentient) {
      if(nmsEntity instanceof EntityCreature)
        ((EntityCreature) nmsEntity).setPathEntity(path);
     
      Navigation navigation = (Navigation) EntityLivingRef.getNavigation.invoke(nmsEntity);
View Full Code Here

Examples of net.minecraft.server.EntityLiving

   *
   * @param entity Entity
   * @param speed New entity speed
   */
  public static void setSpeed(LivingEntity entity, double speed) {
    EntityLiving nmsEntity = CommonNMS.getNative(entity);
    nmsEntity.getAttributeInstance(GenericAttributes.d).setValue(speed);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.