Search in sources :

Example 1 with TooltipDataEvent

use of com.tangykiwi.kiwiclient.event.TooltipDataEvent in project KiwiClient by TangyKiwi.

the class ItemMixin method onTooltipData.

@Inject(method = "getTooltipData", at = @At("HEAD"), cancellable = true)
private void onTooltipData(ItemStack stack, CallbackInfoReturnable<Optional<TooltipData>> cir) {
    TooltipDataEvent event = new TooltipDataEvent(stack);
    KiwiClient.eventBus.post(event);
    if (event.tooltipData != null) {
        cir.setReturnValue(Optional.of(event.tooltipData));
    }
}
Also used : TooltipDataEvent(com.tangykiwi.kiwiclient.event.TooltipDataEvent) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

TooltipDataEvent (com.tangykiwi.kiwiclient.event.TooltipDataEvent)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1