implement tooltip
This commit is contained in:
parent
fc33eea2e5
commit
71883d93e9
@ -1,26 +1,34 @@
|
|||||||
package com.jenny.advancedarrows.items;
|
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.LivingEntity;
|
||||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||||
import net.minecraft.world.item.ArrowItem;
|
import net.minecraft.world.item.ArrowItem;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.TooltipFlag;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.jenny.advancedarrows.advancedArrows.MODID;
|
||||||
|
|
||||||
public abstract class ArrowAbstract extends ArrowItem {
|
public abstract class ArrowAbstract extends ArrowItem {
|
||||||
public ArrowAbstract(Properties properties){
|
public ArrowAbstract(Properties properties){
|
||||||
super(properties);
|
super(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@Override
|
@Override
|
||||||
public void appendHoverText(@NotNull ItemStack pStack, @Nullable Level pLevel, @NotNull List<Component> pTooltipComponents, @NotNull TooltipFlag pIsAdvanced) {
|
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);
|
String key = String.format("tooltip.%s.%s", MODID, this);
|
||||||
MutableComponent toolTip = Component.translatable(key);
|
MutableComponent toolTip = Component.translatable(key);
|
||||||
if (!toolTip.getString().equals(key)) {
|
if (!toolTip.getString().equals(key)) {
|
||||||
pTooltipComponents.add(toolTip.withStyle(ChatFormatting.DARK_BLUE));
|
pTooltipComponents.add(toolTip.withStyle(ChatFormatting.DARK_BLUE));
|
||||||
super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced);
|
super.appendHoverText(pStack, pContext, pTooltipComponents, pTooltipFlag);
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
|
Loading…
x
Reference in New Issue
Block a user