use of riskyken.armourersWorkshop.api.common.skin.data.ISkinDye in project Armourers-Workshop by RiskyKen.
the class ContainerDyeTable method putDyesInSlots.
/**
* Reads the output slot and adds dye bottles to their slots.
*/
private void putDyesInSlots() {
if (tileEntity.getWorldObj().isRemote) {
return;
}
ItemStack outStack = getSlot(45).getStack();
SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(outStack);
ISkinDye dye = skinPointer.getSkinDye();
for (int i = 0; i < 8; i++) {
if (dye.haveDyeInSlot(i)) {
byte[] rgbt = dye.getDyeColour(i);
ItemStack bottle = new ItemStack(ModItems.dyeBottle, 1, 1);
PaintingHelper.setToolPaintColour(bottle, rgbt);
PaintingHelper.setToolPaint(bottle, PaintType.getPaintTypeFormSKey(rgbt[3]));
if (dye.hasName(i)) {
bottle.setStackDisplayName(dye.getDyeName(i));
}
putStackInSlot(37 + i, bottle);
} else {
putStackInSlot(37 + i, null);
}
}
}
use of riskyken.armourersWorkshop.api.common.skin.data.ISkinDye in project Armourers-Workshop by RiskyKen.
the class ContainerDyeTable method updateLockedSlots.
/**
* Reads the input slot and locks dye slots that are in use.
* @param stack
*/
private void updateLockedSlots(ItemStack stack) {
SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(stack);
ISkinDye dye = skinPointer.getSkinDye();
for (int i = 0; i < 8; i++) {
if (dye.haveDyeInSlot(i)) {
((SlotDyeBottle) getSlot(37 + i)).setLocked(true);
} else {
((SlotDyeBottle) getSlot(37 + i)).setLocked(false);
}
}
}
use of riskyken.armourersWorkshop.api.common.skin.data.ISkinDye 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;
}
Aggregations