//Get the stack in each slot
ItemStack stackInSlot = temporaryInventory.getStackInSlot(n);
//Check to see if its a part
if(stackInSlot != null && stackInSlot.getItem() instanceof ItemPart)
{
PartType partType = ((ItemPart)stackInSlot.getItem()).type;
//Check its an engine that we can use
if(partType.category == 2 && partType.worksWith.contains(EnumType.getFromObject(selectedType)))
{
//If we already have engines of this type, add these ones to the stack
if(engines.containsKey(partType))