Skip to content

Commit

Permalink
Fix issue where the tooltip context should not be null
Browse files Browse the repository at this point in the history
* This fixes compatibility with the NBT Tooltip mod
  • Loading branch information
Zailer43 committed Aug 17, 2024
1 parent 303074e commit 748401f
Showing 1 changed file with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,14 @@
import io.wispforest.owo.ui.component.ItemComponent;
import io.wispforest.owo.ui.core.CursorStyle;
import io.wispforest.owo.ui.util.UISounds;
import net.minecraft.client.MinecraftClient;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.tooltip.TooltipType;

public class GiveItemComponent extends ItemComponent {
public GiveItemComponent(ItemStack stack) {
super(stack);
this.showOverlay(true);

MinecraftClient client = MinecraftClient.getInstance();
this.tooltip(stack.getTooltip(
Item.TooltipContext.DEFAULT,
client.player,
client.options.advancedItemTooltips ? TooltipType.Default.ADVANCED : TooltipType.Default.BASIC
));
this.setTooltipFromStack(true);

this.cursorStyle(CursorStyle.HAND);
this.mouseDown().subscribe((mouseX, mouseY, button) -> {
Expand Down

0 comments on commit 748401f

Please sign in to comment.