package me.km.effects.active; import me.km.KajetansMod; import me.km.api.Utils; import me.km.effects.ActiveEffectBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.DamageSource; import net.minecraft.util.math.Vec3d; public class Doomed extends ActiveEffectBase { @Override protected boolean executeEffect(EntityPlayerMP p, int power) { EntityPlayer p2 = Utils.getTargetedEntity(p, 8, EntityPlayer.class); if(p2 == null) { return false; } Vec3d v1 = p2.getPositionVector(); Vec3d v2 = p.getPositionVector(); Utils.setVelocity(p, (v1.xCoord - v2.xCoord) * 0.2, (v1.yCoord - v2.yCoord) * 0.2 + 0.9, (v1.zCoord - v2.zCoord) * 0.2); KajetansMod.scheduler.scheduleTask(() -> { Vec3d v3 = p2.getPositionVector(); Vec3d v4 = p.getPositionVector(); Utils.setVelocity(p, (v3.xCoord - v4.xCoord) * 0.2, (v3.yCoord - v4.yCoord) * 0.2, (v3.zCoord - v4.zCoord) * 0.2); }, 12); int duration = 20 * power; KajetansMod.playerbank.getData(p2).addBadTimedData("doomed", p, duration, "Todgeweiht", 52); KajetansMod.scheduler.scheduleTask(() -> { p2.attackEntityFrom(DamageSource.causeMobDamage(p), power); }, duration); return true; } @Override protected int getManaCost(int manaFactor) { return 4 * manaFactor; } }