call the fallback silk touch function on exception

This commit is contained in:
Xander committed 2017-11-08 21:58:24 +08:00
1 parent 32af79f8f6
commit 74decf0b6c
1 file changed
+11 -6
@@ -55,16 +55,12 @@ public final class MinerUtils
}
} catch (InvocationTargetException|IllegalAccessException e){
Mekanism.logger.error("Block.getSilkTouchDrop errored", e);
fallbackGetSilkTouch(block, state, ret);
}
}
else//fallback to old method
{
Item item = Item.getItemFromBlock(block);
if (item != null && item != Items.AIR)
{
int meta = item.getHasSubtypes() ? block.getMetaFromState(state) : 0;
ret.add(new ItemStack(item, 1, meta));
}
fallbackGetSilkTouch(block, state, ret);
}
if (ret.size() > 0)
@@ -88,4 +84,13 @@ public final class MinerUtils
return new LinkedList<>();
}
private static void fallbackGetSilkTouch(Block block, IBlockState state, List<ItemStack> ret){
Item item = Item.getItemFromBlock(block);
if (item != null && item != Items.AIR)
{
int meta = item.getHasSubtypes() ? block.getMetaFromState(state) : 0;
ret.add(new ItemStack(item, 1, meta));
}
}
}