Created
October 1, 2014 06:22
-
-
Save TigerHix/2cd7a3dc3cb8f4056690 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public Object getTeleportPacket(Location loc) { | |
Class<?> PacketPlayOutEntityTeleport = Util.getCraftClass("PacketPlayOutEntityTeleport"); | |
Object packet = null; | |
try { | |
packet = PacketPlayOutEntityTeleport.getConstructor(new Class<?>[] { | |
int.class, int.class, int.class, int.class, byte.class, byte.class, boolean.class}) | |
.newInstance(this.id, | |
loc.getBlockX() * 32, | |
loc.getBlockY() * 32, | |
loc.getBlockZ() * 32, | |
(byte) ((int) loc.getYaw() * 256 / 360), | |
(byte) ((int) loc.getPitch() * 256 / 360), | |
false); | |
} catch (Exception e) { | |
// Spigot 1653 patch start | |
try { | |
packet = PacketPlayOutEntityTeleport.getConstructor(new Class<?>[] { | |
int.class, int.class, int.class, int.class, byte.class, byte.class, boolean.class, boolean.class}) | |
.newInstance(this.id, | |
loc.getBlockX() * 32, | |
loc.getBlockY() * 32, | |
loc.getBlockZ() * 32, | |
(byte) ((int) loc.getYaw() * 256 / 360), | |
(byte) ((int) loc.getPitch() * 256 / 360), | |
false, | |
true); | |
} catch (Exception e2) { | |
e2.printStackTrace(); | |
} | |
// Spigot 1653 patch end | |
} | |
return packet; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment