Items
This page shows further customization you can use on the framework of custom items.
Events
If you have already made a custom item class it will look something like this:
import com.jewishbanana.uiframework.utils.ItemBuilder;
import com.jewishbanana.uiframework.items.GenericItem;
public class GreenLightsaber extends GenericItem {
//DO NOT add arguments to the constructor this needs to strictly have only an ItemStack argument passed which will be the custom item on initialization when it is detected
public GreenLightsaber(ItemStack item) {
super(item);
}
//this is the UIF item builder that is passed for the items creation, this has a few builder blocks you can explore but for now we keep it simple
//you can also just pass directly ItemBuilder.create(ItemStack) if you want to create an ItemStack first and pass it through
//the assembleLore(id) will just automatically set up the lore with UIF default item lore template including info on abilities, stats, and enchants I HIGHLY RECOMMEND USING THIS TEMPLATE
@Override
public ItemBuilder createItem() {
return ItemBuilder.create(Material.GOLDEN_SWORD).registerName(UIFUtils.convertString("(hex:#1fe615)Green Lightsaber")).assembleLore(id).setCustomModelData(7000).build();
}
}But for more advanced customization you can actually override methods before abilities activate or are attempted to activate. Let me show you an example of what I mean with this lightsaber item class example, let's say we have an ability bound to when they interact with right-click but we want to have a passive effect when they left-click that will spawn some particles where they swing the lightsaber:
Now let's see what it looks like in-game:

Here are all the methods you can override inside your custom item class:
Getting items
To get an ItemType you should use:
To get an items GenericItem class you can simply use:
This will return null if there is no attached GenericItem class. If you want to swap the ItemStack for a GenericItem instance simply use:
Last updated