Package org.spout.vanilla.data.effect

Examples of org.spout.vanilla.data.effect.EntityEffect


      return;
    }

    for (Player player : pos.getWorld().getNearbyPlayers(pos, (int) getEffectRange())) {
      Effects effects = player.add(Effects.class);
      effects.add(new EntityEffect(primary, getPrimaryAmplifier(), getEffectDuration()));
      if (secondary != null && secondary != EntityEffectType.NONE && getLevels() == 4 && primary != secondary) {
        effects.add(new EntityEffect(secondary, getEffectDuration()));
      }
    }
  }
View Full Code Here


    EntityEffectType type = args.popEnumValue("type", EntityEffectType.class);
    float duration = (float) args.popDouble("duration");
    int amp = args.popInteger("amp", 2);
    args.assertCompletelyParsed();

    player.add(Effects.class).add(new EntityEffect(type, amp, duration));
    player.sendMessage(ChatStyle.GREEN + "Applied effect '" + type + "' with amplitude '" + amp + "' for '" + duration + "' seconds.");
  }
View Full Code Here

    }

    Damage damage = getOwner().add(Damage.class);
    damage.getDamageLevel(Difficulty.EASY).setAmount(3);
    //TODO: Check the values
    damage.getDamageLevel(Difficulty.NORMAL).setEffect(new EntityEffect(EntityEffectType.WITHER, 5));
    damage.getDamageLevel(Difficulty.HARD).setEffect(new EntityEffect(EntityEffectType.WITHER, 7));
    damage.getDamageLevel(Difficulty.HARDCORE).setEffect(damage.getDamageLevel(Difficulty.HARD).getEffect());

    // Add metadata for Wither health
    getOwner().add(MetadataComponent.class).addMeta(new Metadata<Float>(Metadata.TYPE_FLOAT, 16) {
      @Override
View Full Code Here

    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(12);
    }
    Damage damage = getOwner().add(Damage.class);
    damage.getDamageLevel(Difficulty.EASY).setAmount(2);
    damage.getDamageLevel(Difficulty.NORMAL).setAmount(2).setEffect(new EntityEffect(EntityEffectType.POISON, 7));
    damage.getDamageLevel(Difficulty.HARD).setAmount(3).setEffect(new EntityEffect(EntityEffectType.POISON, 15));
    damage.getDamageLevel(Difficulty.HARDCORE).setAmount(damage.getDamageLevel(Difficulty.HARD).getAmount()).setEffect(damage.getDamageLevel(Difficulty.HARD).getEffect());
  }
View Full Code Here

    Damage damageComponent = entity.add(Damage.class);
    damageComponent.getDamageLevel(Difficulty.EASY).setAmount(40);
    assertEquals(40, damageComponent.getDamageLevel(Difficulty.EASY).getAmount());
    assertNull(damageComponent.getDamageLevel(null));
    assertEquals(0, damageComponent.getDamageLevel(Difficulty.HARD).getAmount());
    EntityEffect container = new EntityEffect(EntityEffectType.HASTE, 4);
    damageComponent.getDamageLevel(Difficulty.EASY).setEffect(container);
    assertEquals(container, damageComponent.getDamageLevel(Difficulty.EASY).getEffect());
    assertEquals(null, damageComponent.getDamageLevel(Difficulty.HARD).getEffect());
  }
View Full Code Here

    if (entity.getData().get(VanillaData.GAMEMODE).equals(GameMode.SURVIVAL)) {
      Hunger hunger = entity.get(Hunger.class);
      for (FoodEffect effect : getEffectType()) {
        switch (effect.getEffect()) {
          case HEALTH_REGENERATION:
            entity.add(Effects.class).add(new EntityEffect(EntityEffectType.REGENERATION, effect.getChange()));
            break;
          case HUNGER:
            hunger.setHunger((int) (hunger.getHunger() + effect.getChange()));
            break;
          case POISON:
            if (GenericMath.getRandom().nextInt(101) < effect.getChange()) {
              entity.add(Effects.class).add(new EntityEffect(EntityEffectType.HUNGER, 30));
            }
            break;
          case SATURATION:
            hunger.setFoodSaturation(hunger.getFoodSaturation() + effect.getChange());
            break;
View Full Code Here

    }
  }

  public void onDrink(Entity entity, Slot slot) {
    if (this.effect != null) {
      entity.add(Effects.class).add(new EntityEffect(effect, this.getTier(), this.getTime()));
    }

    slot.addAmount(-1);
    entity.get(PlayerInventory.class).getMain().add(new ItemStack(VanillaMaterials.GLASS_BOTTLE, 1));
  }
View Full Code Here

TOP

Related Classes of org.spout.vanilla.data.effect.EntityEffect

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.