StunPunch.java 773 B

12345678910111213141516171819202122232425
  1. package me.km.effects.active;
  2. import me.km.api.Utils;
  3. import me.km.effects.ActiveEffectBase;
  4. import me.km.effects.EffectUtils;
  5. import net.minecraft.entity.EntityLivingBase;
  6. import net.minecraft.entity.player.EntityPlayerMP;
  7. import net.minecraft.init.MobEffects;
  8. import net.minecraft.util.DamageSource;
  9. public class StunPunch extends ActiveEffectBase
  10. {
  11. @Override
  12. protected boolean executeEffect(EntityPlayerMP p, int power)
  13. {
  14. EntityLivingBase liv = Utils.getTargetedEntity(p, 4, EntityLivingBase.class);
  15. if(liv == null)
  16. {
  17. return false;
  18. }
  19. liv.attackEntityFrom(DamageSource.causePlayerDamage(p), 0.125f);
  20. EffectUtils.addPotionTo(liv, MobEffects.SLOWNESS, 10 * power, 50);
  21. return true;
  22. }
  23. }