import * as mc from "@minecraft/server";
import { ActionFormData } from "@minecraft/server-ui";

const VERSION = "1.1.0";
const SOUND_TURN_PAGE = "item.book.page_turn";
const SOUND_OPTIONS = { pitch: 1.0, volume: 5.0, };

const MENU_MAIN = new ActionFormData();
const MENU_TUTORIAL = new ActionFormData();
const MENU_DINOSAURS = new ActionFormData();
const MENU_LOCATING = new ActionFormData();
const MENU_HUNTING = new ActionFormData();
const MENU_CRAFTING = new ActionFormData();
const MENU_TAMING = new ActionFormData();
const MENU_RIDING = new ActionFormData();
const MENU_BREEDING = new ActionFormData();
const MENU_COMMANDS = new ActionFormData();
const MENU_DINO_LIST = new ActionFormData();
const MENU_AMARGASAURUS = new ActionFormData();
const MENU_ANKYLOSAURUS = new ActionFormData();
const MENU_BRACHIOSAURUS = new ActionFormData();
const MENU_COMPSOGNATHUS = new ActionFormData();
const MENU_DEINOSUCHUS = new ActionFormData();
const MENU_DIPLODOCUS = new ActionFormData();
const MENU_HERRERASAURUS = new ActionFormData();
const MENU_IGUANODON = new ActionFormData();
const MENU_MOSASAURUS = new ActionFormData();
const MENU_OVIRAPTOR = new ActionFormData();
const MENU_PRENOCEPHALE = new ActionFormData();
const MENU_PTERANODON = new ActionFormData();
const MENU_SPINOSAURUS = new ActionFormData();
const MENU_STEGOSAURUS = new ActionFormData();
const MENU_STRUTHIOMIMUS = new ActionFormData();
const MENU_TRICERATOPS = new ActionFormData();
const MENU_TUPANDACTYLUS = new ActionFormData();
const MENU_TYRANNOSAURUS = new ActionFormData();
const MENU_UTAHRAPTOR = new ActionFormData();
const MENU_VELOCIRAPTOR = new ActionFormData();
const MENU_AMMONITE = new ActionFormData();
const MENU_ARTHROPLEURA = new ActionFormData();
const MENU_MEGANEUROPSIS = new ActionFormData();
const MENU_PULMONOSCORPIO = new ActionFormData();
const MENU_TRILOBITE = new ActionFormData();
const MENU_ABOUT = new ActionFormData();
const MENU_VEHICLES = new ActionFormData(); /// 1.1 update
const MENU_VEHICLE_CRAFTING = new ActionFormData(); /// 1.1 update
const MENU_VC_METAL_SHAPER = new ActionFormData(); /// 1.1 update
const MENU_VC_PYROLYZER = new ActionFormData(); /// 1.1 update
const MENU_FUEL = new ActionFormData(); /// 1.1 update
const MENU_JEEP = new ActionFormData(); /// 1.1 update
const MENU_BOAT = new ActionFormData(); /// 1.1 update
const MENU_PLANE = new ActionFormData(); /// 1.1 update
const MENU_HELICOPTER = new ActionFormData(); /// 1.1 update
const MENU_CRATE = new ActionFormData(); /// 1.1 update

guideBookListeners();
setupStaticMenus();

//most of the menus don't ever change contents so we set them up once at the very start
function setupStaticMenus() {
    //GUIDEBOOK MAIN
    MENU_MAIN.title("Dinosaurs");
    MENU_MAIN.body("Welcome to §2Dinosaurs!§r\n\nMeet, fight or befriend your favourite prehistoric lizards.\n\nSee 'How stuff works' for more info.");
    MENU_MAIN.button("How stuff works", "textures/PixelBiester/Dino/icons/how_stuff_works_icon");
    MENU_MAIN.button("Dinosaur List", "textures/PixelBiester/Dino/icons/dinosaur_list_icon");
    MENU_MAIN.button("Vehicles", "textures/PixelBiester/Dino/icons/jeep_icon"); /// 1.1 update
    MENU_MAIN.button("About this Add-On", "textures/PixelBiester/Dino/icons/book_icon");

    //GUIDEBOOK TUTORIAL
    MENU_TUTORIAL.title("Tutorial");
    MENU_TUTORIAL.body("§2Dinosaurs§r of all shapes and sizes will now roam your world.\n\nLearn how to §2hunt§r and §2tame§r them.");
	MENU_TUTORIAL.button("Dinosaurs", "textures/PixelBiester/Dino/icons/dinosaur_icon");
	MENU_TUTORIAL.button("Locating", "textures/PixelBiester/Dino/icons/locating_icon");
	MENU_TUTORIAL.button("Hunting", "textures/PixelBiester/Dino/icons/hunting_icon");
	MENU_TUTORIAL.button("Crafting", "textures/PixelBiester/Dino/icons/crafting_icon");
	MENU_TUTORIAL.button("Taming", "textures/PixelBiester/Dino/icons/taming_icon");
    MENU_TUTORIAL.button("Return", "textures/PixelBiester/Dino/icons/return_icon");

    //GUIDEBOOK VEHICLES
    MENU_VEHICLES.title("Vehicles"); /// 1.1 update
    MENU_VEHICLES.body("§2Vehicles§r can be crafted and utilized to navigate your world.\n\nLearn how to §2craft§r and §2operate§r them by selecting an option below."); /// 1.1 update
	MENU_VEHICLES.button("Crafting", "textures/PixelBiester/Dino/icons/crafting_vehicle_icon"); /// 1.1 update
	MENU_VEHICLES.button("Fuel", "textures/PixelBiester/Dino/icons/fuel_icon"); /// 1.1 update
	MENU_VEHICLES.button("Jeep", "textures/PixelBiester/Dino/icons/jeep_icon"); /// 1.1 update
	MENU_VEHICLES.button("Boat", "textures/PixelBiester/Dino/icons/boat_icon"); /// 1.1 update
	MENU_VEHICLES.button("Plane", "textures/PixelBiester/Dino/icons/plane_icon"); /// 1.1 update
	MENU_VEHICLES.button("Helicopter", "textures/PixelBiester/Dino/icons/helicopter_icon"); /// 1.1 update
    MENU_VEHICLES.button("Return", "textures/PixelBiester/Dino/icons/return_icon"); /// 1.1 update

    //GUIDEBOOK VEHICLE CRAFTING
    MENU_VEHICLE_CRAFTING.title("Vehicle Crafting"); /// 1.1 update
    MENU_VEHICLE_CRAFTING.body("§2Vehicle Crafting§r is more complex than standard crafting.\n\nTo begin, you will need a §nMetal Shaper§r, and then a §nPyrolyzer Multi-Block§r.\n\nSelect an option below for more info."); /// 1.1 update
	MENU_VEHICLE_CRAFTING.button("Metal Shaper", "textures/PixelBiester/Dino/icons/metal_shaper_icon"); /// 1.1 update
	MENU_VEHICLE_CRAFTING.button("Pyrolyzer", "textures/PixelBiester/Dino/icons/pyrolyzer_icon"); /// 1.1 update
    MENU_VEHICLE_CRAFTING.button("Return", "textures/PixelBiester/Dino/icons/return_icon"); /// 1.1 update

    //GUIDEBOOK VEHICLE CRAFTING - Metal Shaper
    MENU_VC_METAL_SHAPER.title("Metal Shaper"); /// 1.1 update
    MENU_VC_METAL_SHAPER.body("The §2Metal Shaper§r is a custom device, that is used to craft vehicle components and vehicles themselves.\n\nTo get started, check the recipe for crafting the §nMetal Shaper§r in your regular §nCrafting Table§r.\n\nOnce placed, you can now check more crafting options in its own interface."); /// 1.1 update
    MENU_VC_METAL_SHAPER.button("Return", "textures/PixelBiester/Dino/icons/return_icon"); /// 1.1 update
    
    //GUIDEBOOK VEHICLE CRAFTING - Pyrolyzer
    MENU_VC_PYROLYZER.title("Pyrolyzer"); /// 1.1 update
    MENU_VC_PYROLYZER.body("The §2Pyrolyzer§r is part of a §nmulti-block structure§r that can convert dinosaur drops into §2oil§r, that can fuel your vehicles or craft into §2rubber§r.\n\nTo use the §2Pyrolyzer§r, you will need to place a §2Pyrolyzer Tank§r next to it, making sure §nboth blocks are facing the same way§r.\n\nWhen placed correctly, they will flash with a §2green highlight§r and you can now interact with it while holding dinosaur parts to fill the tank.\n\nWith §noil§r in the tank, you can interact with it using an empty hand to create a §nBall Of Rubber§r, and when it's full, interact while holding an §nEmpty Fuel Can§r to fill the can.\n\nThe §2Pyrolizer§r accepts:\n§n- Dino Meat\n- Dino Bones\n- Bug Meat§r"); /// 1.1 update
    MENU_VC_PYROLYZER.button("Return", "textures/PixelBiester/Dino/icons/return_icon"); /// 1.1 update

    //GUIDEBOOK VEHICLE FUEL
    MENU_FUEL.title("Vehicle Fuel"); /// 1.1 update
    MENU_FUEL.body("§2Vehicle Fuel§r is required to drive any vehicle.\n\nTo operate a vehicle, a §2Fuel Can - Full§r must be placed in the §2top left slot§r of the vehicle's inventory.\n\nTo create fuel, you will need a §nPyrolyzer Multi-Block§r, check the §2Crafting§r page inside the Vehicles menu for more information.\n\nFuel will gradually deplete as you drive, and once it runs out, you will need to replace it."); /// 1.1 update
    MENU_FUEL.button("Return", "textures/PixelBiester/Dino/icons/return_icon"); /// 1.1 update

    //GUIDEBOOK VEHICLE JEEP
    MENU_JEEP.title("Jeep"); /// 1.1 update
    MENU_JEEP.body("The §2Jeep§r is a §nground§r vehicle that can accommodate multiple passengers and has storage for items.\n\n§cPassengers:   [][][][][][]\n§6Storage:        [][][][][][][]\n\n§h(x)Land   §j( )Water   §j( )Air   §j( )Cargo\n\n§rTo pickup your Jeep, simply sneak and hit it, and it will drop into an item."); /// 1.1 update
    MENU_JEEP.button("Return", "textures/PixelBiester/Dino/icons/return_icon"); /// 1.1 update

    //GUIDEBOOK VEHICLE BOAT
    MENU_BOAT.title("Boat"); /// 1.1 update
    MENU_BOAT.body("The §2Boat§r is a §3water-based§r vehicle that allows you to travel swiftly across water.\n\n§cPassengers:   [][][]§r[][][]\n§6Storage:        [][][]§r[][][][]\n\n§j( )Land   §h(x)Water   §j( )Air   §j( )Cargo\n\n§rTo pickup your Boat, simply sneak and hit it, and it will drop into an item."); /// 1.1 update
    MENU_BOAT.button("Return", "textures/PixelBiester/Dino/icons/return_icon"); /// 1.1 update

    //GUIDEBOOK VEHICLE PLANE
    MENU_PLANE.title("Plane"); /// 1.1 update
    MENU_PLANE.body("The §2Plane§r is an §bairborne§r vehicle that enables you to fly quickly to your destination.\n\n§cPassengers:   [][][][]§r[][]\n§6Storage:        [][][][][][]§r[]\n\n§j( )Land   §j( )Water   §h(x)Air   §j( )Cargo\n\n§rTo pickup your Plane, simply sneak and hit it, and it will drop into an item."); /// 1.1 update
    MENU_PLANE.button("Return", "textures/PixelBiester/Dino/icons/return_icon"); /// 1.1 update

    //GUIDEBOOK VEHICLE HELICOPTER
    MENU_HELICOPTER.title("Helicopter"); /// 1.1 update
    MENU_HELICOPTER.body("The §2Helicopter§r is an §bairborne§r vehicle that can transport crated dinosaurs in §ncrates§r.\n\n§cPassengers:   [][][]§r[][][]\n§6Storage:        §r[][][][][][][]\n\n§j( )Land   §j( )Water   §h(x)Air   §h(x)Cargo\n\n§rTo pickup your Helicopter, simply sneak and hit it, and it will drop into an item.\n\n§rTo pick up a §2crated dinosaur§r, fly your helicopter over the §ncrate§r, and land on it. If successful, you will receive an §non-screen prompt§r.\n\nWhen you are ready to §2release§r the crate, simply interact with the helicopter while riding it, and the crate will be released, gently falling to the ground using its §nparachute§r."); /// 1.1 update
    MENU_HELICOPTER.button("Dinosaur Crate", "textures/PixelBiester/Dino/icons/crate_icon"); /// 1.1 update
    MENU_HELICOPTER.button("Return", "textures/PixelBiester/Dino/icons/return_icon"); /// 1.1 update

    //GUIDEBOOK CRATE
    MENU_CRATE.title("Dinosaur Crate"); /// 1.1 update
    MENU_CRATE.body("The §2Dinosaur Crate§r is designed for transporting dinosaurs.\n\nTo place a dinosaur into the crate, you need to either §2tame it§r, or make it §2dizzy§r. You can then interact with the dinosaur while holding the §nDinosaur Crate§r, and it will be packed and ready for transport.\n\nTo release the dinosaur, interact with the crate, and it will pop out, dropping the crate as an item to be used again.\n\n§7**Please note that some dinosaurs are too large to be crated."); /// 1.1 update
    MENU_CRATE.button("Return", "textures/PixelBiester/Dino/icons/return_icon"); /// 1.1 update

    //GUIDEBOOK DINO LIST
    MENU_DINO_LIST.title("Dino List");
	MENU_DINO_LIST.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
    MENU_DINO_LIST.body("Pick an option to learn more about a specific dinosaur");
    MENU_DINO_LIST.button("Amargasaurus", "textures/PixelBiester/Dino/items/spawn_eggs/icon_amargasaurus");
	MENU_DINO_LIST.button("Ankylosaurus", "textures/PixelBiester/Dino/items/spawn_eggs/icon_ankylosaurus");
	MENU_DINO_LIST.button("Brachiosaurus", "textures/PixelBiester/Dino/items/spawn_eggs/icon_brachiosaurus");
	MENU_DINO_LIST.button("Compsognathus", "textures/PixelBiester/Dino/items/spawn_eggs/icon_compsognathus");
	MENU_DINO_LIST.button("Deinosuchus", "textures/PixelBiester/Dino/items/spawn_eggs/icon_deinosuchus");
	MENU_DINO_LIST.button("Diplodocus", "textures/PixelBiester/Dino/items/spawn_eggs/icon_diplodocus");
	MENU_DINO_LIST.button("Herrerasaurus", "textures/PixelBiester/Dino/items/spawn_eggs/icon_herrerasaurus");
	MENU_DINO_LIST.button("Iguanodon", "textures/PixelBiester/Dino/items/spawn_eggs/icon_iguanodon");
	MENU_DINO_LIST.button("Mosasaurus", "textures/PixelBiester/Dino/items/spawn_eggs/icon_mosasaurus");
	MENU_DINO_LIST.button("Oviraptor", "textures/PixelBiester/Dino/items/spawn_eggs/icon_oviraptor");
	MENU_DINO_LIST.button("Prenocephale", "textures/PixelBiester/Dino/items/spawn_eggs/icon_prenocephale");
	MENU_DINO_LIST.button("Pteranodon", "textures/PixelBiester/Dino/items/spawn_eggs/icon_pteranodon");
	MENU_DINO_LIST.button("Spinosaurus", "textures/PixelBiester/Dino/items/spawn_eggs/icon_spinosaurus");
	MENU_DINO_LIST.button("Stegosaurus", "textures/PixelBiester/Dino/items/spawn_eggs/icon_stegosaurus");
	MENU_DINO_LIST.button("Struthiomimus", "textures/PixelBiester/Dino/items/spawn_eggs/icon_struthiomimus");
	MENU_DINO_LIST.button("Triceratops", "textures/PixelBiester/Dino/items/spawn_eggs/icon_triceratops");
	MENU_DINO_LIST.button("Tyrannosaurus", "textures/PixelBiester/Dino/items/spawn_eggs/icon_trex");
	MENU_DINO_LIST.button("Tupandactylus", "textures/PixelBiester/Dino/items/spawn_eggs/icon_tupandactylus");
	MENU_DINO_LIST.button("Utahraptor", "textures/PixelBiester/Dino/items/spawn_eggs/icon_utahraptor");
	MENU_DINO_LIST.button("Velociraptor", "textures/PixelBiester/Dino/items/spawn_eggs/icon_velociraptor");
	MENU_DINO_LIST.button("Ammonite", "textures/PixelBiester/Dino/items/spawn_eggs/icon_ammonite");
	MENU_DINO_LIST.button("Atrhopleura", "textures/PixelBiester/Dino/items/spawn_eggs/icon_arthropleura");
	MENU_DINO_LIST.button("Meganeuropsis", "textures/PixelBiester/Dino/items/spawn_eggs/icon_meganeuropsis");
	MENU_DINO_LIST.button("Pulmonoscorpio", "textures/PixelBiester/Dino/items/spawn_eggs/icon_pulmonoscorpius");
	MENU_DINO_LIST.button("Trilobite", "textures/PixelBiester/Dino/items/spawn_eggs/icon_trilobite");
	
	//GUIDEBOOK Dinosaurs
	MENU_DINOSAURS.title("Dinosaurs");
	MENU_DINOSAURS.body("Every §2dinosaur§r and other prehistoric creature has its own set of quirks. §nWhere§r they appear, §nhow friendly§r they are, and §nwhat they eat§r are different for each species.\n\nCheck the §2'Dinosaur List'§r in this §nguidebook§r to see exactly what each of them does and the kind of biomes you can find them in.\n\nDepending on whether you find them in a §atemperate§r,  §ehot§r or §bcold§r area, they will also appear with §2different scales§r.");
	MENU_DINOSAURS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
    //GUIDEBOOK Locating
	MENU_LOCATING.title("Locating");
	MENU_LOCATING.body("Every §2dinosaur§r and other prehistoric creature has its own preferance for where it lives.\nHere is a list of biome groups:\n\n§a§l(o) Plains:§r Plains, Sunflower Plains, Meadow, Windswept Hills.\n\n§a§l(o) Forest:§r Oak Forest, Birch Forest, Flower Forest, Cherry Grove, Roofed Forest.\n\n§a§l(o) Swamp:§r Swampland, Mangrove Swamp.\n\n§a§l(o) Jungle:§r Jungle, Bamboo Jungle.\n\n§e§l(o) Desert:§r Desert, Mesa (Badlands).\n\n§e§l(o) Savanna:§r Savanna, Wooded Mesa (Badlands), Windswept Gravely Hills.\n\n§b§l(o) Taiga:§r Taiga, Old Growth Taiga, Snowy Taiga, Snowy Plains\n\n§b§l(o) Mountain:§r Jagged Peaks, Frozen Peaks, Stony Peaks, Grove, Snowy Slopes.\n\n§s§l(o) Oceans:§r Ocean, Warm Ocean, Lukewarm Ocean, Cold Ocean");
	MENU_LOCATING.button("Return", "textures/PixelBiester/Dino/icons/return_icon");

	//GUIDEBOOK Hunting
	MENU_HUNTING.title("Hunting");
	MENU_HUNTING.body("Defeating a §2dinosaur§r in combat isn't always easy, depending on which species you're facing.\n\nTaking too much damage makes dinos §ndizzy§r, giving you time to §nfinish them§r. But beware that large dinos can §nhit hard§r, so this won't always save you.\n\nMake sure to choose your battles wisely, and if you're unsure, to always consult the §2'Dinosaur List'§r.");
	MENU_HUNTING.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Crafting
	MENU_CRAFTING.title("Crafting");
	MENU_CRAFTING.body("Once defeated, §2dinosaurs§r will drop some §nmaterials§r for you to collect.\n\nDepending on the type of dino, they might drop some §4meat§r, §nbones§r, §nscales§r, or very rare §npredator fangs§r.\n\nOnce you have them, check your §2crafting list§r to see the things you can craft from them. There is:\n§n- armour\n- weapons\n- tools\n- food");
	MENU_CRAFTING.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Taming
	MENU_TAMING.title("Taming");
	MENU_TAMING.body("To tame §aherbivores§r or §bpescatarians§r, you need to find §2'Araucaria Sprouts'§r, which appear when destroying §atall grass§r and §aferns§r.\n\nTo tame §ccarnivores§r, you need §2'Dino Meat'§r, which drops from §clarge dinos§r.\n\nOnce acquired, you need to find an §2adult dino§r you want to tame and hit them until they're §ndizzy§r, then they can be fed the §2right item§r to tame them.\n\nDinos who aren't fully grown cannot be made §ndizzy§r or §ntamed§r! You can however feed them the §2right item§r to make them grow up.");
	MENU_TAMING.button("Riding", "textures/PixelBiester/Dino/icons/riding_icon");
	MENU_TAMING.button("Breeding", "textures/PixelBiester/Dino/icons/breeding_icon");
	MENU_TAMING.button("Commands", "textures/PixelBiester/Dino/icons/dino_command_icon");
	MENU_TAMING.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Riding
	MENU_RIDING.title("Riding");
	MENU_RIDING.body("Many dinosaurs will accept a §2saddle§r and can then be ridden by the player, some can also §njump§r, §nattack§r, or even §nfly§r while mounted.\n\nTo jump with a dinosaur who is capable of it, simply hold §2'jump'§r and release at the appropriate time.\n\nTo tell a dinosaur you're riding to §2attack§r, look down at them and interact.\n\nTo start §2flying§r on a dinosaur, move forward and look up, then look in the direction you want to fly in.");
	MENU_RIDING.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Breeding
	MENU_BREEDING.title("Breeding");
	MENU_BREEDING.body("Dinosaurs can also §2breed§r and lay eggs. Simply feed two tamed dinosaurs of the same species to get a §2new egg§r.\n\nYou can then pick the egg up and place it somewhere else, but to see it §nhatch§r, you need to leave it and wait patiently until it's ready.\n\nRemember that §2newly hatched dinos§r are wild and that you can't tame them until they're fed to grow up.");
	MENU_BREEDING.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Commands
	MENU_COMMANDS.title("Commands");
	MENU_COMMANDS.body("Tamed dinosaurs can be given commands to §cSit§r, §6Follow§r or §2Wander§r.\n\nIf you §nsneak and interact§r with your dinosaur friend, they will cycle through the different command states.\n\nTheir §ncurrent state§r will be displayed by an §nicon§r appearing above their head.\n\nA §nsitting dinosaur§r icon means your dinosaur will §csit§r and wait for you.\n\nA §ndinosaur with a heart§r means it will §6follow§r you.\n\nA §ndinosaur without a heart, and not sitting§r, means they are in §2wander§r mode, meaning that they will roam around freely.");
	MENU_COMMANDS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
		
	//GUIDEBOOK Amargasaurus
	MENU_AMARGASAURUS.title("Amargasaurus");
	MENU_AMARGASAURUS.body("§l§2Species:§r §oAmargasaurus§r\n§aHerbivore (Dino Meat, Dino Scales)\n\n§nAppears in:\n§a§l(o)§r Plains§6*§r, Swamp§6*§r\n§e§l(o)§r Desert§6*§r, Savanna\n§b§l(o)§r Taiga§6*§r\n\n§cHealth:     [][][][][][][]§r[][][]\n§6Attack:     [][][][][][][]§r[][][]\n§tSize:        [][][][][][][]§r[][][]\n\n§h(x)Ride   §j( )Fly   §j( )Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_AMARGASAURUS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Ankylosaurus
	MENU_ANKYLOSAURUS.title("Ankylosuaurs");
	MENU_ANKYLOSAURUS.body("§l§2Species:§r §oAnkylosaurus§r\n§aHerbivore (Dino Meat, Dino Bones)\n\n§nAppears in:\n§a§l(o)§r Forest§6*§r\n§e§l(o)§r Desert, Savanna§6*§r\n§b§l(o)§r Taiga§6*§r\n\n§cHealth:     [][][][][][][]§r[][][]\n§6Attack:     [][][][][][]§r[][][][]\n§tSize:        [][][][][][]§r[][][][]\n\n§h(x)Ride   §j( )Fly   §j( )Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_ANKYLOSAURUS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Brachiosaurs
	MENU_BRACHIOSAURUS.title("Brachiosaurus");
	MENU_BRACHIOSAURUS.body("§l§2Species:§r §oBrachiosaurus§r\n§aHerbivore (Dino Meat, Dino Bones)\n\n§nAppears in:\n§a§l(o)§r Forest, Plains\n§e§l(o)§r Savanna§6*§r\n§b§l(o)§r Taiga\n\n§cHealth:     [][][][][][][][][][]§r\n§6Attack:     [][][][][][][]§r[][][]\n§tSize:        [][][][][][][][][][]§r\n\n§h(x)Ride   §j( )Fly   §j( )Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome\n\n§7** Due to the huge size of the Brachiosaurus, if you wish to remove their saddle, put them into 'follow' mode and interact with an empty hand to open their inventory");
	MENU_BRACHIOSAURUS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Compsognathus
	MENU_COMPSOGNATHUS.title("Compsognathus");
	MENU_COMPSOGNATHUS.body("§l§2Species:§r §oCompsognathus§r\n§cCarnivore (Dino Meat, Dino Scales)\n\n§nAppears in:\n§a§l(o)§r Forest, Jungle, Plains§6*§r\n§e§l(o)§r Desert§6*§r, Savanna§6*§r\n§b§l(o)§r Taiga§6*§r, Mountain§6*§r\n\n§cHealth:     [][]§r[][][][][][][][]\n§6Attack:     []§r[][][][][][][][][]\n§tSize:        [][]§r[][][][][][][][]\n\n§j( )Ride   §j( )Fly   §j( )Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_COMPSOGNATHUS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Deinosuchus
	MENU_DEINOSUCHUS.title("Deinosuchus");
	MENU_DEINOSUCHUS.body("§l§2Species:§r §oDeinosuchus§r\n§cCarnivore (Dino Meat, Dino Scales)\n\n§nAppears in:\n§a§l(o)§r Swamp, River§6*§r, Plains§6*§r\n§e§l(o)§r Desert§6*§r\n§b§l(o)§r Taiga§6*§r, Ocean§6*§r, Frozen§6*§r\n\n§cHealth:     [][][][][][][]§r[][][]\n§6Attack:     [][][][][][][][]§r[][]\n§tSize:        [][][][][]§r[][][][][]\n\n§h(x)Ride   §j( )Fly   §j( )Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_DEINOSUCHUS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Diplodocus
	MENU_DIPLODOCUS.title("Diplodocus");
	MENU_DIPLODOCUS.body("§l§2Species:§r §oDiplodocus§r\n§aHerbivore (Dino Meat, Dino Bones)\n\n§nAppears in:\n§a§l(o)§r Forest§6*§r, Plains§6*§r, Swamp§6*§r\n§e§l(o)§r Savanna\n§b§l(o)§r Taiga\n\n§cHealth:     [][][][][][][]§r[][][]\n§6Attack:     [][][][][][]§r[][][][]\n§tSize:        [][][][][][][][][]§r[]\n\n§h(x)Ride   §j( )Fly   §j( )Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_DIPLODOCUS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Herrerasaurus
	MENU_HERRERASAURUS.title("Herrerasaurus");
	MENU_HERRERASAURUS.body("§l§2Species:§r §oHerrerasaurus§r\n§cCarnivore (Dino Meat, Dino Fang)\n\n§nAppears in:\n§a§l(o)§r Forest, Jungle, Swamp§6*§r\n§e§l(o)§r Desert§6*§r, Savanna§6*§r\n§b§l(o)§r Taiga§6*§r, Mountain§6*§r\n\n§cHealth:     [][][][][][]§r[][][][]\n§6Attack:     [][][][][][][]§r[][][]\n§tSize:        [][][][]§r[][][][][][]\n\n§h(x)Ride   §j( )Fly   §h(x)Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_HERRERASAURUS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Iguanodon
	MENU_IGUANODON.title("Iguanodon");
	MENU_IGUANODON.body("§l§2Species:§r §oIguanodon§r\n§aHerbivore (Dino Meat, Dino Scales)\n\n§nAppears in:\n§a§l(o)§r Plains§6*§r, Swamp\n§e§l(o)§r Desert§6*§r\n§b§l(o)§r Taiga§6*§r, Mountain\n\n§cHealth:     [][][][][]§r[][][][][]\n§6Attack:     [][][][][]§r[][][][][]\n§tSize:        [][][][][]§r[][][][][]\n\n§h(x)Ride   §j( )Fly   §j( )Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_IGUANODON.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Mosasaurus
	MENU_MOSASAURUS.title("Mosasaurus");
	MENU_MOSASAURUS.body("§l§2Species:§r §oMosasaurus§r\n§cCarnivore (Dino Meat, Dino Fang)\n\n§nAppears in:\n§a§l(o)§r Oceans, Rivers§6*§r\n§e§l(o)§r Oceans, Rivers§6*§r\n§b§l(o)§r Rivers§6*§r\n\n§cHealth:     [][][][][][][][][][]§r\n§6Attack:     §r[][][][][][][]§r[][][]\n§tSize:        [][][][][][][][]§r[][]\n\n§j( )Ride   §j( )Fly   §j( )Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_MOSASAURUS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Oviraptor
	MENU_OVIRAPTOR.title("Oviraptor");
	MENU_OVIRAPTOR.body("§l§2Species:§r §oOviraptor§r\n§cCarnivore (Dino Meat, Dino Scales)\n\n§nAppears in:\n§a§l(o)§r Forest§6*§r, Jungle\n§e§l(o)§r Desert, Savanna\n§b§l(o)§r Taiga§6*§r, Mountain\n\n§cHealth:     [][][]§r[][][][][][][]\n§6Attack:     [][][]§r[][][][][][][]\n§tSize:        []§r[][][][][][][][][]\n\n§j( )Ride   §j( )Fly   §j( )Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_OVIRAPTOR.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Prenocephale
	MENU_PRENOCEPHALE.title("Prenocephale");
	MENU_PRENOCEPHALE.body("§l§2Species:§r §oPrenocephale§r\n§aHerbivore (Dino Meat, Dino Scales)\n\n§nAppears in:\n§a§l(o)§r Jungle§6*§r, Plains\n§e§l(o)§r Savanna§6*§r\n§b§l(o)§r Taiga\n\n§cHealth:     [][][][]§r[][][][][][]\n§6Attack:     [][][]§r[][][][][][][]\n§tSize:        [][][]§r[][][][][][][]\n\n§h(x)Ride   §j( )Fly   §h(x)Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_PRENOCEPHALE.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Pteranodon
	MENU_PTERANODON.title("Pteranodon");
	MENU_PTERANODON.body("§l§2Species:§r §oPteranodon§r\n§aPescatarian (Dino Meat, Dino Scales)\n\n§nAppears in:\n§a§l(o)§r Forest§6*§r, Jungle\n§e§l(o)§r Savanna\n§b§l(o)§r Mountain\n\n§cHealth:     [][][][]§r[][][][][][]\n§6Attack:     [][][][][][]§r[][][][]\n§tSize:        [][][][]§r[][][][][][]\n\n§h(x)Ride   §h(x)Fly   §j( )Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_PTERANODON.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Spinosaurus
	MENU_SPINOSAURUS.title("Spinosaurus");
	MENU_SPINOSAURUS.body("§l§2Species:§r §oSpinosaurus§r\n§cCarnivore (Dino Meat, Dino Fang)\n\n§nAppears in:\n§a§l(o)§r Swamp, River§6*§r\n§e§l(o)§r Savanna§6*§r\n§b§l(o)§r Mountain§6*§r\n\n§cHealth:     [][][][][][][]§r[][][]\n§6Attack:     [][][][][][][]§r[][][]\n§tSize:        [][][][][][][][]§r[][]\n\n§j( )Ride   §j( )Fly   §j( )Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_SPINOSAURUS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Stegosaurus
	MENU_STEGOSAURUS.title("Stegosaurus");
	MENU_STEGOSAURUS.body("§l§2Species:§r §oStegosaurus§r\n§aHerbivore (Dino Meat, Dino Scales)\n\n§nAppears in:\n§a§l(o)§r Forest§6*§r, Plains, Swamp§6*§r\n§e§l(o)§r Desert\n§b§l(o)§r Mountain§6*§r\n\n§cHealth:     [][][][][][][]§r[][][]\n§6Attack:     [][][]§r[][][][][][][]\n§tSize:        [][][][][]§r[][][][][]\n\n§h(x)Ride   §j( )Fly   §j( )Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_STEGOSAURUS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Stuthiomimus
	MENU_STRUTHIOMIMUS.title("Struthiomimus");
	MENU_STRUTHIOMIMUS.body("§l§2Species:§r §oStruthiomimus§r\n§aHerbivore (Dino Meat, Dino Scales)\n\n§nAppears in:\n§a§l(o)§r Jungle, Swamp, River§6*§r\n§e§l(o)§r Desert§6*§r\n§b§l(o)§r Taiga§6*§r, Mountain§6*§r\n\n§cHealth:     [][]§r[][][][][][][][]\n§6Attack:     §r[][][][][][][][][][]\n§tSize:        [][]§r[][][][][][][][]\n\n§j( )Ride   §j( )Fly   §j( )Jump   §j( )Attack\n\n§r(§6*§r) - Indicates rare spawns for that biome");
	MENU_STRUTHIOMIMUS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Triceratops
	MENU_TRICERATOPS.title("Triceratops");
	MENU_TRICERATOPS.body("§l§2Species:§r §oTriceratops§r\n§aHerbivore (Dino Meat, Dino Scales)\n\n§nAppears in:\n§a§l(o)§r Forest§6*§r, Plains§6*§r\n§e§l(o)§r Desert, Savanna§6*§r\n§b§l(o)§r Taiga§6*§r\n\n§cHealth:     [][][][][][][]§r[][][]\n§6Attack:     [][][][][][]§r[][][][]\n§tSize:        [][][][][][]§r[][][][]\n\n§h(x)Ride   §j( )Fly   §j( )Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_TRICERATOPS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Tyrannosaurus
	MENU_TYRANNOSAURUS.title("Tyrannosaurus");
	MENU_TYRANNOSAURUS.body("§l§2Species:§r §oTyrannosaurus§r\n§cCarnivore (Dino Meat, Dino Fang)\n\n§nAppears in:\n§a§l(o)§r Swamp, Jungle§6*§r\n§e§l(o)§r Desert§6*§r\n§b§l(o)§r Mountain§6*§r\n\n§cHealth:     [][][][][][][][]§r[][]\n§6Attack:     [][][][][][][][][][]§r\n§tSize:        [][][][][][][][]§r[][]\n\n§h(x)Ride   §j( )Fly   §j( )Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_TYRANNOSAURUS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Tupandactylus
	MENU_TUPANDACTYLUS.title("Tupandactylus");
	MENU_TUPANDACTYLUS.body("§l§2Species:§r §oTupandactylus§r\n§aPescatarian (Dino Meat, Dino Scales)\n\n§nAppears in:\n§a§l(o)§r Jungle\n§e§l(o)§r Savanna§6*§r\n§b§l(o)§r Taiga§6*§r\n\n§cHealth:     [][][][]§r[][][][][][]\n§6Attack:     [][][][][][]§r[][][][]\n§tSize:        [][][][]§r[][][][][][]\n\n§h(x)Ride   §h(x)Fly   §j( )Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_TUPANDACTYLUS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Utahraptor
	MENU_UTAHRAPTOR.title("Utahraptor");
	MENU_UTAHRAPTOR.body("§l§2Species:§r §oUtahraptor§r\n§cCarnivore (Dino Meat, Dino Fang)\n\n§nAppears in:\n§a§l(o)§r Forest§6*§r, Jungle§6*§r\n§e§l(o)§r Savanna\n§b§l(o)§r Taiga§6*§r, Mountain\n\n§cHealth:     [][][][]§r[][][][][][]\n§6Attack:     [][][][][][]§r[][][][]\n§tSize:        [][][][]§r[][][][][][]\n\n§h(x)Ride   §j( )Fly   §h(x)Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_UTAHRAPTOR.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Velociraptor
	MENU_VELOCIRAPTOR.title("Velociraptor");
	MENU_VELOCIRAPTOR.body("§l§2Species:§r §oVelociraptor§r\n§cCarnivore (Dino Meat, Dino Fang\n\n§nAppears in:\n§a§l(o)§r Forest, Plains§6*§r\n§e§l(o)§r Desert, Savanna\n§b§l(o)§r Taiga§6*§r, Mountain§6*§r\n\n§cHealth:     [][][]§r[][][][][][][]\n§6Attack:     [][][][][]§r[][][][][]\n§tSize:        [][][]§r[][][][][][][]\n\n§h(x)Ride   §j( )Fly   §h(x)Jump   §h(x)Attack\n\n(§6*§r) - Indicates rare spawns for that biome");
	MENU_VELOCIRAPTOR.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Ammonite
	MENU_AMMONITE.title("Ammonite");
	MENU_AMMONITE.body("§l§2Species:§r §oAmmonite§r\n§5Bug (Bug Meat)\n\n§nAppears in:\n§a§l(o)§r Oceans, Beach\n§e§l(o)§r River§6*§r\n§b§l(o)§r Frozen§6*§r\n\n§cHealth:     []§r[][][][][][][][][]\n§6Attack:     §r[][][][][][][][][][]\n§tSize:        []§r[][][][][][][][][]\n\n§j( )Ride   §j( )Fly   §j( )Jump   §j( )Attack");
	MENU_AMMONITE.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Arthropleura
	MENU_ARTHROPLEURA.title("Arthropleura");
	MENU_ARTHROPLEURA.body("§l§2Species:§r §oArthropleura§r\n§5Bug (Bug Meat)\n\n§nAppears in:\n§a§l(o)§r Jungle, Swamp§6*§r, River§6*§r, Caves\n§e§l(o)§r Desert\n§b§l(o)§r Taiga§6*§r\n\n§cHealth:     [][][]§r[][][][][][][]\n§6Attack:     §r[][][][][][][][][][]\n§tSize:        [][]§r[][][][][][][][]\n\n§h(x)Ride   §j( )Fly   §j( )Jump   §j( )Attack");
	MENU_ARTHROPLEURA.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Meganeuropsis
	MENU_MEGANEUROPSIS.title("Meganeuropsis");
	MENU_MEGANEUROPSIS.body("§l§2Species:§r §oMeganeuropsis§r\n§5Bug (Bug Meat)\n\n§nAppears in:\n§a§l(o)§r Forest§6*§r, Jungle, River, Caves\n§e§l(o)§r Savanna§6*§r\n§b§l(o)§r Taiga§6*§r, Mountain\n\n§cHealth:     [][]§r[][][][][][][][]\n§6Attack:     §r[][][][][][][][][][]\n§tSize:        [][]§r[][][][][][][][]\n\n§h(x)Ride   §h(x)Fly   §j( )Jump   §j( )Attack");
	MENU_MEGANEUROPSIS.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Pulmonoscorpio
	MENU_PULMONOSCORPIO.title("Pulmonoscorpio");
	MENU_PULMONOSCORPIO.body("§l§2Species:§r §oPulmonoscorpio§r\n§5Bug (Bug Meat)\n\n§nAppears in:\n§a§l(o)§r Jungle, Swamp§6*§r, River§6*§r, Caves\n§e§l(o)§r Desert\n§b§l(o)§r Mountain§6*§r\n\n§cHealth:     [][]§r[][][][][][][][]\n§6Attack:     [][][]§r[][][][][][][] + §aPoison§r\n§tSize:        []§r[][][][][][][][][]\n\n§j( )Ride   §j( )Fly   §j( )Jump   §h(x)Attack");
	MENU_PULMONOSCORPIO.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
	
	//GUIDEBOOK Trilobite
	MENU_TRILOBITE.title("Trilobite");
	MENU_TRILOBITE.body("§l§2Species:§r §oTrilobite§r\n§5Bug (Bug Meat)\n\n§nAppears in:\n§a§l(o)§r River§6*§r\n§e§l(o)§r Beach\n§b§l(o)§r Oceans, Frozen§6*§r\n\n§cHealth:     []§r[][][][][][][][][]\n§6Attack:     §r[][][][][][][][][][]\n§tSize:        []§r[][][][][][][][][]\n\n§j( )Ride   §j( )Fly   §j( )Jump   §j( )Attack");
	MENU_TRILOBITE.button("Return", "textures/PixelBiester/Dino/icons/return_icon");

    //GUIDEBOOK ABOUT
    MENU_ABOUT.title({ translate: "pb_dino.menu_about_title" });
    MENU_ABOUT.body("Version: §a1.1.0§r\n\n\n§3Changelog:§r\n§21.1.0 - Vehicle Update!§r\n§8->§r New technology has been discovered, allowing us to fabricate and build vehicles!\n§8->§r We have also discovered how to dye armour and weapons in a cauldron.\n§8->§r Dinosaur attack strength and health are now linked to the game difficulty.\n§8->§r Dinosaurs now appear more spread out across different biomes.\n§8->§r Wild Dinosaurs have learned not to waste the spoils of their hunt and will eat food off the ground.\n§8->§r & several more minor changes to Dinosaur behaviour.\n\n§2Dinosaurs Add-On!§r created by Pixelbiester.§r\n\nFollow us:\n§3Twitter§r §o@Pixelbiester\n§r§dInstagram§r §o@pixelbiesterofficial§r\n§cYoutube§r §oPixelBiester§r\n§eWebsite§r §opixelbiester.net§r\n§sDiscord§r §opixelbiester.net/discord§r\n\n");
    MENU_ABOUT.button("Return", "textures/PixelBiester/Dino/icons/return_icon");
}

function menuMain(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_MAIN.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuTutorial(player);
                break;
            case 1:
                menuDinoList(player);
                break;
            case 2:
                menuVehicles(player);
                break;
            case 3:
                menuAbout(player);
                break;
            default: break;
        }
    });
}

function menuTutorial(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_TUTORIAL.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
			case 0:
				menuDinosaurs(player);
				break;
            case 1:
                menuLocating(player);
                break;
            case 2:
                menuHunting(player);
                break;
			case 3:
                menuCrafting(player);
                break;
			case 4:
                menuTaming(player);
                break;
			case 5:
                menuMain(player);
                break;
            default: break;
        }
    });
}


function menuVehicles(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_VEHICLES.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
			case 0:
				menuVehicleCrafting(player);
				break;
            case 1:
                menuFuel(player);
                break;
			case 2:
                menuJeep(player);
                break;
			case 3:
                menuBoat(player);
                break;
			case 4:
                menuPlane(player);
                break;
			case 5:
                menuHelicopter(player);
                break;
			case 6:
                menuMain(player);
                break;
            default: break;
        }
    });
}

function menuVehicleCrafting(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_VEHICLE_CRAFTING.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuVCMetalShaper(player);
                break;
            case 1:
                menuVCPyrolyzer(player);
                break;
            case 2:
                menuVehicles(player);
                break;
            default: break;
        }
    });
}

function menuFuel(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_FUEL.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuVehicles(player);
                break;
            default: break;
        }
    });
}

function menuJeep(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_JEEP.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuVehicles(player);
                break;
            default: break;
        }
    });
}

function menuBoat(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_BOAT.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuVehicles(player);
                break;
            default: break;
        }
    });
}

function menuPlane(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_PLANE.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuVehicles(player);
                break;
            default: break;
        }
    });
}

function menuHelicopter(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_HELICOPTER.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuCrate(player);
                break;
            case 1:
                menuVehicles(player);
                break;
            default: break;
        }
    });
}

function menuCrate(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_CRATE.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuHelicopter(player);
                break;
            default: break;
        }
    });
}

function menuVCMetalShaper(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_VC_METAL_SHAPER.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuVehicleCrafting(player);
                break;
            default: break;
        }
    });
}

function menuVCPyrolyzer(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_VC_PYROLYZER.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuVehicleCrafting(player);
                break;
            default: break;
        }
    });
}

function menuDinosaurs(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_DINOSAURS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuTutorial(player);
                break;
            default: break;
        }
    });
}

function menuLocating(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_LOCATING.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuTutorial(player);
                break;
            default: break;
        }
    });
}

function menuHunting(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_HUNTING.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuTutorial(player);
                break;
            default: break;
        }
    });
}

function menuCrafting(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_CRAFTING.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuTutorial(player);
                break;
            default: break;
        }
    });
}

function menuTaming(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_TAMING.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuRiding(player);
                break;
			case 1:
                menuBreeding(player);
                break;
			case 2:
                menuCommands(player);
                break;
			case 3:
                menuTutorial(player);
                break;
            default: break;
        }
    });
}

function menuRiding(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_RIDING.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuTaming(player);
                break;
            default: break;
        }
    });
}

function menuBreeding(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_BREEDING.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuTaming(player);
                break;
            default: break;
        }
    });
}

function menuCommands(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_COMMANDS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuTaming(player);
                break;
            default: break;
        }
    });
}

function menuDinoList(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_DINO_LIST.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
			case 0:
                menuMain(player);
                break;
			case 1:
                menuAmargasaurus(player);
                break;
			case 2:
                menuAnkylosaurus(player);
                break;
			case 3:
                menuBrachiosuaurs(player);
                break;
			case 4:
                menuCompsognathus(player);
                break;
			case 5:
                menuDeinosuchus(player);
                break;
			case 6:
                menuDiplodocus(player);
                break;
			case 7:
                menuHerrerasaurus(player);
                break;
			case 8:
                menuIguanodon(player);
                break;
			case 9:
                menuMosasaurus(player);
                break;
			case 10:
                menuOviraptor(player);
                break;
			case 11:
                menuPrenocephale(player);
                break;
			case 12:
                menuPteranodon(player);
                break;
			case 13:
                menuSpinosaurus(player);
                break;
			case 14:
                menuStegosaurus(player);
                break;
			case 15:
                menuStruthiomimus(player);
                break;
			case 16:
                menuTriceratops(player);
                break;
			case 17:
                menuTyrannosaurus(player);
				break;
			case 18:
				menuTupandactylus(player);
                break;
			case 19:
                menuUtahraptor(player);
                break;
			case 20:
                menuVelociraptor(player);
                break;
			case 21:
                menuAmmonite(player);
                break;
			case 22:
                menuArthropleura(player);
                break;
			case 23:
                menuMeganeuropsis(player);
                break;
			case 24:
                menuPulmonoscorpio(player);
                break;
			case 25:
                menuTrilobite(player);
                break;
            default: break;
        }
    });
}

function menuAbout(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_ABOUT.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuMain(player);
                break;
            default: break;
        }
    });
}

function menuAmargasaurus(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_AMARGASAURUS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuAnkylosaurus(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_ANKYLOSAURUS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuBrachiosuaurs(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_BRACHIOSAURUS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuCompsognathus(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_COMPSOGNATHUS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuDeinosuchus(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_DEINOSUCHUS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuDiplodocus(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_DIPLODOCUS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuHerrerasaurus(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_HERRERASAURUS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuIguanodon(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_IGUANODON.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuMosasaurus(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_MOSASAURUS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuOviraptor(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_OVIRAPTOR.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuPrenocephale(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_PRENOCEPHALE.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuPteranodon(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_PTERANODON.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuSpinosaurus(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_SPINOSAURUS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuStegosaurus(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_STEGOSAURUS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuStruthiomimus(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_STRUTHIOMIMUS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuTriceratops(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_TRICERATOPS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuTyrannosaurus(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_TYRANNOSAURUS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuTupandactylus(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_TUPANDACTYLUS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuUtahraptor(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_UTAHRAPTOR.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuVelociraptor(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_VELOCIRAPTOR.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuAmmonite(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_AMMONITE.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuArthropleura(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_ARTHROPLEURA.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuMeganeuropsis(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_MEGANEUROPSIS.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuPulmonoscorpio(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_PULMONOSCORPIO.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function menuTrilobite(player) {
    player.playSound(SOUND_TURN_PAGE, SOUND_OPTIONS);
    MENU_TRILOBITE.show(player).then(result => {
        if (result.canceled) return;

        let response = result.selection;
        switch (response) {
            case 0:
                menuDinoList(player);
                break;
            default: break;
        }
    });
}

function guideBookListeners() {
    //drop guidebook on player first spawn only
    mc.world.afterEvents.playerSpawn.subscribe((eventData) => {
        if (eventData.player.hasTag('pb_dino_book')) { }
        else {
            mc.world.getDimension(eventData.player.dimension.id).spawnItem(new mc.ItemStack("pb_dino:dino_guidebook", 1), eventData.player.location);
            eventData.player.addTag('pb_dino_book');
        }
    })

    //guidebook activation listener
    mc.world.afterEvents.itemUse.subscribe((eventData) => {
        let player = eventData.source;
        let itemUse = eventData.itemStack;
        if (itemUse === undefined) return;
        if (itemUse.typeId == "pb_dino:dino_guidebook") menuMain(player);
    })
}