Fix item disguises trying to fly off, fixes #439
This commit is contained in:
		| @@ -54,8 +54,6 @@ public class PacketHandlerAttributes implements IPacketHandler { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         packets.clear(); | ||||
|  | ||||
|         List<WrappedAttribute> attributes = new ArrayList<>(); | ||||
|         PacketContainer updateAttributes = new PacketContainer(PacketType.Play.Server.UPDATE_ATTRIBUTES); | ||||
|  | ||||
|   | ||||
| @@ -158,8 +158,8 @@ public class PacketHandlerSpawn implements IPacketHandler { | ||||
|             boolean visibleOrNewCompat = playerDisguise.isNameVisible() || DisguiseConfig.isScoreboardDisguiseNames(); | ||||
|  | ||||
|             WrappedGameProfile spawnProfile = visibleOrNewCompat ? playerDisguise.getGameProfile() : ReflectionManager | ||||
|                     .getGameProfileWithThisSkin(UUID.randomUUID(), visibleOrNewCompat ? playerDisguise.getProfileName() : "", | ||||
|                             playerDisguise.getGameProfile()); | ||||
|                     .getGameProfileWithThisSkin(UUID.randomUUID(), | ||||
|                             visibleOrNewCompat ? playerDisguise.getProfileName() : "", playerDisguise.getGameProfile()); | ||||
|  | ||||
|             int entityId = disguisedEntity.getEntityId(); | ||||
|  | ||||
| @@ -378,6 +378,13 @@ public class PacketHandlerSpawn implements IPacketHandler { | ||||
|                 ints.write(1, 0); | ||||
|                 ints.write(2, 0); | ||||
|                 ints.write(3, 0); | ||||
|  | ||||
|                 if (disguise.getType() == DisguiseType.DROPPED_ITEM) { | ||||
|                     PacketContainer velocity = new PacketContainer(PacketType.Play.Server.ENTITY_VELOCITY); | ||||
|                     velocity.getIntegers().write(0, disguisedEntity.getEntityId()); | ||||
|  | ||||
|                     packets.addPacket(velocity); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             spawnEntity.getModifier().write(8, pitch); | ||||
|   | ||||
| @@ -21,9 +21,11 @@ public class PacketHandlerVelocity implements IPacketHandler { | ||||
|     @Override | ||||
|     public void handle(Disguise disguise, PacketContainer sentPacket, LibsPackets packets, Player observer, | ||||
|             Entity entity) { | ||||
|         // If the disguise is a misc and the disguised is not the same type | ||||
|         if (disguise.getType().isMisc() && DisguiseType.getType(entity) != disguise.getType()) { | ||||
|             packets.clear(); | ||||
|         // If the disguise isnt a misc or the disguised is the same type | ||||
|         if (!disguise.getType().isMisc() || DisguiseType.getType(entity) == disguise.getType()) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         packets.clear(); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user