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

View File

@ -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);

View File

@ -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);

View File

@ -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();
}
}