package com.drullkus.thermalsmeltery.common.plugins.tcon.tools;

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.tools.ToolCore;
import tconstruct.modifiers.tools.ModBoolean;

public class ModVoidTouch extends ModBoolean {

    public ModVoidTouch(ItemStack[] items, int effect, String tag, String c, String tip)
    {
        super(items, effect, tag, c, tip);
    }

    @Override
    protected boolean canModify(ItemStack tool, ItemStack[] input)
    {
        //POTENTAL API CHANGE: ItemModifier.addIncompatibilitiy(<modifierKey>)
        //If Boni accepts PR, this change will then be implented

        ToolCore toolitem = (ToolCore) tool.getItem();
        if (!validType(toolitem)) return false;

        NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
        if (tags.getBoolean("Silk Touch"))
            return false;
        if (tags.getBoolean("Lava"))
            return false;
        if (tags.getBoolean("Core Touch"))
            return false;
        return tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key); //Will fail if the modifier is false or the tag doesn't exist
    }

    public boolean validType (ToolCore tool)
    {
        if(tool.getToolName().equals("Mattock") ||
                tool.getToolName().equals("Hatchet") ||
                tool.getToolName().equals("Shovel") ||
                tool.getToolName().equals("Excavator") ||
                tool.getToolName().equals("Battle Axe") ||
                tool.getToolName().equals("Lumber Axe") ||
                tool.getToolName().equals("Pickaxe") )
        {
            return true;
        }

        return false;
    }
}

@@ -650,16 +650,78 @@
 lented%0A%0A
+        if (tool.getItem() instanceof ToolCore)%0A        %7B%0A    
         
@@ -771,24 +771,28 @@
 ();%0A        
+   
+ 
 if (!validTy
@@ -820,16 +820,20 @@
 false;%0A%0A
+    
         
@@ -904,16 +904,20 @@
 Tool%22);%0A
+    
         
@@ -955,32 +955,36 @@
 %22))%0A            
+    
 return false;%0A  
@@ -973,32 +973,36 @@
   return false;%0A
+    
         if (tags
@@ -1026,32 +1026,36 @@
 %22))%0A            
+    
 return false;%0A  
@@ -1044,32 +1044,36 @@
   return false;%0A
+    
         if (tags
@@ -1103,32 +1103,36 @@
 %22))%0A            
+    
 return false;%0A  
@@ -1121,32 +1121,36 @@
   return false;%0A
+    
         return t
@@ -1269,16 +1269,48 @@
 t exist%0A
+        %7D%0A        return false;%0A
     %7D%0A%0A 

Fix crash with void touch.