#Making multiple crafting recipe for a single custom item
1 messages · Page 1 of 1 (latest)
Error occurred while enabling Weedz v0.0.0 (Is it up to date?)
java.lang.IllegalStateException: Duplicate recipe ignored with ID weedz:ounce
at net.minecraft.world.item.crafting.CraftingManager.addRecipe(CraftingManager.java:92) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3432-Spigot-699290c-cc5ddd7]
at org.bukkit.craftbukkit.v1_18_R1.inventory.CraftShapedRecipe.addToCraftingManager(CraftShapedRecipe.java:59) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3432-Spigot-699290c-cc5ddd7]
at org.bukkit.craftbukkit.v1_18_R1.CraftServer.addRecipe(CraftServer.java:1273) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3432-Spigot-699290c-cc5ddd7]
at org.bukkit.Bukkit.addRecipe(Bukkit.java:852) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at me.chr1s.weedz.items.Ounce.createOunce(Ounce.java:46) ~[?:?]
at me.chr1s.weedz.items.Ounce.init(Ounce.java:22) ~[?:?]
at me.chr1s.weedz.Weedz.onEnable(Weedz.java:20) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at com.volmit.bile.BileUtils.load(BileUtils.java:128) ~[?:?]
at com.volmit.bile.BileUtils.reload(BileUtils.java:75) ~[?:?]
at com.volmit.bile.BileTools.onTick(BileTools.java:548) ~[?:?]
at com.volmit.bile.BileTools$2.run(BileTools.java:324) ~[?:?]
at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3432-Spigot-699290c-cc5ddd7]
at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:415) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3432-Spigot-699290c-cc5ddd7]
at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1255) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3432-Spigot-699290c-cc5ddd7]
at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:428) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3432-Spigot-699290c-cc5ddd7]
at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1206) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3432-Spigot-699290c-cc5ddd7]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1034) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3432-Spigot-699290c-cc5ddd7]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3432-Spigot-699290c-cc5ddd7]
at java.lang.Thread.run(Thread.java:833) [?:?]
package me.chr1s.weedz.items;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.RecipeChoice;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;
import java.util.List;
public class Ounce {
public static ItemStack ounce;
public static void init(JavaPlugin plugin) {
createOunce(plugin);
}
private static ItemStack createOunce(JavaPlugin plugin) {
ItemStack item = new ItemStack(Material.WHEAT);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&',"&aOunce"));
List<String> lore = new ArrayList<>();
lore.add(ChatColor.translateAlternateColorCodes('&',"&7A Ounce of Weed."));
meta.setLore(lore);
item.setItemMeta(meta);
ounce = item;
NamespacedKey key = new NamespacedKey(plugin, "ounce");
ShapedRecipe recipe = new ShapedRecipe(key, item);
recipe.shape(
"BBB",
"BBB",
"BBB");
recipe.setIngredient('B', new RecipeChoice.ExactChoice(Bud.bud));
Bukkit.addRecipe(recipe);
ItemStack item2 = new ItemStack(Material.WHEAT, 9);
ItemMeta meta2 = item2.getItemMeta();
meta2.setDisplayName(ChatColor.translateAlternateColorCodes('&',"&aOunce"));
List<String> lore2 = new ArrayList<>();
lore2.add(ChatColor.translateAlternateColorCodes('&',"&7A Ounce of Weed."));
meta2.setLore(lore2);
item2.setItemMeta(meta);
NamespacedKey key2 = new NamespacedKey(plugin, "ounce1");
ShapedRecipe recipe2 = new ShapedRecipe(key2, item2);
recipe2.shape(
" ",
" E ",
" ");
recipe2.setIngredient('E', new RecipeChoice.ExactChoice(Pound.pound));
Bukkit.addRecipe(recipe2);
return item2;
}
}
nope i only call it once
Also why is everything static 
it's static so it cannot be called in another class
you think theres an issue with it being all static?
could there be a way to call the item name in a separate class so the two recipes have their own class? you think that would work?