Package org.spout.vanilla.component.entity.misc

Examples of org.spout.vanilla.component.entity.misc.Health.damage()


  @Override
  public void onCollided(EntityCollideEvent event) {
    if (event instanceof EntityCollideEntityEvent) {
      Health health = ((EntityCollideEntityEvent) event).getCollided().get(Health.class);
      if (health != null) {
        health.damage(0);
      }
    }
    getOwner().remove();
  }
}
View Full Code Here


  @Override
  public void onCollided(EntityCollideEvent event) {
    if (event instanceof EntityCollideEntityEvent) {
      Health health = ((EntityCollideEntityEvent) event).getCollided().get(Health.class);
      if (health != null) {
        health.damage(0);
      }
    }
    spawnChickens(new Point(event.getContactInfo().getNormal(), getOwner().getWorld()));
    getOwner().remove();
  }
View Full Code Here

  public void onCollided(Point colliderPoint, Point collidedPoint, Block block) {
    if (getShooter() != null && getShooter() instanceof Player) {
      Health health = getShooter().get(Health.class);
      if (health != null && !health.isDead()) {
        if (!PlayerUtil.isCreativePlayer(getShooter())) {
          health.damage(5);
        }
        ((Player) getShooter()).getPhysics().setPosition(block.translate(BlockFace.TOP).getPosition());
      }
    }
    getOwner().remove();
View Full Code Here

  public void onCollided(EntityCollideEvent event) {
    if (event instanceof EntityCollideEntityEvent) {
      Point point = ((EntityCollideEntityEvent) event).getCollided().getPhysics().getPosition();
      Health health = ((EntityCollideEntityEvent) event).getCollided().get(Health.class);
      if (health != null) {
        health.damage(getOwner().get(Damage.class).getDamageLevel(point.getWorld().getData().get(VanillaData.DIFFICULTY)).getAmount());
      }
    } else {
      //TODO: Fall damage
    }
  }
View Full Code Here

        }
        Human human = entity.get(Human.class);
        if (human != null && human.isCreative()) {
          continue;
        }
        health.damage(getDamage(position, entity.getPhysics().getPosition(), size));
      }
    }

    //explosion packet (TODO: Limit the amount sent per tick? Don't want to lag-out clients!)
    GeneralEffects.EXPLOSION.playGlobal(position, size);
View Full Code Here

    health.setSpawnHealth(20);
    assertEquals(20.0f, health.getMaxHealth(), 0.0f);
    assertEquals(20.0f, health.getHealth(), 0.0f);

    health.damage(1.0f);
    assertEquals(19.0f, health.getHealth(), 0.0f);

    health.kill(HealthChangeCause.DAMAGE);
    assertEquals(0.0f, health.getHealth(), 0.0f);
    assertTrue(health.isDead());
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.