#Help

1 messages · Page 1 of 1 (latest)

south gorge
#

Hello?

foggy vigil
south gorge
#

Oh, hi

#

So

#

Leme find the thing

foggy vigil
#

hmm i make a code but when break cobblestone nothing happen but when i remove
if (player.getItemInHand().equals(c1))
it working normal

south gorge
#

You should use descriptive variables

foggy vigil
#
        
        
        ItemStack item = new ItemStack(Material.WOOD_PICKAXE, 1);
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName(ChatColor.GRAY + "Wooden Hammer");
        ArrayList<String> lore = new ArrayList<>();
        lore.add("hammer!");
        meta.setLore(lore);
        item.setItemMeta(meta);
        player.getInventory().addItem(item);
        
        
    }```
#

c1 is private by customitem

#

private customItem c1 = new customItem();

south gorge
#

Well you are trying to see if an ItemStack is equal to the customItem class

#

Also you should use descriptive variables. Instead of c1 use customItem

#

Also your classes should be capitalized like CustomItem instead of customItem

foggy vigil
#

oh letme try

south gorge
#

So what you would need to do

#

Is check if the lore of the item is equal to the lore of the custom item

#

Because when the durability changes it can be seen as a different item

#

and .equals wont work

south gorge
foggy vigil
# south gorge ?

but i switched from customitem to c1 so sure it's correct about lore both name

south gorge
#

Im sorry, the language barrier is a bit hard to get around

#

You are going to have to use NBT, or PersistentDataContainer