Advertisement
Axebeard2025

CraftTweaker - Ancient Warfare Recipe Unlocks

Feb 28th, 2020
2,324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. // Ancient Warfare 2
  2. // Research Book Recipe Unlock
  3. // CraftTweaker 1.12.2 Script
  4. // written by Axebeard2025
  5. // Last Updated: 03/16/2020
  6. //
  7. // This script unlocks the Ancient Warfare Research Book
  8. // in the Minecraft Vanilla recipe book when the player
  9. // crafts or picks up an iron ingot, leather, or paper.
  10. //
  11. // This script does not unlock the Research Book when
  12. // an iron ingot, leather, or paper is given to the
  13. // player by a mod, console command or console block.
  14. // Also, this script does not work when the player is
  15. // in creative mode
  16.  
  17.  
  18. // PLAYER CRAFTED EVENTS CHECK
  19.  
  20. events.onPlayerCrafted(function(event as crafttweaker.event.PlayerCraftedEvent) { // Casts the crafttweaker.event.PlayerCraftedEvent into the function header
  21. if(event.output.definition.id == "minecraft:paper"){ // Checks if item crafted is minecraft:paper
  22. server.commandManager.executeCommand(server, "recipe give @p ancientwarfare:core/research_book"); // If paper is crafted, then player is given the recipe for AW2 Research Book
  23. }
  24. if(event.output.definition.id == "minecraft:leather"){ // Checks if item crafted is minecraft:leather
  25. server.commandManager.executeCommand(server, "recipe give @p ancientwarfare:core/research_book"); // If leather is crafted, then player is given the recipe for AW2 Research Book
  26. }
  27. if(event.output.definition.id == "minecraft:iron_ingot"){ // Checks if item crafted is minecraft:iron_ingot
  28. server.commandManager.executeCommand(server, "recipe give @p ancientwarfare:core/research_book"); // If iron ingot is crafted, then player is given the recipe for AW2 Research Book
  29. }
  30. });
  31.  
  32. // PLAYER PICK UP ITEM EVENTS CHECK
  33.  
  34. events.onPlayerPickupItem(function(event as crafttweaker.event.PlayerPickupItemEvent) { // Casts the crafttweaker.event.PlayerPickupItemEvent into the function header
  35. if(event.item.item.definition.id == "minecraft:paper"){ // Checks if item picked up is minecraft:paper
  36. server.commandManager.executeCommand(server, "recipe give @p ancientwarfare:core/research_book"); // If paper is picked up, then player is given the recipe for AW2 Research Book
  37. }
  38. if(event.item.item.definition.id == "minecraft:leather"){ // Checks if item picked up is minecraft:leather
  39. server.commandManager.executeCommand(server, "recipe give @p ancientwarfare:core/research_book"); // If leather is picked up, then player is given the recipe for AW2 Research Book
  40. }
  41. if(event.item.item.definition.id == "minecraft:iron_ingot"){ // Checks if item picked up is minecraft:iron_ingot
  42. server.commandManager.executeCommand(server, "recipe give @p ancientwarfare:core/research_book"); // If iron ingot is picked up, then player is given the recipe for AW2 Research Book
  43. }
  44. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement