|
@@ -1,259 +0,0 @@
|
|
|
-event.load("entity_click");
|
|
|
-event.load("inv_click");
|
|
|
-
|
|
|
-items_list = list.new(); //Array-List: Alle Items mit Rezepten
|
|
|
-recipe_site_map = map.new();
|
|
|
-
|
|
|
-air = "minecraft:air";
|
|
|
-air_item = read.item("air");
|
|
|
-leather = "minecraft:leather";
|
|
|
-string = "minecraft:string";
|
|
|
-bronze_ingot = "km:bronze_ingot";
|
|
|
-copper_ingot = "km:copper_ingot";
|
|
|
-tin_ingot = "km:tin_ingot";
|
|
|
-silver_ingot = "km:silver_ingot";
|
|
|
-stick = "minecraft:stick";
|
|
|
-planks = "minecraft:oak_planks";
|
|
|
-cobblestone = "minecraft:cobblestone";
|
|
|
-iron_ingot = "minecraft:iron_ingot";
|
|
|
-gold_ingot = "minecraft:gold_ingot";
|
|
|
-diamond = "minecraft:diamond";
|
|
|
-book = "minecraft:book";
|
|
|
-birch_planks = "minecraft:birch_planks";
|
|
|
-dark_oak_planks = "minecraft:dark_oak_planks";
|
|
|
-jungle_planks = "minecraft:jungle_planks";
|
|
|
-spruce_planks = "minecraft:spruce_planks";
|
|
|
-acacia_planks = "minecraft:acacia_planks";
|
|
|
-coarse_dirt = "minecraft:coarse_dirt";
|
|
|
-gravel = "minecraft:gravel";
|
|
|
-wheat = "minecraft:wheat";
|
|
|
-grass = "minecraft:grass";
|
|
|
-iron_nugget = "minecraft:iron_nugget";
|
|
|
-hay_bundle = "km:hay_bundle";
|
|
|
-real_hay_block = "km:real_hay_block";
|
|
|
-cloth = "km:cloth";
|
|
|
-
|
|
|
-recipe.add(1, "minecraft:saddle", leather, leather, leather, leather, string, leather, air, iron_ingot, air);
|
|
|
-recipe.add(1, "km:bronze_helmet", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, air, bronze_ingot, air, air, air);
|
|
|
-recipe.add(1, "km:bronze_chestplate", bronze_ingot, air, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot);
|
|
|
-recipe.add(1, "km:bronze_leggings", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, air, bronze_ingot, bronze_ingot, air, bronze_ingot);
|
|
|
-recipe.add(1, "km:bronze_boots", bronze_ingot, air, bronze_ingot, bronze_ingot, air, bronze_ingot, air, air, air);
|
|
|
-recipe.add(1, "km:copper_helmet", copper_ingot, copper_ingot, copper_ingot, copper_ingot, air, copper_ingot, air, air, air);
|
|
|
-recipe.add(1, "km:copper_chestplate", copper_ingot, air, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
|
|
|
-recipe.add(1, "km:copper_leggings", copper_ingot, copper_ingot, copper_ingot, copper_ingot, air, copper_ingot, copper_ingot, air, copper_ingot);
|
|
|
-recipe.add(1, "km:copper_boots", copper_ingot, air, copper_ingot, copper_ingot, air, copper_ingot, air, air, air);
|
|
|
-recipe.add(1, "km:bookshelf_acacia", acacia_planks, acacia_planks, acacia_planks, book, book, book, acacia_planks, acacia_planks, acacia_planks);
|
|
|
-recipe.add(1, "km:bookshelf_birch", birch_planks, birch_planks, birch_planks, book, book, book, birch_planks, birch_planks, birch_planks);
|
|
|
-recipe.add(1, "km:bookshelf_dark_oak", dark_oak_planks, dark_oak_planks, dark_oak_planks, book, book, book, dark_oak_planks, dark_oak_planks, dark_oak_planks);
|
|
|
-recipe.add(1, "km:bookshelf_jungle", jungle_planks, jungle_planks, jungle_planks, book, book, book, jungle_planks, jungle_planks, jungle_planks);
|
|
|
-recipe.add(1, "km:bookshelf_spruce", spruce_planks, spruce_planks, spruce_planks, book, book, book, spruce_planks, spruce_planks, spruce_planks);
|
|
|
-recipe.add(1, "km:copper_block", copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
|
|
|
-recipe.add(1, "km:bronze_block", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot);
|
|
|
-recipe.add(1, "km:tin_block", tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot);
|
|
|
-recipe.add(1, "km:silver_block", silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot);
|
|
|
-recipe.add(1, "km:cooking_pot_copper", copper_ingot, air, copper_ingot, copper_ingot, air, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
|
|
|
-recipe.add(1, bronze_ingot, tin_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
|
|
|
-recipe.add(1, copper_ingot, air, air, air, air, "km:copper_ore", air, air, air, air);
|
|
|
-recipe.add(1, tin_ingot, air, air, air, air, "km:tin_ore", air, air, air, air);
|
|
|
-recipe.add(1, silver_ingot, air, air, air, air, "km:silver_ore", air, air, air, air);
|
|
|
-recipe.add(1, "km:spikes_bronze", air, bronze_ingot, air, bronze_ingot, bronze_ingot, bronze_ingot, air, air, air);
|
|
|
-recipe.add(1, "km:spikes_copper", air, copper_ingot, air, copper_ingot, copper_ingot, copper_ingot, air, air, air);
|
|
|
-recipe.add(1, "km:spikes_gold", air, gold_ingot, air, gold_ingot, gold_ingot, gold_ingot, air, air, air);
|
|
|
-recipe.add(1, "km:spikes_iron", air, iron_ingot, air, iron_ingot, iron_ingot, iron_ingot, air, air, air);
|
|
|
-recipe.add(1, "km:wooden_battleaxe", air, planks, planks, air, stick, planks, stick, air, air);
|
|
|
-recipe.add(1, "km:stone_battleaxe", air, cobblestone, cobblestone, air, stick, cobblestone, stick, air, air);
|
|
|
-recipe.add(1, "km:iron_battleaxe", air, iron_ingot, iron_ingot, air, stick, iron_ingot, stick, air, air);
|
|
|
-recipe.add(1, "km:golden_battleaxe", air, gold_ingot, gold_ingot, air, stick, gold_ingot, stick, air, air);
|
|
|
-recipe.add(1, "km:diamond_battleaxe", air, diamond, diamond, air, stick, diamond, stick, air, air);
|
|
|
-recipe.add(1, "km:copper_battleaxe", air, copper_ingot, copper_ingot, air, stick, copper_ingot, stick, air, air);
|
|
|
-recipe.add(1, "km:bronze_battleaxe", air, bronze_ingot, bronze_ingot, air, stick, bronze_ingot, stick, air, air);
|
|
|
-recipe.add(1, "km:copper_axe", air, copper_ingot, copper_ingot, air, copper_ingot, stick, air, air, stick);
|
|
|
-recipe.add(1, "km:bronze_axe", air, bronze_ingot, bronze_ingot, air, bronze_ingot, stick, air, air, stick);
|
|
|
-recipe.add(1, "km:wooden_dagger", air, air, planks, air, stick, air, air, air, air);
|
|
|
-recipe.add(1, "km:stone_dagger", air, air, cobblestone, air, stick, air, air, air, air);
|
|
|
-recipe.add(1, "km:iron_dagger", air, air, iron_ingot, air, stick, air, air, air, air);
|
|
|
-recipe.add(1, "km:golden_dagger", air, air, gold_ingot, air, stick, air, air, air, air);
|
|
|
-recipe.add(1, "km:diamond_dagger", air, air, diamond, air, stick, air, air, air, air);
|
|
|
-recipe.add(1, "km:copper_dagger", air, air, copper_ingot, air, stick, air, air, air, air);
|
|
|
-recipe.add(1, "km:bronze_dagger", air, air, bronze_ingot, air, stick, air, air, air, air);
|
|
|
-recipe.add(1, "km:copper_hoe", air, copper_ingot, copper_ingot, air, air, stick, air, air, stick);
|
|
|
-recipe.add(1, "km:bronze_hoe", air, bronze_ingot, bronze_ingot, air, air, stick, air, air, stick);
|
|
|
-recipe.add(1, "km:wooden_hammer", planks, planks, planks, planks, stick, planks, air, stick, air);
|
|
|
-recipe.add(1, "km:stone_hammer", cobblestone, cobblestone, cobblestone, cobblestone, stick, cobblestone, air, stick, air);
|
|
|
-recipe.add(1, "km:iron_hammer", iron_ingot, iron_ingot, iron_ingot, iron_ingot, stick, iron_ingot, air, stick, air);
|
|
|
-recipe.add(1, "km:golden_hammer", gold_ingot, gold_ingot, gold_ingot, gold_ingot, stick, gold_ingot, air, stick, air);
|
|
|
-recipe.add(1, "km:diamond_hammer", diamond, diamond, diamond, diamond, stick, diamond, air, stick, air);
|
|
|
-recipe.add(1, "km:copper_hammer", copper_ingot, copper_ingot, copper_ingot, copper_ingot, stick, copper_ingot, air, stick, air);
|
|
|
-recipe.add(1, "km:bronze_hammer", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, stick, bronze_ingot, air, stick, air);
|
|
|
-recipe.add(1, "km:copper_shovel", air, copper_ingot, air, air, stick, air, air, stick, air);
|
|
|
-recipe.add(1, "km:bronze_shovel", air, bronze_ingot, air, air, stick, air, air, stick, air);
|
|
|
-recipe.add(1, "km:wooden_scepter", air, stick, planks, air, stick, stick, stick, air, air);
|
|
|
-recipe.add(1, "km:stone_scepter", air, stick, cobblestone, air, stick, stick, stick, air, air);
|
|
|
-recipe.add(1, "km:iron_scepter", air, stick, iron_ingot, air, stick, stick, stick, air, air);
|
|
|
-recipe.add(1, "km:golden_scepter", air, stick, gold_ingot, air, stick, stick, stick, air, air);
|
|
|
-recipe.add(1, "km:diamond_scepter", air, stick, diamond, air, stick, stick, stick, air, air);
|
|
|
-recipe.add(1, "km:copper_scepter", air, stick, copper_ingot, air, stick, stick, stick, air, air);
|
|
|
-recipe.add(1, "km:bronze_scepter", air, stick, bronze_ingot, air, stick, stick, stick, air, air);
|
|
|
-recipe.add(1, "km:copper_pickaxe", copper_ingot, copper_ingot, copper_ingot, air, stick, air, air, stick, air);
|
|
|
-recipe.add(1, "km:bronze_pickaxe", bronze_ingot, bronze_ingot, bronze_ingot, air, stick, air, air, stick, air);
|
|
|
-recipe.add(1, "km:wooden_stick", air, air, planks, air, stick, air, planks, air, air);
|
|
|
-recipe.add(1, "km:stone_stick", air, air, cobblestone, air, stick, air, cobblestone, air, air);
|
|
|
-recipe.add(1, "km:iron_stick", air, air, iron_ingot, air, stick, air, iron_ingot, air, air);
|
|
|
-recipe.add(1, "km:golden_stick", air, air, gold_ingot, air, stick, air, gold_ingot, air, air);
|
|
|
-recipe.add(1, "km:diamond_stick", air, air, diamond, air, stick, air, diamond, air, air);
|
|
|
-recipe.add(1, "km:copper_stick", air, air, copper_ingot, air, stick, air, copper_ingot, air, air);
|
|
|
-recipe.add(1, "km:bronze_stick", air, air, bronze_ingot, air, stick, air, bronze_ingot, air, air);
|
|
|
-recipe.add(1, "km:copper_sword", air, copper_ingot, air, air, copper_ingot, air, air, stick, air);
|
|
|
-recipe.add(1, "km:bronze_sword", air, bronze_ingot, air, air, bronze_ingot, air, air, stick, air);
|
|
|
-recipe.add(1, "km:mushroom_stick_raw", air, "minecraft:brown_mushroom", "minecraft:brown_mushroom", air, stick, "minecraft:red_mushroom", air, air, air);
|
|
|
-recipe.add(1, "km:mushroom_stick_cooked", air, air, air, air, "km:mushroom_stick_raw", air, air, air, air);
|
|
|
-recipe.add(1, "km:fried_egg", air, air, air, air, "minecraft:egg", air, air, air, air);
|
|
|
-recipe.add(1, "km:crate_acacia", acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks);
|
|
|
-recipe.add(1, "km:crate_birch", birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks);
|
|
|
-recipe.add(1, "km:crate_big_oak", dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks, dark_oak_planks);
|
|
|
-recipe.add(1, "km:crate_oak", planks, planks, planks, planks, planks, planks, planks, planks, planks);
|
|
|
-recipe.add(1, "km:crate_jungle", jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks);
|
|
|
-recipe.add(1, "km:crate_spruce", spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks);
|
|
|
-recipe.add(1, "km:coarse_dirt_slab", air, air, air, coarse_dirt, coarse_dirt, coarse_dirt, air, air, air);
|
|
|
-recipe.add(1, "km:gravel_slab", air, air, air, gravel, gravel, gravel, air, air, air);
|
|
|
-recipe.add(1, "km:straw_hat", air, wheat, air, wheat, wheat, wheat, air, air, air);
|
|
|
-recipe.add(1, hay_bundle, grass, grass, grass, grass, grass, grass, grass, grass, grass);
|
|
|
-recipe.add(1, real_hay_block, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle);
|
|
|
-recipe.add(1, "km:real_hay_bed", air, air, air, real_hay_block, real_hay_block, real_hay_block, air, air, air);
|
|
|
-recipe.add(1, "km:lantern", iron_nugget, iron_nugget, iron_nugget, "minecraft:glass_pane", "minecraft:torch", "minecraft:glass_pane", iron_nugget, iron_nugget, iron_nugget);
|
|
|
-recipe.add(1, "km:sling", stick, string, stick, stick, air, stick, air, stick, air);
|
|
|
-recipe.add(4, "minecraft:string", air, air, air, air, "minecraft:white_wool", air, air, air, air);
|
|
|
-recipe.add(4, "km:cloth_helmet", cloth, cloth, cloth, cloth, air, cloth, air, air, air);
|
|
|
-recipe.add(4, "km:cloth_chestplate", cloth, air, cloth, cloth, cloth, cloth, cloth, cloth, cloth);
|
|
|
-recipe.add(4, "km:cloth_leggings", cloth, cloth, cloth, cloth, air, cloth, cloth, air, cloth);
|
|
|
-recipe.add(4, "km:cloth_boots", cloth, air, cloth, cloth, air, cloth, air, air, air);
|
|
|
-
|
|
|
-msg("dev", "§bRecipes §rloaded.");
|
|
|
-@wait
|
|
|
-wait();
|
|
|
-if(event == "entity_click") {
|
|
|
- if(hand == "OFF_HAND") {
|
|
|
- goto("wait");
|
|
|
- }
|
|
|
- if(entity.getType(entity) != "human") {
|
|
|
- goto("wait");
|
|
|
- }
|
|
|
- if(entity.getName(entity) == "Recipes") {
|
|
|
- recipe_menu = inv.new("333333333333333333333333333333333333333333333200000022");
|
|
|
- recipe.setPage(player, recipe_menu, 1);
|
|
|
- inv.open(recipe_menu, player, "Recipes");
|
|
|
- }
|
|
|
- goto("wait");
|
|
|
-}
|
|
|
-if(event == "inv_click") {
|
|
|
- if(inv_name == "Recipes") {
|
|
|
- item_type = item.getType(item);
|
|
|
- if(item_type == "minecraft:air") {
|
|
|
- goto("wait");
|
|
|
- }
|
|
|
- if(item_type == "km:return_red") {
|
|
|
- page = map.getOrDefault($recipe_site_map, player.getUuid(player), 1);
|
|
|
- recipe.setPage(player, inv, page);
|
|
|
- goto("wait");
|
|
|
- }
|
|
|
- if(item_type == "minecraft:paper") {
|
|
|
- name = item.getName(item);
|
|
|
- if(text.contains(name, "<<") || text.contains(name, ">>")) {
|
|
|
- page = removeFormat(name);
|
|
|
- page = text.replace(page, "<<", "");
|
|
|
- page = text.replace(page, ">>", "");
|
|
|
- page = read.number(page);
|
|
|
- if(inv_slot == 46) {
|
|
|
- recipe.setPage(player, inv, page);
|
|
|
- }
|
|
|
- if(inv_slot == 47) {
|
|
|
- recipe.setPage(player, inv, page);
|
|
|
- }
|
|
|
- goto("wait");
|
|
|
- }
|
|
|
- }
|
|
|
- index = recipe.getIndexFromItemType(item_type);
|
|
|
- if(index == null) {
|
|
|
- goto("wait");
|
|
|
- }
|
|
|
- recipe.showRecipe(player, inv, index);
|
|
|
- }
|
|
|
-}
|
|
|
-goto("wait");
|
|
|
-
|
|
|
-function recipe.add(result_amount, result_item, item1, item2, item3, item4, item5, item6, item7, item8, item9) {
|
|
|
- array = array.new(11);
|
|
|
- array[0] = result_amount;
|
|
|
- array[1] = result_item;
|
|
|
- array[2] = item1;
|
|
|
- array[3] = item2;
|
|
|
- array[4] = item3;
|
|
|
- array[5] = item4;
|
|
|
- array[6] = item5;
|
|
|
- array[7] = item6;
|
|
|
- array[8] = item7;
|
|
|
- array[9] = item8;
|
|
|
- array[10] = item9;
|
|
|
- list.add($items_list, array);
|
|
|
-}
|
|
|
-
|
|
|
-function recipe.getIndexFromItemType(item_type) {
|
|
|
- for(i = 0; i < list.getSize($items_list); i++) {
|
|
|
- array = list.getIndex($items_list, i);
|
|
|
- if(array[1] == item_type) {
|
|
|
- return i;
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
-}
|
|
|
-
|
|
|
-function recipe.showRecipe(player, menu, index) {
|
|
|
- for(i = 0; i < 48; i++) {
|
|
|
- inv.setItem(menu, i, $air_item);
|
|
|
- }
|
|
|
- array = list.getIndex($items_list, index);
|
|
|
- inv.setItem(menu, 23, read.item("km:arrow_right"));
|
|
|
- inv.setItem(menu, 45, read.item("km:return_red", 1, "§fReturn to overview"));
|
|
|
- inv.setItem(menu, 10, read.item(array[2]));
|
|
|
- inv.setItem(menu, 11, read.item(array[3]));
|
|
|
- inv.setItem(menu, 12, read.item(array[4]));
|
|
|
- inv.setItem(menu, 19, read.item(array[5]));
|
|
|
- inv.setItem(menu, 20, read.item(array[6]));
|
|
|
- inv.setItem(menu, 21, read.item(array[7]));
|
|
|
- inv.setItem(menu, 28, read.item(array[8]));
|
|
|
- inv.setItem(menu, 29, read.item(array[9]));
|
|
|
- inv.setItem(menu, 30, read.item(array[10]));
|
|
|
- inv.setItem(menu, 25, read.item(array[1], array[0]));
|
|
|
- inv.update(player);
|
|
|
-}
|
|
|
-
|
|
|
-function recipe.setPage(player, menu, page) {
|
|
|
- map.add($recipe_site_map, player.getUuid(player), page);
|
|
|
- size = list.getSize($items_list);
|
|
|
- max_page = math.roundUp(size / 45);
|
|
|
- if(page > max_page) {
|
|
|
- return;
|
|
|
- }
|
|
|
- inv.setItem(menu, 45, $air_item);
|
|
|
- if(page > 1) {
|
|
|
- inv.setItem(menu, 46, read.item("minecraft:paper", 1, concat("§e", text.number(page - 1), " <<")));
|
|
|
- } else {
|
|
|
- inv.setItem(menu, 46, $air_item);
|
|
|
- }
|
|
|
- if(page < max_page) {
|
|
|
- inv.setItem(menu, 47, read.item("minecraft:paper", 1, concat("§e>> ", text.number(page + 1))));
|
|
|
- } else {
|
|
|
- inv.setItem(menu, 47, $air_item);
|
|
|
- }
|
|
|
- max_index = size - 1;
|
|
|
- for(i = 0; i < 45; i++) {
|
|
|
- list_index = i + 45 * (page - 1);
|
|
|
- if(list_index > max_index) {
|
|
|
- inv.setItem(menu, i, $air_item);
|
|
|
- } else {
|
|
|
- array = list.getIndex($items_list, list_index);
|
|
|
- inv.setItem(menu, i, read.item(array[1]));
|
|
|
- }
|
|
|
- }
|
|
|
- inv.update(player);
|
|
|
-}
|