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 { public enum Eff_1_8_R1 {
HUGE_EXPLOSION("hugeexplosion"), EXPLOSION("0"),
LARGE_EXPLODE("largeexplode"), EXPLOSION_LARGE("1"),
FIREWORKS_SPARK("fireworksSpark"), EXPLOSION_HUGE("2"),
BUBBLE("bubble"), FIREWORKS_SPARK("3"),
SUSPEND("susgpend"), BUBBLE("4"),
DEPTH_SUSPEND("depthSuspend"), WAKE("5"),
TOWN_AURA("townaura"), SPLASH("6"),
CRIT("crit"), SUSPENDED("7"),
MAGIC_CRIT("magicCrit"), DEPTH_SUSPEND("8"),
MOB_SPELL("mobSpell"), CRIT("9"),
MOB_SPELL_AMBIENT("mobSpellAmbient"), MAGIC_CRIT("10"),
SPELL("spell"), SMOKE("11"),
INSTANT_SPELL("instantSpell"), LARGE_SMOKE("12"),
WITCH_MAGIC("witchMagic"), SPELL("13"),
NOTE("note"), INSTANT_SPELL("14"),
PORTAL("portal"), MOB_SPELL("15"),
ENCHANTMENT_TABLE("enchantmenttable"), MOB_SPELL_AMBIENT("16"),
EXPLODE("explode"), WITCH_MAGIC("17"),
FLAME("flame"), DRIP_WATER("18"),
LAVA("lava"), DRIP_LAVA("19"),
FOOTSTEP("footstep"), ANGRY_VILLAGER("20"),
SPLASH("splash"), HAPPY_VILLAGER("21"),
LARGE_SMOKE("largesmoke"), TOWN_AURA("22"),
CLOUD("cloud"), NOTE("23"),
RED_DUST("reddust"), PORTAL("24"),
SNOWBALL_POOF("snowballpoof"), ENCHANTMENT_TABLE("25"),
DRIP_WATER("dripWater"), FLAME("26"),
DRIP_LAVA("dripLava"), LAVA("27"),
SNOW_SHOVEL("snowshovel"), FOOTSTEP("28"),
SLIME("slime"), CLOUD("29"),
HEART("heart"), RED_DUST("30"),
ANGRY_VILLAGER("angryVillager"), SNOWBALL_POOF("31"),
HAPPY_VILLAGER("happyVillager"), SNOW_SHOVEL("32"),
ICONCRACK("iconcrack_"), SLIME("33"),
TILECRACK("tilecrack_"); 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) { Eff_1_8_R1(String particleId) {
this.particleName = particleName; 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(); PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles();
ReflectionUtil.setValue(packet, "a", particleName); ReflectionUtil.setValue(packet, "a", particleId);
ReflectionUtil.setValue(packet, "b", (float) location.getX()); ReflectionUtil.setValue(packet, "b", longDistance);
ReflectionUtil.setValue(packet, "c", (float) location.getY()); ReflectionUtil.setValue(packet, "c", (float) location.getX());
ReflectionUtil.setValue(packet, "d", (float) location.getZ()); ReflectionUtil.setValue(packet, "d", (float) location.getY());
ReflectionUtil.setValue(packet, "e", offsetX); ReflectionUtil.setValue(packet, "e", (float) location.getZ());
ReflectionUtil.setValue(packet, "f", offsetY); ReflectionUtil.setValue(packet, "f", offsetX);
ReflectionUtil.setValue(packet, "g", offsetZ); ReflectionUtil.setValue(packet, "g", offsetY);
ReflectionUtil.setValue(packet, "h", speed); ReflectionUtil.setValue(packet, "h", offsetZ);
ReflectionUtil.setValue(packet, "i", count); ReflectionUtil.setValue(packet, "i", speed);
ReflectionUtil.setValue(packet, "k", unknown); ReflectionUtil.setValue(packet, "j", count);
ReflectionUtil.setValue(packet, "k", data);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); ((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. //Get and set eye location, because npc.getBukkitEntity() is deprecated.
Location eyeLoc = npc.getEntity().getLocation(); Location eyeLoc = npc.getEntity().getLocation();
eyeLoc.setY(eyeLoc.getY() + 1.5); eyeLoc.setY(eyeLoc.getY() + 1.5);
boolean longDistance = false;
if (Quests.effect.equalsIgnoreCase("enchant")) { if (Quests.effect.equalsIgnoreCase("enchant")) {
try { 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -86,7 +87,7 @@ public class NpcEffectThread implements Runnable {
} else if (Quests.effect.equalsIgnoreCase("crit")) { } else if (Quests.effect.equalsIgnoreCase("crit")) {
try { 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -94,7 +95,7 @@ public class NpcEffectThread implements Runnable {
} else if (Quests.effect.equalsIgnoreCase("spell")) { } else if (Quests.effect.equalsIgnoreCase("spell")) {
try { 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -102,7 +103,7 @@ public class NpcEffectThread implements Runnable {
} else if (Quests.effect.equalsIgnoreCase("magiccrit")) { } else if (Quests.effect.equalsIgnoreCase("magiccrit")) {
try { 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -110,7 +111,7 @@ public class NpcEffectThread implements Runnable {
} else if (Quests.effect.equalsIgnoreCase("mobspell")) { } else if (Quests.effect.equalsIgnoreCase("mobspell")) {
try { 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -120,7 +121,7 @@ public class NpcEffectThread implements Runnable {
try { try {
Location old = eyeLoc; Location old = eyeLoc;
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ()); 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -128,7 +129,7 @@ public class NpcEffectThread implements Runnable {
} else if (Quests.effect.equalsIgnoreCase("portal")) { } else if (Quests.effect.equalsIgnoreCase("portal")) {
try { 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -137,7 +138,7 @@ public class NpcEffectThread implements Runnable {
try { try {
Location newLoc = new Location(player.getWorld(), eyeLoc.getX(), eyeLoc.getY() + (float) 0.5, eyeLoc.getZ()); 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -145,7 +146,7 @@ public class NpcEffectThread implements Runnable {
} else if (Quests.effect.equalsIgnoreCase("witch")) { } else if (Quests.effect.equalsIgnoreCase("witch")) {
try { 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -155,7 +156,7 @@ public class NpcEffectThread implements Runnable {
try { try {
Location old = eyeLoc; Location old = eyeLoc;
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ()); 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -165,7 +166,7 @@ public class NpcEffectThread implements Runnable {
try { try {
Location old = eyeLoc; Location old = eyeLoc;
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ()); 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -173,7 +174,7 @@ public class NpcEffectThread implements Runnable {
} else if (Quests.effect.equalsIgnoreCase("smoke")) { } else if (Quests.effect.equalsIgnoreCase("smoke")) {
try { 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }