Solved Changing speed of bat

Discussion in 'Plugin Development' started by I Al Istannen, Apr 24, 2015.

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

    I Al Istannen

    Hi,

    i wanted to change the speed of a bat. I tried applying a speed potion: nothing. Then i tried to change the movementSpeed attribute with some NMS: nothing. It worked with every other mob I tried though. Just not with bats. Then i tried applying an custom Navigation, according to this: https://bukkit.org/threads/make-a-mob-follow-a-player.351739/
    This worked with pigs and so on, but not with Bats. If nothing else workes, i guess i will just be teleporting the bat, but this seems rather bad to me, due to all the things you need to check and the performance it may cost. Do you have any other ideas?
     
  2. Offline

    mine-care

    Are u sure the speed potion isn't working because back in 1.7.9 I made a piƱata plugin with cows hanging from bats that move around, it worked perfectly with invisibility and speed potions at power 3 duration infinite
     
    CodePlaysMinecraft likes this.
  3. Offline

    I Al Istannen

    @mine-care It's hard to see with small values, but speed 20 or so seems to be as fast as a normal bat. It's hard to tell though, because they move quite random, but with speed 20 there should be a difference. But there is none ;/
     
  4. Offline

    Konato_K

    @I Al Istannen Probably a nasty workaround, but you can set the velocity of the bat to make it move faster or so
     
  5. Offline

    I Al Istannen

    @Konato_K I already tried that and it didn't work. Now, after your comment i tried it again and it seems to work. Weird... It was late yesterday :p Thanks!
     
  6. Offline

    mine-care

    @I Al Istannen Adding huge amp values may have an opposite effect to the LivingEntity. try with 3 :/ Make sure the changes take place! because from the thread above i can see that no changes aply to the bats at all so i am thinking it could be that the bat is not spawn or something

    May we see your code so far?
     
  7. Offline

    I Al Istannen

    @mine-care I know for players that the effect inverts after 255. I also tried setting it to 3, but I couldn't spot a difference between with and without. The bat shows speed particles and when i just change the mob variable to e.g. a slime it works just fine. Even with 20.

    Code:
     
    PotionEffectType type = PotionEffectType.SPEED;
    PotionEffect effect = new PotionEffect(type, 200, 20, false);
    effect.apply(bat); //hmm doesn't seem to work
    
    effect.apply((LivingEntity) (loc.getWorld().spawnEntity(loc, EntityType.SLIME)));  //works like a charm
    
    
     
  8. Offline

    mine-care

Thread Status:
Not open for further replies.

Share This Page