use of net.mcft.copy.betterstorage.api.stand.ArmorStandEquipHandler in project BetterStorage by copygirl.
the class TileEntityArmorStand method read.
public void read(NBTTagCompound compound) {
rotation = compound.getByte("rotation");
clearItems();
NBTBase itemsTag = compound.getTag("Items");
if (itemsTag instanceof NBTTagList) {
// Backward compatibility.
NBTTagList items = (NBTTagList) itemsTag;
for (int i = 0; i < items.tagCount(); i++) {
NBTTagCompound item = items.getCompoundTagAt(i);
int slot = item.getByte("Slot") & 255;
if ((slot < 0) || (slot >= EnumArmorStandRegion.values().length))
continue;
EnumArmorStandRegion region = EnumArmorStandRegion.values()[slot];
ArmorStandEquipHandler handler = BetterStorageArmorStand.getEquipHandler(region, VanillaArmorStandEquipHandler.ID);
if (handler != null)
setItem(handler, ItemStack.loadItemStackFromNBT(item));
}
} else {
NBTTagCompound items = (NBTTagCompound) itemsTag;
for (EnumArmorStandRegion region : EnumArmorStandRegion.values()) {
NBTTagCompound regionItems = items.getCompoundTag(region.toString());
for (String id : (Set<String>) regionItems.func_150296_c()) {
ItemStack item = ItemStack.loadItemStackFromNBT(regionItems.getCompoundTag(id));
ArmorStandEquipHandler handler = BetterStorageArmorStand.getEquipHandler(region, id);
setItem(handler, item);
}
}
}
}
Aggregations