Package org.spout.vanilla.component.entity.living

Examples of org.spout.vanilla.component.entity.living.Living


  }

  @EventHandler (order = Order.EARLIEST)
  public void onEntitySpawn(EntitySpawnEvent event) {
    WorldConfigurationNode node = VanillaConfiguration.WORLDS.get(event.getEntity().getWorld());
    Living mob = event.getEntity().get(Living.class);
    if (!(mob instanceof Player)) {
      if (!node.SPAWN_ANIMALS.getBoolean()) {
        if (mob instanceof Neutral || mob instanceof Passive) {
          event.setCancelled(true);
        }
View Full Code Here


    }
    //Optional param was provided (ie the block material for a falling block).
    if (args.length() == 2) {
      //Now we know its either a living or substance. Lets figure out which.
      if (Living.class.isAssignableFrom(clazz)) {
        final Living living = entity.get(Living.class);
        if (name.equalsIgnoreCase("human")) {
          ((Human) living).setName(args.popString("disp_name"));
        }
      } else if (Substance.class.isAssignableFrom(clazz)) {
        final Substance substance = entity.get(Substance.class);
View Full Code Here

      if (clickedEntity.get(Human.class) != null && !VanillaConfiguration.PLAYER_PVP_ENABLED.getBoolean()) {
        return;
      }

      Living clicked = clickedEntity.get(Living.class);
      if (clicked != null) {
        //TODO: Reimplement exhaustion values

        int damage = 1;
        if (holding != null && holdingMat instanceof VanillaMaterial) {
          damage = ((VanillaMaterial) holdingMat).getDamage();
          if (holdingMat instanceof Tool) {
            // This is a bit of a hack due to the way Tool hierarchy is now (Only Swords can have a damage modifier, but Sword must be an interface and therefore is not able to contain getDamageModifier without code duplication)
            damage += ((Tool) holdingMat).getDamageBonus(clickedEntity, holding);
            //            player.getInventory().getQuickbar().getCurrentSlotInventory().addData(1); TODO: Reimplement durability change
          }
        }

        //Potion modification
        if (holdingMat.equals(VanillaMaterials.AIR)) {
          Effects effect = playerEnt.add(Effects.class);
          if (effect.contains(EntityEffectType.STRENGTH)) {
            damage += 3;
          }
          if (effect.contains(EntityEffectType.WEAKNESS)) {
            damage -= 2;
          }
        }
        //END Potion modification

        // Damage the clicked entity
        if (damage > 0 && !PlayerUtil.isCreativePlayer(clickedEntity) && !clicked.getHealth().isDead()) {
          clicked.getHealth().damage(damage, new PlayerDamageCause(playerEnt, DamageType.ATTACK), damage > 0);
        }
      }
    } else {
      event = new PlayerInteractEntityEvent(playerEnt, clickedEntity, clickedEntity.getPhysics().getPosition(), Action.LEFT_CLICK);
      if (Spout.getEventManager().callEvent(event).isCancelled()) {
View Full Code Here

TOP

Related Classes of org.spout.vanilla.component.entity.living.Living

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.