Fix item disguises trying to fly off, fixes #439

This commit is contained in:
libraryaddict 2020-04-04 14:58:37 +13:00
parent 44012ab58b
commit 269a5c3aef
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4
3 changed files with 14 additions and 7 deletions

@ -54,8 +54,6 @@ public class PacketHandlerAttributes implements IPacketHandler {
return; return;
} }
packets.clear();
List<WrappedAttribute> attributes = new ArrayList<>(); List<WrappedAttribute> attributes = new ArrayList<>();
PacketContainer updateAttributes = new PacketContainer(PacketType.Play.Server.UPDATE_ATTRIBUTES); PacketContainer updateAttributes = new PacketContainer(PacketType.Play.Server.UPDATE_ATTRIBUTES);

@ -158,8 +158,8 @@ public class PacketHandlerSpawn implements IPacketHandler {
boolean visibleOrNewCompat = playerDisguise.isNameVisible() || DisguiseConfig.isScoreboardDisguiseNames(); boolean visibleOrNewCompat = playerDisguise.isNameVisible() || DisguiseConfig.isScoreboardDisguiseNames();
WrappedGameProfile spawnProfile = visibleOrNewCompat ? playerDisguise.getGameProfile() : ReflectionManager WrappedGameProfile spawnProfile = visibleOrNewCompat ? playerDisguise.getGameProfile() : ReflectionManager
.getGameProfileWithThisSkin(UUID.randomUUID(), visibleOrNewCompat ? playerDisguise.getProfileName() : "", .getGameProfileWithThisSkin(UUID.randomUUID(),
playerDisguise.getGameProfile()); visibleOrNewCompat ? playerDisguise.getProfileName() : "", playerDisguise.getGameProfile());
int entityId = disguisedEntity.getEntityId(); int entityId = disguisedEntity.getEntityId();
@ -378,6 +378,13 @@ public class PacketHandlerSpawn implements IPacketHandler {
ints.write(1, 0); ints.write(1, 0);
ints.write(2, 0); ints.write(2, 0);
ints.write(3, 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); spawnEntity.getModifier().write(8, pitch);

@ -21,9 +21,11 @@ public class PacketHandlerVelocity implements IPacketHandler {
@Override @Override
public void handle(Disguise disguise, PacketContainer sentPacket, LibsPackets packets, Player observer, public void handle(Disguise disguise, PacketContainer sentPacket, LibsPackets packets, Player observer,
Entity entity) { Entity entity) {
// If the disguise is a misc and the disguised is not the same type // If the disguise isnt a misc or the disguised is the same type
if (disguise.getType().isMisc() && DisguiseType.getType(entity) != disguise.getType()) { if (!disguise.getType().isMisc() || DisguiseType.getType(entity) == disguise.getType()) {
packets.clear(); return;
} }
packets.clear();
} }
} }