Update to MC 1.10, completely untested. Added missing particle effects

back to MC 1.9. Bump version number
This commit is contained in:
HappyPikachu 2016-06-09 14:04:21 -04:00
parent f2b8c60fb0
commit 6f34c15a71
5 changed files with 227 additions and 3 deletions

View File

@ -3,7 +3,7 @@
<groupId>me.blackvein.quests</groupId>
<artifactId>quests</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>
<name>quests</name>
<url>https://github.com/FlyingPikachu/Quests/</url>
<packaging>jar</packaging>
@ -63,6 +63,13 @@
<version>1.9.4-R0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/craftbukkit-1.9.4.jar</systemPath>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>spigot110</artifactId>
<version>1.10-R0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/craftbukkit-1.10.jar</systemPath>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>

View File

@ -0,0 +1,84 @@
package me.blackvein.particles;
import me.blackvein.quests.util.ReflectionUtil;
import net.minecraft.server.v1_10_R1.EnumParticle;
import net.minecraft.server.v1_10_R1.PacketPlayOutWorldParticles;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
public enum Eff_1_10_R1 {
EXPLOSION(EnumParticle.EXPLOSION_NORMAL),
EXPLOSION_LARGE(EnumParticle.EXPLOSION_LARGE),
EXPLOSION_HUGE(EnumParticle.EXPLOSION_HUGE),
FIREWORKS_SPARK(EnumParticle.FIREWORKS_SPARK),
BUBBLE(EnumParticle.WATER_BUBBLE),
WAKE(EnumParticle.WATER_WAKE),
SPLASH(EnumParticle.WATER_SPLASH),
SUSPENDED(EnumParticle.SUSPENDED),
DEPTH_SUSPEND(EnumParticle.SUSPENDED_DEPTH),
CRIT(EnumParticle.CRIT),
MAGIC_CRIT(EnumParticle.CRIT_MAGIC),
SMOKE(EnumParticle.SMOKE_NORMAL),
LARGE_SMOKE(EnumParticle.SMOKE_LARGE),
SPELL(EnumParticle.SPELL),
INSTANT_SPELL(EnumParticle.SPELL_INSTANT),
MOB_SPELL(EnumParticle.SPELL_MOB),
MOB_SPELL_AMBIENT(EnumParticle.SPELL_MOB_AMBIENT),
WITCH_MAGIC(EnumParticle.SPELL_WITCH),
DRIP_WATER(EnumParticle.DRIP_WATER),
DRIP_LAVA(EnumParticle.DRIP_LAVA),
ANGRY_VILLAGER(EnumParticle.VILLAGER_ANGRY),
HAPPY_VILLAGER(EnumParticle.VILLAGER_HAPPY),
TOWN_AURA(EnumParticle.TOWN_AURA),
NOTE(EnumParticle.NOTE),
PORTAL(EnumParticle.PORTAL),
ENCHANTMENT_TABLE(EnumParticle.ENCHANTMENT_TABLE),
FLAME(EnumParticle.FLAME),
LAVA(EnumParticle.LAVA),
FOOTSTEP(EnumParticle.FOOTSTEP),
CLOUD(EnumParticle.CLOUD),
RED_DUST(EnumParticle.REDSTONE),
SNOWBALL_POOF(EnumParticle.SNOWBALL),
SNOW_SHOVEL(EnumParticle.SNOW_SHOVEL),
SLIME(EnumParticle.SLIME),
HEART(EnumParticle.HEART),
BARRIER(EnumParticle.BARRIER),
ICONCRACK_(EnumParticle.ITEM_CRACK),
BLOCKCRACK_(EnumParticle.BLOCK_CRACK),
BLOCKDUST_(EnumParticle.BLOCK_DUST),
DROPLET(EnumParticle.WATER_DROP),
TAKE(EnumParticle.ITEM_TAKE),
MOB_APPEARANCE(EnumParticle.MOB_APPEARANCE),
SWEEPING_DUST(EnumParticle.SWEEP_ATTACK),
DRAGON_BREATH(EnumParticle.DRAGON_BREATH),
ENDROD(EnumParticle.END_ROD),
DAMAGE_INDICATOR(EnumParticle.DAMAGE_INDICATOR),
FALLING_DUST(EnumParticle.FALLING_DUST);
private final EnumParticle particleEnum;
Eff_1_10_R1(EnumParticle particleEnum) {
this.particleEnum = particleEnum;
}
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count, int[] data) throws Exception {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles();
ReflectionUtil.setValue(packet, "a", particleEnum);
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", data);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
}

View File

@ -51,7 +51,11 @@ public enum Eff_1_9_R1 {
BLOCKDUST_(EnumParticle.BLOCK_DUST),
DROPLET(EnumParticle.WATER_DROP),
TAKE(EnumParticle.ITEM_TAKE),
MOB_APPEARANCE(EnumParticle.MOB_APPEARANCE);
MOB_APPEARANCE(EnumParticle.MOB_APPEARANCE),
SWEEPING_DUST(EnumParticle.SWEEP_ATTACK),
DRAGON_BREATH(EnumParticle.DRAGON_BREATH),
ENDROD(EnumParticle.END_ROD),
DAMAGE_INDICATOR(EnumParticle.DAMAGE_INDICATOR),;
private final EnumParticle particleEnum;

View File

@ -51,7 +51,11 @@ public enum Eff_1_9_R2 {
BLOCKDUST_(EnumParticle.BLOCK_DUST),
DROPLET(EnumParticle.WATER_DROP),
TAKE(EnumParticle.ITEM_TAKE),
MOB_APPEARANCE(EnumParticle.MOB_APPEARANCE);
MOB_APPEARANCE(EnumParticle.MOB_APPEARANCE),
SWEEPING_DUST(EnumParticle.SWEEP_ATTACK),
DRAGON_BREATH(EnumParticle.DRAGON_BREATH),
ENDROD(EnumParticle.END_ROD),
DAMAGE_INDICATOR(EnumParticle.DAMAGE_INDICATOR),;
private final EnumParticle particleEnum;

View File

@ -10,6 +10,7 @@ import me.blackvein.particles.Eff_1_8_R2;
import me.blackvein.particles.Eff_1_8_R3;
import me.blackvein.particles.Eff_1_9_R1;
import me.blackvein.particles.Eff_1_9_R2;
import me.blackvein.particles.Eff_1_10_R1;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.Bukkit;
@ -79,8 +80,132 @@ public class NpcEffectThread implements Runnable {
showEffect_1_9_R2(player, npc);
} else if (Bukkit.getBukkitVersion().contains("1.9")) {
showEffect_1_9_R1(player, npc);
} else if (Bukkit.getBukkitVersion().contains("1.10")) {
showEffect_1_10_R1(player, npc);
}
}
private static void showEffect_1_10_R1(Player player, NPC npc) {
//Get and set eye location, because npc.getBukkitEntity() is deprecated.
Location eyeLoc = npc.getEntity().getLocation();
eyeLoc.setY(eyeLoc.getY() + 1.5);
if (Quests.effect.equalsIgnoreCase("enchant")) {
try {
Eff_1_10_R1.ENCHANTMENT_TABLE.sendToPlayer(player, eyeLoc, 0, 1, 0, 1, 10, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (Quests.effect.equalsIgnoreCase("crit")) {
try {
Eff_1_10_R1.CRIT.sendToPlayer(player, eyeLoc, 0, 0, 0, (float) 0.35, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (Quests.effect.equalsIgnoreCase("spell")) {
try {
Eff_1_10_R1.INSTANT_SPELL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (Quests.effect.equalsIgnoreCase("magiccrit")) {
try {
Eff_1_10_R1.MAGIC_CRIT.sendToPlayer(player, eyeLoc, 0, 0, 0, (float) 0.35, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (Quests.effect.equalsIgnoreCase("mobspell")) {
try {
Eff_1_10_R1.MOB_SPELL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (Quests.effect.equalsIgnoreCase("note")) {
try {
Location old = eyeLoc;
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
Eff_1_10_R1.NOTE.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (Quests.effect.equalsIgnoreCase("portal")) {
try {
Eff_1_10_R1.PORTAL.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 5, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (Quests.effect.equalsIgnoreCase("dust")) {
try {
Location newLoc = new Location(player.getWorld(), eyeLoc.getX(), eyeLoc.getY() + (float) 0.5, eyeLoc.getZ());
Eff_1_10_R1.RED_DUST.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (Quests.effect.equalsIgnoreCase("witch")) {
try {
Eff_1_10_R1.WITCH_MAGIC.sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (Quests.effect.equalsIgnoreCase("snowball")) {
try {
Location old = eyeLoc;
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
Eff_1_10_R1.SNOWBALL_POOF.sendToPlayer(player, newLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (Quests.effect.equalsIgnoreCase("splash")) {
try {
Location old = eyeLoc;
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
Eff_1_10_R1.SPLASH.sendToPlayer(player, newLoc, 0, 0, 0, 1, 4, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (Quests.effect.equalsIgnoreCase("smoke")) {
try {
Eff_1_10_R1.TOWN_AURA.sendToPlayer(player, eyeLoc, 0, 1, 0, 1, 20, null);
} catch (Exception e) {
e.printStackTrace();
}
} else {
try {
Eff_1_10_R1.valueOf(Quests.effect).sendToPlayer(player, eyeLoc, 0, 0, 0, 1, 3, null);
} catch (Exception e) {
Quests.getInstance().getLogger().info(Quests.effect + " is not a valid effect name!");
e.printStackTrace();
}
}
}
private static void showEffect_1_9_R2(Player player, NPC npc) {
//Get and set eye location, because npc.getBukkitEntity() is deprecated.