implement tooltip

This commit is contained in:
Jenny 2025-02-12 16:35:51 +01:00
parent fc33eea2e5
commit 71883d93e9
Signed by: Jenny
GPG Key ID: 2072A14E40940632

View File

@ -1,26 +1,34 @@
package com.jenny.advancedarrows.items;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.item.ArrowItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import static com.jenny.advancedarrows.advancedArrows.MODID;
public abstract class ArrowAbstract extends ArrowItem {
public ArrowAbstract(Properties properties){
super(properties);
}
/*@Override
public void appendHoverText(@NotNull ItemStack pStack, @Nullable Level pLevel, @NotNull List<Component> pTooltipComponents, @NotNull TooltipFlag pIsAdvanced) {
@Override
public void appendHoverText(@NotNull ItemStack pStack, @NotNull TooltipContext pContext, @NotNull List<Component> pTooltipComponents, @NotNull TooltipFlag pTooltipFlag) {
String key = String.format("tooltip.%s.%s", MODID, this);
MutableComponent toolTip = Component.translatable(key);
if (!toolTip.getString().equals(key)) {
pTooltipComponents.add(toolTip.withStyle(ChatFormatting.DARK_BLUE));
super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced);
super.appendHoverText(pStack, pContext, pTooltipComponents, pTooltipFlag);
}
}*/
}
@Override
@NotNull