-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/main/java/com/github/ptom76/tutorialfabricmod/item/TutorialItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,35 @@ | ||
package com.github.ptom76.tutorialfabricmod.item; | ||
|
||
import net.minecraft.client.item.TooltipContext; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.util.Formatting; | ||
import net.minecraft.util.Rarity; | ||
import net.minecraft.world.World; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.List; | ||
|
||
public class TutorialItem extends Item { | ||
public TutorialItem(Settings settings) { | ||
super(settings); | ||
} | ||
|
||
@Override | ||
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) { | ||
super.appendTooltip(stack, world, tooltip, context); | ||
// ツールチップ追加 | ||
// 1.18以前では↓new TranslatableText(key); | ||
tooltip.add(Text.translatable("item.tutorialfabricmod.tutorial_item.tooltip").formatted(Formatting.RED)); | ||
|
||
// 1.18以前では↓new LiteralText(string); | ||
tooltip.add(Text.literal("§dHello, §bWorld!!")); | ||
} | ||
|
||
@Override | ||
public Rarity getRarity(ItemStack stack) { | ||
// レア度 | ||
return Rarity.UNCOMMON; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters