#Creating an item framework to easily make new items

1 messages · Page 1 of 1 (latest)

modern cypress
#

Thanks to Conclure for letting me see his item framework.
I tried creating a very simple one of my own, but im too stupid to actually use it. Could someone please explain how I integrate it in an actual custom item class?

public class CustomItem {
    List<String> lore = new ArrayList();
    public static ItemStack itemStackName;
    public void setItemMeta(String materialName, String displayName, boolean isUnbreakable) {
        Material material = Material.matchMaterial(materialName);
        ItemStack customItem = new ItemStack(material);
        ItemMeta customMeta = customItem.getItemMeta();

        customMeta.setDisplayName(displayName);
        customMeta.setUnbreakable(isUnbreakable);
        customMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_UNBREAKABLE);
        customMeta.setLore(lore);
    }
}
static dome
#

you've never set the actual item meta

modern cypress
#

I mean how do i use this code in a new item class e.g. CustomItem.setItemMeta
It doesnt seem to work

static dome
#

give an example of how you imagine using this

modern cypress
#

In another class

public class MyItem {
CustomItem.setItemMeta("item", "item name", true);
CustomItem.lore.add("lore");
}
#

'True' sets it to unbreakable

static dome
#

that does not make sense

#

looks like you have gotten the idea fundamentally wrong, you should take a look into object oriented programming before continuing