Fix equip packets, again
This commit is contained in:
@@ -404,16 +404,24 @@ public class PacketHandlerSpawn implements IPacketHandler {
|
||||
boolean delayedArmor =
|
||||
DisguiseConfig.isPlayerHideArmor() && (disguise.isPlayerDisguise() && disguisedEntity != observer) &&
|
||||
disguisedEntity instanceof LivingEntity;
|
||||
|
||||
if (delayedArmor) {
|
||||
packets.setSendArmor(true);
|
||||
packets.setRemoveMetaAt(7);
|
||||
}
|
||||
// This sends the armor packets so that the player isn't naked.
|
||||
if (DisguiseConfig.isEquipmentPacketsEnabled() || delayedArmor) {
|
||||
for (EquipmentSlot slot : EquipmentSlot.values()) {
|
||||
// Get what the disguise wants to show for its armor
|
||||
ItemStack itemToSend = disguise.getWatcher().getItemStack(slot);
|
||||
ItemStack itemToSend;
|
||||
|
||||
// If the disguise armor isn't visible
|
||||
if (itemToSend == null || itemToSend.getType() == Material.AIR) {
|
||||
// If we need to send the natural armor if possible
|
||||
if (delayedArmor) {
|
||||
if (delayedArmor) {
|
||||
itemToSend = new ItemStack(Material.AIR);
|
||||
} else {
|
||||
itemToSend = disguise.getWatcher().getItemStack(slot);
|
||||
|
||||
// If the disguise armor isn't visible
|
||||
if (itemToSend == null || itemToSend.getType() != Material.AIR) {
|
||||
itemToSend = ReflectionManager.getEquipment(slot, disguisedEntity);
|
||||
|
||||
// If natural armor isn't sent either
|
||||
@@ -421,14 +429,7 @@ public class PacketHandlerSpawn implements IPacketHandler {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
// We don't need to send natural armor and disguise armor isn't visible
|
||||
continue;
|
||||
}
|
||||
} else if (!delayedArmor && disguisedEntity instanceof LivingEntity) {
|
||||
ItemStack item = ReflectionManager.getEquipment(slot, disguisedEntity);
|
||||
|
||||
// If the item was going to be sent anyways
|
||||
if (item != null && item.getType() != Material.AIR) {
|
||||
// Its air which shouldn't be sent
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -441,12 +442,7 @@ public class PacketHandlerSpawn implements IPacketHandler {
|
||||
mods.write(1, ReflectionManager.createEnumItemSlot(slot));
|
||||
mods.write(2, ReflectionManager.getNmsItem(itemToSend));
|
||||
|
||||
if (delayedArmor) {
|
||||
packets.addDelayedPacket(packet, 7);
|
||||
packets.setRemoveMetaAt(7);
|
||||
} else {
|
||||
packets.addDelayedPacket(packet);
|
||||
}
|
||||
packets.addDelayedPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user