Generic Attributes

Discussion in 'Spigot Plugin Development' started by 97WaterPolo, May 24, 2015.

  1. Hello!

    So back in the 1.6/1.7 era I used the following to modify the speed of which a mob runs. I did this on a new laptop and I am not able to access my old desktop with the code that worked, but hopefully someone can point me in the right direction.

    Code (Text):

      public static void setSpeedMultiplier(LivingEntity le){
         EntityInsentient el = (EntityInsentient) ((CraftLivingEntity) le).getHandle();//Gets entity
         double mult = 1D+(((r.nextInt(20-10)+10)-2)/10D);
         Bukkit.broadcastMessage("START" + el.getAttributeInstance(GenericAttributes.c).getValue());
         AttributeInstance att = el.getAttributeInstance(GenericAttributes.c); //Gets the speed GA
         AttributeModifier modifier = new AttributeModifier(UUID.randomUUID(), "Speed multiplier", mult*10, 0);
         att.b(modifier); //Removes existing modifier
         att.a(modifier); // Adds new modifier
         Bukkit.broadcastMessage("END" + el.getAttributeInstance(GenericAttributes.c).getValue());
       }
     
    [​IMG]

    As you can see it is clearly being modified (I threw in some insane values like the *10) but the mob itself seems to have no effect. I am 100% sure the difference between 1 and .03 would be noticeable. Am I missing something or did something chance with the 1.8 update?
    Any help would be greatly appreciated!
     
  2. Bump. Any way to modify the speed of a mob would be appreciated.
     
  3. very nice, thank you so much
     
    • Funny Funny x 2
  4. What do you mean? I'm asking for help as its not actually modifying the speed of the entity?
     
  5. Necroposting ;-;
     
    #6 SuperSniper, Jul 15, 2016
    Last edited: Jul 15, 2016
  6. you could take a look at this for how to go about doing it and take a look at this to figure out what tags to modify.

    if you used the search function you would have seen that there is a thread on how to do this.

    might as well post the answer since it got NECTOposted
     
    • Informative Informative x 1
  7. Rip my spelling
     
    • Funny Funny x 1
  8. MiniDigger

    Supporter

  9. MiniDigger

    Supporter

    ohh ^^
    well, we should let this thread die now...