Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.16 KB | None | 0 0
  1. package me.Shkiperrr.CustomCrafts;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.ChatColor;
  8. import org.bukkit.Material;
  9. import org.bukkit.NamespacedKey;
  10. import org.bukkit.command.Command;
  11. import org.bukkit.command.CommandSender;
  12. import org.bukkit.inventory.ItemStack;
  13. import org.bukkit.inventory.ShapedRecipe;
  14. import org.bukkit.inventory.meta.ItemMeta;
  15. import org.bukkit.plugin.java.JavaPlugin;
  16.  
  17. public class Main extends JavaPlugin{
  18.    
  19.     @Override
  20.     public void onEnable() {
  21.        
  22.         generateRecipes();
  23.        
  24.         new Listeners(this);
  25.        
  26.         Bukkit.addRecipe(getRecipeNetherStar());
  27.         Bukkit.addRecipe(getRecipeGoldenApple());
  28.         Bukkit.addRecipe(getRecipeBlueGlass());
  29.         Bukkit.addRecipe(getRecipeEndCrystal());
  30.         Bukkit.addRecipe(getRecipeBeacon());
  31.         Bukkit.addRecipe(getRecipeTrident());
  32.         Bukkit.addRecipe(getRecipeZombieLocator());
  33.     }
  34.  
  35.     @Override
  36.     public void onDisable() {
  37.  
  38.     }
  39.  
  40.     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  41.  
  42.         return false;
  43.     }
  44.    
  45.     public ShapedRecipe getRecipeNetherStar() {
  46.        
  47.         ItemStack item = new ItemStack(Material.NETHER_STAR);
  48.        
  49.         NamespacedKey key = new NamespacedKey(this, "nether_star");
  50.        
  51.         ShapedRecipe recipe = new ShapedRecipe(key, item);
  52.        
  53.         recipe.shape("ABA", "BCB", "ABA");
  54.         recipe.setIngredient('A', Material.GLOWSTONE);
  55.         recipe.setIngredient('B', Material.BLAZE_ROD);
  56.         recipe.setIngredient('C', Material.DIAMOND);
  57.        
  58.         return recipe;
  59.     }
  60.    
  61.    
  62.     public ShapedRecipe getRecipeGoldenApple() {
  63.        
  64.         ItemStack item = new ItemStack(Material.GOLDEN_APPLE);
  65.        
  66.         NamespacedKey key = new NamespacedKey(this, "golden_apple");
  67.        
  68.         ShapedRecipe recipe = new ShapedRecipe(key, item);
  69.        
  70.         recipe.shape(" A ", "ABA", " A ");
  71.         recipe.setIngredient('A', Material.GOLD_INGOT);
  72.         recipe.setIngredient('B', Material.APPLE);
  73.        
  74.         return recipe;
  75.     }
  76.    
  77.     public void generateRecipes() {
  78.         List<Material> ingredientMaterials = new ArrayList<>();
  79.      
  80.         ingredientMaterials.add(Material.BEEF);
  81.         ingredientMaterials.add(Material.CHICKEN);
  82.         ingredientMaterials.add(Material.COD);
  83.         ingredientMaterials.add(Material.MUTTON);
  84.         ingredientMaterials.add(Material.PORKCHOP);
  85.         ingredientMaterials.add(Material.RABBIT);
  86.         ingredientMaterials.add(Material.SALMON);
  87.         ingredientMaterials.add(Material.ROTTEN_FLESH);
  88.      
  89.         for (Material ingredient : ingredientMaterials) {
  90.             ItemStack item = new ItemStack(Material.ZOMBIE_SPAWN_EGG);
  91.      
  92.             NamespacedKey key = new NamespacedKey(this, String.format("zombie_spawn_%s_egg", ingredient.toString().toLowerCase()));
  93.      
  94.             ShapedRecipe recipe = new ShapedRecipe(key, item);
  95.      
  96.             recipe.shape("A A", " B ", "A A");
  97.             recipe.setIngredient('A', Material.STICK);
  98.             recipe.setIngredient('B', ingredient);
  99.      
  100.             Bukkit.addRecipe(recipe);
  101.         }
  102.     }
  103.     public ShapedRecipe getRecipeBlueGlass() {
  104.        
  105.         ItemStack item = new ItemStack(Material.BLUE_STAINED_GLASS);
  106.        
  107.         NamespacedKey key = new NamespacedKey(this, "blue_stained_glass");
  108.        
  109.         ShapedRecipe recipe = new ShapedRecipe(key, item);
  110.        
  111.         recipe.shape("AAA", "ABA", "AAA");
  112.         recipe.setIngredient('A', Material.GLASS);
  113.         recipe.setIngredient('B', Material.DIAMOND);
  114.        
  115.         return recipe;
  116.     }
  117.     public ShapedRecipe getRecipeEndCrystal() {
  118.        
  119.         ItemStack item = new ItemStack(Material.END_CRYSTAL);
  120.        
  121.         NamespacedKey key = new NamespacedKey(this, "end_crystal");
  122.        
  123.         ShapedRecipe recipe = new ShapedRecipe(key, item);
  124.        
  125.         recipe.shape("ABA", "BCB", "ABA");
  126.         recipe.setIngredient('A', Material.GLASS);
  127.         recipe.setIngredient('B', Material.DIAMOND);
  128.         recipe.setIngredient('C', Material.NETHER_STAR);
  129.        
  130.         return recipe;
  131.     }
  132.     public ShapedRecipe getRecipeBeacon() {
  133.        
  134.         ItemStack item = new ItemStack(Material.BEACON);
  135.        
  136.         NamespacedKey key = new NamespacedKey(this, "beacon");
  137.        
  138.         ShapedRecipe recipe = new ShapedRecipe(key, item);
  139.        
  140.         recipe.shape("ACA", "ADA", "BBB");
  141.         recipe.setIngredient('A', Material.GLASS);
  142.         recipe.setIngredient('B', Material.OBSIDIAN);
  143.         recipe.setIngredient('C', Material.BLUE_STAINED_GLASS_PANE);
  144.         recipe.setIngredient('D', Material.END_CRYSTAL);
  145.        
  146.         return recipe;
  147.     }  
  148.     public ShapedRecipe getRecipeTrident() {
  149.        
  150.         ItemStack item = new ItemStack(Material.TRIDENT);
  151.        
  152.         NamespacedKey key = new NamespacedKey(this, "trident");
  153.        
  154.         ShapedRecipe recipe = new ShapedRecipe(key, item);
  155.        
  156.         recipe.shape(" A ", " B ", " B ");
  157.         recipe.setIngredient('A', Material.IRON_SWORD);
  158.         recipe.setIngredient('B', Material.STICK);
  159.        
  160.         return recipe;
  161.     }
  162.     public ShapedRecipe getRecipeZombieLocator() {
  163.        
  164.         ItemStack item = new ItemStack(Material.CARROT_ON_A_STICK);
  165.         ItemMeta meta = item.getItemMeta();
  166.        
  167.         meta.setDisplayName(ChatColor.WHITE + "Zombie Locator");
  168.         item.setItemMeta(meta);
  169.        
  170.         NamespacedKey key = new NamespacedKey(this, "zombie_locator");
  171.        
  172.         ShapedRecipe recipe = new ShapedRecipe(key, item);
  173.        
  174.         recipe.shape("ABA", "BCB", "ABA");
  175.         recipe.setIngredient('A', Material.ROTTEN_FLESH);
  176.         recipe.setIngredient('B', Material.BONE);
  177.         recipe.setIngredient('C', Material.COMPASS);
  178.        
  179.         return recipe;
  180.     }
  181.  
  182. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement