use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class RecipeSkinBow method getCraftingResult.
@Override
public ItemStack getCraftingResult(IInventory inventory) {
ItemStack skinStack = null;
ItemStack bowStack = null;
for (int slotId = 0; slotId < inventory.getSizeInventory(); slotId++) {
ItemStack stack = inventory.getStackInSlot(slotId);
if (stack != null) {
Item item = stack.getItem();
if (isValidSkinForType(stack)) {
if (skinStack != null) {
return null;
}
skinStack = stack;
} else if (EntityEquipmentDataManager.INSTANCE.isRenderItem(ItemOverrideType.BOW, item) & !SkinNBTHelper.isSkinLockedOnStack(stack)) {
if (bowStack != null) {
return null;
}
bowStack = stack;
} else {
return null;
}
}
}
if (skinStack != null && bowStack != null) {
ItemStack returnStack = bowStack.copy();
SkinPointer skinData = SkinNBTHelper.getSkinPointerFromStack(skinStack);
SkinNBTHelper.addSkinDataToStack(returnStack, skinData.getIdentifier(), skinData.getSkinDye(), true);
return returnStack;
} else {
return null;
}
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class RecipeSkinDye method getCraftingResult.
@Override
public ItemStack getCraftingResult(InventoryCrafting invCrafting) {
ItemStack skinStack = null;
ItemStack dyeStack = null;
for (int slotId = 0; slotId < invCrafting.getSizeInventory(); slotId++) {
ItemStack stack = invCrafting.getStackInSlot(slotId);
if (stack != null) {
Item item = stack.getItem();
if (item == ModItems.dyeBottle) {
if (dyeStack != null) {
return null;
}
if (PaintingHelper.getToolHasPaint(stack)) {
dyeStack = stack;
} else {
return null;
}
} else if (item == ModItems.equipmentSkin) {
if (skinStack != null) {
return null;
}
SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(stack);
if (skinPointer != null) {
if (skinPointer.getSkinDye().getNumberOfDyes() < SkinDye.MAX_SKIN_DYES) {
skinStack = stack;
} else {
return null;
}
} else {
return null;
}
}
}
}
if (skinStack != null && dyeStack != null) {
ItemStack returnStack = skinStack.copy();
byte[] rgbt = PaintingHelper.getToolPaintData(dyeStack);
SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(returnStack);
ISkinDye dye = skinPointer.getSkinDye();
dye.addDye(rgbt);
SkinNBTHelper.addSkinDataToStack(returnStack, skinPointer);
return returnStack;
}
return null;
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer 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;
}
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class RecipeSkinArmour method getCraftingResult.
@Override
public ItemStack getCraftingResult(IInventory inventory) {
ItemStack skinStack = null;
ItemStack armourStack = null;
for (int slotId = 0; slotId < inventory.getSizeInventory(); slotId++) {
ItemStack stack = inventory.getStackInSlot(slotId);
if (stack != null) {
Item item = stack.getItem();
if (isValidSkinForType(stack)) {
if (skinStack != null) {
return null;
}
skinStack = stack;
} else if (isValidArmour(stack) & !SkinNBTHelper.isSkinLockedOnStack(stack)) {
if (armourStack != null) {
return null;
}
armourStack = stack;
} else {
return null;
}
}
}
if (skinStack != null && armourStack != null) {
if (!isValidArmourForSkin(armourStack, skinStack)) {
return null;
}
ItemStack returnStack = armourStack.copy();
SkinPointer skinData = SkinNBTHelper.getSkinPointerFromStack(skinStack);
SkinNBTHelper.addSkinDataToStack(returnStack, skinData.getIdentifier(), skinData.getSkinDye(), true);
return returnStack;
} else {
return null;
}
}
Aggregations