mirror of
https://github.com/GTNewHorizons/WailaHarvestability.git
synced 2026-11-25 06:14:34 +00:00
Added a special case for TiC gravel ore because Iguana Tweaks for TConstruct/TiC Tweaks adds pickaxe effectiveness to them by accident
This commit is contained in:
1 parent
9273f92063
commit
61bacae931
2 files changed
+13
-1
No files matched your search
@@ -1,5 +1,6 @@
|
||||
package squeek.wailaharvestability.helpers;
|
||||
|
||||
import squeek.wailaharvestability.proxy.ProxyIguanaTweaks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
@@ -10,9 +11,10 @@ public class BlockHelper
|
||||
{
|
||||
int i = 0;
|
||||
boolean hasEffectiveTools = false;
|
||||
boolean isGravelOre = ProxyIguanaTweaks.isGravelOre(block);
|
||||
for (String toolClass : toolClasses)
|
||||
{
|
||||
harvestLevels[i] = MinecraftForge.getBlockHarvestLevel(block, metadata, toolClass);
|
||||
harvestLevels[i] = isGravelOre && toolClass.equals("pickaxe") ? -1 : MinecraftForge.getBlockHarvestLevel(block, metadata, toolClass);
|
||||
|
||||
if (harvestLevels[i] != -1)
|
||||
hasEffectiveTools = true;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package squeek.wailaharvestability.proxy;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class ProxyIguanaTweaks
|
||||
{
|
||||
private static Class<?> IguanaTweaksTConstruct = null;
|
||||
private static Method proxyGetHarvestLevelName;
|
||||
private static Block oreGravel = null;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
@@ -13,6 +15,9 @@ public class ProxyIguanaTweaks
|
||||
{
|
||||
IguanaTweaksTConstruct = Class.forName("iguanaman.iguanatweakstconstruct.IguanaTweaksTConstruct");
|
||||
proxyGetHarvestLevelName = IguanaTweaksTConstruct.getDeclaredMethod("getHarvestLevelName", int.class);
|
||||
|
||||
Class<?> TContent = Class.forName("tconstruct.common.TContent");
|
||||
oreGravel = (Block) TContent.getDeclaredField("oreGravel").get(null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -35,4 +40,9 @@ public class ProxyIguanaTweaks
|
||||
|
||||
return harvestLevelName;
|
||||
}
|
||||
|
||||
public static boolean isGravelOre(Block block)
|
||||
{
|
||||
return oreGravel != null && oreGravel.blockID == block.blockID;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user