recipes.txt 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. event.load("entity_click");
  2. event.load("inv_click");
  3. items_list = list.new(); //Array-List: Alle Items mit Rezepten
  4. recipe_site_map = map.new();
  5. air = "minecraft:air";
  6. air_item = read.item("air");
  7. leather = "minecraft:leather";
  8. string = "minecraft:string";
  9. bronze_ingot = "km:bronze_ingot";
  10. copper_ingot = "km:copper_ingot";
  11. tin_ingot = "km:tin_ingot";
  12. silver_ingot = "km:silver_ingot";
  13. stick = "minecraft:stick";
  14. planks = "minecraft:oak_planks";
  15. cobblestone = "minecraft:cobblestone";
  16. iron_ingot = "minecraft:iron_ingot";
  17. gold_ingot = "minecraft:gold_ingot";
  18. diamond = "minecraft:diamond";
  19. book = "minecraft:book";
  20. birch_planks = "minecraft:birch_planks";
  21. dark_oak_planks = "minecraft:dark_oak_planks";
  22. jungle_planks = "minecraft:jungle_planks";
  23. spruce_planks = "minecraft:spruce_planks";
  24. acacia_planks = "minecraft:acacia_planks";
  25. coarse_dirt = "minecraft:coarse_dirt";
  26. gravel = "minecraft:gravel";
  27. wheat = "minecraft:wheat";
  28. grass = "minecraft:grass";
  29. iron_nugget = "minecraft:iron_nugget";
  30. hay_bundle = "km:hay_bundle";
  31. real_hay_block = "km:real_hay_block";
  32. cloth = "km:cloth";
  33. recipe.add(1, "minecraft:saddle", leather, leather, leather, leather, string, leather, air, iron_ingot, air);
  34. recipe.add(1, "km:bronze_helmet", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, air, bronze_ingot, air, air, air);
  35. recipe.add(1, "km:bronze_chestplate", bronze_ingot, air, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot);
  36. recipe.add(1, "km:bronze_leggings", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, air, bronze_ingot, bronze_ingot, air, bronze_ingot);
  37. recipe.add(1, "km:bronze_boots", bronze_ingot, air, bronze_ingot, bronze_ingot, air, bronze_ingot, air, air, air);
  38. recipe.add(1, "km:copper_helmet", copper_ingot, copper_ingot, copper_ingot, copper_ingot, air, copper_ingot, air, air, air);
  39. recipe.add(1, "km:copper_chestplate", copper_ingot, air, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
  40. recipe.add(1, "km:copper_leggings", copper_ingot, copper_ingot, copper_ingot, copper_ingot, air, copper_ingot, copper_ingot, air, copper_ingot);
  41. recipe.add(1, "km:copper_boots", copper_ingot, air, copper_ingot, copper_ingot, air, copper_ingot, air, air, air);
  42. recipe.add(1, "km:bookshelf_acacia", acacia_planks, acacia_planks, acacia_planks, book, book, book, acacia_planks, acacia_planks, acacia_planks);
  43. recipe.add(1, "km:bookshelf_birch", birch_planks, birch_planks, birch_planks, book, book, book, birch_planks, birch_planks, birch_planks);
  44. 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);
  45. recipe.add(1, "km:bookshelf_jungle", jungle_planks, jungle_planks, jungle_planks, book, book, book, jungle_planks, jungle_planks, jungle_planks);
  46. recipe.add(1, "km:bookshelf_spruce", spruce_planks, spruce_planks, spruce_planks, book, book, book, spruce_planks, spruce_planks, spruce_planks);
  47. recipe.add(1, "km:copper_block", copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
  48. recipe.add(1, "km:bronze_block", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot);
  49. recipe.add(1, "km:tin_block", tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot, tin_ingot);
  50. recipe.add(1, "km:silver_block", silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot, silver_ingot);
  51. recipe.add(1, "km:cooking_pot_copper", copper_ingot, air, copper_ingot, copper_ingot, air, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
  52. recipe.add(1, bronze_ingot, tin_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot, copper_ingot);
  53. recipe.add(1, copper_ingot, air, air, air, air, "km:copper_ore", air, air, air, air);
  54. recipe.add(1, tin_ingot, air, air, air, air, "km:tin_ore", air, air, air, air);
  55. recipe.add(1, silver_ingot, air, air, air, air, "km:silver_ore", air, air, air, air);
  56. recipe.add(1, "km:spikes_bronze", air, bronze_ingot, air, bronze_ingot, bronze_ingot, bronze_ingot, air, air, air);
  57. recipe.add(1, "km:spikes_copper", air, copper_ingot, air, copper_ingot, copper_ingot, copper_ingot, air, air, air);
  58. recipe.add(1, "km:spikes_gold", air, gold_ingot, air, gold_ingot, gold_ingot, gold_ingot, air, air, air);
  59. recipe.add(1, "km:spikes_iron", air, iron_ingot, air, iron_ingot, iron_ingot, iron_ingot, air, air, air);
  60. recipe.add(1, "km:wooden_battleaxe", air, planks, planks, air, stick, planks, stick, air, air);
  61. recipe.add(1, "km:stone_battleaxe", air, cobblestone, cobblestone, air, stick, cobblestone, stick, air, air);
  62. recipe.add(1, "km:iron_battleaxe", air, iron_ingot, iron_ingot, air, stick, iron_ingot, stick, air, air);
  63. recipe.add(1, "km:golden_battleaxe", air, gold_ingot, gold_ingot, air, stick, gold_ingot, stick, air, air);
  64. recipe.add(1, "km:diamond_battleaxe", air, diamond, diamond, air, stick, diamond, stick, air, air);
  65. recipe.add(1, "km:copper_battleaxe", air, copper_ingot, copper_ingot, air, stick, copper_ingot, stick, air, air);
  66. recipe.add(1, "km:bronze_battleaxe", air, bronze_ingot, bronze_ingot, air, stick, bronze_ingot, stick, air, air);
  67. recipe.add(1, "km:copper_axe", air, copper_ingot, copper_ingot, air, copper_ingot, stick, air, air, stick);
  68. recipe.add(1, "km:bronze_axe", air, bronze_ingot, bronze_ingot, air, bronze_ingot, stick, air, air, stick);
  69. recipe.add(1, "km:wooden_dagger", air, air, planks, air, stick, air, air, air, air);
  70. recipe.add(1, "km:stone_dagger", air, air, cobblestone, air, stick, air, air, air, air);
  71. recipe.add(1, "km:iron_dagger", air, air, iron_ingot, air, stick, air, air, air, air);
  72. recipe.add(1, "km:golden_dagger", air, air, gold_ingot, air, stick, air, air, air, air);
  73. recipe.add(1, "km:diamond_dagger", air, air, diamond, air, stick, air, air, air, air);
  74. recipe.add(1, "km:copper_dagger", air, air, copper_ingot, air, stick, air, air, air, air);
  75. recipe.add(1, "km:bronze_dagger", air, air, bronze_ingot, air, stick, air, air, air, air);
  76. recipe.add(1, "km:copper_hoe", air, copper_ingot, copper_ingot, air, air, stick, air, air, stick);
  77. recipe.add(1, "km:bronze_hoe", air, bronze_ingot, bronze_ingot, air, air, stick, air, air, stick);
  78. recipe.add(1, "km:wooden_hammer", planks, planks, planks, planks, stick, planks, air, stick, air);
  79. recipe.add(1, "km:stone_hammer", cobblestone, cobblestone, cobblestone, cobblestone, stick, cobblestone, air, stick, air);
  80. recipe.add(1, "km:iron_hammer", iron_ingot, iron_ingot, iron_ingot, iron_ingot, stick, iron_ingot, air, stick, air);
  81. recipe.add(1, "km:golden_hammer", gold_ingot, gold_ingot, gold_ingot, gold_ingot, stick, gold_ingot, air, stick, air);
  82. recipe.add(1, "km:diamond_hammer", diamond, diamond, diamond, diamond, stick, diamond, air, stick, air);
  83. recipe.add(1, "km:copper_hammer", copper_ingot, copper_ingot, copper_ingot, copper_ingot, stick, copper_ingot, air, stick, air);
  84. recipe.add(1, "km:bronze_hammer", bronze_ingot, bronze_ingot, bronze_ingot, bronze_ingot, stick, bronze_ingot, air, stick, air);
  85. recipe.add(1, "km:copper_shovel", air, copper_ingot, air, air, stick, air, air, stick, air);
  86. recipe.add(1, "km:bronze_shovel", air, bronze_ingot, air, air, stick, air, air, stick, air);
  87. recipe.add(1, "km:wooden_scepter", air, stick, planks, air, stick, stick, stick, air, air);
  88. recipe.add(1, "km:stone_scepter", air, stick, cobblestone, air, stick, stick, stick, air, air);
  89. recipe.add(1, "km:iron_scepter", air, stick, iron_ingot, air, stick, stick, stick, air, air);
  90. recipe.add(1, "km:golden_scepter", air, stick, gold_ingot, air, stick, stick, stick, air, air);
  91. recipe.add(1, "km:diamond_scepter", air, stick, diamond, air, stick, stick, stick, air, air);
  92. recipe.add(1, "km:copper_scepter", air, stick, copper_ingot, air, stick, stick, stick, air, air);
  93. recipe.add(1, "km:bronze_scepter", air, stick, bronze_ingot, air, stick, stick, stick, air, air);
  94. recipe.add(1, "km:copper_pickaxe", copper_ingot, copper_ingot, copper_ingot, air, stick, air, air, stick, air);
  95. recipe.add(1, "km:bronze_pickaxe", bronze_ingot, bronze_ingot, bronze_ingot, air, stick, air, air, stick, air);
  96. recipe.add(1, "km:wooden_stick", air, air, planks, air, stick, air, planks, air, air);
  97. recipe.add(1, "km:stone_stick", air, air, cobblestone, air, stick, air, cobblestone, air, air);
  98. recipe.add(1, "km:iron_stick", air, air, iron_ingot, air, stick, air, iron_ingot, air, air);
  99. recipe.add(1, "km:golden_stick", air, air, gold_ingot, air, stick, air, gold_ingot, air, air);
  100. recipe.add(1, "km:diamond_stick", air, air, diamond, air, stick, air, diamond, air, air);
  101. recipe.add(1, "km:copper_stick", air, air, copper_ingot, air, stick, air, copper_ingot, air, air);
  102. recipe.add(1, "km:bronze_stick", air, air, bronze_ingot, air, stick, air, bronze_ingot, air, air);
  103. recipe.add(1, "km:copper_sword", air, copper_ingot, air, air, copper_ingot, air, air, stick, air);
  104. recipe.add(1, "km:bronze_sword", air, bronze_ingot, air, air, bronze_ingot, air, air, stick, air);
  105. recipe.add(1, "km:mushroom_stick_raw", air, "minecraft:brown_mushroom", "minecraft:brown_mushroom", air, stick, "minecraft:red_mushroom", air, air, air);
  106. recipe.add(1, "km:mushroom_stick_cooked", air, air, air, air, "km:mushroom_stick_raw", air, air, air, air);
  107. recipe.add(1, "km:fried_egg", air, air, air, air, "minecraft:egg", air, air, air, air);
  108. recipe.add(1, "km:crate_acacia", acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks, acacia_planks);
  109. recipe.add(1, "km:crate_birch", birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks, birch_planks);
  110. 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);
  111. recipe.add(1, "km:crate_oak", planks, planks, planks, planks, planks, planks, planks, planks, planks);
  112. recipe.add(1, "km:crate_jungle", jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks, jungle_planks);
  113. recipe.add(1, "km:crate_spruce", spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks, spruce_planks);
  114. recipe.add(1, "km:coarse_dirt_slab", air, air, air, coarse_dirt, coarse_dirt, coarse_dirt, air, air, air);
  115. recipe.add(1, "km:gravel_slab", air, air, air, gravel, gravel, gravel, air, air, air);
  116. recipe.add(1, "km:straw_hat", air, wheat, air, wheat, wheat, wheat, air, air, air);
  117. recipe.add(1, hay_bundle, grass, grass, grass, grass, grass, grass, grass, grass, grass);
  118. recipe.add(1, real_hay_block, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle, hay_bundle);
  119. recipe.add(1, "km:real_hay_bed", air, air, air, real_hay_block, real_hay_block, real_hay_block, air, air, air);
  120. 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);
  121. recipe.add(1, "km:sling", stick, string, stick, stick, air, stick, air, stick, air);
  122. recipe.add(4, "minecraft:string", air, air, air, air, "minecraft:white_wool", air, air, air, air);
  123. recipe.add(4, "km:cloth_helmet", cloth, cloth, cloth, cloth, air, cloth, air, air, air);
  124. recipe.add(4, "km:cloth_chestplate", cloth, air, cloth, cloth, cloth, cloth, cloth, cloth, cloth);
  125. recipe.add(4, "km:cloth_leggings", cloth, cloth, cloth, cloth, air, cloth, cloth, air, cloth);
  126. recipe.add(4, "km:cloth_boots", cloth, air, cloth, cloth, air, cloth, air, air, air);
  127. msg("dev", "§bRecipes §rloaded.");
  128. @wait
  129. wait();
  130. if(event == "entity_click") {
  131. if(hand == "OFF_HAND") {
  132. goto("wait");
  133. }
  134. if(entity.getType(entity) != "human") {
  135. goto("wait");
  136. }
  137. if(entity.getName(entity) == "Recipes") {
  138. recipe_menu = inv.new("333333333333333333333333333333333333333333333200000022");
  139. recipe.setPage(player, recipe_menu, 1);
  140. inv.open(recipe_menu, player, "Recipes");
  141. }
  142. goto("wait");
  143. }
  144. if(event == "inv_click") {
  145. if(inv_name == "Recipes") {
  146. item_type = item.getType(item);
  147. if(item_type == "minecraft:air") {
  148. goto("wait");
  149. }
  150. if(item_type == "km:return_red") {
  151. page = map.getOrDefault($recipe_site_map, player.getUuid(player), 1);
  152. recipe.setPage(player, inv, page);
  153. goto("wait");
  154. }
  155. if(item_type == "minecraft:paper") {
  156. name = item.getName(item);
  157. if(text.contains(name, "<<") || text.contains(name, ">>")) {
  158. page = removeFormat(name);
  159. page = text.replace(page, "<<", "");
  160. page = text.replace(page, ">>", "");
  161. page = read.number(page);
  162. if(inv_slot == 46) {
  163. recipe.setPage(player, inv, page);
  164. }
  165. if(inv_slot == 47) {
  166. recipe.setPage(player, inv, page);
  167. }
  168. goto("wait");
  169. }
  170. }
  171. index = recipe.getIndexFromItemType(item_type);
  172. if(index == null) {
  173. goto("wait");
  174. }
  175. recipe.showRecipe(player, inv, index);
  176. }
  177. }
  178. goto("wait");
  179. function recipe.add(result_amount, result_item, item1, item2, item3, item4, item5, item6, item7, item8, item9) {
  180. array = array.new(11);
  181. array[0] = result_amount;
  182. array[1] = result_item;
  183. array[2] = item1;
  184. array[3] = item2;
  185. array[4] = item3;
  186. array[5] = item4;
  187. array[6] = item5;
  188. array[7] = item6;
  189. array[8] = item7;
  190. array[9] = item8;
  191. array[10] = item9;
  192. list.add($items_list, array);
  193. }
  194. function recipe.getIndexFromItemType(item_type) {
  195. for(i = 0; i < list.getSize($items_list); i++) {
  196. array = list.getIndex($items_list, i);
  197. if(array[1] == item_type) {
  198. return i;
  199. }
  200. }
  201. return null;
  202. }
  203. function recipe.showRecipe(player, menu, index) {
  204. for(i = 0; i < 48; i++) {
  205. inv.setItem(menu, i, $air_item);
  206. }
  207. array = list.getIndex($items_list, index);
  208. inv.setItem(menu, 23, read.item("km:arrow_right"));
  209. inv.setItem(menu, 45, read.item("km:return_red", 1, "§fReturn to overview"));
  210. inv.setItem(menu, 10, read.item(array[2]));
  211. inv.setItem(menu, 11, read.item(array[3]));
  212. inv.setItem(menu, 12, read.item(array[4]));
  213. inv.setItem(menu, 19, read.item(array[5]));
  214. inv.setItem(menu, 20, read.item(array[6]));
  215. inv.setItem(menu, 21, read.item(array[7]));
  216. inv.setItem(menu, 28, read.item(array[8]));
  217. inv.setItem(menu, 29, read.item(array[9]));
  218. inv.setItem(menu, 30, read.item(array[10]));
  219. inv.setItem(menu, 25, read.item(array[1], array[0]));
  220. inv.update(player);
  221. }
  222. function recipe.setPage(player, menu, page) {
  223. map.add($recipe_site_map, player.getUuid(player), page);
  224. size = list.getSize($items_list);
  225. max_page = math.roundUp(size / 45);
  226. if(page > max_page) {
  227. return;
  228. }
  229. inv.setItem(menu, 45, $air_item);
  230. if(page > 1) {
  231. inv.setItem(menu, 46, read.item("minecraft:paper", 1, concat("§e", text.number(page - 1), " <<")));
  232. } else {
  233. inv.setItem(menu, 46, $air_item);
  234. }
  235. if(page < max_page) {
  236. inv.setItem(menu, 47, read.item("minecraft:paper", 1, concat("§e>> ", text.number(page + 1))));
  237. } else {
  238. inv.setItem(menu, 47, $air_item);
  239. }
  240. max_index = size - 1;
  241. for(i = 0; i < 45; i++) {
  242. list_index = i + 45 * (page - 1);
  243. if(list_index > max_index) {
  244. inv.setItem(menu, i, $air_item);
  245. } else {
  246. array = list.getIndex($items_list, list_index);
  247. inv.setItem(menu, i, read.item(array[1]));
  248. }
  249. }
  250. inv.update(player);
  251. }