Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.Shkiperrr.CustomCrafts;
- import java.util.ArrayList;
- import java.util.List;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Material;
- import org.bukkit.NamespacedKey;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.ShapedRecipe;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Main extends JavaPlugin{
- @Override
- public void onEnable() {
- generateRecipes();
- new Listeners(this);
- Bukkit.addRecipe(getRecipeNetherStar());
- Bukkit.addRecipe(getRecipeGoldenApple());
- Bukkit.addRecipe(getRecipeBlueGlass());
- Bukkit.addRecipe(getRecipeEndCrystal());
- Bukkit.addRecipe(getRecipeBeacon());
- Bukkit.addRecipe(getRecipeTrident());
- Bukkit.addRecipe(getRecipeZombieLocator());
- }
- @Override
- public void onDisable() {
- }
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- return false;
- }
- public ShapedRecipe getRecipeNetherStar() {
- ItemStack item = new ItemStack(Material.NETHER_STAR);
- NamespacedKey key = new NamespacedKey(this, "nether_star");
- ShapedRecipe recipe = new ShapedRecipe(key, item);
- recipe.shape("ABA", "BCB", "ABA");
- recipe.setIngredient('A', Material.GLOWSTONE);
- recipe.setIngredient('B', Material.BLAZE_ROD);
- recipe.setIngredient('C', Material.DIAMOND);
- return recipe;
- }
- public ShapedRecipe getRecipeGoldenApple() {
- ItemStack item = new ItemStack(Material.GOLDEN_APPLE);
- NamespacedKey key = new NamespacedKey(this, "golden_apple");
- ShapedRecipe recipe = new ShapedRecipe(key, item);
- recipe.shape(" A ", "ABA", " A ");
- recipe.setIngredient('A', Material.GOLD_INGOT);
- recipe.setIngredient('B', Material.APPLE);
- return recipe;
- }
- public void generateRecipes() {
- List<Material> ingredientMaterials = new ArrayList<>();
- ingredientMaterials.add(Material.BEEF);
- ingredientMaterials.add(Material.CHICKEN);
- ingredientMaterials.add(Material.COD);
- ingredientMaterials.add(Material.MUTTON);
- ingredientMaterials.add(Material.PORKCHOP);
- ingredientMaterials.add(Material.RABBIT);
- ingredientMaterials.add(Material.SALMON);
- ingredientMaterials.add(Material.ROTTEN_FLESH);
- for (Material ingredient : ingredientMaterials) {
- ItemStack item = new ItemStack(Material.ZOMBIE_SPAWN_EGG);
- NamespacedKey key = new NamespacedKey(this, String.format("zombie_spawn_%s_egg", ingredient.toString().toLowerCase()));
- ShapedRecipe recipe = new ShapedRecipe(key, item);
- recipe.shape("A A", " B ", "A A");
- recipe.setIngredient('A', Material.STICK);
- recipe.setIngredient('B', ingredient);
- Bukkit.addRecipe(recipe);
- }
- }
- public ShapedRecipe getRecipeBlueGlass() {
- ItemStack item = new ItemStack(Material.BLUE_STAINED_GLASS);
- NamespacedKey key = new NamespacedKey(this, "blue_stained_glass");
- ShapedRecipe recipe = new ShapedRecipe(key, item);
- recipe.shape("AAA", "ABA", "AAA");
- recipe.setIngredient('A', Material.GLASS);
- recipe.setIngredient('B', Material.DIAMOND);
- return recipe;
- }
- public ShapedRecipe getRecipeEndCrystal() {
- ItemStack item = new ItemStack(Material.END_CRYSTAL);
- NamespacedKey key = new NamespacedKey(this, "end_crystal");
- ShapedRecipe recipe = new ShapedRecipe(key, item);
- recipe.shape("ABA", "BCB", "ABA");
- recipe.setIngredient('A', Material.GLASS);
- recipe.setIngredient('B', Material.DIAMOND);
- recipe.setIngredient('C', Material.NETHER_STAR);
- return recipe;
- }
- public ShapedRecipe getRecipeBeacon() {
- ItemStack item = new ItemStack(Material.BEACON);
- NamespacedKey key = new NamespacedKey(this, "beacon");
- ShapedRecipe recipe = new ShapedRecipe(key, item);
- recipe.shape("ACA", "ADA", "BBB");
- recipe.setIngredient('A', Material.GLASS);
- recipe.setIngredient('B', Material.OBSIDIAN);
- recipe.setIngredient('C', Material.BLUE_STAINED_GLASS_PANE);
- recipe.setIngredient('D', Material.END_CRYSTAL);
- return recipe;
- }
- public ShapedRecipe getRecipeTrident() {
- ItemStack item = new ItemStack(Material.TRIDENT);
- NamespacedKey key = new NamespacedKey(this, "trident");
- ShapedRecipe recipe = new ShapedRecipe(key, item);
- recipe.shape(" A ", " B ", " B ");
- recipe.setIngredient('A', Material.IRON_SWORD);
- recipe.setIngredient('B', Material.STICK);
- return recipe;
- }
- public ShapedRecipe getRecipeZombieLocator() {
- ItemStack item = new ItemStack(Material.CARROT_ON_A_STICK);
- ItemMeta meta = item.getItemMeta();
- meta.setDisplayName(ChatColor.WHITE + "Zombie Locator");
- item.setItemMeta(meta);
- NamespacedKey key = new NamespacedKey(this, "zombie_locator");
- ShapedRecipe recipe = new ShapedRecipe(key, item);
- recipe.shape("ABA", "BCB", "ABA");
- recipe.setIngredient('A', Material.ROTTEN_FLESH);
- recipe.setIngredient('B', Material.BONE);
- recipe.setIngredient('C', Material.COMPASS);
- return recipe;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement