Elevation.java 1.1 KB

123456789101112131415161718192021222324252627282930
  1. package me.km.effects.active;
  2. import java.util.Collection;
  3. import me.km.api.Utils;
  4. import me.km.effects.ActiveEffectBase;
  5. import me.km.effects.EffectUtils;
  6. import net.minecraft.entity.EntityLivingBase;
  7. import net.minecraft.entity.player.EntityPlayerMP;
  8. import net.minecraft.init.SoundEvents;
  9. import net.minecraft.util.EnumParticleTypes;
  10. import net.minecraft.util.math.BlockPos;
  11. public class Elevation extends ActiveEffectBase
  12. {
  13. @Override
  14. protected boolean executeEffect(EntityPlayerMP p, int power)
  15. {
  16. BlockPos target = Utils.getPlayerTarget(p, power + 3).up();
  17. EffectUtils.playSound(p, SoundEvents.ENTITY_FIREWORK_TWINKLE_FAR);
  18. EffectUtils.spawnSpell(p, power);
  19. Collection<EntityLivingBase> list = EffectUtils.getEntsOfNotGuild(p, p.world, target.getX(), target.getY(), target.getZ(), 3);
  20. EffectUtils.spawnParticleCircle(p.getServerWorld(), p, EnumParticleTypes.SPELL, 3, 30);
  21. double shootPower = 1 + power / 20d;
  22. list.stream().forEach((en) ->
  23. {
  24. Utils.setVelocity(en, 0, shootPower, 0);
  25. });
  26. return true;
  27. }
  28. }