Пример #1
0
  public static void onAttackEntityFrom(DamageSource damage, EntityLiving living) {
    if (living.getHealth() > 0 && living.hurtTime <= 0) {
      float f = 0.41F;

      if (living.canBleed() && living.canBleedByDamage(damage)) {
        Entity entity = damage.getEntity();

        if (GoreRegistry.containsFarDamage(damage.damageType)) {
          produceBlood(MathHelper.floor_double(GoreRegistry.AMOUT_PARTICLES * f), false, living);
        } else if (entity instanceof EntityPlayer) {
          ItemStack is = ((EntityPlayer) entity).getCurrentEquippedItem();

          if (living.canHurtByItem(is)) {
            f = 1.0F;
            living.isBleeding = true;
            living.ticksActuallyBleeding = 0;
            living.ticksNoBlood = 0;
            produceBlood(MathHelper.floor_double(GoreRegistry.AMOUT_PARTICLES * f), false, living);
          }
        } else {
          produceBlood(MathHelper.floor_double(GoreRegistry.AMOUT_PARTICLES * f), false, living);
        }
      }
    }
  }
Пример #2
0
  public static void onUpdateBlood(EntityLiving living) {
    if (!living.isDead && living.isBleeding) {
      if (living.ticksNoBlood > GoreRegistry.TICKS_BLEED) {
        produceBlood(
            MathHelper.floor_double(GoreRegistry.AMOUT_PARTICLES * 0.80000000000000004D),
            true,
            living);
        living.ticksActuallyBleeding += living.ticksNoBlood;
        living.ticksNoBlood = 0;
      }

      if (((living instanceof EntityPlayer) || (living instanceof EntityPlayerSP))
          && (living.getHealth() < 4 && living.ticksNoBlood > GoreRegistry.TICKS_BLEED / 2.0F
              || living.getHealth() < 10 && living.ticksNoBlood > GoreRegistry.TICKS_BLEED)) {
        produceBlood(GoreRegistry.AMOUT_PARTICLES / 3, true, living);
        living.ticksNoBlood = 0;
      }

      if (living.ticksActuallyBleeding >= GoreRegistry.TICKS_BLEEDING) {
        living.isBleeding = false;
      }

      living.ticksNoBlood++;
    }
  }