mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-03-09 12:49:06 +01:00
Lute custom particles now work will all lute attack effects
This commit is contained in:
parent
dbb0c0de04
commit
402fcfe26c
@ -1,5 +1,7 @@
|
||||
package net.Indyuce.mmoitems.api.interaction.weapon.untargeted.lute;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
@ -7,6 +9,7 @@ import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.SoundReader;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -36,7 +39,24 @@ public class BruteLuteAttack implements LuteAttackHandler {
|
||||
break;
|
||||
}
|
||||
|
||||
loc.getWorld().spawnParticle(Particle.NOTE, loc, 2, .1, .1, .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(stats.getPlayer(), particle, loc, red, green, blue);
|
||||
// If it's not colored, just shoot the particle
|
||||
} else {
|
||||
ProjectileParticlesData.shootParticle(stats.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, 2, .1, .1, .1, 0);
|
||||
}
|
||||
|
||||
if (j == 0) sound.play(loc, 2, (float) (.5 + (double) ti / range));
|
||||
|
||||
for (Entity target : entities)
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.Indyuce.mmoitems.api.interaction.weapon.untargeted.lute;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
@ -7,6 +9,7 @@ import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.SoundReader;
|
||||
import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -38,8 +41,29 @@ public class CircularLuteAttack implements LuteAttackHandler {
|
||||
|
||||
double a = (double) ti / 3;
|
||||
Vector vec = MMOUtils.rotateFunc(new Vector(Math.cos(a), Math.sin(a), 0).multiply(.3), loc);
|
||||
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(stats.getPlayer(), particle, loc.clone().add(vec), red, green, blue);
|
||||
ProjectileParticlesData.shootParticle(stats.getPlayer(), particle, loc.clone().add(vec.multiply(-1)), red, green, blue);
|
||||
// If it's not colored, just shoot the particle
|
||||
} else {
|
||||
ProjectileParticlesData.shootParticle(stats.getPlayer(), particle, loc.clone().add(vec), 0, 0, 0);
|
||||
ProjectileParticlesData.shootParticle(stats.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));
|
||||
|
||||
for (Entity target : entities)
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.Indyuce.mmoitems.api.interaction.weapon.untargeted.lute;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
@ -7,6 +9,7 @@ import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.SoundReader;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -36,7 +39,24 @@ public class SimpleLuteAttack implements LuteAttackHandler {
|
||||
break;
|
||||
}
|
||||
|
||||
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(stats.getPlayer(), particle, loc, red, green, blue);
|
||||
// If it's not colored, just shoot the particle
|
||||
} else {
|
||||
ProjectileParticlesData.shootParticle(stats.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));
|
||||
|
||||
for (Entity target : entities)
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.Indyuce.mmoitems.api.interaction.weapon.untargeted.lute;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
@ -7,6 +9,7 @@ import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.SoundReader;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -32,7 +35,24 @@ public class SlashLuteAttack implements LuteAttackHandler {
|
||||
loc.setDirection(vec);
|
||||
loc.setYaw(loc.getYaw() + k);
|
||||
loc.setPitch(stats.getPlayer().getEyeLocation().getPitch());
|
||||
loc.getWorld().spawnParticle(Particle.NOTE, loc.clone().add(loc.getDirection().multiply(1.5 * ti)), 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(stats.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(stats.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);
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.Indyuce.mmoitems.api.interaction.weapon.untargeted.lute;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
@ -7,6 +9,7 @@ import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.SoundReader;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -37,8 +40,28 @@ public class WaveLuteAttack implements LuteAttackHandler {
|
||||
}
|
||||
|
||||
Vector vec = MMOUtils.rotateFunc(new Vector(.5, 0, 0), loc);
|
||||
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(stats.getPlayer(), particle, loc.clone().add(vec.multiply(Math.sin((double) ti / 2))), red, green, blue);
|
||||
ProjectileParticlesData.shootParticle(stats.getPlayer(), particle, loc.clone().add(vec.multiply(-1)), red, green, blue);
|
||||
// If it's not colored, just shoot the particle
|
||||
} else {
|
||||
ProjectileParticlesData.shootParticle(stats.getPlayer(), particle, loc.clone().add(vec.multiply(Math.sin((double) ti / 2))), 0, 0, 0);
|
||||
ProjectileParticlesData.shootParticle(stats.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));
|
||||
|
||||
for (Entity target : entities)
|
||||
|
Loading…
Reference in New Issue
Block a user