Skip to content

Commit

Permalink
Updated tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
Leronus committed Aug 9, 2024
1 parent 3462851 commit 1f88d24
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 48 deletions.
14 changes: 7 additions & 7 deletions src/main/java/mod/leronus/mores/item/custom/ModAxeItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.AxeItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.MiningToolItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.item.*;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.world.World;
Expand Down Expand Up @@ -39,9 +36,12 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack
@Override
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> tooltip, TooltipType type) {
if (stack.getItem() instanceof MiningToolItem item) {
if (item.getMaterial() == ModToolMaterials.RUBY){
tooltip.add(Text.literal(""));
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.auto_smelt").formatted(Formatting.DARK_RED)));
tooltip.add(Text.literal(""));
if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.ONYX) {
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.wither_effect").formatted(Formatting.DARK_GRAY)));
}
if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.RUBY) {
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.burn_effect").formatted(Formatting.DARK_RED)));
}
tooltip.add(Text.literal(""));
// tooltip.add(Text.translatable("mores.harvest_level").formatted(Formatting.GRAY).append(Text.translatable(String.valueOf(item.getMaterial().getMiningLevel())).formatted(Formatting.GOLD)));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package mod.leronus.mores.item.custom;

import mod.leronus.mores.item.ModItems;
import mod.leronus.mores.item.ModToolMaterials;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.item.*;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;

Expand Down Expand Up @@ -43,14 +41,14 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> tooltip, TooltipType type) {
if (stack.getItem() instanceof ModBattleAxeItem){
tooltip.add(Text.literal(""));
if (stack.getItem() == ModItems.ONYX_BATTLEAXE) {
if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.ONYX) {
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.wither_effect").formatted(Formatting.DARK_GRAY)));
}
if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.RUBY) {
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.burn_effect").formatted(Formatting.DARK_RED)));
}
tooltip.add(Text.literal(""));
tooltip.add(Text.translatable("mores.durability").formatted(Formatting.GRAY).append(Text.translatable(String.valueOf(((ModBattleAxeItem) stack.getItem()).getMaterial().getDurability())).formatted(Formatting.LIGHT_PURPLE)));
if (stack.getItem() == ModItems.RUBY_SWORD || stack.getItem() == ModItems.RUBY_MACE || stack.getItem() == ModItems.RUBY_BATTLEAXE || stack.getItem() == ModItems.RUBY_DAGGER) {
tooltip.add(Text.translatable(Formatting.GRAY + "mores.bonus" + Formatting.RED + "Burn Effect"));
}
}
}
}
14 changes: 7 additions & 7 deletions src/main/java/mod/leronus/mores/item/custom/ModHoeItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.HoeItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.MiningToolItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.item.*;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;

Expand All @@ -36,9 +33,12 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack
@Override
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> tooltip, TooltipType type) {
if (stack.getItem() instanceof MiningToolItem item) {
if (item.getMaterial() == ModToolMaterials.RUBY){
tooltip.add(Text.literal(""));
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.auto_smelt").formatted(Formatting.DARK_RED)));
tooltip.add(Text.literal(""));
if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.ONYX) {
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.wither_effect").formatted(Formatting.DARK_GRAY)));
}
if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.RUBY) {
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.burn_effect").formatted(Formatting.DARK_RED)));
}
tooltip.add(Text.literal(""));
// tooltip.add(Text.translatable("mores.harvest_level").formatted(Formatting.GRAY).append(Text.translatable(String.valueOf(item.getMaterial().getMiningLevel())).formatted(Formatting.GOLD)));
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/mod/leronus/mores/item/custom/ModPickaxeItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.ItemStack;
import net.minecraft.item.MiningToolItem;
import net.minecraft.item.PickaxeItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.item.*;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.world.World;
Expand Down Expand Up @@ -38,9 +35,12 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack
@Override
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> tooltip, TooltipType type) {
if (stack.getItem() instanceof MiningToolItem item) {
if (item.getMaterial() == ModToolMaterials.RUBY){
tooltip.add(Text.literal(""));
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.auto_smelt").formatted(Formatting.DARK_RED)));
tooltip.add(Text.literal(""));
if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.ONYX) {
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.wither_effect").formatted(Formatting.DARK_GRAY)));
}
if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.RUBY) {
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.burn_effect").formatted(Formatting.DARK_RED)));
}
tooltip.add(Text.literal(""));
// tooltip.add(Text.translatable("mores.harvest_level").formatted(Formatting.GRAY).append(Text.translatable(String.valueOf(item.getMaterial().getMiningLevel())).formatted(Formatting.GOLD)));
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/mod/leronus/mores/item/custom/ModShovelItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.ItemStack;
import net.minecraft.item.MiningToolItem;
import net.minecraft.item.ShovelItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.item.*;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;

Expand All @@ -36,9 +33,12 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack
@Override
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> tooltip, TooltipType type) {
if (stack.getItem() instanceof MiningToolItem item) {
if (item.getMaterial() == ModToolMaterials.RUBY){
tooltip.add(Text.literal(""));
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.auto_smelt").formatted(Formatting.DARK_RED)));
tooltip.add(Text.literal(""));
if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.ONYX) {
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.wither_effect").formatted(Formatting.DARK_GRAY)));
}
if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.RUBY) {
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.burn_effect").formatted(Formatting.DARK_RED)));
}
tooltip.add(Text.literal(""));
// tooltip.add(Text.translatable("mores.harvest_level").formatted(Formatting.GRAY).append(Text.translatable(String.valueOf(item.getMaterial().getMiningLevel())).formatted(Formatting.GOLD)));
Expand Down
22 changes: 10 additions & 12 deletions src/main/java/mod/leronus/mores/item/custom/ModSwordItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

import mod.leronus.mores.item.ModItems;
import net.minecraft.item.tooltip.TooltipType;
import mod.leronus.mores.item.ModToolMaterials;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.item.*;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;

Expand All @@ -23,15 +21,15 @@ public ModSwordItem(ToolMaterial toolMaterial, Item.Settings settings) {
@Override
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> tooltip, TooltipType type) {
if (stack.getItem() instanceof ModSwordItem){
tooltip.add(Text.literal(""));
if (stack.getItem() == ModItems.ONYX_SWORD || stack.getItem() == ModItems.ONYX_MACE || stack.getItem() == ModItems.ONYX_DAGGER) {
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.wither_effect").formatted(Formatting.DARK_GRAY)));
}
tooltip.add(Text.literal(""));
tooltip.add(Text.translatable("mores.durability").formatted(Formatting.GRAY).append(Text.translatable(String.valueOf(((ModSwordItem) stack.getItem()).getMaterial().getDurability())).formatted(Formatting.LIGHT_PURPLE)));
if (stack.getItem() == ModItems.RUBY_SWORD || stack.getItem() == ModItems.RUBY_MACE || stack.getItem() == ModItems.RUBY_DAGGER) {
tooltip.add(Text.translatable(Formatting.GRAY + "mores.bonus" + Formatting.RED + "Burn Effect"));
tooltip.add(Text.literal(""));
if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.ONYX) {
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.wither_effect").formatted(Formatting.DARK_GRAY)));
}
if (((ToolItem) stack.getItem()).getMaterial() == ModToolMaterials.RUBY) {
tooltip.add(Text.translatable("mores.bonus").formatted(Formatting.GRAY).append(Text.translatable("mores.burn_effect").formatted(Formatting.DARK_RED)));
}
tooltip.add(Text.literal(""));
tooltip.add(Text.translatable("mores.durability").formatted(Formatting.GRAY).append(Text.translatable(String.valueOf(((ModSwordItem) stack.getItem()).getMaterial().getDurability())).formatted(Formatting.LIGHT_PURPLE)));
}
}

Expand Down

0 comments on commit 1f88d24

Please sign in to comment.