Hello any one can help me ? idk why not work on 1.13++ on 1.8.8 - 1.12.2 was allways work Code (YAML): public static ItemStack createItemWithLore(final String name, final int id, final int subid, final int anzahl, final String lore) { final ItemStack item = new ItemStack(Material.getMaterial(id), anzahl, (short)(byte)subid); final ItemMeta im = item.getItemMeta(); im.setDisplayName(name); final List<String> loreL = Lists.newArrayList(); loreL.add(""); loreL.add(lore.replaceAll("&", "ยง")); loreL.add(""); im.setLore((List)loreL); item.setItemMeta(im); return item; }
first of all, what is not working? Second, ItemStacks with integer ids and data bytes and that stuff are long deprecated and should not be used. The only constructors that should be used are ItemStack(Material) or ItemStack(Material, amount). Everything else can have unpredicted behavior
eclipse tell me " The method getMaterial(String) in the type Material is not applicable for the arguments (int) " .getMaterial is red ... i know is old i never have any problem whit this
You're getting an error because you're trying to get the ID as a material. Instead, get the material name.
yea, read the second part. You should not (and as it seems, you cannot as of 1.13) construct a Material of a String. As @Darrionat pointed out, use the string. Be careful thou as getMaterial() is an enum lookup, the name must be precisely the same (e.g. OAK_PLANKS). If you want to lookup the "minecraftak_planks" name, use Material#matchMaterial() Edit: "minecraft:\ oak_planks"...