예제 #1
0
파일: NMS.java 프로젝트: Jeebiss/Citizens2
 public static void updateAI(EntityLiving entity) {
   updateSenses(entity);
   entity.getNavigation().e();
   entity.getControllerMove().c();
   entity.getControllerLook().a();
   entity.getControllerJump().b();
 }
예제 #2
0
파일: NMS.java 프로젝트: Jeebiss/Citizens2
 public static void updateNavigationWorld(LivingEntity entity, org.bukkit.World world) {
   if (NAVIGATION_WORLD_FIELD == null) return;
   EntityLiving handle = ((CraftLivingEntity) entity).getHandle();
   World worldHandle = ((CraftWorld) world).getHandle();
   try {
     NAVIGATION_WORLD_FIELD.set(handle.getNavigation(), worldHandle);
   } catch (Exception e) {
     Messaging.logTr(Messages.ERROR_UPDATING_NAVIGATION_WORLD, e.getMessage());
   }
 }
예제 #3
0
파일: NMS.java 프로젝트: Jeebiss/Citizens2
  public static void setHeadYaw(EntityLiving handle, float yaw) {
    while (yaw < -180.0F) {
      yaw += 360.0F;
    }

    while (yaw >= 180.0F) {
      yaw -= 360.0F;
    }
    handle.aA = yaw;
    if (!(handle instanceof EntityHuman)) handle.ay = yaw;
    handle.aB = yaw;
  }
예제 #4
0
파일: NMS.java 프로젝트: Jeebiss/Citizens2
  public static void attack(EntityLiving handle, Entity target) {
    int damage = handle instanceof EntityMonster ? ((EntityMonster) handle).c(target) : 2;

    if (handle.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
      damage += 3 << handle.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier();
    }

    if (handle.hasEffect(MobEffectList.WEAKNESS)) {
      damage -= 2 << handle.getEffect(MobEffectList.WEAKNESS).getAmplifier();
    }

    int knockbackLevel = 0;

    if (target instanceof EntityLiving) {
      damage += EnchantmentManager.a(handle, (EntityLiving) target);
      knockbackLevel +=
          EnchantmentManager.getKnockbackEnchantmentLevel(handle, (EntityLiving) target);
    }

    boolean success = target.damageEntity(DamageSource.mobAttack(handle), damage);

    if (!success) return;
    if (knockbackLevel > 0) {
      target.g(
          -MathHelper.sin((float) (handle.yaw * Math.PI / 180.0F)) * knockbackLevel * 0.5F,
          0.1D,
          MathHelper.cos((float) (handle.yaw * Math.PI / 180.0F)) * knockbackLevel * 0.5F);
      handle.motX *= 0.6D;
      handle.motZ *= 0.6D;
    }

    int fireAspectLevel = EnchantmentManager.getFireAspectEnchantmentLevel(handle);

    if (fireAspectLevel > 0) target.setOnFire(fireAspectLevel * 4);
  }
예제 #5
0
파일: NMS.java 프로젝트: Jeebiss/Citizens2
 public static void updateSenses(EntityLiving entity) {
   entity.aD().a();
 }
예제 #6
0
파일: NMS.java 프로젝트: Jeebiss/Citizens2
 public static void look(LivingEntity bukkitEntity, float yaw, float pitch) {
   EntityLiving handle = getHandle(bukkitEntity);
   handle.yaw = yaw;
   setHeadYaw(handle, yaw);
   handle.pitch = pitch;
 }
예제 #7
0
파일: NMS.java 프로젝트: Jeebiss/Citizens2
 public static void look(EntityLiving handle, Entity target) {
   handle.getControllerLook().a(target, 10.0F, handle.bs());
 }
예제 #8
0
파일: NMS.java 프로젝트: Jeebiss/Citizens2
 public static boolean inWater(LivingEntity entity) {
   EntityLiving mcEntity = getHandle(entity);
   return mcEntity.G() || mcEntity.I();
 }