Forgot to add a hook here..

This commit is contained in:
libraryaddict 2014-05-23 10:33:50 +12:00
parent d4ac36b1ef
commit a70932da4d

View File

@ -99,27 +99,29 @@ public class PacketsManager {
ArrayList<PacketContainer> packets = new ArrayList<PacketContainer>(); ArrayList<PacketContainer> packets = new ArrayList<PacketContainer>();
// This sends the armor packets so that the player isn't naked. // This sends the armor packets so that the player isn't naked.
// Please note it only sends the packets that wouldn't be sent normally // Please note it only sends the packets that wouldn't be sent normally
for (int nmsSlot = 0; nmsSlot < 5; nmsSlot++) { if (DisguiseConfig.isEnquipmentPacketsEnabled()) {
int armorSlot = nmsSlot - 1; for (int nmsSlot = 0; nmsSlot < 5; nmsSlot++) {
if (armorSlot < 0) int armorSlot = nmsSlot - 1;
armorSlot = 4; if (armorSlot < 0)
ItemStack itemstack = disguise.getWatcher().getItemStack(armorSlot); armorSlot = 4;
if (itemstack != null && itemstack.getTypeId() != 0) { ItemStack itemstack = disguise.getWatcher().getItemStack(armorSlot);
ItemStack item = null; if (itemstack != null && itemstack.getTypeId() != 0) {
if (disguisedEntity instanceof LivingEntity) { ItemStack item = null;
if (nmsSlot == 0) { if (disguisedEntity instanceof LivingEntity) {
item = ((LivingEntity) disguisedEntity).getEquipment().getItemInHand(); if (nmsSlot == 0) {
} else { item = ((LivingEntity) disguisedEntity).getEquipment().getItemInHand();
item = ((LivingEntity) disguisedEntity).getEquipment().getArmorContents()[armorSlot]; } else {
item = ((LivingEntity) disguisedEntity).getEquipment().getArmorContents()[armorSlot];
}
}
if (item == null || item.getType() == Material.AIR) {
PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_EQUIPMENT);
StructureModifier<Object> mods = packet.getModifier();
mods.write(0, disguisedEntity.getEntityId());
mods.write(1, nmsSlot);
mods.write(2, ReflectionManager.getNmsItem(itemstack));
packets.add(packet);
} }
}
if (item == null || item.getType() == Material.AIR) {
PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_EQUIPMENT);
StructureModifier<Object> mods = packet.getModifier();
mods.write(0, disguisedEntity.getEntityId());
mods.write(1, nmsSlot);
mods.write(2, ReflectionManager.getNmsItem(itemstack));
packets.add(packet);
} }
} }
} }