Skip to content

Commit

Permalink
Add gui:tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
OroArmor committed Sep 28, 2024
1 parent fa7d144 commit 62b80e7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 50 deletions.
4 changes: 4 additions & 0 deletions fabric-item-api-v1/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ moduleDependencies(project, ['fabric-api-base', 'fabric-resource-loader-v0'])
testDependencies(project, [
':fabric-content-registries-v0',
])

dependencies {
modApi getQslModule("gui", "tooltip")
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,27 @@

import java.util.List;

import net.minecraft.client.MinecraftClient;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.text.Text;

import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.fabricmc.fabric.impl.base.event.QuiltCompatEvent;

/**
* @deprecated see {@link org.quiltmc.qsl.tooltip.api.client.ItemTooltipCallback ItemTooltipCallback}
*/
@Deprecated
public interface ItemTooltipCallback {
/**
* Fired after the game has appended all base tooltip lines to the list.
*/
Event<ItemTooltipCallback> EVENT = EventFactory.createArrayBacked(ItemTooltipCallback.class, callbacks -> (stack, context, type, lines) -> {
for (ItemTooltipCallback callback : callbacks) {
callback.getTooltip(stack, context, type, lines);
}
});
Event<ItemTooltipCallback> EVENT = QuiltCompatEvent.fromQuilt(org.quiltmc.qsl.tooltip.api.client.ItemTooltipCallback.EVENT,
itemTooltipCallback -> (stack, player, context, tooltipType, lines) -> itemTooltipCallback.getTooltip(stack, context, tooltipType, lines),
invokerGetter -> (stack, context, tooltipType, lines) -> invokerGetter.get().onTooltipRequest(stack, MinecraftClient.getInstance().player, context, tooltipType, lines)
);

/**
* Called when an item stack's tooltip is rendered. Text added to {@code lines} will be
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"compatibilityLevel": "JAVA_17",
"client": [
"ClientPlayerInteractionManagerMixin",
"HeldItemRendererMixin",
"ItemStackMixin"
"HeldItemRendererMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 62b80e7

Please sign in to comment.