diff options
Diffstat (limited to 'src/main/java/me/Danker/features/ExpertiseLore.java')
-rw-r--r-- | src/main/java/me/Danker/features/ExpertiseLore.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/features/ExpertiseLore.java b/src/main/java/me/Danker/features/ExpertiseLore.java new file mode 100644 index 0000000..1eb998d --- /dev/null +++ b/src/main/java/me/Danker/features/ExpertiseLore.java @@ -0,0 +1,40 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class ExpertiseLore { + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onTooltip(ItemTooltipEvent event) { + if (!Utils.inSkyblock) return; + if (event.toolTip == null) return; + + ItemStack item = event.itemStack; + if (ToggleCommand.expertiseLoreToggled) { + if (item.hasTagCompound()) { + NBTTagCompound tags = item.getSubCompound("ExtraAttributes", false); + if (tags != null) { + if (tags.hasKey("expertise_kills")) { + int index = 4; + if (!Minecraft.getMinecraft().gameSettings.advancedItemTooltips) index -= 2; + + event.toolTip.add(event.toolTip.size() - index, ""); + event.toolTip.add(event.toolTip.size() - index, "Expertise Kills: " + EnumChatFormatting.RED + tags.getInteger("expertise_kills")); + if (Utils.expertiseKillsLeft(tags.getInteger("expertise_kills")) != -1) { + event.toolTip.add(event.toolTip.size() - index, Utils.expertiseKillsLeft(tags.getInteger("expertise_kills")) + " kills to tier up!"); + } + } + } + } + } + } + +} |