diff --git a/src/main/java/net/Indyuce/mmoitems/api/Element.java b/src/main/java/net/Indyuce/mmoitems/api/Element.java index 56945636..e9876093 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/Element.java +++ b/src/main/java/net/Indyuce/mmoitems/api/Element.java @@ -1,28 +1,15 @@ package net.Indyuce.mmoitems.api; -import io.lumine.mythic.lib.MythicLib; -import io.lumine.mythic.lib.UtilityMethods; -import io.lumine.mythic.lib.comp.target.InteractionType; -import io.lumine.mythic.lib.damage.DamageMetadata; -import io.lumine.mythic.lib.damage.DamageType; import io.lumine.mythic.lib.player.PlayerMetadata; -import io.lumine.mythic.lib.version.VersionMaterial; -import io.lumine.mythic.lib.version.VersionSound; -import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.listener.ElementListener; import org.bukkit.*; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.inventory.ItemStack; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Consumer; -import org.bukkit.util.Vector; public enum Element { - FIRE(Material.BLAZE_POWDER, ChatColor.DARK_RED, new ElementParticle(Particle.FLAME, .05f, 8), (attacker, target, relative, absolute) -> { + /*FIRE(Material.BLAZE_POWDER, ChatColor.DARK_RED, new ElementParticle(Particle.FLAME, .05f, 8), (attacker, target, relative, absolute) -> { target.getWorld().spawnParticle(Particle.LAVA, target.getLocation().add(0, target.getHeight() / 2, 0), 14); target.getWorld().playSound(target.getLocation(), Sound.ENTITY_BLAZE_HURT, 2, .8f); target.setFireTicks((int) (relative * 2)); @@ -110,7 +97,7 @@ public enum Element { DARKNESS(Material.COAL, ChatColor.DARK_GRAY, new ElementParticle(Particle.BLOCK_CRACK, .07f, 32, Material.COAL_BLOCK), (attacker, target, relative, absolute) -> { // TODO - }, 39, 41), + }, 39, 41),*/ ; diff --git a/src/main/java/net/Indyuce/mmoitems/api/ElementalAttack.java b/src/main/java/net/Indyuce/mmoitems/api/ElementalAttack.java deleted file mode 100644 index 65642e3d..00000000 --- a/src/main/java/net/Indyuce/mmoitems/api/ElementalAttack.java +++ /dev/null @@ -1,120 +0,0 @@ -package net.Indyuce.mmoitems.api; - -import io.lumine.mythic.lib.MythicLib; -import io.lumine.mythic.lib.api.item.NBTItem; -import io.lumine.mythic.lib.player.PlayerMetadata; -import net.Indyuce.mmoitems.api.player.PlayerData; -import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.inventory.ItemStack; - -import java.util.HashMap; -import java.util.Map; -import java.util.Random; - -/** - * @deprecated Move this over to MythicLib ffs - * Also implementation is bad af - */ -@Deprecated -public class ElementalAttack { - private final PlayerMetadata attacker; - private final PlayerData playerData; - - /** - * Percentage of the initial damage being dealt as elemental damage - */ - private final Map relative = new HashMap<>(); - - /** - * Flat damage being dealt as elemental damage - */ - private final Map absolute = new HashMap<>(); - - /** - * Attack target saved because MI needs to - * access the defense stats from that entity - */ - private final LivingEntity target; - - /** - * Damage that is not elemental - */ - private final double regularDamage; - - /** - * Initial attack damage (both regular and elemental) - */ - private final double initialDamage; - - private static final Random RANDOM = new Random(); - - public ElementalAttack(PlayerMetadata attacker, NBTItem item, double initialDamage, LivingEntity target) { - this.initialDamage = initialDamage; - this.playerData = PlayerData.get(attacker.getPlayer()); - this.attacker = attacker; - this.target = target; - - double regularDamage = initialDamage; - for (Element element : Element.values()) { - double relativeDamage = item.getStat(element.name() + "_DAMAGE"); - if (relativeDamage > 0) { - double flatElemental = relativeDamage / 100 * initialDamage; - relative.put(element, relativeDamage); - absolute.put(element, flatElemental); - regularDamage -= flatElemental; - } - } - - this.regularDamage = regularDamage; - } - - public double getDamageModifier() { - - // Elemental defense - if (target.getEquipment() != null) // Null check for ModelEngine mobs - for (ItemStack equip : target.getEquipment().getArmorContents()) { - NBTItem nbtEquip = MythicLib.plugin.getVersion().getWrapper().getNBTItem(equip); - if (nbtEquip.getType() != null) - for (Element element : absolute.keySet()) { - double defense = nbtEquip.getStat(element.name() + "_DEFENSE") / 100; - if (defense > 0) { - relative.put(element, relative.get(element) * (1 - defense)); - absolute.put(element, absolute.get(element) * (1 - defense)); - } - } - } - - // Elemental attacks - double correctionCoeff = 1; - if (!playerData.isOnCooldown(CooldownType.ELEMENTAL_ATTACK)) - for (Element element : relative.keySet()) { - double relativeDamage = relative.get(element); - double independentProbability = relativeDamage / 100; - if (RANDOM.nextDouble() < independentProbability / correctionCoeff) { - - // Perform elemental critical strike - playerData.applyCooldown(CooldownType.ELEMENTAL_ATTACK, 2); - element.getHandler().elementAttack(attacker, target, relativeDamage, absolute.get(element)); - - // Multiply corresponding damage by 2 - absolute.put(element, absolute.get(element) * 2); - break; - } - correctionCoeff -= independentProbability; - } - - // Calculate final damage again - double finalDamage = regularDamage; - - for (Element element : absolute.keySet()) { - double partialDamage = absolute.get(element); - if (partialDamage > 0) { - finalDamage += partialDamage; - element.getParticle().displayParticle(target); - } - } - - return finalDamage - initialDamage; - } -} diff --git a/src/main/java/net/Indyuce/mmoitems/api/ItemAttackMetadata.java b/src/main/java/net/Indyuce/mmoitems/api/ItemAttackMetadata.java deleted file mode 100644 index 888cadfe..00000000 --- a/src/main/java/net/Indyuce/mmoitems/api/ItemAttackMetadata.java +++ /dev/null @@ -1,75 +0,0 @@ -package net.Indyuce.mmoitems.api; - -import io.lumine.mythic.lib.MythicLib; -import io.lumine.mythic.lib.api.item.NBTItem; -import io.lumine.mythic.lib.api.stat.StatMap; -import io.lumine.mythic.lib.damage.AttackMetadata; -import io.lumine.mythic.lib.damage.DamageMetadata; -import io.lumine.mythic.lib.damage.DamageType; -import io.lumine.mythic.lib.player.PlayerMetadata; -import net.Indyuce.mmoitems.api.player.PlayerData; -import org.bukkit.entity.LivingEntity; - -/** - * The attack metadata used here in MMOItems. It extends the default - * attack metadata from MythicLib to benefit from all its methods - * - * @deprecated Elemental damage calculation will be moved to MythicLib and this - * class will therefore be 100% useless - */ -@Deprecated -public class ItemAttackMetadata extends AttackMetadata { - public ItemAttackMetadata(DamageMetadata damage, PlayerMetadata damager) { - super(damage, damager); - } - - public ItemAttackMetadata(AttackMetadata attackMeta) { - super(attackMeta.getDamage(), attackMeta); - } - - public PlayerData getPlayerData() { - return PlayerData.get(getPlayer().getUniqueId()); - } - - public ItemAttackMetadata clone() { - return new ItemAttackMetadata(getDamage().clone(), this); - } - - /** - * Applies on-hit effects and deals damage to the target - * - * @param item The item being used - * @param target The entity target - */ - public void applyEffectsAndDamage(NBTItem item, LivingEntity target) { - MythicLib.plugin.getDamage().damage(applyEffects(item, target), target, true); - } - - /** - * Applies all necessary weapon on-hit effects for any type of damage. - * Makes things much easier for untargeted weapons like staffs - * - * @param item The item being used - * @param target The entity target - * @return The unedited attack result - */ - public ItemAttackMetadata applyEffects(NBTItem item, LivingEntity target) { - if (getDamage().hasType(DamageType.WEAPON)) - applyElementalEffects(item, target); - return this; - } - - /** - * Applies MMOItem specific on-hit effects like elemental damage. - * - * @param item The item being used - * @param target The entity target - * @return The unedited attack result - */ - @SuppressWarnings("UnusedReturnValue") - public ItemAttackMetadata applyElementalEffects(NBTItem item, LivingEntity target) { - double damageModifier = new ElementalAttack(this, item, getDamage().getDamage(), target).getDamageModifier(); - getDamage().add(damageModifier); - return this; - } -} diff --git a/src/main/java/net/Indyuce/mmoitems/api/TypeSet.java b/src/main/java/net/Indyuce/mmoitems/api/TypeSet.java index 1877220d..08f3f3ef 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/TypeSet.java +++ b/src/main/java/net/Indyuce/mmoitems/api/TypeSet.java @@ -43,9 +43,9 @@ public enum TypeSet { && attack.getPlayer().getEyeLocation().getDirection() .angle(entity.getLocation().subtract(attack.getPlayer().getLocation()).toVector()) < Math.PI / 3 && UtilityMethods.canTarget(attack.getPlayer(), entity, InteractionType.OFFENSE_ACTION) && !entity.equals(target)) { - ItemAttackMetadata subAttack = new ItemAttackMetadata(attack.getDamage().clone(), attack); + AttackMetadata subAttack = new AttackMetadata(attack.getDamage().clone(), attack); subAttack.getDamage().multiplicativeModifier(.4); - subAttack.applyEffectsAndDamage(weapon.getNBTItem(), (LivingEntity) entity); + subAttack.damage((LivingEntity) entity); } }), @@ -72,9 +72,9 @@ public enum TypeSet { && attack.getPlayer().getEyeLocation().getDirection() .angle(entity.getLocation().toVector().subtract(attack.getPlayer().getLocation().toVector())) < Math.PI / 12 && UtilityMethods.canTarget(attack.getPlayer(), entity, InteractionType.OFFENSE_ACTION)) { - ItemAttackMetadata subAttack = new ItemAttackMetadata(attack.getDamage().clone(), attack); + AttackMetadata subAttack = new AttackMetadata(attack.getDamage().clone(), attack); subAttack.getDamage().multiplicativeModifier(.6); - subAttack.applyEffectsAndDamage(weapon.getNBTItem(), (LivingEntity) entity); + subAttack.damage((LivingEntity) entity); } }), @@ -98,9 +98,9 @@ public enum TypeSet { MMOItems.plugin.getConfig().getDouble("default.blunt-rating")) / 100; for (Entity entity : target.getNearbyEntities(bluntPower, bluntPower, bluntPower)) if (UtilityMethods.canTarget(attack.getPlayer(), entity, InteractionType.OFFENSE_ACTION) && !entity.equals(target)) { - ItemAttackMetadata subAttack = new ItemAttackMetadata(attack.getDamage().clone(), attack); + AttackMetadata subAttack = new AttackMetadata(attack.getDamage().clone(), attack); subAttack.getDamage().multiplicativeModifier(bluntRating); - subAttack.applyEffectsAndDamage(weapon.getNBTItem(), (LivingEntity) entity); + subAttack.damage((LivingEntity) entity); } } } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/projectile/ProjectileData.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/projectile/ProjectileData.java index 1b272eff..1adc3a8d 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/projectile/ProjectileData.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/projectile/ProjectileData.java @@ -5,9 +5,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.api.item.NBTItem; -import io.lumine.mythic.lib.damage.AttackMetadata; import io.lumine.mythic.lib.player.PlayerMetadata; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import net.Indyuce.mmoitems.manager.EntityManager; import net.Indyuce.mmoitems.stat.data.PotionEffectData; import org.bukkit.entity.LivingEntity; diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Lute.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Lute.java index d12347e6..83118b4d 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Lute.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Lute.java @@ -6,6 +6,7 @@ import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.api.player.EquipmentSlot; import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.damage.AttackMetadata; import io.lumine.mythic.lib.damage.DamageMetadata; import io.lumine.mythic.lib.damage.DamageType; import io.lumine.mythic.lib.player.PlayerMetadata; @@ -13,9 +14,6 @@ import io.lumine.mythic.lib.version.VersionSound; import net.Indyuce.mmoitems.ItemStats; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; -import net.Indyuce.mmoitems.api.interaction.util.UntargetedDurabilityItem; -import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType; import net.Indyuce.mmoitems.api.util.SoundReader; import net.Indyuce.mmoitems.stat.LuteAttackEffectStat.LuteAttackEffect; import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData; @@ -46,7 +44,7 @@ public class Lute extends UntargetedWeapon { Vector weight = new Vector(0, -.003 * getNBTItem().getStat(ItemStats.NOTE_WEIGHT.getId()), 0); // Attack meta - ItemAttackMetadata attackMeta = new ItemAttackMetadata(new DamageMetadata(attackDamage, DamageType.WEAPON, DamageType.MAGIC, DamageType.PROJECTILE), stats); + AttackMetadata attackMeta = new AttackMetadata(new DamageMetadata(attackDamage, DamageType.WEAPON, DamageType.MAGIC, DamageType.PROJECTILE), stats); LuteAttackEffect effect = LuteAttackEffect.get(getNBTItem()); SoundReader sound = new SoundReader(getNBTItem().getString("MMOITEMS_LUTE_ATTACK_SOUND"), VersionSound.BLOCK_NOTE_BLOCK_BELL.toSound()); @@ -96,7 +94,7 @@ public class Lute extends UntargetedWeapon { for (Entity target : entities) if (UtilityMethods.canTarget(getPlayer(), loc, target, InteractionType.OFFENSE_ACTION)) { - attackMeta.applyEffectsAndDamage(getNBTItem(), (LivingEntity) target); + attackMeta.damage((LivingEntity) target); cancel(); return; } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Musket.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Musket.java index 3348d450..92dae69c 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Musket.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Musket.java @@ -4,14 +4,13 @@ import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.api.player.EquipmentSlot; import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.damage.AttackMetadata; import io.lumine.mythic.lib.damage.DamageMetadata; import io.lumine.mythic.lib.damage.DamageType; import io.lumine.mythic.lib.player.PlayerMetadata; import io.lumine.mythic.lib.util.RayTrace; import net.Indyuce.mmoitems.ItemStats; import net.Indyuce.mmoitems.MMOItems; -import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Sound; @@ -48,10 +47,8 @@ public class Musket extends UntargetedWeapon { Vector vec = loc.getDirection(); RayTrace trace = new RayTrace(loc, vec, range, entity -> UtilityMethods.canTarget(stats.getPlayer(), entity, InteractionType.OFFENSE_ACTION)); - if (trace.hasHit()) { - ItemAttackMetadata attackMeta = new ItemAttackMetadata(new DamageMetadata(attackDamage, DamageType.WEAPON, DamageType.PROJECTILE, DamageType.PHYSICAL), stats); - attackMeta.applyEffectsAndDamage(getNBTItem(), trace.getHit()); - } + if (trace.hasHit()) + new AttackMetadata(new DamageMetadata(attackDamage, DamageType.WEAPON, DamageType.PROJECTILE, DamageType.PHYSICAL), stats).damage(trace.getHit()); trace.draw(.5, Color.BLACK); getPlayer().getWorld().playSound(getPlayer().getLocation(), Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 2, 2); diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Staff.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Staff.java index 93c81be3..829c7c1a 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Staff.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Staff.java @@ -4,6 +4,7 @@ import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.api.player.EquipmentSlot; import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.damage.AttackMetadata; import io.lumine.mythic.lib.damage.DamageMetadata; import io.lumine.mythic.lib.damage.DamageType; import io.lumine.mythic.lib.player.PlayerMetadata; @@ -11,8 +12,6 @@ import io.lumine.mythic.lib.util.RayTrace; import io.lumine.mythic.lib.version.VersionSound; import net.Indyuce.mmoitems.ItemStats; import net.Indyuce.mmoitems.MMOItems; -import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType; import net.Indyuce.mmoitems.stat.StaffSpiritStat.StaffSpirit; import org.bukkit.EntityEffect; @@ -39,7 +38,7 @@ public class Staff extends UntargetedWeapon { double range = getValue(getNBTItem().getStat(ItemStats.RANGE.getId()), MMOItems.plugin.getConfig().getDouble("default.range")); // Attack meta - ItemAttackMetadata attackMeta = new ItemAttackMetadata(new DamageMetadata(attackDamage, DamageType.WEAPON, DamageType.PROJECTILE, DamageType.MAGIC), stats); + AttackMetadata attackMeta = new AttackMetadata(new DamageMetadata(attackDamage, DamageType.WEAPON, DamageType.PROJECTILE, DamageType.MAGIC), stats); StaffSpirit spirit = StaffSpirit.get(getNBTItem()); if (spirit != null) { @@ -49,7 +48,7 @@ public class Staff extends UntargetedWeapon { RayTrace trace = new RayTrace(stats.getPlayer(), slot, range, entity -> UtilityMethods.canTarget(stats.getPlayer(), entity, InteractionType.OFFENSE_ACTION)); if (trace.hasHit()) - attackMeta.applyEffectsAndDamage(getNBTItem(), trace.getHit()); + attackMeta.damage(trace.getHit()); trace.draw(.5, tick -> tick.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, tick, 0, .1, .1, .1, 0)); getPlayer().getWorld().playSound(getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_TWINKLE.toSound(), 2, 2); diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Whip.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Whip.java index 51574a8a..0fe67499 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Whip.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/Whip.java @@ -4,6 +4,7 @@ import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.api.player.EquipmentSlot; import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.damage.AttackMetadata; import io.lumine.mythic.lib.damage.DamageMetadata; import io.lumine.mythic.lib.damage.DamageType; import io.lumine.mythic.lib.player.PlayerMetadata; @@ -11,8 +12,6 @@ import io.lumine.mythic.lib.util.RayTrace; import io.lumine.mythic.lib.version.VersionSound; import net.Indyuce.mmoitems.ItemStats; import net.Indyuce.mmoitems.MMOItems; -import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import org.bukkit.Particle; import org.bukkit.entity.Player; @@ -34,7 +33,7 @@ public class Whip extends UntargetedWeapon { RayTrace trace = new RayTrace(getPlayer(), slot, range, entity -> UtilityMethods.canTarget(stats.getPlayer(), entity, InteractionType.OFFENSE_ACTION)); if (trace.hasHit()) - new ItemAttackMetadata(new DamageMetadata(attackDamage, DamageType.WEAPON, DamageType.PROJECTILE, DamageType.PHYSICAL), stats).applyEffectsAndDamage(getNBTItem(), trace.getHit()); + new AttackMetadata(new DamageMetadata(attackDamage, DamageType.WEAPON, DamageType.PROJECTILE, DamageType.PHYSICAL), stats).damage(trace.getHit()); trace.draw(.5, tick -> tick.getWorld().spawnParticle(Particle.CRIT, tick, 0, .1, .1, .1, 0)); getPlayer().getWorld().playSound(getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 1, 2); } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/BruteLuteAttack.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/BruteLuteAttack.java index 0f8c91fe..2243510d 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/BruteLuteAttack.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/BruteLuteAttack.java @@ -5,9 +5,9 @@ import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.damage.AttackMetadata; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import net.Indyuce.mmoitems.api.util.SoundReader; import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData; import org.bukkit.Location; @@ -22,7 +22,7 @@ import java.util.List; public class BruteLuteAttack implements LuteAttackHandler { @Override - public void handle(ItemAttackMetadata attack, NBTItem nbt, double range, Vector weight, SoundReader sound) { + public void handle(AttackMetadata attack, NBTItem nbt, double range, Vector weight, SoundReader sound) { new BukkitRunnable() { final Vector vec = attack.getPlayer().getEyeLocation().getDirection().multiply(.4); final Location loc = attack.getPlayer().getEyeLocation(); @@ -61,7 +61,7 @@ public class BruteLuteAttack implements LuteAttackHandler { for (Entity target : entities) if (UtilityMethods.canTarget(attack.getPlayer(), loc, target, InteractionType.OFFENSE_ACTION)) { - attack.clone().applyEffectsAndDamage(nbt, (LivingEntity) target); + attack.clone().damage((LivingEntity) target); cancel(); return; } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/CircularLuteAttack.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/CircularLuteAttack.java index 535307b4..790df255 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/CircularLuteAttack.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/CircularLuteAttack.java @@ -5,9 +5,9 @@ import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.damage.AttackMetadata; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import net.Indyuce.mmoitems.api.util.SoundReader; import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData; import org.bukkit.Location; @@ -21,60 +21,60 @@ import java.util.List; public class CircularLuteAttack implements LuteAttackHandler { - @Override - public void handle(ItemAttackMetadata attack, NBTItem nbt, double range, Vector weight, SoundReader sound) { - new BukkitRunnable() { - final Vector vec = attack.getPlayer().getEyeLocation().getDirection().multiply(.4); - final Location loc = attack.getPlayer().getEyeLocation(); - int ti = 0; + @Override + public void handle(AttackMetadata attack, NBTItem nbt, double range, Vector weight, SoundReader sound) { + new BukkitRunnable() { + final Vector vec = attack.getPlayer().getEyeLocation().getDirection().multiply(.4); + final Location loc = attack.getPlayer().getEyeLocation(); + int ti = 0; - public void run() { - if (ti++ > range) cancel(); + public void run() { + if (ti++ > range) cancel(); - List entities = MMOUtils.getNearbyChunkEntities(loc); - for (int j = 0; j < 3; j++) { - loc.add(vec.add(weight)); - if (loc.getBlock().getType().isSolid()) { - cancel(); - break; - } + List entities = MMOUtils.getNearbyChunkEntities(loc); + for (int j = 0; j < 3; j++) { + loc.add(vec.add(weight)); + if (loc.getBlock().getType().isSolid()) { + cancel(); + break; + } - double a = (double) ti / 3; - Vector vec = MMOUtils.rotateFunc(new Vector(Math.cos(a), Math.sin(a), 0).multiply(.3), loc); + double a = (double) ti / 3; + Vector vec = MMOUtils.rotateFunc(new Vector(Math.cos(a), Math.sin(a), 0).multiply(.3), loc); - if (nbt.hasTag("MMOITEMS_PROJECTILE_PARTICLES")) { - JsonObject obj = MythicLib.plugin.getJson().parse(nbt.getString("MMOITEMS_PROJECTILE_PARTICLES"), JsonObject.class); - Particle particle = Particle.valueOf(obj.get("Particle").getAsString()); - // If the selected particle is colored, use the provided color - if (ProjectileParticlesData.isColorable(particle)) { - double red = Double.parseDouble(String.valueOf(obj.get("Red"))); - double green = Double.parseDouble(String.valueOf(obj.get("Green"))); - double blue = Double.parseDouble(String.valueOf(obj.get("Blue"))); - ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(vec), red, green, blue); - ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(vec.multiply(-1)), red, green, blue); - // If it's not colored, just shoot the particle - } else { - ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(vec), 0, 0, 0); - ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(vec.multiply(-1)), 0, 0, 0); - } - // If no particle has been provided via projectile particle attribute, default to this particle - } else { - loc.getWorld().spawnParticle(Particle.NOTE, loc.clone().add(vec), 0); - loc.getWorld().spawnParticle(Particle.NOTE, loc.clone().add(vec.multiply(-1)), 0); - } + if (nbt.hasTag("MMOITEMS_PROJECTILE_PARTICLES")) { + JsonObject obj = MythicLib.plugin.getJson().parse(nbt.getString("MMOITEMS_PROJECTILE_PARTICLES"), JsonObject.class); + Particle particle = Particle.valueOf(obj.get("Particle").getAsString()); + // If the selected particle is colored, use the provided color + if (ProjectileParticlesData.isColorable(particle)) { + double red = Double.parseDouble(String.valueOf(obj.get("Red"))); + double green = Double.parseDouble(String.valueOf(obj.get("Green"))); + double blue = Double.parseDouble(String.valueOf(obj.get("Blue"))); + ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(vec), red, green, blue); + ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(vec.multiply(-1)), red, green, blue); + // If it's not colored, just shoot the particle + } else { + ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(vec), 0, 0, 0); + ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(vec.multiply(-1)), 0, 0, 0); + } + // If no particle has been provided via projectile particle attribute, default to this particle + } else { + loc.getWorld().spawnParticle(Particle.NOTE, loc.clone().add(vec), 0); + loc.getWorld().spawnParticle(Particle.NOTE, loc.clone().add(vec.multiply(-1)), 0); + } - if (j == 0) sound.play(loc, 2, (float) (.5 + (double) ti / range)); + if (j == 0) sound.play(loc, 2, (float) (.5 + (double) ti / range)); - for (Entity target : entities) - if (UtilityMethods.canTarget(attack.getPlayer(), loc, target, InteractionType.OFFENSE_ACTION)) { - attack.clone().applyEffectsAndDamage(nbt, (LivingEntity) target); - cancel(); - return; - } - } - } - }.runTaskTimer(MMOItems.plugin, 0, 1); - } + for (Entity target : entities) + if (UtilityMethods.canTarget(attack.getPlayer(), loc, target, InteractionType.OFFENSE_ACTION)) { + attack.clone().damage((LivingEntity) target); + cancel(); + return; + } + } + } + }.runTaskTimer(MMOItems.plugin, 0, 1); + } } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/LuteAttackHandler.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/LuteAttackHandler.java index 5da0df5d..d5b64153 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/LuteAttackHandler.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/LuteAttackHandler.java @@ -2,14 +2,13 @@ package net.Indyuce.mmoitems.api.interaction.weapon.untargeted.lute; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.damage.AttackMetadata; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import net.Indyuce.mmoitems.api.util.SoundReader; import org.bukkit.util.Vector; import java.util.Random; public interface LuteAttackHandler { - void handle(ItemAttackMetadata attackMeta, NBTItem nbt, double range, Vector weight, SoundReader sound); + void handle(AttackMetadata attackMeta, NBTItem nbt, double range, Vector weight, SoundReader sound); Random random = new Random(); } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/SimpleLuteAttack.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/SimpleLuteAttack.java index 108264f7..5d031586 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/SimpleLuteAttack.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/SimpleLuteAttack.java @@ -5,9 +5,9 @@ import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.damage.AttackMetadata; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import net.Indyuce.mmoitems.api.util.SoundReader; import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData; import org.bukkit.Location; @@ -21,53 +21,53 @@ import java.util.List; public class SimpleLuteAttack implements LuteAttackHandler { - @Override - public void handle(ItemAttackMetadata attack, NBTItem nbt, double range, Vector weight, SoundReader sound) { - new BukkitRunnable() { - final Vector vec = attack.getPlayer().getEyeLocation().getDirection().multiply(.4); - final Location loc = attack.getPlayer().getEyeLocation(); - int ti = 0; + @Override + public void handle(AttackMetadata attack, NBTItem nbt, double range, Vector weight, SoundReader sound) { + new BukkitRunnable() { + final Vector vec = attack.getPlayer().getEyeLocation().getDirection().multiply(.4); + final Location loc = attack.getPlayer().getEyeLocation(); + int ti = 0; - public void run() { - if (ti++ > range) cancel(); + public void run() { + if (ti++ > range) cancel(); - List entities = MMOUtils.getNearbyChunkEntities(loc); - for (int j = 0; j < 3; j++) { - loc.add(vec.add(weight)); - if (loc.getBlock().getType().isSolid()) { - cancel(); - break; - } + List entities = MMOUtils.getNearbyChunkEntities(loc); + for (int j = 0; j < 3; j++) { + loc.add(vec.add(weight)); + if (loc.getBlock().getType().isSolid()) { + cancel(); + break; + } - if (nbt.hasTag("MMOITEMS_PROJECTILE_PARTICLES")) { - JsonObject obj = MythicLib.plugin.getJson().parse(nbt.getString("MMOITEMS_PROJECTILE_PARTICLES"), JsonObject.class); - Particle particle = Particle.valueOf(obj.get("Particle").getAsString()); - // If the selected particle is colored, use the provided color - if (ProjectileParticlesData.isColorable(particle)) { - double red = Double.parseDouble(String.valueOf(obj.get("Red"))); - double green = Double.parseDouble(String.valueOf(obj.get("Green"))); - double blue = Double.parseDouble(String.valueOf(obj.get("Blue"))); - ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc, red, green, blue); - // If it's not colored, just shoot the particle - } else { - ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc, 0, 0, 0); - } - // If no particle has been provided via projectile particle attribute, default to this particle - } else { - loc.getWorld().spawnParticle(Particle.NOTE, loc, 0); - } + if (nbt.hasTag("MMOITEMS_PROJECTILE_PARTICLES")) { + JsonObject obj = MythicLib.plugin.getJson().parse(nbt.getString("MMOITEMS_PROJECTILE_PARTICLES"), JsonObject.class); + Particle particle = Particle.valueOf(obj.get("Particle").getAsString()); + // If the selected particle is colored, use the provided color + if (ProjectileParticlesData.isColorable(particle)) { + double red = Double.parseDouble(String.valueOf(obj.get("Red"))); + double green = Double.parseDouble(String.valueOf(obj.get("Green"))); + double blue = Double.parseDouble(String.valueOf(obj.get("Blue"))); + ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc, red, green, blue); + // If it's not colored, just shoot the particle + } else { + ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc, 0, 0, 0); + } + // If no particle has been provided via projectile particle attribute, default to this particle + } else { + loc.getWorld().spawnParticle(Particle.NOTE, loc, 0); + } - if (j == 0) sound.play(loc, 2, (float) (.5 + (double) ti / range)); + if (j == 0) sound.play(loc, 2, (float) (.5 + (double) ti / range)); - for (Entity target : entities) - if (UtilityMethods.canTarget(attack.getPlayer(), loc, target, InteractionType.OFFENSE_ACTION)) { - attack.clone().applyEffectsAndDamage(nbt, (LivingEntity) target); - cancel(); - return; - } - } - } - }.runTaskTimer(MMOItems.plugin, 0, 1); - } + for (Entity target : entities) + if (UtilityMethods.canTarget(attack.getPlayer(), loc, target, InteractionType.OFFENSE_ACTION)) { + attack.clone().damage((LivingEntity) target); + cancel(); + return; + } + } + } + }.runTaskTimer(MMOItems.plugin, 0, 1); + } } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/SlashLuteAttack.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/SlashLuteAttack.java index cbe1d09e..da94e10f 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/SlashLuteAttack.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/SlashLuteAttack.java @@ -5,9 +5,9 @@ import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.damage.AttackMetadata; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import net.Indyuce.mmoitems.api.util.SoundReader; import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData; import org.bukkit.Location; @@ -19,48 +19,48 @@ import org.bukkit.util.Vector; public class SlashLuteAttack implements LuteAttackHandler { - @Override - public void handle(ItemAttackMetadata attack, NBTItem nbt, double range, Vector weight, SoundReader sound) { - new BukkitRunnable() { - final Vector vec = attack.getPlayer().getEyeLocation().getDirection(); - final Location loc = attack.getPlayer().getLocation().add(0, 1.3, 0); - double ti = 1; + @Override + public void handle(AttackMetadata attack, NBTItem nbt, double range, Vector weight, SoundReader sound) { + new BukkitRunnable() { + final Vector vec = attack.getPlayer().getEyeLocation().getDirection(); + final Location loc = attack.getPlayer().getLocation().add(0, 1.3, 0); + double ti = 1; - public void run() { - if ((ti += .6) > 5) cancel(); + public void run() { + if ((ti += .6) > 5) cancel(); - sound.play(loc, 2, (float) (.5 + ti / range)); - for (int k = -30; k < 30; k += 3) - if (random.nextBoolean()) { - loc.setDirection(vec); - loc.setYaw(loc.getYaw() + k); - loc.setPitch(attack.getPlayer().getEyeLocation().getPitch()); + sound.play(loc, 2, (float) (.5 + ti / range)); + for (int k = -30; k < 30; k += 3) + if (random.nextBoolean()) { + loc.setDirection(vec); + loc.setYaw(loc.getYaw() + k); + loc.setPitch(attack.getPlayer().getEyeLocation().getPitch()); - if (nbt.hasTag("MMOITEMS_PROJECTILE_PARTICLES")) { - JsonObject obj = MythicLib.plugin.getJson().parse(nbt.getString("MMOITEMS_PROJECTILE_PARTICLES"), JsonObject.class); - Particle particle = Particle.valueOf(obj.get("Particle").getAsString()); - // If the selected particle is colored, use the provided color - if (ProjectileParticlesData.isColorable(particle)) { - double red = Double.parseDouble(String.valueOf(obj.get("Red"))); - double green = Double.parseDouble(String.valueOf(obj.get("Green"))); - double blue = Double.parseDouble(String.valueOf(obj.get("Blue"))); - ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(loc.getDirection().multiply(1.5 * ti)), red, green, blue); - // If it's not colored, just shoot the particle - } else { - ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(loc.getDirection().multiply(1.5 * ti)), 0, 0, 0); - } - // If no particle has been provided via projectile particle attribute, default to this particle - } else { - loc.getWorld().spawnParticle(Particle.NOTE, loc.clone().add(loc.getDirection().multiply(1.5 * ti)), 0); - } - } - } - }.runTaskTimer(MMOItems.plugin, 0, 1); + if (nbt.hasTag("MMOITEMS_PROJECTILE_PARTICLES")) { + JsonObject obj = MythicLib.plugin.getJson().parse(nbt.getString("MMOITEMS_PROJECTILE_PARTICLES"), JsonObject.class); + Particle particle = Particle.valueOf(obj.get("Particle").getAsString()); + // If the selected particle is colored, use the provided color + if (ProjectileParticlesData.isColorable(particle)) { + double red = Double.parseDouble(String.valueOf(obj.get("Red"))); + double green = Double.parseDouble(String.valueOf(obj.get("Green"))); + double blue = Double.parseDouble(String.valueOf(obj.get("Blue"))); + ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(loc.getDirection().multiply(1.5 * ti)), red, green, blue); + // If it's not colored, just shoot the particle + } else { + ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(loc.getDirection().multiply(1.5 * ti)), 0, 0, 0); + } + // If no particle has been provided via projectile particle attribute, default to this particle + } else { + loc.getWorld().spawnParticle(Particle.NOTE, loc.clone().add(loc.getDirection().multiply(1.5 * ti)), 0); + } + } + } + }.runTaskTimer(MMOItems.plugin, 0, 1); - for (Entity entity : MMOUtils.getNearbyChunkEntities(attack.getPlayer().getLocation())) - if (entity.getLocation().distanceSquared(attack.getPlayer().getLocation()) < 40 - && attack.getPlayer().getEyeLocation().getDirection().angle(entity.getLocation().toVector().subtract(attack.getPlayer().getLocation().toVector())) < Math.PI / 6 - && UtilityMethods.canTarget(attack.getPlayer(), entity, InteractionType.OFFENSE_ACTION)) - attack.clone().applyEffectsAndDamage(nbt, (LivingEntity) entity); - } + for (Entity entity : MMOUtils.getNearbyChunkEntities(attack.getPlayer().getLocation())) + if (entity.getLocation().distanceSquared(attack.getPlayer().getLocation()) < 40 + && attack.getPlayer().getEyeLocation().getDirection().angle(entity.getLocation().toVector().subtract(attack.getPlayer().getLocation().toVector())) < Math.PI / 6 + && UtilityMethods.canTarget(attack.getPlayer(), entity, InteractionType.OFFENSE_ACTION)) + attack.clone().damage((LivingEntity) entity); + } } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/WaveLuteAttack.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/WaveLuteAttack.java index 51d383e4..88fcbdcb 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/WaveLuteAttack.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/lute/WaveLuteAttack.java @@ -5,9 +5,9 @@ import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.damage.AttackMetadata; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import net.Indyuce.mmoitems.api.util.SoundReader; import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData; import org.bukkit.Location; @@ -21,58 +21,58 @@ import java.util.List; public class WaveLuteAttack implements LuteAttackHandler { - @Override - public void handle(ItemAttackMetadata attack, NBTItem nbt, double range, Vector weight, SoundReader sound) { - new BukkitRunnable() { - final Vector vec = attack.getPlayer().getEyeLocation().getDirection().multiply(.4); - final Location loc = attack.getPlayer().getEyeLocation(); - int ti = 0; + @Override + public void handle(AttackMetadata attack, NBTItem nbt, double range, Vector weight, SoundReader sound) { + new BukkitRunnable() { + final Vector vec = attack.getPlayer().getEyeLocation().getDirection().multiply(.4); + final Location loc = attack.getPlayer().getEyeLocation(); + int ti = 0; - public void run() { - if (ti++ > range) cancel(); + public void run() { + if (ti++ > range) cancel(); - List entities = MMOUtils.getNearbyChunkEntities(loc); - for (int j = 0; j < 3; j++) { - loc.add(vec.add(weight)); - if (loc.getBlock().getType().isSolid()) { - cancel(); - break; - } + List entities = MMOUtils.getNearbyChunkEntities(loc); + for (int j = 0; j < 3; j++) { + loc.add(vec.add(weight)); + if (loc.getBlock().getType().isSolid()) { + cancel(); + break; + } - Vector vec = MMOUtils.rotateFunc(new Vector(.5, 0, 0), loc); + Vector vec = MMOUtils.rotateFunc(new Vector(.5, 0, 0), loc); - if (nbt.hasTag("MMOITEMS_PROJECTILE_PARTICLES")) { - JsonObject obj = MythicLib.plugin.getJson().parse(nbt.getString("MMOITEMS_PROJECTILE_PARTICLES"), JsonObject.class); - Particle particle = Particle.valueOf(obj.get("Particle").getAsString()); - // If the selected particle is colored, use the provided color - if (ProjectileParticlesData.isColorable(particle)) { - double red = Double.parseDouble(String.valueOf(obj.get("Red"))); - double green = Double.parseDouble(String.valueOf(obj.get("Green"))); - double blue = Double.parseDouble(String.valueOf(obj.get("Blue"))); - ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(vec.multiply(Math.sin((double) ti / 2))), red, green, blue); - ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(vec.multiply(-1)), red, green, blue); - // If it's not colored, just shoot the particle - } else { - ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(vec.multiply(Math.sin((double) ti / 2))), 0, 0, 0); - ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(vec.multiply(-1)), 0, 0, 0); - } - // If no particle has been provided via projectile particle attribute, default to this particle - } else { - loc.getWorld().spawnParticle(Particle.NOTE, loc.clone().add(vec.multiply(Math.sin((double) ti / 2))), 0); - loc.getWorld().spawnParticle(Particle.NOTE, loc.clone().add(vec.multiply(-1)), 0); - } + if (nbt.hasTag("MMOITEMS_PROJECTILE_PARTICLES")) { + JsonObject obj = MythicLib.plugin.getJson().parse(nbt.getString("MMOITEMS_PROJECTILE_PARTICLES"), JsonObject.class); + Particle particle = Particle.valueOf(obj.get("Particle").getAsString()); + // If the selected particle is colored, use the provided color + if (ProjectileParticlesData.isColorable(particle)) { + double red = Double.parseDouble(String.valueOf(obj.get("Red"))); + double green = Double.parseDouble(String.valueOf(obj.get("Green"))); + double blue = Double.parseDouble(String.valueOf(obj.get("Blue"))); + ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(vec.multiply(Math.sin((double) ti / 2))), red, green, blue); + ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(vec.multiply(-1)), red, green, blue); + // If it's not colored, just shoot the particle + } else { + ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(vec.multiply(Math.sin((double) ti / 2))), 0, 0, 0); + ProjectileParticlesData.shootParticle(attack.getPlayer(), particle, loc.clone().add(vec.multiply(-1)), 0, 0, 0); + } + // If no particle has been provided via projectile particle attribute, default to this particle + } else { + loc.getWorld().spawnParticle(Particle.NOTE, loc.clone().add(vec.multiply(Math.sin((double) ti / 2))), 0); + loc.getWorld().spawnParticle(Particle.NOTE, loc.clone().add(vec.multiply(-1)), 0); + } - if (j == 0) sound.play(loc, 2, (float) (.5 + (double) ti / range)); + if (j == 0) sound.play(loc, 2, (float) (.5 + (double) ti / range)); - for (Entity target : entities) - if (UtilityMethods.canTarget(attack.getPlayer(), loc, target, InteractionType.OFFENSE_ACTION)) { - attack.clone().applyEffectsAndDamage(nbt, (LivingEntity) target); - cancel(); - return; - } - } - } - }.runTaskTimer(MMOItems.plugin, 0, 1); - } + for (Entity target : entities) + if (UtilityMethods.canTarget(attack.getPlayer(), loc, target, InteractionType.OFFENSE_ACTION)) { + attack.clone().damage((LivingEntity) target); + cancel(); + return; + } + } + } + }.runTaskTimer(MMOItems.plugin, 0, 1); + } } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/LightningSpirit.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/LightningSpirit.java index c01d9283..4cbabc90 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/LightningSpirit.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/LightningSpirit.java @@ -4,22 +4,21 @@ import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.api.player.EquipmentSlot; import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.damage.AttackMetadata; import io.lumine.mythic.lib.util.RayTrace; import io.lumine.mythic.lib.version.VersionSound; -import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import org.bukkit.Particle; public class LightningSpirit implements StaffAttackHandler { @Override - public void handle(ItemAttackMetadata attackMeta, NBTItem nbt, EquipmentSlot slot, double range) { + public void handle(AttackMetadata attackMeta, NBTItem nbt, EquipmentSlot slot, double range) { attackMeta.getPlayer().getWorld().playSound(attackMeta.getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 2, 2); RayTrace trace = new RayTrace(attackMeta.getPlayer(), slot, range, entity -> UtilityMethods.canTarget(attackMeta.getPlayer(), entity, InteractionType.OFFENSE_ACTION)); if (trace.hasHit()) - attackMeta.applyEffectsAndDamage(nbt, trace.getHit()); + attackMeta.damage(trace.getHit()); trace.draw(.5, loc1 -> loc1.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc1, 0)); } } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/ManaSpirit.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/ManaSpirit.java index ddc6cb1b..50d3a2e3 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/ManaSpirit.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/ManaSpirit.java @@ -4,9 +4,9 @@ import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.api.player.EquipmentSlot; import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.damage.AttackMetadata; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Particle; @@ -21,7 +21,7 @@ import java.util.List; public class ManaSpirit implements StaffAttackHandler { @Override - public void handle(ItemAttackMetadata attackMeta, NBTItem nbt, EquipmentSlot slot, double range) { + public void handle(AttackMetadata attackMeta, NBTItem nbt, EquipmentSlot slot, double range) { new BukkitRunnable() { final Vector vec = attackMeta.getPlayer().getEyeLocation().getDirection().multiply(.4); final Location loc = attackMeta.getPlayer().getEyeLocation(); @@ -49,7 +49,7 @@ public class ManaSpirit implements StaffAttackHandler { } for (Entity target : targets) if (UtilityMethods.canTarget(attackMeta.getPlayer(), loc, target, InteractionType.OFFENSE_ACTION)) { - attackMeta.applyEffectsAndDamage(nbt, (LivingEntity) target); + attackMeta.damage((LivingEntity) target); loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0); cancel(); return; diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/NetherSpirit.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/NetherSpirit.java index 602f196a..bba8dec6 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/NetherSpirit.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/NetherSpirit.java @@ -4,9 +4,9 @@ import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.api.player.EquipmentSlot; import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.damage.AttackMetadata; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.Sound; @@ -20,7 +20,7 @@ import java.util.List; public class NetherSpirit implements StaffAttackHandler { @Override - public void handle(ItemAttackMetadata attackMeta, NBTItem nbt, EquipmentSlot slot, double range) { + public void handle(AttackMetadata attackMeta, NBTItem nbt, EquipmentSlot slot, double range) { new BukkitRunnable() { final Vector vec = attackMeta.getPlayer().getEyeLocation().getDirection().multiply(.3); final Location loc = attackMeta.getPlayer().getEyeLocation(); @@ -41,7 +41,7 @@ public class NetherSpirit implements StaffAttackHandler { loc.getWorld().spawnParticle(Particle.SMOKE_NORMAL, loc, 0); for (Entity target : targets) if (UtilityMethods.canTarget(attackMeta.getPlayer(), loc, target, InteractionType.OFFENSE_ACTION)) { - attackMeta.applyEffectsAndDamage(nbt, (LivingEntity) target); + attackMeta.damage((LivingEntity) target); loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0); cancel(); return; diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/StaffAttackHandler.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/StaffAttackHandler.java index 3fc782c0..09331f7e 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/StaffAttackHandler.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/StaffAttackHandler.java @@ -2,15 +2,15 @@ package net.Indyuce.mmoitems.api.interaction.weapon.untargeted.staff; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.api.player.EquipmentSlot; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; +import io.lumine.mythic.lib.damage.AttackMetadata; import org.bukkit.Location; import java.util.Random; public interface StaffAttackHandler { - Random RANDOM = new Random(); + static final Random RANDOM = new Random(); - void handle(ItemAttackMetadata attackMeta, NBTItem nbt, EquipmentSlot slot, double range); + void handle(AttackMetadata attackMeta, NBTItem nbt, EquipmentSlot slot, double range); default Location getGround(Location loc) { for (int j = 0; j < 20; j++) { diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/SunfireSpirit.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/SunfireSpirit.java index c8612b71..56db31c4 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/SunfireSpirit.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/SunfireSpirit.java @@ -4,10 +4,10 @@ import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.api.player.EquipmentSlot; import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.damage.AttackMetadata; import io.lumine.mythic.lib.version.VersionSound; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.Sound; @@ -19,7 +19,7 @@ import org.bukkit.util.Vector; public class SunfireSpirit implements StaffAttackHandler { @Override - public void handle(ItemAttackMetadata attackMeta, NBTItem nbt, EquipmentSlot slot, double range) { + public void handle(AttackMetadata attackMeta, NBTItem nbt, EquipmentSlot slot, double range) { attackMeta.getPlayer().getWorld().playSound(attackMeta.getPlayer().getLocation(), Sound.ENTITY_WITHER_SHOOT, 2, 2); new BukkitRunnable() { final Location target = getGround(attackMeta.getPlayer().getTargetBlock(null, (int) range * 2).getLocation()).add(0, 1.2, 0); @@ -41,7 +41,7 @@ public class SunfireSpirit implements StaffAttackHandler { loc.getWorld().playSound(loc, VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 2, 2); for (Entity target : MMOUtils.getNearbyChunkEntities(loc)) if (UtilityMethods.canTarget(attackMeta.getPlayer(), target, InteractionType.OFFENSE_ACTION) && target.getLocation().distanceSquared(loc) <= 9) - attackMeta.clone().applyEffectsAndDamage(nbt, (LivingEntity) target); + attackMeta.clone().damage((LivingEntity) target); cancel(); break; } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/ThunderSpirit.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/ThunderSpirit.java index 24460c72..ee156759 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/ThunderSpirit.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/ThunderSpirit.java @@ -4,10 +4,10 @@ import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.api.player.EquipmentSlot; import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.damage.AttackMetadata; import io.lumine.mythic.lib.version.VersionSound; import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import org.bukkit.Location; import org.bukkit.Particle; import org.bukkit.Sound; @@ -19,7 +19,7 @@ import org.bukkit.util.Vector; public class ThunderSpirit implements StaffAttackHandler { @Override - public void handle(ItemAttackMetadata attackMeta, NBTItem nbt, EquipmentSlot slot, double range) { + public void handle(AttackMetadata attackMeta, NBTItem nbt, EquipmentSlot slot, double range) { attackMeta.getPlayer().getWorld().playSound(attackMeta.getPlayer().getLocation(), Sound.ENTITY_WITHER_SHOOT, 2, 2); new BukkitRunnable() { final Location target = getGround(attackMeta.getPlayer().getTargetBlock(null, (int) range * 2).getLocation()).add(0, 1.2, 0); @@ -39,7 +39,7 @@ public class ThunderSpirit implements StaffAttackHandler { loc.getWorld().playSound(loc, VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 2, 2); for (Entity target : MMOUtils.getNearbyChunkEntities(loc)) if (UtilityMethods.canTarget(attackMeta.getPlayer(), target, InteractionType.OFFENSE_ACTION) && target.getLocation().distanceSquared(loc) <= 9) - attackMeta.clone().applyEffectsAndDamage(nbt, (LivingEntity) target); + attackMeta.clone().damage((LivingEntity) target); cancel(); } } diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/VoidSpirit.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/VoidSpirit.java index 8db14b41..28a40e95 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/VoidSpirit.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/VoidSpirit.java @@ -2,8 +2,8 @@ package net.Indyuce.mmoitems.api.interaction.weapon.untargeted.staff; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.api.player.EquipmentSlot; +import io.lumine.mythic.lib.damage.AttackMetadata; import net.Indyuce.mmoitems.MMOItems; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import net.Indyuce.mmoitems.skill.Shulker_Missile; import org.bukkit.Sound; import org.bukkit.entity.EntityType; @@ -14,7 +14,7 @@ import org.bukkit.util.Vector; public class VoidSpirit implements StaffAttackHandler { @Override - public void handle(ItemAttackMetadata attackMeta, NBTItem nbt, EquipmentSlot slot, double range) { + public void handle(AttackMetadata attackMeta, NBTItem nbt, EquipmentSlot slot, double range) { Vector vec = attackMeta.getPlayer().getEyeLocation().getDirection(); attackMeta.getPlayer().getWorld().playSound(attackMeta.getPlayer().getLocation(), Sound.ENTITY_WITHER_SHOOT, 2, 2); ShulkerBullet shulkerBullet = (ShulkerBullet) attackMeta.getPlayer().getWorld().spawnEntity(attackMeta.getPlayer().getLocation().add(0, 1, 0), EntityType.valueOf("SHULKER_BULLET")); diff --git a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/XRaySpirit.java b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/XRaySpirit.java index 4530c5b7..40accb76 100644 --- a/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/XRaySpirit.java +++ b/src/main/java/net/Indyuce/mmoitems/api/interaction/weapon/untargeted/staff/XRaySpirit.java @@ -4,23 +4,20 @@ import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.api.player.EquipmentSlot; import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.damage.AttackMetadata; import io.lumine.mythic.lib.util.RayTrace; -import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import org.bukkit.Color; -import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.util.Vector; public class XRaySpirit implements StaffAttackHandler { @Override - public void handle(ItemAttackMetadata attackMeta, NBTItem nbt, EquipmentSlot slot, double range) { + public void handle(AttackMetadata attackMeta, NBTItem nbt, EquipmentSlot slot, double range) { attackMeta.getPlayer().getWorld().playSound(attackMeta.getPlayer().getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 2, 2); RayTrace trace = new RayTrace(attackMeta.getPlayer(), slot, range, entity -> UtilityMethods.canTarget(attackMeta.getPlayer(), entity, InteractionType.OFFENSE_ACTION)); if (trace.hasHit()) - attackMeta.applyEffectsAndDamage(nbt, trace.getHit()); + attackMeta.damage(trace.getHit()); trace.draw(.5, Color.BLACK); attackMeta.getPlayer().getWorld().playSound(attackMeta.getPlayer().getLocation(), Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 0.40f, 2); } diff --git a/src/main/java/net/Indyuce/mmoitems/listener/ItemUse.java b/src/main/java/net/Indyuce/mmoitems/listener/ItemUse.java index f83a5c86..d045cb82 100644 --- a/src/main/java/net/Indyuce/mmoitems/listener/ItemUse.java +++ b/src/main/java/net/Indyuce/mmoitems/listener/ItemUse.java @@ -8,7 +8,6 @@ import io.lumine.mythic.lib.api.player.EquipmentSlot; import io.lumine.mythic.lib.comp.target.InteractionType; import io.lumine.mythic.lib.damage.MeleeAttackMetadata; import net.Indyuce.mmoitems.MMOItems; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import net.Indyuce.mmoitems.api.Type; import net.Indyuce.mmoitems.api.TypeSet; import net.Indyuce.mmoitems.api.event.item.SpecialWeaponAttackEvent; @@ -143,9 +142,6 @@ public class ItemUse implements Listener { return; } } - - // Cast on-hit abilities and add the extra damage to the damage event - new ItemAttackMetadata(event.getAttack()).applyEffects(item, event.getEntity()); } /** diff --git a/src/main/java/net/Indyuce/mmoitems/manager/EntityManager.java b/src/main/java/net/Indyuce/mmoitems/manager/EntityManager.java index 1fba62af..1b1f96ca 100644 --- a/src/main/java/net/Indyuce/mmoitems/manager/EntityManager.java +++ b/src/main/java/net/Indyuce/mmoitems/manager/EntityManager.java @@ -3,7 +3,6 @@ package net.Indyuce.mmoitems.manager; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.player.PlayerMetadata; import net.Indyuce.mmoitems.MMOItems; -import net.Indyuce.mmoitems.api.ElementalAttack; import net.Indyuce.mmoitems.api.interaction.projectile.ArrowParticles; import net.Indyuce.mmoitems.api.interaction.projectile.EntityData; import net.Indyuce.mmoitems.api.interaction.projectile.ProjectileData; @@ -159,10 +158,8 @@ public class EntityManager implements Listener { damage *= 1.25 + (.25 * data.getSourceItem().getItem().getItemMeta().getEnchantLevel(Enchantment.ARROW_DAMAGE)); // Apply MMOItems specific modifications - if (data.isCustomWeapon()) { + if (data.isCustomWeapon()) data.applyPotionEffects(target); - damage += new ElementalAttack(data.getShooter(), data.getSourceItem(), damage, target).getDamageModifier(); - } event.setDamage(event.getDamage() + damage - data.getCachedInitialDamage()); diff --git a/src/main/java/net/Indyuce/mmoitems/skill/Shulker_Missile.java b/src/main/java/net/Indyuce/mmoitems/skill/Shulker_Missile.java index 8b7fa7e7..ebea6b33 100644 --- a/src/main/java/net/Indyuce/mmoitems/skill/Shulker_Missile.java +++ b/src/main/java/net/Indyuce/mmoitems/skill/Shulker_Missile.java @@ -3,14 +3,13 @@ package net.Indyuce.mmoitems.skill; import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.comp.target.InteractionType; +import io.lumine.mythic.lib.damage.AttackMetadata; import io.lumine.mythic.lib.damage.DamageMetadata; import io.lumine.mythic.lib.damage.DamageType; import io.lumine.mythic.lib.skill.SkillMetadata; import io.lumine.mythic.lib.skill.handler.SkillHandler; import io.lumine.mythic.lib.skill.result.def.VectorSkillResult; import net.Indyuce.mmoitems.MMOItems; -import net.Indyuce.mmoitems.MMOUtils; -import net.Indyuce.mmoitems.api.ItemAttackMetadata; import net.Indyuce.mmoitems.api.interaction.projectile.EntityData; import org.bukkit.Color; import org.bukkit.Location; @@ -63,7 +62,7 @@ public class Shulker_Missile extends SkillHandler implements EntityType.SHULKER_BULLET); shulkerBullet.setShooter(caster); - ItemAttackMetadata attackMeta = new ItemAttackMetadata(new DamageMetadata(skillMeta.getModifier("damage"), DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE), skillMeta.getCaster()); + AttackMetadata attackMeta = new AttackMetadata(new DamageMetadata(skillMeta.getModifier("damage"), DamageType.SKILL, DamageType.MAGIC, DamageType.PROJECTILE), skillMeta.getCaster()); MMOItems.plugin.getEntities().registerCustomEntity(shulkerBullet, new ShulkerMissileEntityData(attackMeta, skillMeta.getModifier("effect-duration"))); new BukkitRunnable() { @@ -95,10 +94,6 @@ public class Shulker_Missile extends SkillHandler implements return; } - // Void spirit - if (data.isWeaponAttack()) - data.attackMeta.applyEffects(data.weapon, entity); - event.setDamage(data.attackMeta.getDamage().getDamage()); new BukkitRunnable() { @@ -129,7 +124,7 @@ public class Shulker_Missile extends SkillHandler implements } public static class ShulkerMissileEntityData implements EntityData { - private final ItemAttackMetadata attackMeta; + private final AttackMetadata attackMeta; private final double duration; @Nullable @@ -141,7 +136,7 @@ public class Shulker_Missile extends SkillHandler implements * @param attackMeta Attack meta * @param duration Duration of levitation effect in seconds */ - public ShulkerMissileEntityData(ItemAttackMetadata attackMeta, double duration) { + public ShulkerMissileEntityData(AttackMetadata attackMeta, double duration) { this(attackMeta, duration, null); } @@ -151,11 +146,11 @@ public class Shulker_Missile extends SkillHandler implements * @param attackMeta Attack meta * @param weapon Item used for the attack */ - public ShulkerMissileEntityData(ItemAttackMetadata attackMeta, NBTItem weapon) { + public ShulkerMissileEntityData(AttackMetadata attackMeta, NBTItem weapon) { this(attackMeta, 0, weapon); } - private ShulkerMissileEntityData(ItemAttackMetadata attackMeta, double duration, NBTItem weapon) { + private ShulkerMissileEntityData(AttackMetadata attackMeta, double duration, NBTItem weapon) { this.attackMeta = attackMeta; this.duration = duration; this.weapon = weapon;