use of com.infinityraider.agricraft.api.v1.content.items.IAgriTrowelItem in project AgriCraft by AgriCraft.
the class ItemToolTipHandler method addTrowelTooltip.
/**
* Adds tooltips to items that are trowels (implementing ITrowel).
*/
@SubscribeEvent
@SuppressWarnings("unused")
public void addTrowelTooltip(ItemTooltipEvent event) {
ItemStack stack = event.getItemStack();
if (!stack.isEmpty() && stack.getItem() instanceof IAgriTrowelItem) {
event.getToolTip().add(AgriToolTips.TROWEL);
IAgriTrowelItem trowel = (IAgriTrowelItem) stack.getItem();
trowel.getGenome(stack).map(genome -> {
event.getToolTip().add(AgriToolTips.getPlantTooltip(genome.getPlant()));
trowel.getGrowthStage(stack).ifPresent(stage -> event.getToolTip().add(AgriToolTips.getGrowthTooltip(stage)));
return genome.getStats();
}).ifPresent(stats -> stats.addTooltips(text -> event.getToolTip().add(text)));
}
}
Aggregations