Why write the fake entity id if we don't use false in the send packet?

This commit is contained in:
libraryaddict 2014-01-21 05:34:07 +13:00
parent 62c2050587
commit ff6567ba23

View File

@ -1,6 +1,5 @@
package me.libraryaddict.disguise.disguisetypes; package me.libraryaddict.disguise.disguisetypes;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -183,7 +182,7 @@ public abstract class Disguise {
public void run() { public void run() {
// If entity is no longer valid. Remove it. // If entity is no longer valid. Remove it.
if (!getEntity().isValid()) { if (!getEntity().isValid()) {
removeDisguise(); DisguiseAPI.undisguiseToAll(getEntity());
} else { } else {
// If the disguise type is tnt, we need to resend the entity packet else it will turn invisible // If the disguise type is tnt, we need to resend the entity packet else it will turn invisible
if (getType() == DisguiseType.PRIMED_TNT || getType() == DisguiseType.FIREWORK) { if (getType() == DisguiseType.PRIMED_TNT || getType() == DisguiseType.FIREWORK) {
@ -202,7 +201,8 @@ public abstract class Disguise {
// If this disguise has velocity sending enabled and the entity is flying. // If this disguise has velocity sending enabled and the entity is flying.
if (vectorY != 0 && isVelocitySent() && (alwaysSendVelocity || !getEntity().isOnGround())) { if (vectorY != 0 && isVelocitySent() && (alwaysSendVelocity || !getEntity().isOnGround())) {
Vector vector = getEntity().getVelocity(); Vector vector = getEntity().getVelocity();
// If the entity doesn't have velocity changes already - You know. I really can't wrap my head about the if statement. // If the entity doesn't have velocity changes already - You know. I really can't wrap my head about the
// if statement.
// But it doesn't seem to do anything wrong.. // But it doesn't seem to do anything wrong..
if (vector.getY() != 0 && !(vector.getY() < 0 && alwaysSendVelocity && getEntity().isOnGround())) { if (vector.getY() != 0 && !(vector.getY() < 0 && alwaysSendVelocity && getEntity().isOnGround())) {
return; return;
@ -248,17 +248,16 @@ public abstract class Disguise {
} }
mods.write(2, (int) (8000D * (vectorY * ReflectionManager.getPing(player)) * 0.069D)); mods.write(2, (int) (8000D * (vectorY * ReflectionManager.getPing(player)) * 0.069D));
if (lookPacket != null) { if (lookPacket != null) {
ProtocolLibrary.getProtocolManager().sendServerPacket(player, lookPacket); ProtocolLibrary.getProtocolManager().sendServerPacket(player, lookPacket, false);
} }
ProtocolLibrary.getProtocolManager().sendServerPacket(player, velocityPacket); ProtocolLibrary.getProtocolManager().sendServerPacket(player, velocityPacket.shallowClone(),
velocityPacket = velocityPacket.shallowClone(); false);
mods = velocityPacket.getIntegers();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
// If we need to send a packet to update the exp orbs position as it likes to gravitate client sided to // If we need to send a packet to update the exp position as it likes to gravitate client sided to
// players. // players.
if (getType() == DisguiseType.EXPERIENCE_ORB) { if (getType() == DisguiseType.EXPERIENCE_ORB) {
PacketContainer packet = new PacketContainer(PacketType.Play.Server.REL_ENTITY_MOVE); PacketContainer packet = new PacketContainer(PacketType.Play.Server.REL_ENTITY_MOVE);