use of riskyken.armourersWorkshop.common.skin.data.SkinIdentifier 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