Update effects

This commit is contained in:
HappyPikachu 2015-02-14 22:28:20 -05:00
parent ac09b2da8a
commit e5dafd790f
2 changed files with 70 additions and 61 deletions

View File

@ -9,60 +9,68 @@ import org.bukkit.entity.Player;
public enum Eff_1_8_R1 {
HUGE_EXPLOSION("hugeexplosion"),
LARGE_EXPLODE("largeexplode"),
FIREWORKS_SPARK("fireworksSpark"),
BUBBLE("bubble"),
SUSPEND("susgpend"),
DEPTH_SUSPEND("depthSuspend"),
TOWN_AURA("townaura"),
CRIT("crit"),
MAGIC_CRIT("magicCrit"),
MOB_SPELL("mobSpell"),
MOB_SPELL_AMBIENT("mobSpellAmbient"),
SPELL("spell"),
INSTANT_SPELL("instantSpell"),
WITCH_MAGIC("witchMagic"),
NOTE("note"),
PORTAL("portal"),
ENCHANTMENT_TABLE("enchantmenttable"),
EXPLODE("explode"),
FLAME("flame"),
LAVA("lava"),
FOOTSTEP("footstep"),
SPLASH("splash"),
LARGE_SMOKE("largesmoke"),
CLOUD("cloud"),
RED_DUST("reddust"),
SNOWBALL_POOF("snowballpoof"),
DRIP_WATER("dripWater"),
DRIP_LAVA("dripLava"),
SNOW_SHOVEL("snowshovel"),
SLIME("slime"),
HEART("heart"),
ANGRY_VILLAGER("angryVillager"),
HAPPY_VILLAGER("happyVillager"),
ICONCRACK("iconcrack_"),
TILECRACK("tilecrack_");
EXPLOSION("0"),
EXPLOSION_LARGE("1"),
EXPLOSION_HUGE("2"),
FIREWORKS_SPARK("3"),
BUBBLE("4"),
WAKE("5"),
SPLASH("6"),
SUSPENDED("7"),
DEPTH_SUSPEND("8"),
CRIT("9"),
MAGIC_CRIT("10"),
SMOKE("11"),
LARGE_SMOKE("12"),
SPELL("13"),
INSTANT_SPELL("14"),
MOB_SPELL("15"),
MOB_SPELL_AMBIENT("16"),
WITCH_MAGIC("17"),
DRIP_WATER("18"),
DRIP_LAVA("19"),
ANGRY_VILLAGER("20"),
HAPPY_VILLAGER("21"),
TOWN_AURA("22"),
NOTE("23"),
PORTAL("24"),
ENCHANTMENT_TABLE("25"),
FLAME("26"),
LAVA("27"),
FOOTSTEP("28"),
CLOUD("29"),
RED_DUST("30"),
SNOWBALL_POOF("31"),
SNOW_SHOVEL("32"),
SLIME("33"),
HEART("34"),
BARRIER("35"),
ICONCRACK_("36"),
BLOCKCRACK_("37"),
BLOCKDUST_("38"),
DROPLET("39"),
TAKE("40"),
MOB_APPEARANCE("41");
private final String particleName;
private final String particleId;
Eff_1_8_R1(String particleName) {
this.particleName = particleName;
Eff_1_8_R1(String particleId) {
this.particleId = particleId;
}
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] unknown) throws Exception {
public void sendToPlayer(Player player, Location location, boolean longDistance, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles();
ReflectionUtil.setValue(packet, "a", particleName);
ReflectionUtil.setValue(packet, "b", (float) location.getX());
ReflectionUtil.setValue(packet, "c", (float) location.getY());
ReflectionUtil.setValue(packet, "d", (float) location.getZ());
ReflectionUtil.setValue(packet, "e", offsetX);
ReflectionUtil.setValue(packet, "f", offsetY);
ReflectionUtil.setValue(packet, "g", offsetZ);
ReflectionUtil.setValue(packet, "h", speed);
ReflectionUtil.setValue(packet, "i", count);
ReflectionUtil.setValue(packet, "k", unknown);
ReflectionUtil.setValue(packet, "a", particleId);
ReflectionUtil.setValue(packet, "b", longDistance);
ReflectionUtil.setValue(packet, "c", (float) location.getX());
ReflectionUtil.setValue(packet, "d", (float) location.getY());
ReflectionUtil.setValue(packet, "e", (float) location.getZ());
ReflectionUtil.setValue(packet, "f", offsetX);
ReflectionUtil.setValue(packet, "g", offsetY);
ReflectionUtil.setValue(packet, "h", offsetZ);
ReflectionUtil.setValue(packet, "i", speed);
ReflectionUtil.setValue(packet, "j", count);
ReflectionUtil.setValue(packet, "k", data);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}

View File

@ -74,11 +74,12 @@ public class NpcEffectThread implements Runnable {
//Get and set eye location, because npc.getBukkitEntity() is deprecated.
Location eyeLoc = npc.getEntity().getLocation();
eyeLoc.setY(eyeLoc.getY() + 1.5);
boolean longDistance = false;
if (Quests.effect.equalsIgnoreCase("enchant")) {
try {
Eff_1_8_R1.ENCHANTMENT_TABLE.sendToPlayer(player, eyeLoc, 0, 1, 0, 1, 10, null);
Eff_1_8_R1.ENCHANTMENT_TABLE.sendToPlayer(player, eyeLoc, longDistance, 0, 1, 0, 1, 10, null);
} catch (Exception e) {
e.printStackTrace();
}
@ -86,7 +87,7 @@ public class NpcEffectThread implements Runnable {
} else if (Quests.effect.equalsIgnoreCase("crit")) {
try {
Eff_1_8_R1.CRIT.sendToPlayer(player, eyeLoc, 0, 0, 0, (float) 0.35, 3, null);
Eff_1_8_R1.CRIT.sendToPlayer(player, eyeLoc, longDistance, 0, 0, 0, (float) 0.35, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
@ -94,7 +95,7 @@ public class NpcEffectThread implements Runnable {
} else if (Quests.effect.equalsIgnoreCase("spell")) {
try {
Eff_1_8_R1.INSTANT_SPELL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
Eff_1_8_R1.INSTANT_SPELL.sendToPlayer(player, eyeLoc, longDistance, 0, 0, 0, 1, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
@ -102,7 +103,7 @@ public class NpcEffectThread implements Runnable {
} else if (Quests.effect.equalsIgnoreCase("magiccrit")) {
try {
Eff_1_8_R1.MAGIC_CRIT.sendToPlayer(player, eyeLoc, 0, 0, 0, (float) 0.35, 3, null);
Eff_1_8_R1.MAGIC_CRIT.sendToPlayer(player, eyeLoc, longDistance, 0, 0, 0, (float) 0.35, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
@ -110,7 +111,7 @@ public class NpcEffectThread implements Runnable {
} else if (Quests.effect.equalsIgnoreCase("mobspell")) {
try {
Eff_1_8_R1.MOB_SPELL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
Eff_1_8_R1.MOB_SPELL.sendToPlayer(player, eyeLoc, longDistance, 0, 0, 0, 1, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
@ -120,7 +121,7 @@ public class NpcEffectThread implements Runnable {
try {
Location old = eyeLoc;
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
Eff_1_8_R1.NOTE.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1, null);
Eff_1_8_R1.NOTE.sendToPlayer(player, newLoc, longDistance, 0, 0, 0, 1, 1, null);
} catch (Exception e) {
e.printStackTrace();
}
@ -128,7 +129,7 @@ public class NpcEffectThread implements Runnable {
} else if (Quests.effect.equalsIgnoreCase("portal")) {
try {
Eff_1_8_R1.PORTAL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 5, null);
Eff_1_8_R1.PORTAL.sendToPlayer(player, eyeLoc, longDistance, 0, 0, 0, 1, 5, null);
} catch (Exception e) {
e.printStackTrace();
}
@ -137,7 +138,7 @@ public class NpcEffectThread implements Runnable {
try {
Location newLoc = new Location(player.getWorld(), eyeLoc.getX(), eyeLoc.getY() + (float) 0.5, eyeLoc.getZ());
Eff_1_8_R1.RED_DUST.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1, null);
Eff_1_8_R1.RED_DUST.sendToPlayer(player, newLoc, longDistance, 0, 0, 0, 1, 1, null);
} catch (Exception e) {
e.printStackTrace();
}
@ -145,7 +146,7 @@ public class NpcEffectThread implements Runnable {
} else if (Quests.effect.equalsIgnoreCase("witch")) {
try {
Eff_1_8_R1.WITCH_MAGIC.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
Eff_1_8_R1.WITCH_MAGIC.sendToPlayer(player, eyeLoc, longDistance, 0, 0, 0, 1, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
@ -155,7 +156,7 @@ public class NpcEffectThread implements Runnable {
try {
Location old = eyeLoc;
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
Eff_1_8_R1.SNOWBALL_POOF.sendToPlayer(player, newLoc, 0, 0, 0, 1, 3, null);
Eff_1_8_R1.SNOWBALL_POOF.sendToPlayer(player, newLoc, longDistance, 0, 0, 0, 1, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
@ -165,7 +166,7 @@ public class NpcEffectThread implements Runnable {
try {
Location old = eyeLoc;
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
Eff_1_8_R1.SPLASH.sendToPlayer(player, newLoc, 0, 0, 0, 1, 4, null);
Eff_1_8_R1.SPLASH.sendToPlayer(player, newLoc, longDistance, 0, 0, 0, 1, 4, null);
} catch (Exception e) {
e.printStackTrace();
}
@ -173,7 +174,7 @@ public class NpcEffectThread implements Runnable {
} else if (Quests.effect.equalsIgnoreCase("smoke")) {
try {
Eff_1_8_R1.TOWN_AURA.sendToPlayer(player, eyeLoc, 0, 1, 0, 1, 20, null);
Eff_1_8_R1.TOWN_AURA.sendToPlayer(player, eyeLoc, longDistance, 0, 1, 0, 1, 20, null);
} catch (Exception e) {
e.printStackTrace();
}