Potion effect?

Discussion in 'Plugin Development' started by APPLEisPRO, Apr 11, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    APPLEisPRO

    How can I add these? Is it even possible? I want add those potion things in inventory without the actual potion effect, so just that "Strength" when you look your inventory. No damage increasing when hitting entitys.

    [​IMG]
     
  2. Offline

    CreepahMC

    So you want the physical Strength potion in a player's inventory or an infinite effect of Strength..?

    EDIT: I understand. You want to show potion effect icons saying certain things. I'm not sure if there's an api in bukkit for that but it's a cool concept I'd use to show player stats in some way!


    Not relevant but what Resource Pack is that might I ask ;) I like the look of the inventory.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  3. Offline

    APPLEisPRO

    Haha, i made it myself it also has pink hearts :p

    But yes, i only want physical Strength potion in a player's inventory. Not the actual "powers" of potion. ;)
     
  4. Offline

    CreepahMC

    There might be a way to show the Strength icon besides a player's inventory but disallowing the effect but I'm not sure where to start with that idea.
     
  5. Offline

    khave

    I guess you might be able to show the strength effect and add the player to an arraylist and then change their damage with the EntityDamageByEntityEvent. That's what I'd do at least.
     
  6. Offline

    APPLEisPRO

    I tried to do this, but I didnt' get that damage part to work! :S It's good idea to just take some damage away... ;)
     
  7. Offline

    khave


    I tried messing a bit with it and came up with this:
    Code:java
    1. @EventHandler
    2. public void onEntityDamageByEntity(EntityDamageByEntityEvent e){
    3. Player damager = (Player) e.getDamager(); //Damager = player
    4.  
    5. if(damager.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE) == true){//Condition. In my case I just made it the strength effect
    6. double damage = e.getDamage(); //First get the damage.
    7. double modifiedDamage = damage / 100 * 55; //Take amount of % away from it. First I took 50%, but that seemed to make higher damaging values round of wrong, so I upped it by 5%
    8. double finalDamage = damage - modifiedDamage; //Get the damage - the 55% of the original damage
    9. e.setDamage(finalDamage); //Add the damage.
    10. }
    11. }


    You're welcome my good sir.
     
  8. Offline

    APPLEisPRO

    Thanks, :) looks good i'll use it with array list instead of this
    Code:java
    1. if(damager.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE) == true){
     
    khave likes this.
Thread Status:
Not open for further replies.

Share This Page