Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static <T extends Item> RegistryObject<T> registerItem(String name, Suppl
public static final RegistryObject<CreativeModeTab> TAB = TABS.register("mining_master",
() -> CreativeModeTab.builder()
.icon(() -> new ItemStack(TAB_ITEM.get()))
.title(Component.literal("Mining Master"))
.title(Component.translatable("itemGroup.MiningMasterTab"))
.displayItems((features, output) -> {
for (RegistryObject<Item> item : ITEMS.getEntries()) {
if (item != TAB_ITEM) output.accept(item.get());
Expand Down
16 changes: 12 additions & 4 deletions src/main/java/org/infernalstudios/miningmaster/items/GemItem.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.infernalstudios.miningmaster.items;

import net.minecraft.client.gui.screens.Screen;
import net.minecraft.locale.Language;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
Expand All @@ -15,14 +16,21 @@ public GemItem() {
super(new Item.Properties());
}



@Override
public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List<Component> tooltip, TooltipFlag flagIn) {
if (Screen.hasShiftDown()) {
tooltip.add(Component.literal("\u00A7dCombine with an item in a smithing table to enchant!"));
String tooltipText = this.getTooltipText().getString();
for (String line : tooltipText.split("\n")) {
tooltip.add(Component.literal(line));
}
Comment on lines +23 to +25

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this will not preserve color codes at the beginning of the string in the lang json. You should make sure to communicate this somehow.

} else {
tooltip.add(Component.literal("\u00A78Hold Shift for Instructions"));
tooltip.add(Component.translatable("miningmaster.item.tooltip.hold_shift"));
}
}

private Component getTooltipText() {
return Language.getInstance().has(this.getDescriptionId() + ".tooltip") ?
Component.translatable(this.getDescriptionId() + ".tooltip") :
Component.translatable("miningmaster.item.tooltip.fallback_gem");
}
}
4 changes: 3 additions & 1 deletion src/main/resources/assets/miningmaster/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@
"item.miningmaster.paragon_leggings": "Paragon Leggings",
"item.miningmaster.paragon_boots": "Paragon Boots",

"miningmaster.item.tooltip.hold_shift": "\u00A78Hold [SHIFT] for more info",
"miningmaster.item.tooltip.fallback_gem": "\u00A7dCombine with an item in a smithing table to enchant!",

"miningmaster:container.gem_forge": "Gem Forge",

"miningmaster.advancements.miningmaster.root.title": "Mining Master",
Expand Down Expand Up @@ -204,7 +207,6 @@
"miningmaster.config.option.randomGemsPerChunk": "Random Gem Spawns Per Chunk",
"miningmaster.config.tooltip.randomGemsPerChunk": "Determines how many times a random gem ore will attempt to spawn per chunk. REQUIRES RESTART.",


"enchantment.miningmaster.freezing": "Freezing",
"enchantment.miningmaster.freezing.desc": "Inflicts Slowness on hit. Also deals extra damage to fire-based entities.",

Expand Down