import crafttweaker.api.item.IItemStack;
import crafttweaker.api.data.MapData;

craftingTable.addShaped("essence_block", <item:kubejs:essence_block>, [[<item:minecraft:air>, <tag:items:mysticalagriculture:essences>, <tag:items:mysticalagriculture:essences>],[<item:minecraft:air>, <tag:items:mysticalagriculture:essences>,<tag:items:mysticalagriculture:essences>]], (usualOut as IItemStack, inputs as IItemStack[][]) => {
    
    if ((inputs[0][1].displayName == inputs[0][2].displayName) && (inputs[0][2].displayName == inputs[1][1].displayName) && (inputs[1][1].displayName == inputs[1][2].displayName)){
        
        return usualOut.setDisplayName(inputs[0][1].displayName + " Block");
    }

   
    return usualOut.setDisplayName("INVALID");
});


craftingTable.addShapeless("experience_block", <item:kubejs:experience_block>*6, [<item:mysticalagriculture:experience_capsule>.withTag({Experience:1200})]);




/*craftingTable.addShapeless("experience_block", <item:kubejs:experience_block>, [<item:mysticalagriculture:experience_capsule>.transformCustom("left_over_exp", (stack as IItemStack) => {

    var xp = (stack.tag as MapData).Experience.asNumber() as int;
    var xpLeft = xp % 200;    

    return stack.withTag({Experience: xpLeft});

})], (usualOut as IItemStack, inputs as IItemStack[]) => {
 
    var xp = (inputs[0].tag as MapData).Experience.asNumber() as int;
    var blocksNum = xp / 200;   
 
    //inputs[0].reuse().withTag({Experience: xpLeft as int}));
 
    return usualOut*blocksNum;
});*/