Package org.spout.vanilla.event.cause

Examples of org.spout.vanilla.event.cause.NullDamageCause


    ItemStack test = new ItemStack(VanillaMaterials.DIAMOND_CHESTPLATE, 1);
    Enchantment.addEnchantment(test, VanillaEnchantments.PROTECTION, 4, false);
    assertTrue(Enchantment.hasEnchantment(test, VanillaEnchantments.PROTECTION));

    Armor armor = (Armor) test.getMaterial();
    assertTrue((int) Math.ceil(.04 * (armor.getBaseProtection() + armor.getProtection(test, new NullDamageCause(DamageType.CACTUS)))) == 1);
  }
View Full Code Here


  private int duration;

  public EntityCombustEvent(Entity e, int duration) {
    super(e);
    this.duration = duration;
    this.cause = new NullDamageCause(DamageType.UNKNOWN);
  }
View Full Code Here

  private boolean hasSendHurtMessage = true;
  private final Cause<?> cause;

  public EntityDamageEvent(Entity e, float damage) {
    super(e, HealthChangeCause.DAMAGE, -damage);
    this.cause = new NullDamageCause(DamageType.UNKNOWN);
  }
View Full Code Here

      setFireTick(0f);
      setFireHurting(false);
    }
    if (isFireHurting()) {
      if (internalTimer >= 1.0f) {
        health.damage(1, new NullDamageCause(DamageCause.DamageType.BURN));
        internalTimer = 0;
      }
    }
    setFireTick(getFireTick() - dt);
    internalTimer += dt;
View Full Code Here

        // Damage health

        if (hunger <= 0) {
          starveTimer -= dt;
          if (starveTimer <= 0) {
            healthComponent.damage(1.0f, new NullDamageCause(DamageType.STARVATION));
            starveTimer = getStarvationTimerStart();
          }
        }

        // Exhaustion
View Full Code Here

   * Damages this entity
   *
   * @param amount amount the entity will be damaged by, can be modified based on armor and enchantments
   */
  public void damage(float amount) {
    damage(amount, new NullDamageCause(DamageCause.DamageType.UNKNOWN));
  }
View Full Code Here

    }
    Cause<?> eventCause;
    if (cause instanceof Cause<?>) {
      eventCause = (Cause<?>) cause;
    } else {
      eventCause = new NullDamageCause(cause.getType());
    }
    // TODO take potion effects into account
    EntityDamageEvent event = getEngine().getEventManager().callEvent(new EntityDamageEvent(getOwner(), amount, eventCause, sendHurtMessage));
    if (event.isCancelled()) {
      return;
View Full Code Here

TOP

Related Classes of org.spout.vanilla.event.cause.NullDamageCause

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.