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

Commit

Permalink
Just some crash-prevention in cases that shouldn't happen with compat…
Browse files Browse the repository at this point in the history
…ible tcon versions anyway.
  • Loading branch information
bonii-xx committed Dec 22, 2014
1 parent 00fdc5a commit dfe752f
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.util.StatCollector;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.tools.ToolMaterial;
import tconstruct.library.util.IToolPart;

public class PartToolTipHandler {
Expand All @@ -29,7 +30,13 @@ public void onItemToolTip(ItemTooltipEvent event) {
ItemStack stack = event.itemStack;
IToolPart part = (IToolPart)stack.getItem();

String ability = TConstructRegistry.getMaterial(part.getMaterialID(stack)).ability();
ToolMaterial mat = TConstructRegistry.getMaterial(part.getMaterialID(stack));
if(mat == null)
return;

String ability = mat.ability();
if(ability == null)
return;
// paper or thaumium?
if(ability.equals(StatCollector.translateToLocal("materialtraits.writable")) ||
ability.equals(StatCollector.translateToLocal("materialtraits.thaumic"))) {
Expand Down

0 comments on commit dfe752f

Please sign in to comment.