use of riskyken.armourersWorkshop.api.common.skin.type.ISkinType in project Armourers-Workshop by RiskyKen.
the class WardrobeInventoryContainer method readFromNBT.
public void readFromNBT(NBTTagCompound compound) {
if (compound.hasKey(TAG_WARDROBE_CONTAINER, 10)) {
NBTTagCompound containerCompound = compound.getCompoundTag(TAG_WARDROBE_CONTAINER);
Set skinTypes = skinInventorys.keySet();
for (int i = 0; i < skinInventorys.size(); i++) {
ISkinType skinType = (ISkinType) skinInventorys.keySet().toArray()[i];
skinInventorys.get(skinType).readItemsFromNBT(containerCompound);
}
} else {
if (compound.hasKey(TAG_LEGACY_ITEMS)) {
ItemStack[] legacyItems = new ItemStack[7];
NBTHelper.readStackArrayFromNBT(compound, TAG_LEGACY_ITEMS, legacyItems);
getInventoryForSkinType(SkinTypeRegistry.skinHead).setInventorySlotContents(0, legacyItems[0]);
getInventoryForSkinType(SkinTypeRegistry.skinChest).setInventorySlotContents(0, legacyItems[1]);
getInventoryForSkinType(SkinTypeRegistry.skinLegs).setInventorySlotContents(0, legacyItems[2]);
getInventoryForSkinType(SkinTypeRegistry.skinFeet).setInventorySlotContents(0, legacyItems[3]);
getInventoryForSkinType(SkinTypeRegistry.skinSword).setInventorySlotContents(0, legacyItems[4]);
getInventoryForSkinType(SkinTypeRegistry.skinBow).setInventorySlotContents(0, legacyItems[5]);
getInventoryForSkinType(SkinTypeRegistry.skinArrow).setInventorySlotContents(0, legacyItems[6]);
}
}
}
use of riskyken.armourersWorkshop.api.common.skin.type.ISkinType in project Armourers-Workshop by RiskyKen.
the class RecipeSkinArmourContainer method isValidArmourForSkin.
private boolean isValidArmourForSkin(ItemStack armourStack, ItemStack skinStack) {
SkinPointer sp = SkinNBTHelper.getSkinPointerFromStack(skinStack);
ISkinType skinType = sp.getIdentifier().getSkinType();
Item armourItem = armourStack.getItem();
if (armourItem.isValidArmor(armourStack, skinType.getVanillaArmourSlotId(), null)) {
return true;
}
return false;
}
use of riskyken.armourersWorkshop.api.common.skin.type.ISkinType in project Armourers-Workshop by RiskyKen.
the class RecipeSkinUpdate method getCraftingResult.
@Override
public ItemStack getCraftingResult(InventoryCrafting invCrafting) {
ItemStack oldSkinStack = null;
for (int slotId = 0; slotId < invCrafting.getSizeInventory(); slotId++) {
ItemStack stack = invCrafting.getStackInSlot(slotId);
if (stack != null) {
Item item = stack.getItem();
if (SkinNBTHelper.stackHasLegacySkinData(stack)) {
if (oldSkinStack != null) {
return null;
}
oldSkinStack = stack;
} else {
return null;
}
}
}
if (oldSkinStack != null) {
int skinId = SkinNBTHelper.getLegacyIdFromStack(oldSkinStack);
ISkinType skinType = SkinTypeRegistry.INSTANCE.getSkinTypeFromLegacyId(oldSkinStack.getItemDamage());
SkinPointer skinPointer = new SkinPointer(new SkinIdentifier(skinId, null, 0, skinType), false);
if (oldSkinStack.getItem() instanceof AbstractModItemArmour) {
return SkinNBTHelper.makeArmouerContainerStack(skinPointer);
} else {
return SkinNBTHelper.makeEquipmentSkinStack(skinPointer);
}
} else {
return null;
}
}
Aggregations