Package net.minecraft.server

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


   * 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

   * 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

   *
   * @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

   *
   * @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

      }
    }
  }
 
  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

   *
   * @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

   *
   * @param entity to check speed
   * @return entity speed
   */
  public static double getSpeed(LivingEntity entity) {
    EntityLiving nmsEntity = CommonNMS.getNative(entity);
    return nmsEntity.getAttributeInstance(GenericAttributes.d).getValue();
  }
View Full Code Here

      if (!attributes.isEmpty()) {
        PacketUtil.sendPacket(viewer, PacketType.OUT_ENTITY_UPDATE_ATTRIBUTES.newInstance(entity.getEntityId(), attributes));
      }

      // Entity Equipment
      EntityLiving living = (EntityLiving) handle;
      for (int i = 0; i < 5; ++i) {
              org.bukkit.inventory.ItemStack itemstack = Conversion.toItemStack.convert(living.getEquipment(i));
              if (itemstack != null) {
                PacketUtil.sendPacket(viewer, PacketType.OUT_ENTITY_EQUIPMENT.newInstance(entity.getEntityId(), i, itemstack));
              }
      }

      // Entity Mob Effects
      for (MobEffect effect : (Collection<MobEffect>) living.getEffects()) {
        PacketUtil.sendPacket(viewer, PacketType.OUT_ENTITY_EFFECT_ADD.newInstance(entity.getEntityId(), effect));
      }
    }
  }
View Full Code Here

TOP

Related Classes of net.minecraft.server.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.