Skip to content
This repository has been archived by the owner on Mar 10, 2021. It is now read-only.

Commit

Permalink
Fix mining level tooltips being displayed on EVERYTHING applicable in…
Browse files Browse the repository at this point in the history
…stead of just vanilla tools :S

(like, ticon tools .)
  • Loading branch information
bonii-xx committed Aug 2, 2014
1 parent 2727486 commit 40c8f31
Showing 1 changed file with 16 additions and 3 deletions.
Expand Up @@ -3,6 +3,7 @@
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import iguanaman.iguanatweakstconstruct.leveling.LevelingTooltips;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemTool;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import tconstruct.library.tools.ToolCore;

Expand All @@ -13,11 +14,23 @@ public void onItemToolTip(ItemTooltipEvent event) {
if (event.entityPlayer == null)
return;

if(!(event.itemStack.getItem() instanceof ItemTool))
return;

// we're only interested in stuff that's basically a pickaxe
int hlvl = event.itemStack.getItem().getHarvestLevel(event.itemStack, "pickaxe");
if (hlvl < 0)
return;
if (hlvl >= 0)
event.toolTip.add(1, LevelingTooltips.getMiningLevelTooltip(hlvl));

// well.. let's check the other things too /o\
/* disabled because it'll probably cause more confusion than help..
hlvl = event.itemStack.getItem().getHarvestLevel(event.itemStack, "shovel");
if (hlvl >= 0)
event.toolTip.add(1, LevelingTooltips.getMiningLevelTooltip(hlvl));
event.toolTip.add(1, LevelingTooltips.getMiningLevelTooltip(hlvl));
hlvl = event.itemStack.getItem().getHarvestLevel(event.itemStack, "axe");
if (hlvl >= 0)
event.toolTip.add(1, LevelingTooltips.getMiningLevelTooltip(hlvl));
*/
}
}

0 comments on commit 40c8f31

Please sign in to comment.