mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-12-25 20:17:38 +01:00
Fixed Annihilate infinite vector
This commit is contained in:
parent
b07db4c12c
commit
293027fc23
@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.special;
|
||||
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.util.VectorUtils;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -19,7 +20,9 @@ public class Annihilate extends EcoEnchant {
|
||||
public void onMeleeAttack(LivingEntity attacker, LivingEntity victim, int level, EntityDamageByEntityEvent event) {
|
||||
double baseMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-multiplier");
|
||||
Vector vector = attacker.getLocation().toVector().clone().subtract(victim.getLocation().toVector()).normalize().multiply(level * baseMultiplier).multiply(-1);
|
||||
if(!VectorUtils.isFinite(vector)) return;
|
||||
vector.setY(0.2);
|
||||
if(!VectorUtils.isFinite(vector)) return;
|
||||
victim.setVelocity(vector);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user