I'm trying to make a minecraft plugin where I'm making it so you can make craftable items. I have that part down, but how do you make properties for those items (Like for instance making an obsidian shovel with high durability)?
1
You can't change the durability of Minecraft items, but you can add invisible unbreaking enchanments that will make it seem like it has more durability
Here's some example code
Here's some example code
ItemStack op_sword = new ItemStack(Material.DIAMOND_SWORD);
ItemMeta meta = op_sword.getItemMeta();
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
op_sword.setItemMeta(meta);
op_sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 32767);
op_sword.addUnsafeEnchantment(Enchantment.DAMAGE_ARTHROPODS, 32767);
op_sword.addUnsafeEnchantment(Enchantment.DAMAGE_UNDEAD, 32767);
op_sword.addUnsafeEnchantment(Enchantment.DURABILITY, 32767);
