Smash.java 722 B

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