var laserPattern = < refinedstorage: pattern > .withTag({
	Input_2: {
		id: "minecraft:glass",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_4: {
		id: "minecraft:glass",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_3: {
		id: "minecraft:glass",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Version: "1.6.14",
	Input_0: {
		id: "minecraft:glass",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Oredict: 0 as byte,
	Input_6: {
		id: "minecraft:glass",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_5: {
		id: "minecraft:glass",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_8: {
		id: "minecraft:glass",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Processing: 0 as byte
});

var aaMinerV1 = < refinedstorage: pattern > .withTag({
	Input_2: {
		id: "enderio:item_alloy_ingot",
		Count: 1 as byte,
		Damage: 9 as short
	},
	Input_1: {
		id: "minecraft:gold_ingot",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_4: {
		id: "actuallyadditions:item_misc",
		Count: 1 as byte,
		Damage: 18 as short
	},
	Input_3: {
		id: "minecraft:coal",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Version: "1.6.14",
	Input_0: {
		id: "minecraft:diamond",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Oredict: 1 as byte,
	Input_6: {
		id: "minecraft:quartz",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_5: {
		id: "actuallyadditions:item_misc",
		Count: 1 as byte,
		Damage: 5 as short
	},
	Input_8: {
		id: "minecraft:emerald",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Processing: 0 as byte,
	Input_7: {
		id: "minecraft:dye",
		Count: 1 as byte,
		Damage: 4 as short
	}
});

var aaMinerV2 = < refinedstorage: pattern > .withTag({
	Input_2: {
		id: "minecraft:iron_ingot",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_1: {
		id: "minecraft:gold_ingot",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_4: {
		id: "actuallyadditions:item_misc",
		Count: 1 as byte,
		Damage: 18 as short
	},
	Input_3: {
		id: "minecraft:coal",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Version: "1.6.14",
	Input_0: {
		id: "minecraft:diamond",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Oredict: 0 as byte,
	Input_6: {
		id: "minecraft:quartz",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_5: {
		id: "actuallyadditions:item_misc",
		Count: 1 as byte,
		Damage: 5 as short
	},
	Input_8: {
		id: "minecraft:emerald",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Processing: 0 as byte,
	Input_7: {
		id: "minecraft:dye",
		Count: 1 as byte,
		Damage: 4 as short
	}
});

var ifLaserBaseV1 = < refinedstorage: pattern > .withTag({
	Input_2: {
		id: "industrialforegoing:plastic",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_1: {
		id: "minecraft:glowstone",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_4: {
		id: "minecraft:glowstone",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_3: {
		id: "thermalfoundation:material",
		Count: 1 as byte,
		Damage: 25 as short
	},
	Version: "1.6.14",
	Input_0: {
		id: "industrialforegoing:plastic",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Oredict: 0 as byte,
	Input_6: {
		id: "thermalfoundation:material",
		Count: 1 as byte,
		Damage: 26 as short
	},
	Input_5: {
		id: "thermalfoundation:material",
		Count: 1 as byte,
		Damage: 25 as short
	},
	Input_8: {
		id: "thermalfoundation:material",
		Count: 1 as byte,
		Damage: 26 as short
	},
	Processing: 0 as byte,
	Input_7: {
		id: "teslacorelib:machine_case",
		Count: 1 as byte,
		Damage: 0 as short
	}
});

var ifLaserBaseV2 = < refinedstorage: pattern > .withTag({
	Input_2: {
		id: "industrialforegoing:plastic",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_1: {
		id: "minecraft:glowstone",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_4: {
		id: "minecraft:glowstone",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_3: {
		id: "thermalfoundation:material",
		Count: 1 as byte,
		Damage: 25 as short
	},
	Version: "1.6.14",
	Input_0: {
		id: "industrialforegoing:plastic",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Oredict: 0 as byte,
	Input_6: {
		id: "thermalfoundation:material",
		Count: 1 as byte,
		Damage: 26 as short
	},
	Input_5: {
		id: "thermalfoundation:material",
		Count: 1 as byte,
		Damage: 25 as short
	},
	Input_8: {
		id: "thermalfoundation:material",
		Count: 1 as byte,
		Damage: 26 as short
	},
	Processing: 0 as byte,
	Input_7: {
		id: "thermalexpansion:frame",
		Count: 1 as byte,
		Damage: 0 as short
	}
});

var ifLaserBaseV3 = < refinedstorage: pattern > .withTag({
	Input_2: {
		id: "industrialforegoing:plastic",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_1: {
		id: "minecraft:glowstone",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_4: {
		id: "minecraft:glowstone",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_3: {
		id: "thermalfoundation:material",
		Count: 1 as byte,
		Damage: 25 as short
	},
	Version: "1.6.14",
	Input_0: {
		id: "industrialforegoing:plastic",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Oredict: 0 as byte,
	Input_6: {
		id: "thermalfoundation:material",
		Count: 1 as byte,
		Damage: 26 as short
	},
	Input_5: {
		id: "thermalfoundation:material",
		Count: 1 as byte,
		Damage: 25 as short
	},
	Input_8: {
		id: "thermalfoundation:material",
		Count: 1 as byte,
		Damage: 26 as short
	},
	Processing: 0 as byte,
	Input_7: {
		id: "enderio:item_material",
		Count: 1 as byte,
		Damage: 0 as short
	}
});

var ifLaserBaseV4 = < refinedstorage: pattern > .withTag({
	Input_2: {
		id: "industrialforegoing:plastic",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_1: {
		id: "minecraft:glowstone",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_4: {
		id: "minecraft:glowstone",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Input_3: {
		id: "thermalfoundation:material",
		Count: 1 as byte,
		Damage: 25 as short
	},
	Version: "1.6.14",
	Input_0: {
		id: "industrialforegoing:plastic",
		Count: 1 as byte,
		Damage: 0 as short
	},
	Oredict: 0 as byte,
	Input_6: {
		id: "thermalfoundation:material",
		Count: 1 as byte,
		Damage: 26 as short
	},
	Input_5: {
		id: "thermalfoundation:material",
		Count: 1 as byte,
		Damage: 25 as short
	},
	Input_8: {
		id: "thermalfoundation:material",
		Count: 1 as byte,
		Damage: 26 as short
	},
	Processing: 0 as byte,
	Input_7: {
		id: "mekanism:basicblock",
		Count: 1 as byte,
		Damage: 8 as short
	}
});

//===== Overworld Stage =====
//Stage 3
//Trigger       - ET Laser Lens | AA Miner Lens | IF Laser Base | Scanner | Patterns of thereof
//Death Token   - Diamond Shovel
events.onPlayerCrafted(function(event as PlayerCraftedEvent){
   if((<environmentaltech:laser_lens:*>.matches(event.output)) | (<actuallyadditions:item_color_lens:*>.matches(event.output)) | (<industrialforegoing:laser_base>.matches(event.output)) | (laserPattern.matches(event.output)) | (aaMinerV1.matches(event.output)) | (aaMinerV2.matches(event.output)) | (ifLaserBaseV1.matches(event.output)) | (ifLaserBaseV2.matches(event.output)) | (ifLaserBaseV3.matches(event.output)) | (ifLaserBaseV4.matches(event.output))) {
       if(!event.player.hasAnyGameStages("three", "four", "five", "six", "skyblock")) {
           if(event.player.world.isRemote()) {
               return;
           }
            event.player.addGameStage("three");
            event.player.removeGameStage("two");
            event.player.sendChat("Your technology is improving.");
            event.player.sendChat("Advance to stage three.");
            return;
       }  
        
    }
});